diff --git a/addons/fluxcd/definitions/helm-release-def.cue b/addons/fluxcd/definitions/helm-release-def.cue index 620caf39..43096bfd 100644 --- a/addons/fluxcd/definitions/helm-release-def.cue +++ b/addons/fluxcd/definitions/helm-release-def.cue @@ -1,3 +1,4 @@ +import ("strings") helm: { attributes: { workload: type: "autodetects.core.oam.dev" @@ -166,6 +167,12 @@ template: { } }}] } + if parameter.serviceAccountName != _|_ { + serviceAccountName: parameter.serviceAccountName + } + if parameter.serviceAccountName == _|_ && strings.HasPrefix(context.appAnnotations["app.oam.dev/username"], "system:serviceaccount:\(context.namespace):") { + serviceAccountName: strings.TrimPrefix(context.appAnnotations["app.oam.dev/username"], "system:serviceaccount:\(context.namespace):") + } install: { remediation: { retries: parameter.retries @@ -239,6 +246,8 @@ template: { version: *"*" | string // +usage=The namespace for helm chart, optional targetNamespace?: string + // +usage=The service account used to install or upgrade helm release + serviceAccountName?: string // +usage=The release name releaseName?: string // +usage=Retry times when install/upgrade fail. diff --git a/addons/fluxcd/metadata.yaml b/addons/fluxcd/metadata.yaml index 82d01bd6..4a99abb3 100644 --- a/addons/fluxcd/metadata.yaml +++ b/addons/fluxcd/metadata.yaml @@ -1,5 +1,5 @@ name: fluxcd -version: 2.3.2 +version: 2.3.3 description: Extended workload to do continuous and progressive delivery icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/flux/horizontal/color/flux-horizontal-color.png url: https://fluxcd.io