From 5d2680cce36b1cecf4ea5cd5e5d3b7339639e5fa Mon Sep 17 00:00:00 2001 From: Pavel Yudin Date: Thu, 2 Jun 2022 15:42:23 +0300 Subject: [PATCH 1/3] Add ability to set which k8s storage class will be used to create volumes --- helm-charts/tarantool-cartridge/templates/deployment.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helm-charts/tarantool-cartridge/templates/deployment.yaml b/helm-charts/tarantool-cartridge/templates/deployment.yaml index 37ca8029..5432b6b2 100644 --- a/helm-charts/tarantool-cartridge/templates/deployment.yaml +++ b/helm-charts/tarantool-cartridge/templates/deployment.yaml @@ -51,6 +51,9 @@ spec: name: www spec: accessModes: ["ReadWriteOnce"] + {{ if $.Values.StorageClassName }} + storageClassName: {{ $.Values.StorageClassName }} + {{ end }} resources: requests: storage: {{ .DiskSize }} From adc97accdf8ce6b9de830b8e3cb66d908741c762 Mon Sep 17 00:00:00 2001 From: Pavel Yudin Date: Thu, 2 Jun 2022 16:16:01 +0300 Subject: [PATCH 2/3] Add prefix to all resources which created by operator Prefix is a name of helm installation. Example: If application installing with command: helm install app ./helm-charts/tarantool-cartridge then resources will have name: ttq-routers-0 --- .github/workflows/test.yml | 10 ++++----- .../templates/deployment.yaml | 22 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 840d35c4..f2c8daef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,7 +106,7 @@ jobs: helm install -n ${{ env.APP_NAMESPACE }} --create-namespace \ -f test/helpers/ci/cluster_values.yaml \ - cartridge-app \ + crtg \ helm-charts/tarantool-cartridge - name: Waiting for routers Pods availability @@ -115,10 +115,10 @@ jobs: - name: Сhecking the number of ready router replicas run : | desired_routers_num=1 - ready_routers_num=$(kubectl get statefulsets/router-0 -o=jsonpath="{.status.readyReplicas}") + ready_routers_num=$(kubectl get statefulsets/crtg-router-0 -o=jsonpath="{.status.readyReplicas}") if [[ $ready_routers_num -ne $desired_routers_num ]]; then - kubectl describe statefulsets/router-0 + kubectl describe statefulsets/crtg-router-0 kubectl describe pod -l tarantool.io/role=router echo 'ERROR: invalid number of ready routers...' >&2; exit 1 fi @@ -129,10 +129,10 @@ jobs: - name: Сhecking the number of ready storage replicas run: | desired_storage_num=1 - ready_storage_num=$(kubectl get statefulsets/storage-0 -o=jsonpath="{.status.readyReplicas}") + ready_storage_num=$(kubectl get statefulsets/crtg-storage-0 -o=jsonpath="{.status.readyReplicas}") if [[ $ready_storage_num -ne $desired_storage_num ]]; then - kubectl describe statefulsets/storage-0 + kubectl describe statefulsets/crtg-storage-0 kubectl describe pod -l tarantool.io/role=storage echo 'ERROR: invalid number of ready storages...' >&2; exit 1 fi diff --git a/helm-charts/tarantool-cartridge/templates/deployment.yaml b/helm-charts/tarantool-cartridge/templates/deployment.yaml index 5432b6b2..c60050a7 100644 --- a/helm-charts/tarantool-cartridge/templates/deployment.yaml +++ b/helm-charts/tarantool-cartridge/templates/deployment.yaml @@ -12,7 +12,7 @@ spec: apiVersion: tarantool.io/v1alpha1 kind: Role metadata: - name: {{ .RoleName | replace "_" "" }} + name: "{{ $.Release.Name }}-{{ .RoleName | replace "_" "" }}" labels: tarantool.io/cluster-id: {{ $.Values.ClusterName }} tarantool.io/role: {{ .RoleName }} @@ -21,16 +21,16 @@ metadata: spec: selector: matchLabels: - tarantool.io/replicaset-template: "{{ .RoleName }}-template" + tarantool.io/replicaset-template: "{{ $.Release.Name }}-{{ .RoleName }}-template" numReplicasets: {{ .ReplicaSetCount }} --- apiVersion: tarantool.io/v1alpha1 kind: ReplicasetTemplate metadata: - name: "{{ .RoleName | replace "_" "" }}-template" + name: "{{ $.Release.Name }}-{{ .RoleName | replace "_" "" }}-template" labels: tarantool.io/cluster-id: {{ $.Values.ClusterName }} - tarantool.io/replicaset-template: "{{ .RoleName }}-template" + tarantool.io/replicaset-template: "{{ $.Release.Name }}-{{ .RoleName }}-template" tarantool.io/role: {{ .RoleName }} {{ if .VshardGroup }} tarantool.io/useVshardGroups: "1" @@ -42,13 +42,13 @@ metadata: tarantool.io/rolesToAssign: {{ $r }} spec: replicas: {{ .ReplicaCount }} - serviceName: {{ .RoleName }} + serviceName: "{{ $.Release.Name }}-{{ .RoleName }}" selector: matchLabels: - tarantool.io/pod-template: "{{ .RoleName }}-pod-template" + tarantool.io/pod-template: "{{ $.Release.Name }}-{{ .RoleName }}-pod-template" volumeClaimTemplates: - metadata: - name: www + name: {{ $.Release.Name }} spec: accessModes: ["ReadWriteOnce"] {{ if $.Values.StorageClassName }} @@ -62,7 +62,7 @@ spec: labels: tarantool.io/cluster-id: "{{ $.Values.ClusterName }}" tarantool.io/cluster-domain-name: "{{ $.Values.ClusterDomainName }}" - tarantool.io/pod-template: "{{ .RoleName }}-pod-template" + tarantool.io/pod-template: "{{ $.Release.Name }}-{{ .RoleName }}-pod-template" {{ if .VshardGroup }} tarantool.io/useVshardGroups: "1" tarantool.io/vshardGroupName: {{ .VshardGroup }} @@ -83,10 +83,10 @@ spec: securityContext: fsGroup: {{ $.Values.securityContext.fsGroup }} containers: - - name: pim-storage + - name: "{{ $.Release.Name }}-container" image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" volumeMounts: - - name: www + - name: {{ $.Release.Name }} mountPath: "{{ $.Values.TarantoolWorkDir }}" resources: requests: @@ -145,7 +145,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: {{ .RoleName }} + name: "{{ $.Release.Name }}-{{ .RoleName }}" labels: tarantool.io/role: {{ .RoleName }} spec: From e6a4fc305ee147c35327402c5a760ebd4acc110d Mon Sep 17 00:00:00 2001 From: Pavel Yudin Date: Thu, 2 Jun 2022 16:16:19 +0300 Subject: [PATCH 3/3] Remove unused github jobs --- .github/workflows/destroy-deployment.yml | 24 ---------- .github/workflows/pull-translation.yml | 51 -------------------- .github/workflows/push-translation.yml | 57 ----------------------- .github/workflows/upload-translations.yml | 40 ---------------- 4 files changed, 172 deletions(-) delete mode 100644 .github/workflows/destroy-deployment.yml delete mode 100644 .github/workflows/pull-translation.yml delete mode 100644 .github/workflows/push-translation.yml delete mode 100644 .github/workflows/upload-translations.yml diff --git a/.github/workflows/destroy-deployment.yml b/.github/workflows/destroy-deployment.yml deleted file mode 100644 index 5e7ec3e0..00000000 --- a/.github/workflows/destroy-deployment.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Destroy-deployments - -on: - pull_request: - paths: - - 'doc/**/*' - types: - - closed -jobs: - destroy-deployment: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - - - name: Set branch name from source branch - run: echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV - - - name: Remove dev server deployment at ${{env.DEPLOYMENT_NAME}} - uses: strumwolf/delete-deployment-environment@v2 - with: - token: "${{ secrets.TARANTOOLBOT_TOKEN }}" - environment: "translation-${{env.BRANCH_NAME}}" diff --git a/.github/workflows/pull-translation.yml b/.github/workflows/pull-translation.yml deleted file mode 100644 index f61fa598..00000000 --- a/.github/workflows/pull-translation.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Pull translations - -on: - workflow_dispatch: - branches: - - '!master' -jobs: - pull-translations: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - token: ${{secrets.TARANTOOLBOT_TOKEN}} - - - name: Set branch name from source branch - run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV - - - name: Setup Python environment - uses: actions/setup-python@v2 - - - name: Setup Python requirements - run: | - python -m pip install --upgrade pip - pip install -r doc/requirements.txt - - - name: Pull translations from Crowdin - uses: crowdin/github-action@1.0.21 - with: - config: 'doc/crowdin.yaml' - upload_sources: false - upload_translations: false - push_translations: false - download_translations: true - download_language: 'ru' - crowdin_branch_name: ${{env.BRANCH_NAME}} - debug_mode: true - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}} - - - name: Cleanup translation files - run: | - sudo chown -R runner:docker doc/locale/ru/LC_MESSAGES - python doc/cleanup.py po - - - name: Commit translation files - uses: stefanzweifel/git-auto-commit-action@v4.1.2 - with: - commit_message: "Update translations" - file_pattern: "*.po" diff --git a/.github/workflows/push-translation.yml b/.github/workflows/push-translation.yml deleted file mode 100644 index 113e5691..00000000 --- a/.github/workflows/push-translation.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Push translation sources - -on: - pull_request: - paths: - - 'doc/**/*.rst' - - 'doc/conf.py' - - '.github/workflows/push-translation.yml' -jobs: - push-translation-sources: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set branch name from source branch - run: echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV - - - name: Start translation service deployment - uses: bobheadxi/deployments@v0.5.2 - id: translation - with: - step: start - token: ${{secrets.GITHUB_TOKEN}} - env: translation-${{env.BRANCH_NAME}} - ref: ${{github.head_ref}} - - - name: Setup Python environment - uses: actions/setup-python@v2 - - - name: Setup Python requirements - run: | - python -m pip install --upgrade pip - pip install -r doc/requirements.txt - - - name: Build pot files - run: python -m sphinx . doc/locale/en -c doc -b gettext - - - name: Push POT files to crowdin - uses: crowdin/github-action@1.0.21 - with: - upload_sources: true - upload_translations: false - crowdin_branch_name: ${{env.BRANCH_NAME}} - config: 'doc/crowdin.yaml' - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}} - - - name: update deployment status - uses: bobheadxi/deployments@v0.5.2 - with: - step: finish - token: ${{secrets.GITHUB_TOKEN}} - status: ${{job.status}} - deployment_id: ${{steps.translation.outputs.deployment_id}} - env_url: https://crowdin.com/project/tarantool-cartridge-cli/ru#/${{env.BRANCH_NAME}} diff --git a/.github/workflows/upload-translations.yml b/.github/workflows/upload-translations.yml deleted file mode 100644 index 75a88c4e..00000000 --- a/.github/workflows/upload-translations.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Update translations on the main branch - -on: - push: - paths: - - 'doc/**/*.rst' - - 'doc/locale/**/*.po' - - '.github/workflows/upload-translations.yml' - branches: - - master -jobs: - autocommit-pot-files: - runs-on: ubuntu-latest - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup Python environment - uses: actions/setup-python@v2 - - - name: Setup Python requirements - run: | - python -m pip install --upgrade pip - pip install -r doc/requirements.txt - - - name: Build pot files - run: python -m sphinx . doc/locale/en -c doc -b gettext - - - name: Push Pot-files to crowdin - uses: crowdin/github-action@1.1.0 - with: - config: 'doc/crowdin.yaml' - upload_sources: true - upload_translations: true - import_eq_suggestions: true - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}