diff --git a/charts/vela-core/templates/defwithtemplate/config-image-registry.yaml b/charts/vela-core/templates/defwithtemplate/config-image-registry.yaml index 53cc3a25f..d93687a2a 100644 --- a/charts/vela-core/templates/defwithtemplate/config-image-registry.yaml +++ b/charts/vela-core/templates/defwithtemplate/config-image-registry.yaml @@ -36,20 +36,23 @@ spec: "config.oam.dev/sub-type": "auth" } } - type: "kubernetes.io/dockerconfigjson" - stringData: { - if parameter.auth != _|_ { - ".dockerconfigjson": json.Marshal({ - auths: "\(parameter.registry)": { - username: parameter.auth.username - password: parameter.auth.password - if parameter.auth.email != _|_ { - email: parameter.auth.email - } - auth: base64.Encode(null, (parameter.auth.username + ":" + parameter.auth.password)) + if parameter.auth != _|_ { + type: "kubernetes.io/dockerconfigjson" + } + if parameter.auth == _|_ { + type: "Opaque" + } + if parameter.auth != _|_ { + stringData: ".dockerconfigjson": json.Marshal({ + auths: "\(parameter.registry)": { + username: parameter.auth.username + password: parameter.auth.password + if parameter.auth.email != _|_ { + email: parameter.auth.email } - }) - } + auth: base64.Encode(null, (parameter.auth.username + ":" + parameter.auth.password)) + } + }) } } parameter: { diff --git a/charts/vela-minimal/templates/defwithtemplate/config-image-registry.yaml b/charts/vela-minimal/templates/defwithtemplate/config-image-registry.yaml index 53cc3a25f..d93687a2a 100644 --- a/charts/vela-minimal/templates/defwithtemplate/config-image-registry.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/config-image-registry.yaml @@ -36,20 +36,23 @@ spec: "config.oam.dev/sub-type": "auth" } } - type: "kubernetes.io/dockerconfigjson" - stringData: { - if parameter.auth != _|_ { - ".dockerconfigjson": json.Marshal({ - auths: "\(parameter.registry)": { - username: parameter.auth.username - password: parameter.auth.password - if parameter.auth.email != _|_ { - email: parameter.auth.email - } - auth: base64.Encode(null, (parameter.auth.username + ":" + parameter.auth.password)) + if parameter.auth != _|_ { + type: "kubernetes.io/dockerconfigjson" + } + if parameter.auth == _|_ { + type: "Opaque" + } + if parameter.auth != _|_ { + stringData: ".dockerconfigjson": json.Marshal({ + auths: "\(parameter.registry)": { + username: parameter.auth.username + password: parameter.auth.password + if parameter.auth.email != _|_ { + email: parameter.auth.email } - }) - } + auth: base64.Encode(null, (parameter.auth.username + ":" + parameter.auth.password)) + } + }) } } parameter: { diff --git a/vela-templates/definitions/internal/component/config-image-registry.cue b/vela-templates/definitions/internal/component/config-image-registry.cue index 2133ebdf9..eb2915d5f 100644 --- a/vela-templates/definitions/internal/component/config-image-registry.cue +++ b/vela-templates/definitions/internal/component/config-image-registry.cue @@ -33,9 +33,14 @@ template: { "config.oam.dev/sub-type": "auth" } } - type: "kubernetes.io/dockerconfigjson" - stringData: { - if parameter.auth != _|_ { + if parameter.auth != _|_ { + type: "kubernetes.io/dockerconfigjson" + } + if parameter.auth == _|_ { + type: "Opaque" + } + if parameter.auth != _|_ { + stringData: { ".dockerconfigjson": json.Marshal({ "auths": "\(parameter.registry)": { "username": parameter.auth.username