Merge pull request #13205 from sharifelgamal/olm

Fix OLM addon by pinning to correct versions of images
pull/13225/head
Sharif Elgamal 2021-12-22 11:25:38 -08:00 committed by GitHub
commit 4f4eca8fd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 24 deletions

View File

@ -224,7 +224,7 @@ func EnableOrDisableAddon(cc *config.ClusterConfig, name string, val string) err
out.WarningT("At least needs control plane nodes to enable addon")
}
data := assets.GenerateTemplateData(addon, cc.KubernetesConfig, networkInfo, images, customRegistries)
data := assets.GenerateTemplateData(addon, cc.KubernetesConfig, networkInfo, images, customRegistries, enable)
return enableOrDisableAddonInternal(cc, addon, runner, data, enable)
}

View File

@ -312,7 +312,7 @@ var Addons = map[string]*Addon{
}, false, "olm", "third-party (operator framework)", map[string]string{
"OLM": "operator-framework/olm@sha256:e74b2ac57963c7f3ba19122a8c31c9f2a0deb3c0c5cac9e5323ccffd0ca198ed",
// operator-framework/community-operators was deprecated: https://github.com/operator-framework/community-operators#repository-is-obsolete; switching to OperatorHub.io instead
"UpstreamCommunityOperators": "operatorhubio/catalog:latest@sha256:53fad78977d83dde0c27b3183c2acc25ec153ae466e1b3c9a7efb517691b77b7",
"UpstreamCommunityOperators": "operatorhubio/catalog@sha256:e08a1cd21fe72dd1be92be738b4bf1515298206dac5479c17a4b3ed119e30bd4",
}, map[string]string{
"OLM": "quay.io",
"UpstreamCommunityOperators": "quay.io",
@ -781,7 +781,7 @@ func SelectAndPersistImages(addon *Addon, cc *config.ClusterConfig) (images, cus
}
// GenerateTemplateData generates template data for template assets
func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig, netInfo NetworkInfo, images, customRegistries map[string]string) interface{} {
func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig, netInfo NetworkInfo, images, customRegistries map[string]string, enable bool) interface{} {
a := runtime.GOARCH
// Some legacy docker images still need the -arch suffix
@ -862,23 +862,25 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig, netInfo Net
opts.Registries[name] = "" // Avoid nil access when rendering
}
if override, ok := opts.CustomRegistries[name]; ok {
out.Infof("Using image {{.registry}}{{.image}}", out.V{
"registry": override,
// removing the SHA from UI
// SHA example gcr.io/k8s-minikube/gcp-auth-webhook:v0.0.4@sha256:65e9e69022aa7b0eb1e390e1916e3bf67f75ae5c25987f9154ef3b0e8ab8528b
"image": strings.Split(image, "@")[0],
})
} else if opts.ImageRepository != "" {
out.Infof("Using image {{.registry}}{{.image}} (global image repository)", out.V{
"registry": opts.ImageRepository,
"image": image,
})
} else {
out.Infof("Using image {{.registry}}{{.image}}", out.V{
"registry": opts.Registries[name],
"image": strings.Split(image, "@")[0],
})
if enable {
if override, ok := opts.CustomRegistries[name]; ok {
out.Infof("Using image {{.registry}}{{.image}}", out.V{
"registry": override,
// removing the SHA from UI
// SHA example gcr.io/k8s-minikube/gcp-auth-webhook:v0.0.4@sha256:65e9e69022aa7b0eb1e390e1916e3bf67f75ae5c25987f9154ef3b0e8ab8528b
"image": strings.Split(image, "@")[0],
})
} else if opts.ImageRepository != "" {
out.Infof("Using image {{.registry}}{{.image}} (global image repository)", out.V{
"registry": opts.ImageRepository,
"image": image,
})
} else {
out.Infof("Using image {{.registry}}{{.image}}", out.V{
"registry": opts.Registries[name],
"image": strings.Split(image, "@")[0],
})
}
}
}
return opts

View File

@ -451,22 +451,22 @@ func validateOlmAddon(ctx context.Context, t *testing.T, profile string) {
start := time.Now()
if _, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "wait", "--for=condition=ready", "--namespace=olm", "pod", "--selector=app=catalog-operator", "--timeout=90s")); err != nil {
t.Fatalf("failed waititing for pod catalog-operator: %v", err)
t.Fatalf("failed waiting for pod catalog-operator: %v", err)
}
t.Logf("catalog-operator stabilized in %s", time.Since(start))
if _, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "wait", "--for=condition=ready", "--namespace=olm", "pod", "--selector=app=olm-operator", "--timeout=90s")); err != nil {
t.Fatalf("failed waititing for pod olm-operator: %v", err)
t.Fatalf("failed waiting for pod olm-operator: %v", err)
}
t.Logf("olm-operator stabilized in %s", time.Since(start))
if _, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "wait", "--for=condition=ready", "--namespace=olm", "pod", "--selector=app=packageserver", "--timeout=90s")); err != nil {
t.Fatalf("failed waititing for pod olm-operator: %v", err)
t.Fatalf("failed waiting for pod olm-operator: %v", err)
}
t.Logf("packageserver stabilized in %s", time.Since(start))
if _, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "wait", "--for=condition=ready", "--namespace=olm", "pod", "--selector=olm.catalogSource=operatorhubio-catalog", "--timeout=90s")); err != nil {
t.Fatalf("failed waititing for pod operatorhubio-catalog: %v", err)
t.Fatalf("failed waiting for pod operatorhubio-catalog: %v", err)
}
t.Logf("operatorhubio-catalog stabilized in %s", time.Since(start))