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

Commit

Permalink
CRD Spec: add option to configure HostNetwork and DNSPolicy
Browse files Browse the repository at this point in the history
this allows the network plugins like CNI to use etcd-cluster
as kv when bootstrapping the cluster

fixes #1929
  • Loading branch information
rajatjindal committed Jun 14, 2019
1 parent 8347d27 commit 4797be3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
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

0 comments on commit 4797be3

Please sign in to comment.