Skip to content

Commit c403eb9

Browse files
authored
Merge pull request #724 from Nalum/luke/twwtsmnlntsk
🐛 ConfigMap OCI Image Label Error
2 parents 1d81436 + 6138db4 commit c403eb9

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

internal/controller/manifests_downloader.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"compress/gzip"
2222
"context"
2323
"fmt"
24-
"strings"
2524

2625
corev1 "k8s.io/api/core/v1"
2726
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -39,11 +38,12 @@ import (
3938
)
4039

4140
const (
42-
configMapVersionLabel = "provider.cluster.x-k8s.io/version"
43-
configMapTypeLabel = "provider.cluster.x-k8s.io/type"
44-
configMapNameLabel = "provider.cluster.x-k8s.io/name"
45-
configMapSourceLabel = "provider.cluster.x-k8s.io/source"
46-
operatorManagedLabel = "managed-by.operator.cluster.x-k8s.io"
41+
configMapVersionLabel = "provider.cluster.x-k8s.io/version"
42+
configMapTypeLabel = "provider.cluster.x-k8s.io/type"
43+
configMapNameLabel = "provider.cluster.x-k8s.io/name"
44+
configMapSourceLabel = "provider.cluster.x-k8s.io/source"
45+
configMapSourceAnnotation = "provider.cluster.x-k8s.io/source"
46+
operatorManagedLabel = "managed-by.operator.cluster.x-k8s.io"
4747

4848
maxConfigMapSize = 1 * 1024 * 1024
4949
ociSource = "oci"
@@ -171,6 +171,12 @@ func TemplateManifestsConfigMap(provider operatorv1.GenericProvider, labels map[
171171
},
172172
}
173173

174+
if provider.GetSpec().FetchConfig != nil && provider.GetSpec().FetchConfig.OCI != "" {
175+
configMap.ObjectMeta.Annotations = map[string]string{
176+
configMapSourceAnnotation: provider.GetSpec().FetchConfig.OCI,
177+
}
178+
}
179+
174180
// Components manifests data can exceed the configmap size limit. In this case we have to compress it.
175181
if !compress {
176182
configMap.Data[operatorv1.ComponentsConfigMapKey] = string(components)
@@ -293,9 +299,7 @@ func ProviderLabels(provider operatorv1.GenericProvider) map[string]string {
293299
}
294300

295301
if provider.GetSpec().FetchConfig != nil && provider.GetSpec().FetchConfig.OCI != "" {
296-
image := strings.ReplaceAll(provider.GetSpec().FetchConfig.OCI, "/", "_")
297-
image = strings.ReplaceAll(image, ":", "_")
298-
labels[configMapSourceLabel] = image
302+
labels[configMapSourceLabel] = ociSource
299303
}
300304

301305
return labels

0 commit comments

Comments
 (0)