Skip to content

Commit 63de898

Browse files
committed
fix node-local-dns on cilium 1.16.5+ when BPF host networking is enabled
Signed-off-by: Rafael da Fonseca <rafael.fonseca@wildlifestudios.com>
1 parent 1fa7b70 commit 63de898

File tree

11 files changed

+73
-7
lines changed

11 files changed

+73
-7
lines changed

k8s/crds/kops.k8s.io_clusters.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,6 +3635,12 @@ spec:
36353635
config for node local dns by the user - it will include
36363636
the original CoreFile made by kOps.
36373637
type: string
3638+
ciliumBPFCompatibility:
3639+
description: CiliumBPFCompatibility allows user to enable
3640+
cilium bpf host routing compatibility mode, which is required
3641+
for cilium 1.16.5+ and above, when the user is using cilium
3642+
as an externally managed daemonset.
3643+
type: boolean
36383644
cpuRequest:
36393645
anyOf:
36403646
- type: integer

pkg/apis/kops/cluster.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ type NodeLocalDNSConfig struct {
625625
// PodAnnotations makes possible to add additional annotations to node-local-dns.
626626
// Default: none
627627
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
628+
// CiliumBPFCompatibility allows user to enable cilium bpf host routing compatibility mode, which is required for cilium 1.16.5+ and above, when the user is using cilium as an externally managed daemonset.
629+
CiliumBPFCompatibility *bool `json:"ciliumBPFCompatibility,omitempty"`
628630
}
629631

630632
type ExternalDNSProvider string

pkg/apis/kops/v1alpha2/cluster.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ type NodeLocalDNSConfig struct {
604604
// PodAnnotations makes possible to add additional annotations to node-local-dns.
605605
// Default: none
606606
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
607+
// CiliumBPFCompatibility allows user to enable cilium bpf host routing compatibility mode, which is required for cilium 1.16.5+ and above, when the user is using cilium as an externally managed daemonset.
608+
CiliumBPFCompatibility *bool `json:"ciliumBPFCompatibility,omitempty"`
607609
}
608610

609611
type ExternalDNSProvider string

pkg/apis/kops/v1alpha2/zz_generated.conversion.go

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

pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go

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

pkg/apis/kops/v1alpha3/cluster.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ type NodeLocalDNSConfig struct {
590590
// PodAnnotations makes possible to add additional annotations to node-local-dns.
591591
// Default: none
592592
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
593+
// CiliumBPFCompatibility allows user to enable cilium bpf host routing compatibility mode, which is required for cilium 1.16.5+ and above, when the user is using cilium as an externally managed daemonset.
594+
CiliumBPFCompatibility *bool `json:"ciliumBPFCompatibility,omitempty"`
593595
}
594596

595597
type ExternalDNSProvider string

pkg/apis/kops/v1alpha3/zz_generated.conversion.go

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

pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go

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

pkg/apis/kops/zz_generated.deepcopy.go

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

pkg/model/components/kubelet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (b *KubeletOptionsBuilder) configureKubelet(cluster *kops.Cluster, kubelet
8787
}
8888

8989
if kubelet.ClusterDNS == "" {
90-
if cluster.Spec.KubeDNS != nil && cluster.Spec.KubeDNS.NodeLocalDNS != nil && fi.ValueOf(cluster.Spec.KubeDNS.NodeLocalDNS.Enabled) {
90+
if cluster.Spec.KubeDNS != nil && cluster.Spec.KubeDNS.NodeLocalDNS != nil && fi.ValueOf(cluster.Spec.KubeDNS.NodeLocalDNS.Enabled) && !fi.ValueOf(cluster.Spec.KubeDNS.NodeLocalDNS.CiliumBPFCompatibility) && cluster.Spec.Networking.Cilium == nil {
9191
kubelet.ClusterDNS = cluster.Spec.KubeDNS.NodeLocalDNS.LocalIP
9292
} else {
9393
ip, err := WellKnownServiceIP(&cluster.Spec.Networking, 10)

0 commit comments

Comments
 (0)