Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

[WIP] CRD Spec: add option to configure HostNetwork and DNSPolicy #2094

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/apis/etcd/v1beta2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ type PodPolicy struct {
// '.cluster.local'.
// The default is to not set a cluster domain explicitly.
ClusterDomain string `json:"ClusterDomain"`

// hostNetwork will set HostNetwork: true in podspec
HostNetwork bool `json:"hostNetwork,omitempty"`

// dnsPolicy will set dnsPolicy: <whatever> in podspec
DNSPolicy v1.DNSPolicy `json:"dnsPolicy,omitempty"`
}

// TODO: move this to initializer
Expand Down
9 changes: 9 additions & 0 deletions pkg/util/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
SecurityContext: podSecurityContext(cs.Pod),
},
}

if cs.Pod.DNSPolicy != "" {
pod.Spec.DNSPolicy = cs.Pod.DNSPolicy
}

if cs.Pod.HostNetwork {
pod.Spec.HostNetwork = true
}

SetEtcdVersion(pod, cs.Version)
return pod
}
Expand Down