diff --git a/.github/workflows/helm-test-workflow.yaml b/.github/workflows/helm-test-workflow.yaml index 8d6bd30..b57eb06 100644 --- a/.github/workflows/helm-test-workflow.yaml +++ b/.github/workflows/helm-test-workflow.yaml @@ -55,7 +55,7 @@ jobs: - name: packageAll run: helm package ${{env.CHART_SRC_DIR}} -d dist --version "${{steps.setVersion.outputs.version}}" - name: Store target - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: helm-build path: "dist/${{env.NAME}}-${{steps.setVersion.outputs.version}}.tgz" @@ -66,7 +66,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: helm-build path: dist @@ -91,7 +91,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: helm-build path: dist @@ -116,7 +116,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: helm-build path: dist @@ -145,7 +145,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: helm-build path: dist @@ -169,7 +169,7 @@ jobs: runs-on: ubuntu-latest needs: [ build, test-flink, test-streaming-lite-postgres, test-streaming-lite-hsql, test-request-response ] steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: helm-build path: dist @@ -180,7 +180,7 @@ jobs: runs-on: ubuntu-latest needs: [ build, test-flink, test-streaming-lite-postgres, test-streaming-lite-hsql, test-request-response ] steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: helm-build path: dist diff --git a/src/templates/flink-k8s-operator/delete-flink-deployments.yaml b/src/templates/flink-k8s-operator/delete-flink-deployments.yaml index cefcc7e..4bc7013 100644 --- a/src/templates/flink-k8s-operator/delete-flink-deployments.yaml +++ b/src/templates/flink-k8s-operator/delete-flink-deployments.yaml @@ -1,11 +1,14 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} -{{- if not (and (hasKey .Values.enterprise.flinkK8sOperatorDeploymentManager "keepFlinkDeploymentsOnUninstall") (.Values.enterprise.flinkK8sOperatorDeploymentManager.keepFlinkDeploymentsOnUninstall)) }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} +{{- if not (and (hasKey . "keepFlinkDeploymentsOnUninstall") (.keepFlinkDeploymentsOnUninstall)) }} apiVersion: batch/v1 kind: Job metadata: name: delete-flinkdeployments labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{ include "nussknacker.labels" $originalContext | nindent 4 }} annotations: "helm.sh/hook": pre-delete "helm.sh/hook-weight": "0" @@ -14,9 +17,9 @@ spec: template: metadata: labels: - {{ include "nussknacker.labels" . | nindent 8 }} + {{ include "nussknacker.labels" $originalContext | nindent 8 }} spec: - serviceAccountName: {{ include "nussknacker.serviceAccountName" . }} + serviceAccountName: {{ include "nussknacker.serviceAccountName" $originalContext }} containers: - name: delete-flinkdeployments image: bitnami/kubectl:latest @@ -25,7 +28,7 @@ spec: - /bin/sh - -c - | - kubectl delete flinkdeployments --all -n {{ .Release.Namespace }} + kubectl delete flinkdeployments --all -n {{ $originalContext.Release.Namespace }} resources: limits: cpu: "100m" @@ -37,3 +40,5 @@ spec: backoffLimit: 1 {{- end }} {{- end }} +{{- end }} +{{- end }} diff --git a/src/templates/flink-k8s-operator/flink-deployment-creator-role.yaml b/src/templates/flink-k8s-operator/flink-deployment-creator-role.yaml index 97d786d..20bed40 100644 --- a/src/templates/flink-k8s-operator/flink-deployment-creator-role.yaml +++ b/src/templates/flink-k8s-operator/flink-deployment-creator-role.yaml @@ -1,12 +1,17 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{ default "flink-deployment-creator" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkDeploymentCreatorRole }} + name: {{ default "flink-deployment-creator" .flinkDeploymentCreatorRole }} labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{ include "nussknacker.labels" $originalContext | nindent 4 }} rules: - apiGroups: ["flink.apache.org"] resources: ["flinkdeployments"] verbs: ["create", "delete", "list", "update", "get"] +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/src/templates/flink-k8s-operator/flink-deployment-creator-rolebinding.yaml b/src/templates/flink-k8s-operator/flink-deployment-creator-rolebinding.yaml index 727bf7d..1916086 100644 --- a/src/templates/flink-k8s-operator/flink-deployment-creator-rolebinding.yaml +++ b/src/templates/flink-k8s-operator/flink-deployment-creator-rolebinding.yaml @@ -1,15 +1,20 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ default "flink-deployment-creator" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkDeploymentCreatorRole }}-rolebinding + name: {{ default "flink-deployment-creator" .flinkDeploymentCreatorRole }}-rolebinding labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{- include "nussknacker.labels" $originalContext | nindent 4 }} subjects: - kind: ServiceAccount - name: {{ include "nussknacker.serviceAccountName" . }} + name: {{ include "nussknacker.serviceAccountName" $originalContext }} roleRef: kind: Role - name: {{ default "flink-deployment-creator" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkDeploymentCreatorRole }} + name: {{ default "flink-deployment-creator" .flinkDeploymentCreatorRole }} apiGroup: rbac.authorization.k8s.io +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/src/templates/flink-k8s-operator/flink-operator-role.yaml b/src/templates/flink-k8s-operator/flink-operator-role.yaml index 2c66762..2ffd4d3 100644 --- a/src/templates/flink-k8s-operator/flink-operator-role.yaml +++ b/src/templates/flink-k8s-operator/flink-operator-role.yaml @@ -1,10 +1,13 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{ default "flink-operator" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkOperatorRole }} + name: {{ default "flink-operator" .flinkOperatorRole }} labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{ include "nussknacker.labels" $originalContext | nindent 4 }} rules: - apiGroups: [""] resources: ["pods"] @@ -15,4 +18,6 @@ rules: - apiGroups: ["apps"] resources: ["deployments"] verbs: ["create", "get", "list", "watch", "update", "delete"] +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/src/templates/flink-k8s-operator/flink-operator-rolebinding.yaml b/src/templates/flink-k8s-operator/flink-operator-rolebinding.yaml index ca3ccdc..597cb7a 100644 --- a/src/templates/flink-k8s-operator/flink-operator-rolebinding.yaml +++ b/src/templates/flink-k8s-operator/flink-operator-rolebinding.yaml @@ -1,15 +1,20 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ default "flink-operator" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkOperatorRole }}-rolebinding + name: {{ default "flink-operator" .flinkOperatorRole }}-rolebinding labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{- include "nussknacker.labels" $originalContext | nindent 4 }} subjects: - kind: ServiceAccount - name: {{ default "flink-service-account" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkServiceAccount }} + name: {{ default "flink-service-account" .flinkServiceAccount }} roleRef: kind: Role - name: {{ default "flink-operator" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkOperatorRole }} + name: {{ default "flink-operator" .flinkOperatorRole }} apiGroup: rbac.authorization.k8s.io +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/src/templates/flink-k8s-operator/flink-service-account.yaml b/src/templates/flink-k8s-operator/flink-service-account.yaml index ea2ae85..3f3d69d 100644 --- a/src/templates/flink-k8s-operator/flink-service-account.yaml +++ b/src/templates/flink-k8s-operator/flink-service-account.yaml @@ -1,8 +1,13 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} apiVersion: v1 kind: ServiceAccount metadata: - name: {{ default "flink-service-account" .Values.enterprise.flinkK8sOperatorDeploymentManager.flinkServiceAccount }} + name: {{ default "flink-service-account" .flinkServiceAccount }} labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{ include "nussknacker.labels" $originalContext | nindent 4 }} +{{- end -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/src/templates/flink-k8s-operator/jar-shared-volume-pvc.yaml b/src/templates/flink-k8s-operator/jar-shared-volume-pvc.yaml index 702dc35..69b6921 100644 --- a/src/templates/flink-k8s-operator/jar-shared-volume-pvc.yaml +++ b/src/templates/flink-k8s-operator/jar-shared-volume-pvc.yaml @@ -1,21 +1,28 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} +{{- with .jobJarStorage -}} apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ .Values.enterprise.flinkK8sOperatorDeploymentManager.jobJarStorage.pvcName }} -{{- if and (hasKey .Values.enterprise.flinkK8sOperatorDeploymentManager.jobJarStorage "keepAfterUninstall") .Values.enterprise.flinkK8sOperatorDeploymentManager.jobJarStorage.keepAfterUninstall }} + name: {{ .pvcName }} +{{- if and (hasKey . "keepAfterUninstall") .keepAfterUninstall }} annotations: "helm.sh/resource-policy": keep {{- end }} labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{ include "nussknacker.labels" $originalContext | nindent 4 }} spec: accessModes: - ReadWriteMany resources: requests: - storage: {{ default "1Gi" .Values.enterprise.flinkK8sOperatorDeploymentManager.jobJarStorage.pvcSize }} - {{- with .Values.enterprise.flinkK8sOperatorDeploymentManager.jobJarStorage.pvcStorageClassName }} + storage: {{ default "1Gi" .pvcSize }} + {{- with .pvcStorageClassName }} storageClassName: {{ . }} {{- end }} +{{- end }} +{{- end }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/src/templates/flink-k8s-operator/job-state-shared-volume-pvc.yaml b/src/templates/flink-k8s-operator/job-state-shared-volume-pvc.yaml index 1ed50f7..9ff1f12 100644 --- a/src/templates/flink-k8s-operator/job-state-shared-volume-pvc.yaml +++ b/src/templates/flink-k8s-operator/job-state-shared-volume-pvc.yaml @@ -1,21 +1,28 @@ -{{- if and (hasKey .Values "enterprise.flinkK8sOperatorDeploymentManager") .Values.enterprise.flinkK8sOperatorDeploymentManager.enabled }} +{{- $originalContext := . -}} +{{- with .Values.enterprise -}} +{{- with .flinkK8sOperatorDeploymentManager -}} +{{- if .enabled }} +{{- with .jobStateStorage -}} apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ .Values.enterprise.flinkK8sOperatorDeploymentManager.jobStateStorage.pvcName }} -{{- if and (hasKey .Values.enterprise.flinkK8sOperatorDeploymentManager.jobStateStorage "keepAfterUninstall") .Values.enterprise.flinkK8sOperatorDeploymentManager.jobStateStorage.keepAfterUninstall }} + name: {{ .pvcName }} +{{- if and (hasKey . "keepAfterUninstall") .keepAfterUninstall }} annotations: "helm.sh/resource-policy": keep {{- end }} labels: - {{ include "nussknacker.labels" . | nindent 4 }} + {{ include "nussknacker.labels" $originalContext | nindent 4 }} spec: accessModes: - ReadWriteMany resources: requests: - storage: {{ default "1Gi" .Values.enterprise.flinkK8sOperatorDeploymentManager.jobStateStorage.pvcSize }} - {{- with .Values.enterprise.flinkK8sOperatorDeploymentManager.jobStateStorage.pvcStorageClassName }} + storage: {{ default "1Gi" .pvcSize }} + {{- with .pvcStorageClassName }} storageClassName: {{ . }} {{- end }} +{{- end }} +{{- end }} +{{- end }} {{- end }} \ No newline at end of file