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

Commit 4797be3

Browse files
committed
CRD Spec: add option to configure HostNetwork and DNSPolicy
this allows the network plugins like CNI to use etcd-cluster as kv when bootstrapping the cluster fixes #1929
1 parent 8347d27 commit 4797be3

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

Gopkg.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/etcd/v1beta2/cluster.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ type PodPolicy struct {
162162
// '.cluster.local'.
163163
// The default is to not set a cluster domain explicitly.
164164
ClusterDomain string `json:"ClusterDomain"`
165+
166+
// hostNetwork will set HostNetwork: true in podspec
167+
HostNetwork bool `json:"hostNetwork,omitempty"`
168+
169+
// dnsPolicy will set dnsPolicy: <whatever> in podspec
170+
DNSPolicy v1.DNSPolicy `json:"dnsPolicy,omitempty"`
165171
}
166172

167173
// TODO: move this to initializer

pkg/util/k8sutil/k8sutil.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,15 @@ func newEtcdPod(m *etcdutil.Member, initialCluster []string, clusterName, state,
402402
SecurityContext: podSecurityContext(cs.Pod),
403403
},
404404
}
405+
406+
if cs.Pod.DNSPolicy != "" {
407+
pod.Spec.DNSPolicy = cs.Pod.DNSPolicy
408+
}
409+
410+
if cs.Pod.HostNetwork {
411+
pod.Spec.HostNetwork = true
412+
}
413+
405414
SetEtcdVersion(pod, cs.Version)
406415
return pod
407416
}

0 commit comments

Comments
 (0)