diff --git a/charts/vela-core/templates/_helpers.tpl b/charts/vela-core/templates/_helpers.tpl index fcef7edfc..4e0d77d21 100644 --- a/charts/vela-core/templates/_helpers.tpl +++ b/charts/vela-core/templates/_helpers.tpl @@ -66,3 +66,14 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +systemDefinitionNamespace value defaulter +*/}} +{{- define "systemDefinitionNamespace" -}} +{{- if .Values.systemDefinitionNamespace -}} + {{ .Values.systemDefinitionNamespace }} +{{- else -}} + {{ .Release.Namespace }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/vela-core/templates/addon_registry.yaml b/charts/vela-core/templates/addon_registry.yaml index 317224ee9..1abc0eaf3 100644 --- a/charts/vela-core/templates/addon_registry.yaml +++ b/charts/vela-core/templates/addon_registry.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: vela-addon-registry - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} data: registries: '{ "KubeVela":{ diff --git a/charts/vela-core/templates/definitions/autodetect.yaml b/charts/vela-core/templates/definitions/autodetect.yaml index 530aa6f73..ff890d1d6 100644 --- a/charts/vela-core/templates/definitions/autodetect.yaml +++ b/charts/vela-core/templates/definitions/autodetect.yaml @@ -4,7 +4,7 @@ metadata: annotations: definition.oam.dev/description: "autodetects.core.oam.dev is the default workload type of ComponentDefinition" name: autodetects.core.oam.dev - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: definitionRef: name: autodetects.core.oam.dev \ No newline at end of file diff --git a/charts/vela-core/templates/definitions/healthscopes.yaml b/charts/vela-core/templates/definitions/healthscopes.yaml index fa3dbbf26..73595f334 100644 --- a/charts/vela-core/templates/definitions/healthscopes.yaml +++ b/charts/vela-core/templates/definitions/healthscopes.yaml @@ -2,7 +2,7 @@ apiVersion: core.oam.dev/v1beta1 kind: ScopeDefinition metadata: name: healthscopes.core.oam.dev - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: workloadRefsPath: spec.workloadRefs allowComponentOverlap: true diff --git a/charts/vela-core/templates/defwithtemplate/annotations.yaml b/charts/vela-core/templates/defwithtemplate/annotations.yaml index 2b50a468d..00141cef0 100644 --- a/charts/vela-core/templates/defwithtemplate/annotations.yaml +++ b/charts/vela-core/templates/defwithtemplate/annotations.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: annotations - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml b/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml index efd6bc5e6..e984ea8a3 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-application-in-parallel - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/apply-application.yaml b/charts/vela-core/templates/defwithtemplate/apply-application.yaml index 25d875292..4e35bc599 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-application.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-application.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-application - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/apply-object.yaml b/charts/vela-core/templates/defwithtemplate/apply-object.yaml index a86c7574f..9f2b30caf 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-object.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-object.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-object - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml b/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml index db2180f20..53f0f9dbe 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-remaining - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/configmap.yaml b/charts/vela-core/templates/defwithtemplate/configmap.yaml index b66eef93b..40fb584f9 100644 --- a/charts/vela-core/templates/defwithtemplate/configmap.yaml +++ b/charts/vela-core/templates/defwithtemplate/configmap.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: configmap - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/cpuscaler.yaml b/charts/vela-core/templates/defwithtemplate/cpuscaler.yaml index 6b6609e50..b9b1dcbae 100644 --- a/charts/vela-core/templates/defwithtemplate/cpuscaler.yaml +++ b/charts/vela-core/templates/defwithtemplate/cpuscaler.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: cpuscaler - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml b/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml index 3e446591c..7d4e64094 100644 --- a/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml +++ b/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: depends-on-app - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml b/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml index 8a884ddf9..684c45692 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Deploy cloud resource and bind secret to clusters name: deploy-cloud-resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/deploy2env.yaml b/charts/vela-core/templates/defwithtemplate/deploy2env.yaml index d9dd2c691..1442ee963 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy2env.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy2env.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Deploy env binding component to target env name: deploy2env - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml b/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml index 57144e3ed..fe8f12888 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: deploy2runtime - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/env-binding.yaml b/charts/vela-core/templates/defwithtemplate/env-binding.yaml index 8b4e89199..e5134b461 100644 --- a/charts/vela-core/templates/defwithtemplate/env-binding.yaml +++ b/charts/vela-core/templates/defwithtemplate/env-binding.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Provides differentiated configuration and environment scheduling policies for application. name: env-binding - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/env.yaml b/charts/vela-core/templates/defwithtemplate/env.yaml index f9276d4d0..9155eab21 100644 --- a/charts/vela-core/templates/defwithtemplate/env.yaml +++ b/charts/vela-core/templates/defwithtemplate/env.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: env - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/export2config.yaml b/charts/vela-core/templates/defwithtemplate/export2config.yaml index be5ab957e..7bd39a62b 100644 --- a/charts/vela-core/templates/defwithtemplate/export2config.yaml +++ b/charts/vela-core/templates/defwithtemplate/export2config.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: export2config - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/export2secret.yaml b/charts/vela-core/templates/defwithtemplate/export2secret.yaml index c12489f78..44cf4d07b 100644 --- a/charts/vela-core/templates/defwithtemplate/export2secret.yaml +++ b/charts/vela-core/templates/defwithtemplate/export2secret.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: export2secret - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/expose.yaml b/charts/vela-core/templates/defwithtemplate/expose.yaml index 6e613b689..29b9c6b37 100644 --- a/charts/vela-core/templates/defwithtemplate/expose.yaml +++ b/charts/vela-core/templates/defwithtemplate/expose.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: expose - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-core/templates/defwithtemplate/gateway.yaml b/charts/vela-core/templates/defwithtemplate/gateway.yaml index 9b044df2e..bcfa7382c 100644 --- a/charts/vela-core/templates/defwithtemplate/gateway.yaml +++ b/charts/vela-core/templates/defwithtemplate/gateway.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Enable public web traffic for the component, the ingress API matches K8s v1.20+. name: gateway - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-core/templates/defwithtemplate/health.yaml b/charts/vela-core/templates/defwithtemplate/health.yaml index 7f9c4fcad..74bc05421 100644 --- a/charts/vela-core/templates/defwithtemplate/health.yaml +++ b/charts/vela-core/templates/defwithtemplate/health.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Apply periodical health checking to the application. name: health - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: manageHealthCheck: true schematic: diff --git a/charts/vela-core/templates/defwithtemplate/hostalias.yaml b/charts/vela-core/templates/defwithtemplate/hostalias.yaml index e92048c15..9b9c1782d 100644 --- a/charts/vela-core/templates/defwithtemplate/hostalias.yaml +++ b/charts/vela-core/templates/defwithtemplate/hostalias.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: hostalias - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/import-grafana-dashboard.yaml b/charts/vela-core/templates/defwithtemplate/import-grafana-dashboard.yaml index 7e9037057..df92f54d6 100644 --- a/charts/vela-core/templates/defwithtemplate/import-grafana-dashboard.yaml +++ b/charts/vela-core/templates/defwithtemplate/import-grafana-dashboard.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: import-grafana-dashboard - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: [] conflictsWith: [] diff --git a/charts/vela-core/templates/defwithtemplate/ingress-1-20.yaml b/charts/vela-core/templates/defwithtemplate/ingress-1-20.yaml index 30ce1c4c8..3336ce8ba 100644 --- a/charts/vela-core/templates/defwithtemplate/ingress-1-20.yaml +++ b/charts/vela-core/templates/defwithtemplate/ingress-1-20.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: ingress-1-20 - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-core/templates/defwithtemplate/ingress.yaml b/charts/vela-core/templates/defwithtemplate/ingress.yaml index 69bafb442..8f228ea20 100644 --- a/charts/vela-core/templates/defwithtemplate/ingress.yaml +++ b/charts/vela-core/templates/defwithtemplate/ingress.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: ingress - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-core/templates/defwithtemplate/init-container.yaml b/charts/vela-core/templates/defwithtemplate/init-container.yaml index 51948867b..cf5c7df29 100644 --- a/charts/vela-core/templates/defwithtemplate/init-container.yaml +++ b/charts/vela-core/templates/defwithtemplate/init-container.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: init-container - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-core/templates/defwithtemplate/k8s-objects.yaml b/charts/vela-core/templates/defwithtemplate/k8s-objects.yaml index b87bcddca..f1241b297 100644 --- a/charts/vela-core/templates/defwithtemplate/k8s-objects.yaml +++ b/charts/vela-core/templates/defwithtemplate/k8s-objects.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: K8s-objects allow users to specify raw K8s objects in properties name: k8s-objects - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/labels.yaml b/charts/vela-core/templates/defwithtemplate/labels.yaml index fb2c970c7..87b7044bd 100644 --- a/charts/vela-core/templates/defwithtemplate/labels.yaml +++ b/charts/vela-core/templates/defwithtemplate/labels.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: labels - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/lifecycle.yaml b/charts/vela-core/templates/defwithtemplate/lifecycle.yaml index c5e817b43..3819ab880 100644 --- a/charts/vela-core/templates/defwithtemplate/lifecycle.yaml +++ b/charts/vela-core/templates/defwithtemplate/lifecycle.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: lifecycle - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/nocalhost.yaml b/charts/vela-core/templates/defwithtemplate/nocalhost.yaml index 0a1d11e33..64bde3427 100644 --- a/charts/vela-core/templates/defwithtemplate/nocalhost.yaml +++ b/charts/vela-core/templates/defwithtemplate/nocalhost.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: nocalhost - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/node-affinity.yaml b/charts/vela-core/templates/defwithtemplate/node-affinity.yaml index c61d6d089..537923172 100644 --- a/charts/vela-core/templates/defwithtemplate/node-affinity.yaml +++ b/charts/vela-core/templates/defwithtemplate/node-affinity.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: node-affinity - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/notification.yaml b/charts/vela-core/templates/defwithtemplate/notification.yaml index 08d1497af..8bdfbbf11 100644 --- a/charts/vela-core/templates/defwithtemplate/notification.yaml +++ b/charts/vela-core/templates/defwithtemplate/notification.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Send message to webhook name: notification - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/pure-ingress.yaml b/charts/vela-core/templates/defwithtemplate/pure-ingress.yaml index 183ff1ec5..40d6972f3 100644 --- a/charts/vela-core/templates/defwithtemplate/pure-ingress.yaml +++ b/charts/vela-core/templates/defwithtemplate/pure-ingress.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: pure-ingress - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: [] conflictsWith: [] diff --git a/charts/vela-core/templates/defwithtemplate/pvc.yaml b/charts/vela-core/templates/defwithtemplate/pvc.yaml index 6bae6f4ff..79b240af5 100644 --- a/charts/vela-core/templates/defwithtemplate/pvc.yaml +++ b/charts/vela-core/templates/defwithtemplate/pvc.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: pvc - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-core/templates/defwithtemplate/raw.yaml b/charts/vela-core/templates/defwithtemplate/raw.yaml index b52cfc608..729cd0bf4 100644 --- a/charts/vela-core/templates/defwithtemplate/raw.yaml +++ b/charts/vela-core/templates/defwithtemplate/raw.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: raw - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/read-object.yaml b/charts/vela-core/templates/defwithtemplate/read-object.yaml index 3fef0c2b4..c455595dd 100644 --- a/charts/vela-core/templates/defwithtemplate/read-object.yaml +++ b/charts/vela-core/templates/defwithtemplate/read-object.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: read-object - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/register-grafana-datasource.yaml b/charts/vela-core/templates/defwithtemplate/register-grafana-datasource.yaml index 58bef0316..98a59500b 100644 --- a/charts/vela-core/templates/defwithtemplate/register-grafana-datasource.yaml +++ b/charts/vela-core/templates/defwithtemplate/register-grafana-datasource.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: register-grafana-datasource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: [] conflictsWith: [] diff --git a/charts/vela-core/templates/defwithtemplate/resource.yaml b/charts/vela-core/templates/defwithtemplate/resource.yaml index 2ecf4a033..b66c2d907 100644 --- a/charts/vela-core/templates/defwithtemplate/resource.yaml +++ b/charts/vela-core/templates/defwithtemplate/resource.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/scaler.yaml b/charts/vela-core/templates/defwithtemplate/scaler.yaml index e6f4ce220..d65f1ee48 100644 --- a/charts/vela-core/templates/defwithtemplate/scaler.yaml +++ b/charts/vela-core/templates/defwithtemplate/scaler.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Manually scale K8s pod for your workload which follows the pod spec in path 'spec.template'. name: scaler - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/service-account.yaml b/charts/vela-core/templates/defwithtemplate/service-account.yaml index 75c9c976b..23ffc6e4c 100644 --- a/charts/vela-core/templates/defwithtemplate/service-account.yaml +++ b/charts/vela-core/templates/defwithtemplate/service-account.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Specify serviceAccount for your workload which follows the pod spec in path 'spec.template'. name: service-account - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/service-binding.yaml b/charts/vela-core/templates/defwithtemplate/service-binding.yaml index 299741e0d..41913f558 100644 --- a/charts/vela-core/templates/defwithtemplate/service-binding.yaml +++ b/charts/vela-core/templates/defwithtemplate/service-binding.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: service-binding - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml b/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml index c05d4c36f..aac98dc9f 100644 --- a/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml +++ b/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Sync secrets created by terraform component to runtime clusters so that runtime clusters can share the created cloud resource. name: share-cloud-resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/sidecar.yaml b/charts/vela-core/templates/defwithtemplate/sidecar.yaml index ce6b88585..1ef0f15dd 100644 --- a/charts/vela-core/templates/defwithtemplate/sidecar.yaml +++ b/charts/vela-core/templates/defwithtemplate/sidecar.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: sidecar - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-core/templates/defwithtemplate/storage.yaml b/charts/vela-core/templates/defwithtemplate/storage.yaml index f9202a0e1..8bec0fe21 100644 --- a/charts/vela-core/templates/defwithtemplate/storage.yaml +++ b/charts/vela-core/templates/defwithtemplate/storage.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Add storages on K8s pod for your workload which follows the pod spec in path 'spec.template'. name: storage - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-core/templates/defwithtemplate/suspend.yaml b/charts/vela-core/templates/defwithtemplate/suspend.yaml index 6cad30f67..935364c22 100644 --- a/charts/vela-core/templates/defwithtemplate/suspend.yaml +++ b/charts/vela-core/templates/defwithtemplate/suspend.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Suspend your workflow name: suspend - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/task.yaml b/charts/vela-core/templates/defwithtemplate/task.yaml index 94008f5ab..cd1a39030 100644 --- a/charts/vela-core/templates/defwithtemplate/task.yaml +++ b/charts/vela-core/templates/defwithtemplate/task.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Describes jobs that run code or a script to completion. name: task - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/volumes.yaml b/charts/vela-core/templates/defwithtemplate/volumes.yaml index e9484a6e4..1cb53b3e6 100644 --- a/charts/vela-core/templates/defwithtemplate/volumes.yaml +++ b/charts/vela-core/templates/defwithtemplate/volumes.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: volumes - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-core/templates/defwithtemplate/webhook-notification.yaml b/charts/vela-core/templates/defwithtemplate/webhook-notification.yaml index 68bb75239..9756efc62 100644 --- a/charts/vela-core/templates/defwithtemplate/webhook-notification.yaml +++ b/charts/vela-core/templates/defwithtemplate/webhook-notification.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: webhook-notification - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/webhook.yaml b/charts/vela-core/templates/defwithtemplate/webhook.yaml index ef6e33540..c54c726aa 100644 --- a/charts/vela-core/templates/defwithtemplate/webhook.yaml +++ b/charts/vela-core/templates/defwithtemplate/webhook.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Send webhook request to the url name: webhook - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/webservice.yaml b/charts/vela-core/templates/defwithtemplate/webservice.yaml index 7012ea8e7..3410a90d3 100644 --- a/charts/vela-core/templates/defwithtemplate/webservice.yaml +++ b/charts/vela-core/templates/defwithtemplate/webservice.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers. name: webservice - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/defwithtemplate/worker.yaml b/charts/vela-core/templates/defwithtemplate/worker.yaml index fd688660e..1b84227e7 100644 --- a/charts/vela-core/templates/defwithtemplate/worker.yaml +++ b/charts/vela-core/templates/defwithtemplate/worker.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: worker - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-core/templates/kubevela-controller.yaml b/charts/vela-core/templates/kubevela-controller.yaml index 6d646eeb9..cd2f7940a 100644 --- a/charts/vela-core/templates/kubevela-controller.yaml +++ b/charts/vela-core/templates/kubevela-controller.yaml @@ -125,7 +125,7 @@ spec: {{ if ne .Values.disableCaps "" }} - "--disable-caps={{ .Values.disableCaps }}" {{ end }} - - "--system-definition-namespace={{ .Values.systemDefinitionNamespace }}" + - "--system-definition-namespace={{ include "systemDefinitionNamespace" . }}" - "--application-revision-limit={{ .Values.applicationRevisionLimit }}" - "--definition-revision-limit={{ .Values.definitionRevisionLimit }}" - "--oam-spec-ver={{ .Values.OAMSpecVer }}" diff --git a/charts/vela-core/templates/test/test-application.yaml b/charts/vela-core/templates/test/test-application.yaml index 3b63f3124..04705c678 100644 --- a/charts/vela-core/templates/test/test-application.yaml +++ b/charts/vela-core/templates/test/test-application.yaml @@ -5,7 +5,7 @@ metadata: helm.sh/hook: test-success helm.sh/hook-delete-policy: hook-succeeded name: helm-test-vela-app - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: components: - name: helm-test-express-server @@ -24,7 +24,7 @@ apiVersion: v1 kind: Pod metadata: name: "{{ .Release.Name }}-application-test" - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} annotations: "helm.sh/hook": test helm.sh/hook-delete-policy: hook-succeeded @@ -44,16 +44,16 @@ spec: echo "Waiting application is ready..." echo "waiting for application being Ready" - kubectl -n {{.Values.systemDefinitionNamespace}} wait --for=condition=Ready applications.core.oam.dev helm-test-vela-app --timeout=3m + kubectl -n {{ include "systemDefinitionNamespace" . }} wait --for=condition=Ready applications.core.oam.dev helm-test-vela-app --timeout=3m echo "application is Ready" # wait for deploy being created echo "waiting for deployment being available" - kubectl -n {{.Values.systemDefinitionNamespace}} wait --for=condition=available deployments helm-test-express-server --timeout 3m + kubectl -n {{ include "systemDefinitionNamespace" . }} wait --for=condition=available deployments helm-test-express-server --timeout 3m echo "deployment being available" # wait for ingress being created - while ! [ `kubectl -n {{.Values.systemDefinitionNamespace}} get ing helm-test-express-server | grep -v NAME | wc -l` = 1 ]; do + while ! [ `kubectl -n {{ include "systemDefinitionNamespace" . }} get ing helm-test-express-server | grep -v NAME | wc -l` = 1 ]; do echo "waiting for ingress being created" sleep 1 done diff --git a/charts/vela-core/templates/velaql/endpoints.yaml b/charts/vela-core/templates/velaql/endpoints.yaml index 684f4de47..83d685ce8 100644 --- a/charts/vela-core/templates/velaql/endpoints.yaml +++ b/charts/vela-core/templates/velaql/endpoints.yaml @@ -2,7 +2,7 @@ apiVersion: "v1" kind: "ConfigMap" metadata: name: "service-endpoints-view" - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} data: template: | import ( diff --git a/charts/vela-core/values.yaml b/charts/vela-core/values.yaml index 8286ae8e7..2d689db41 100644 --- a/charts/vela-core/values.yaml +++ b/charts/vela-core/values.yaml @@ -91,7 +91,8 @@ logFilePath: "" #If the value is 0, the maximum file size is unlimited. logFileMaxSize: 1024 -systemDefinitionNamespace: vela-system +#System definition namespace, if unspecified, will use built-in variable `.Release.Namespace`. +systemDefinitionNamespace: applicationRevisionLimit: 10 diff --git a/charts/vela-minimal/templates/_helpers.tpl b/charts/vela-minimal/templates/_helpers.tpl index fcef7edfc..4e0d77d21 100644 --- a/charts/vela-minimal/templates/_helpers.tpl +++ b/charts/vela-minimal/templates/_helpers.tpl @@ -66,3 +66,14 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +systemDefinitionNamespace value defaulter +*/}} +{{- define "systemDefinitionNamespace" -}} +{{- if .Values.systemDefinitionNamespace -}} + {{ .Values.systemDefinitionNamespace }} +{{- else -}} + {{ .Release.Namespace }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/vela-minimal/templates/definitions/autodetect.yaml b/charts/vela-minimal/templates/definitions/autodetect.yaml index 530aa6f73..ff890d1d6 100644 --- a/charts/vela-minimal/templates/definitions/autodetect.yaml +++ b/charts/vela-minimal/templates/definitions/autodetect.yaml @@ -4,7 +4,7 @@ metadata: annotations: definition.oam.dev/description: "autodetects.core.oam.dev is the default workload type of ComponentDefinition" name: autodetects.core.oam.dev - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: definitionRef: name: autodetects.core.oam.dev \ No newline at end of file diff --git a/charts/vela-minimal/templates/definitions/healthscopes.yaml b/charts/vela-minimal/templates/definitions/healthscopes.yaml index fa3dbbf26..73595f334 100644 --- a/charts/vela-minimal/templates/definitions/healthscopes.yaml +++ b/charts/vela-minimal/templates/definitions/healthscopes.yaml @@ -2,7 +2,7 @@ apiVersion: core.oam.dev/v1beta1 kind: ScopeDefinition metadata: name: healthscopes.core.oam.dev - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: workloadRefsPath: spec.workloadRefs allowComponentOverlap: true diff --git a/charts/vela-minimal/templates/defwithtemplate/annotations.yaml b/charts/vela-minimal/templates/defwithtemplate/annotations.yaml index 2b50a468d..00141cef0 100644 --- a/charts/vela-minimal/templates/defwithtemplate/annotations.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/annotations.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: annotations - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/apply-application-in-parallel.yaml b/charts/vela-minimal/templates/defwithtemplate/apply-application-in-parallel.yaml index efd6bc5e6..e984ea8a3 100644 --- a/charts/vela-minimal/templates/defwithtemplate/apply-application-in-parallel.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/apply-application-in-parallel.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-application-in-parallel - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/apply-application.yaml b/charts/vela-minimal/templates/defwithtemplate/apply-application.yaml index 25d875292..4e35bc599 100644 --- a/charts/vela-minimal/templates/defwithtemplate/apply-application.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/apply-application.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-application - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/apply-object.yaml b/charts/vela-minimal/templates/defwithtemplate/apply-object.yaml index a86c7574f..9f2b30caf 100644 --- a/charts/vela-minimal/templates/defwithtemplate/apply-object.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/apply-object.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-object - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/apply-remaining.yaml b/charts/vela-minimal/templates/defwithtemplate/apply-remaining.yaml index db2180f20..53f0f9dbe 100644 --- a/charts/vela-minimal/templates/defwithtemplate/apply-remaining.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/apply-remaining.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: apply-remaining - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/bind-cloud-resource.yaml b/charts/vela-minimal/templates/defwithtemplate/bind-cloud-resource.yaml index 0f56cf427..f91381b4e 100644 --- a/charts/vela-minimal/templates/defwithtemplate/bind-cloud-resource.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/bind-cloud-resource.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Sync secrets created by terraform component to runtime clusters name: bind-cloud-resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/configmap.yaml b/charts/vela-minimal/templates/defwithtemplate/configmap.yaml index b66eef93b..40fb584f9 100644 --- a/charts/vela-minimal/templates/defwithtemplate/configmap.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/configmap.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: configmap - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/cpuscaler.yaml b/charts/vela-minimal/templates/defwithtemplate/cpuscaler.yaml index 6b6609e50..b9b1dcbae 100644 --- a/charts/vela-minimal/templates/defwithtemplate/cpuscaler.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/cpuscaler.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: cpuscaler - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml b/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml index 3e446591c..7d4e64094 100644 --- a/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: depends-on-app - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/deploy-cloud-resource.yaml b/charts/vela-minimal/templates/defwithtemplate/deploy-cloud-resource.yaml index 8a884ddf9..684c45692 100644 --- a/charts/vela-minimal/templates/defwithtemplate/deploy-cloud-resource.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/deploy-cloud-resource.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Deploy cloud resource and bind secret to clusters name: deploy-cloud-resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/deploy2runtime.yaml b/charts/vela-minimal/templates/defwithtemplate/deploy2runtime.yaml index 57144e3ed..fe8f12888 100644 --- a/charts/vela-minimal/templates/defwithtemplate/deploy2runtime.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/deploy2runtime.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: deploy2runtime - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/env.yaml b/charts/vela-minimal/templates/defwithtemplate/env.yaml index f9276d4d0..9155eab21 100644 --- a/charts/vela-minimal/templates/defwithtemplate/env.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/env.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: env - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/export2config.yaml b/charts/vela-minimal/templates/defwithtemplate/export2config.yaml index be5ab957e..7bd39a62b 100644 --- a/charts/vela-minimal/templates/defwithtemplate/export2config.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/export2config.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: export2config - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml b/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml index c12489f78..44cf4d07b 100644 --- a/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/export2secret.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: export2secret - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/expose.yaml b/charts/vela-minimal/templates/defwithtemplate/expose.yaml index 6e613b689..29b9c6b37 100644 --- a/charts/vela-minimal/templates/defwithtemplate/expose.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/expose.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: expose - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-minimal/templates/defwithtemplate/gateway.yaml b/charts/vela-minimal/templates/defwithtemplate/gateway.yaml index 9b044df2e..bcfa7382c 100644 --- a/charts/vela-minimal/templates/defwithtemplate/gateway.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/gateway.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Enable public web traffic for the component, the ingress API matches K8s v1.20+. name: gateway - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-minimal/templates/defwithtemplate/health.yaml b/charts/vela-minimal/templates/defwithtemplate/health.yaml index 7f9c4fcad..74bc05421 100644 --- a/charts/vela-minimal/templates/defwithtemplate/health.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/health.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Apply periodical health checking to the application. name: health - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: manageHealthCheck: true schematic: diff --git a/charts/vela-minimal/templates/defwithtemplate/hostalias.yaml b/charts/vela-minimal/templates/defwithtemplate/hostalias.yaml index e92048c15..9b9c1782d 100644 --- a/charts/vela-minimal/templates/defwithtemplate/hostalias.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/hostalias.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: hostalias - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/import-grafana-dashboard.yaml b/charts/vela-minimal/templates/defwithtemplate/import-grafana-dashboard.yaml index 7e9037057..df92f54d6 100644 --- a/charts/vela-minimal/templates/defwithtemplate/import-grafana-dashboard.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/import-grafana-dashboard.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: import-grafana-dashboard - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: [] conflictsWith: [] diff --git a/charts/vela-minimal/templates/defwithtemplate/ingress-1-20.yaml b/charts/vela-minimal/templates/defwithtemplate/ingress-1-20.yaml index 30ce1c4c8..3336ce8ba 100644 --- a/charts/vela-minimal/templates/defwithtemplate/ingress-1-20.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/ingress-1-20.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: ingress-1-20 - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-minimal/templates/defwithtemplate/ingress.yaml b/charts/vela-minimal/templates/defwithtemplate/ingress.yaml index 69bafb442..8f228ea20 100644 --- a/charts/vela-minimal/templates/defwithtemplate/ingress.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/ingress.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: ingress - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: podDisruptive: false schematic: diff --git a/charts/vela-minimal/templates/defwithtemplate/init-container.yaml b/charts/vela-minimal/templates/defwithtemplate/init-container.yaml index 51948867b..cf5c7df29 100644 --- a/charts/vela-minimal/templates/defwithtemplate/init-container.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/init-container.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: init-container - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-minimal/templates/defwithtemplate/k8s-objects.yaml b/charts/vela-minimal/templates/defwithtemplate/k8s-objects.yaml index b87bcddca..f1241b297 100644 --- a/charts/vela-minimal/templates/defwithtemplate/k8s-objects.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/k8s-objects.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: K8s-objects allow users to specify raw K8s objects in properties name: k8s-objects - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/labels.yaml b/charts/vela-minimal/templates/defwithtemplate/labels.yaml index fb2c970c7..87b7044bd 100644 --- a/charts/vela-minimal/templates/defwithtemplate/labels.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/labels.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: labels - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/lifecycle.yaml b/charts/vela-minimal/templates/defwithtemplate/lifecycle.yaml index c5e817b43..3819ab880 100644 --- a/charts/vela-minimal/templates/defwithtemplate/lifecycle.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/lifecycle.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: lifecycle - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml b/charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml index 0a1d11e33..64bde3427 100644 --- a/charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: nocalhost - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/node-affinity.yaml b/charts/vela-minimal/templates/defwithtemplate/node-affinity.yaml index c61d6d089..537923172 100644 --- a/charts/vela-minimal/templates/defwithtemplate/node-affinity.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/node-affinity.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: node-affinity - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/notification.yaml b/charts/vela-minimal/templates/defwithtemplate/notification.yaml index 08d1497af..8bdfbbf11 100644 --- a/charts/vela-minimal/templates/defwithtemplate/notification.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/notification.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Send message to webhook name: notification - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/pure-ingress.yaml b/charts/vela-minimal/templates/defwithtemplate/pure-ingress.yaml index 183ff1ec5..40d6972f3 100644 --- a/charts/vela-minimal/templates/defwithtemplate/pure-ingress.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/pure-ingress.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: pure-ingress - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: [] conflictsWith: [] diff --git a/charts/vela-minimal/templates/defwithtemplate/pvc.yaml b/charts/vela-minimal/templates/defwithtemplate/pvc.yaml index 6bae6f4ff..79b240af5 100644 --- a/charts/vela-minimal/templates/defwithtemplate/pvc.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/pvc.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: pvc - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-minimal/templates/defwithtemplate/raw.yaml b/charts/vela-minimal/templates/defwithtemplate/raw.yaml index b52cfc608..729cd0bf4 100644 --- a/charts/vela-minimal/templates/defwithtemplate/raw.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/raw.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: raw - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/read-object.yaml b/charts/vela-minimal/templates/defwithtemplate/read-object.yaml index 3fef0c2b4..c455595dd 100644 --- a/charts/vela-minimal/templates/defwithtemplate/read-object.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/read-object.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: read-object - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/register-grafana-datasource.yaml b/charts/vela-minimal/templates/defwithtemplate/register-grafana-datasource.yaml index 58bef0316..98a59500b 100644 --- a/charts/vela-minimal/templates/defwithtemplate/register-grafana-datasource.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/register-grafana-datasource.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: register-grafana-datasource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: [] conflictsWith: [] diff --git a/charts/vela-minimal/templates/defwithtemplate/resource.yaml b/charts/vela-minimal/templates/defwithtemplate/resource.yaml index 2ecf4a033..b66c2d907 100644 --- a/charts/vela-minimal/templates/defwithtemplate/resource.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/resource.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/scaler.yaml b/charts/vela-minimal/templates/defwithtemplate/scaler.yaml index e6f4ce220..d65f1ee48 100644 --- a/charts/vela-minimal/templates/defwithtemplate/scaler.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/scaler.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Manually scale K8s pod for your workload which follows the pod spec in path 'spec.template'. name: scaler - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/service-account.yaml b/charts/vela-minimal/templates/defwithtemplate/service-account.yaml index 75c9c976b..23ffc6e4c 100644 --- a/charts/vela-minimal/templates/defwithtemplate/service-account.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/service-account.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Specify serviceAccount for your workload which follows the pod spec in path 'spec.template'. name: service-account - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/service-binding.yaml b/charts/vela-minimal/templates/defwithtemplate/service-binding.yaml index 299741e0d..41913f558 100644 --- a/charts/vela-minimal/templates/defwithtemplate/service-binding.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/service-binding.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: service-binding - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/share-cloud-resource.yaml b/charts/vela-minimal/templates/defwithtemplate/share-cloud-resource.yaml index c05d4c36f..aac98dc9f 100644 --- a/charts/vela-minimal/templates/defwithtemplate/share-cloud-resource.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/share-cloud-resource.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Sync secrets created by terraform component to runtime clusters so that runtime clusters can share the created cloud resource. name: share-cloud-resource - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml b/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml index ce6b88585..1ef0f15dd 100644 --- a/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: sidecar - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - '*' diff --git a/charts/vela-minimal/templates/defwithtemplate/storage.yaml b/charts/vela-minimal/templates/defwithtemplate/storage.yaml index f9202a0e1..8bec0fe21 100644 --- a/charts/vela-minimal/templates/defwithtemplate/storage.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/storage.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Add storages on K8s pod for your workload which follows the pod spec in path 'spec.template'. name: storage - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-minimal/templates/defwithtemplate/suspend.yaml b/charts/vela-minimal/templates/defwithtemplate/suspend.yaml index 6cad30f67..935364c22 100644 --- a/charts/vela-minimal/templates/defwithtemplate/suspend.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/suspend.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Suspend your workflow name: suspend - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/task.yaml b/charts/vela-minimal/templates/defwithtemplate/task.yaml index 94008f5ab..cd1a39030 100644 --- a/charts/vela-minimal/templates/defwithtemplate/task.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/task.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Describes jobs that run code or a script to completion. name: task - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/volumes.yaml b/charts/vela-minimal/templates/defwithtemplate/volumes.yaml index e9484a6e4..1cb53b3e6 100644 --- a/charts/vela-minimal/templates/defwithtemplate/volumes.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/volumes.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: volumes - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: appliesToWorkloads: - deployments.apps diff --git a/charts/vela-minimal/templates/defwithtemplate/webhook-notification.yaml b/charts/vela-minimal/templates/defwithtemplate/webhook-notification.yaml index 68bb75239..9756efc62 100644 --- a/charts/vela-minimal/templates/defwithtemplate/webhook-notification.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/webhook-notification.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/deprecated: "true" name: webhook-notification - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/webhook.yaml b/charts/vela-minimal/templates/defwithtemplate/webhook.yaml index ef6e33540..c54c726aa 100644 --- a/charts/vela-minimal/templates/defwithtemplate/webhook.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/webhook.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Send webhook request to the url name: webhook - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/webservice.yaml b/charts/vela-minimal/templates/defwithtemplate/webservice.yaml index 7012ea8e7..3410a90d3 100644 --- a/charts/vela-minimal/templates/defwithtemplate/webservice.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/webservice.yaml @@ -6,7 +6,7 @@ metadata: annotations: definition.oam.dev/description: Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers. name: webservice - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/defwithtemplate/worker.yaml b/charts/vela-minimal/templates/defwithtemplate/worker.yaml index fd688660e..1b84227e7 100644 --- a/charts/vela-minimal/templates/defwithtemplate/worker.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/worker.yaml @@ -8,7 +8,7 @@ metadata: labels: custom.definition.oam.dev/ui-hidden: "true" name: worker - namespace: {{.Values.systemDefinitionNamespace}} + namespace: {{ include "systemDefinitionNamespace" . }} spec: schematic: cue: diff --git a/charts/vela-minimal/templates/kubevela-controller.yaml b/charts/vela-minimal/templates/kubevela-controller.yaml index cc263b40c..65c34c75e 100644 --- a/charts/vela-minimal/templates/kubevela-controller.yaml +++ b/charts/vela-minimal/templates/kubevela-controller.yaml @@ -129,7 +129,7 @@ spec: {{ if ne .Values.disableCaps "" }} - "--disable-caps={{ .Values.disableCaps }}" {{ end }} - - "--system-definition-namespace={{ .Values.systemDefinitionNamespace }}" + - "--system-definition-namespace={{ include "systemDefinitionNamespace" . }}" - "--application-revision-limit={{ .Values.applicationRevisionLimit }}" - "--definition-revision-limit={{ .Values.definitionRevisionLimit }}" - "--oam-spec-ver={{ .Values.OAMSpecVer }}" diff --git a/charts/vela-minimal/values.yaml b/charts/vela-minimal/values.yaml index 2d0517b5b..0dd1e5ef5 100644 --- a/charts/vela-minimal/values.yaml +++ b/charts/vela-minimal/values.yaml @@ -91,7 +91,8 @@ logFilePath: "" #If the value is 0, the maximum file size is unlimited. logFileMaxSize: 1024 -systemDefinitionNamespace: vela-system +#System definition namespace, if unspecified, will use built-in variable `.Release.Namespace`. +systemDefinitionNamespace: applicationRevisionLimit: 10 diff --git a/references/cli/def.go b/references/cli/def.go index 13b2f7f5a..6a784de45 100644 --- a/references/cli/def.go +++ b/references/cli/def.go @@ -683,7 +683,7 @@ func NewDefinitionRenderCommand(c common.Args) *cobra.Command { if err != nil { return errors.Wrapf(err, "failed to marshal CRD into YAML") } - s = strings.ReplaceAll(s, "'"+HelmChartNamespacePlaceholder+"'", "{{.Values.systemDefinitionNamespace}}") + "\n" + s = strings.ReplaceAll(s, "'"+HelmChartNamespacePlaceholder+"'", "{{ include \"systemDefinitionNamespace\" . }}") + "\n" if outputFilename == "" { s = fmt.Sprintf("--- %s ---\n%s", filepath.Base(inputFilename), s) cmd.Print(s) diff --git a/references/cli/velaql_test.go b/references/cli/velaql_test.go index b58bc2c22..5cc3128bf 100644 --- a/references/cli/velaql_test.go +++ b/references/cli/velaql_test.go @@ -345,7 +345,7 @@ var _ = Describe("Test velaQL", func() { } velaQL, err := ioutil.ReadFile("../../charts/vela-core/templates/velaql/endpoints.yaml") Expect(err).Should(BeNil()) - velaQLYaml := strings.Replace(string(velaQL), "{{.Values.systemDefinitionNamespace}}", types.DefaultKubeVelaNS, 1) + velaQLYaml := strings.Replace(string(velaQL), "{{ include \"systemDefinitionNamespace\" . }}", types.DefaultKubeVelaNS, 1) var cm corev1.ConfigMap err = yaml.Unmarshal([]byte(velaQLYaml), &cm) Expect(err).Should(BeNil())