Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRD Spec: add option to configure HostNetwork and DNSPolicy #1

Merged
merged 1 commit into from
Jun 29, 2020
Merged
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