@@ -21,7 +21,6 @@ import (
21
21
"compress/gzip"
22
22
"context"
23
23
"fmt"
24
- "strings"
25
24
26
25
corev1 "k8s.io/api/core/v1"
27
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -39,11 +38,12 @@ import (
39
38
)
40
39
41
40
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"
47
47
48
48
maxConfigMapSize = 1 * 1024 * 1024
49
49
ociSource = "oci"
@@ -171,6 +171,12 @@ func TemplateManifestsConfigMap(provider operatorv1.GenericProvider, labels map[
171
171
},
172
172
}
173
173
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
+
174
180
// Components manifests data can exceed the configmap size limit. In this case we have to compress it.
175
181
if ! compress {
176
182
configMap .Data [operatorv1 .ComponentsConfigMapKey ] = string (components )
@@ -293,9 +299,7 @@ func ProviderLabels(provider operatorv1.GenericProvider) map[string]string {
293
299
}
294
300
295
301
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
299
303
}
300
304
301
305
return labels
0 commit comments