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