Skip to content

Commit

Permalink
support dns config options (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaByte875 authored Jul 26, 2024
1 parent c6ae313 commit e5f657a
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apis/apps/v1alpha1/nebulacluster_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ func generateStatefulSet(c NebulaClusterComponent, cm *corev1.ConfigMap) (*appsv
Affinity: c.ComponentSpec().Affinity(),
Tolerations: c.ComponentSpec().Tolerations(),
ServiceAccountName: NebulaServiceAccountName,
DNSConfig: c.ComponentSpec().DNSConfig(),
DNSPolicy: c.ComponentSpec().DNSPolicy(),
}

podSpec.TopologySpreadConstraints = c.ComponentSpec().TopologySpreadConstraints(componentLabel)
Expand Down
16 changes: 16 additions & 0 deletions apis/apps/v1alpha1/nebulacluster_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type ComponentAccessor interface {
VolumeMounts() []corev1.VolumeMount
ReadinessProbe() *corev1.Probe
LivenessProbe() *corev1.Probe
DNSConfig() *corev1.PodDNSConfig
DNSPolicy() corev1.DNSPolicy
}

var _ ComponentAccessor = &componentAccessor{}
Expand Down Expand Up @@ -187,6 +189,20 @@ func (a *componentAccessor) LivenessProbe() *corev1.Probe {
return a.componentSpec.LivenessProbe
}

func (a *componentAccessor) DNSConfig() *corev1.PodDNSConfig {
if a.componentSpec == nil {
return nil
}
return a.componentSpec.DNSConfig
}

func (a *componentAccessor) DNSPolicy() corev1.DNSPolicy {
if a.componentSpec != nil && a.componentSpec.DNSPolicy != "" {
return a.componentSpec.DNSPolicy
}
return corev1.DNSClusterFirst
}

// NebulaClusterComponent is the interface for component
// +k8s:deepcopy-gen=false
type NebulaClusterComponent interface {
Expand Down
6 changes: 6 additions & 0 deletions apis/apps/v1alpha1/nebulacluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,12 @@ type ComponentSpec struct {

// +optional
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`

// +optional
DNSConfig *corev1.PodDNSConfig `json:"dnsConfig,omitempty"`

// +optional
DNSPolicy corev1.DNSPolicy `json:"dnsPolicy,omitempty"`
}

// StorageClaim contains details of storage
Expand Down
5 changes: 5 additions & 0 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

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

88 changes: 88 additions & 0 deletions charts/nebula-operator/crds/nebulaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,28 @@ spec:
type: object
collectRegex:
type: string
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
env:
items:
properties:
Expand Down Expand Up @@ -3667,6 +3689,28 @@ spec:
additionalProperties:
type: string
type: object
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
env:
items:
properties:
Expand Down Expand Up @@ -6483,6 +6527,28 @@ spec:
storageClassName:
type: string
type: object
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
env:
items:
properties:
Expand Down Expand Up @@ -9338,6 +9404,28 @@ spec:
type: string
type: object
type: array
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
enableAutoBalance:
type: boolean
enableForceUpdate:
Expand Down
88 changes: 88 additions & 0 deletions config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,28 @@ spec:
type: object
collectRegex:
type: string
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
env:
items:
properties:
Expand Down Expand Up @@ -3667,6 +3689,28 @@ spec:
additionalProperties:
type: string
type: object
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
env:
items:
properties:
Expand Down Expand Up @@ -6483,6 +6527,28 @@ spec:
storageClassName:
type: string
type: object
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
env:
items:
properties:
Expand Down Expand Up @@ -9338,6 +9404,28 @@ spec:
type: string
type: object
type: array
dnsConfig:
properties:
nameservers:
items:
type: string
type: array
options:
items:
properties:
name:
type: string
value:
type: string
type: object
type: array
searches:
items:
type: string
type: array
type: object
dnsPolicy:
type: string
enableAutoBalance:
type: boolean
enableForceUpdate:
Expand Down

0 comments on commit e5f657a

Please sign in to comment.