Allow Cilium manifest to be replaced (for testing)

We allow the Cilium manifest to be specified as an addon, to enable
better testing of new Cilium versions.
This commit is contained in:
justinsb 2023-03-18 02:13:45 +00:00 committed by Ciprian Hacman
parent 1459d54fa9
commit 8cda714fb8
1 changed files with 22 additions and 16 deletions

View File

@ -17,31 +17,37 @@ limitations under the License.
package bootstrapchannelbuilder package bootstrapchannelbuilder
import ( import (
"k8s.io/klog/v2"
"k8s.io/kops/channels/pkg/api" "k8s.io/kops/channels/pkg/api"
"k8s.io/kops/upup/pkg/fi" "k8s.io/kops/upup/pkg/fi"
) )
func addCiliumAddon(b *BootstrapChannelBuilder, addons *AddonList) error { func addCiliumAddon(b *BootstrapChannelBuilder, addons *AddonList) error {
cilium := b.Cluster.Spec.Networking.Cilium cilium := b.Cluster.Spec.Networking.Cilium
if cilium != nil { if cilium == nil {
key := "networking.cilium.io" return nil
}
{ key := "networking.cilium.io"
id := "k8s-1.16" useBuiltin := !b.hasExternalAddon(key)
location := key + "/" + id + "-v1.12.yaml"
addon := &api.AddonSpec{ if !useBuiltin {
Name: fi.PtrTo(key), klog.Infof("found cilium (%q) in addons; won't use builtin", key)
Selector: networkingSelector(), } else {
Manifest: fi.PtrTo(location), id := "k8s-1.16"
Id: id, location := key + "/" + id + "-v1.12.yaml"
NeedsRollingUpdate: api.NeedsRollingUpdateAll,
} addon := &api.AddonSpec{
if cilium.Hubble != nil && fi.ValueOf(cilium.Hubble.Enabled) { Name: fi.PtrTo(key),
addon.NeedsPKI = true Selector: networkingSelector(),
} Manifest: fi.PtrTo(location),
addons.Add(addon) Id: id,
NeedsRollingUpdate: api.NeedsRollingUpdateAll,
} }
if cilium.Hubble != nil && fi.ValueOf(cilium.Hubble.Enabled) {
addon.NeedsPKI = true
}
addons.Add(addon)
} }
return nil return nil
} }