diff --git a/.changes/header.tpl.md b/.changes/header.tpl.md new file mode 100644 index 00000000..825c32f0 --- /dev/null +++ b/.changes/header.tpl.md @@ -0,0 +1 @@ +# Changelog diff --git a/.changes/unreleased/.gitkeep b/.changes/unreleased/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.changes/v0.5.31.md b/.changes/v0.5.31.md new file mode 100644 index 00000000..0bf49300 --- /dev/null +++ b/.changes/v0.5.31.md @@ -0,0 +1,3 @@ +## v0.5.31 - 2024-11-04 +### Added +* Initialized a changelog diff --git a/.changes/v0.5.32.md b/.changes/v0.5.32.md new file mode 100644 index 00000000..61d2e7f2 --- /dev/null +++ b/.changes/v0.5.32.md @@ -0,0 +1,3 @@ +## v0.5.32 - 2024-11-05 +### Fixed +* Chart.yaml version is bumped up automatically when a new release PR is created diff --git a/.changes/v0.6.0.md b/.changes/v0.6.0.md new file mode 100644 index 00000000..aeffbf29 --- /dev/null +++ b/.changes/v0.6.0.md @@ -0,0 +1,27 @@ +## v0.6.0 - 2025-01-29 +### Added +* starting with this release, deploying to dockerhub (ydbplatform/ydb-kubernetes-operator) +* added the ability to create metadata announce for customize dns domain (default: cluster.local) +* new field additionalPodLabels for Storage and Database CRD +* new method buildPodTemplateLabels to append additionalPodLabels for statefulset builders +* compatibility tests running automatically on each new tag +* customize Database and Storage container securityContext +* field externalPort for grpc service to override --grpc-public-port arg +* annotations overrides default secret name and key for arg --auth-token-file +* field ObservedGeneration inside .status.conditions +### Changed +* up CONTROLLER_GEN_VERSION to 0.16.5 and ENVTEST_VERSION to release-0.17 +* refactor package labels to separate methods buildLabels, buildSelectorLabels and buildeNodeSetLabels for each resource +* propagate labels ydb.tech/database-nodeset, ydb.tech/storage-nodeset and ydb.tech/remote-cluster with method makeCommonLabels between resource recasting +### Fixed +* e2e tests and unit tests flapped because of the race between storage finalizers and uninstalling operator helm chart +* regenerate CRDs in upload-artifacts workflow (as opposed to manually) +* additional kind worker to maintain affinity rules for blobstorage init job +* update the Makefile with the changes in GitHub CI +* bug: missing error handler for arg --auth-token-file +* fix field resourceVersion inside .status.remoteResources.conditions +* panic when create object with .spec.pause is true +* Passing additional secret volumes to blobstorage-init. The init container can now use them without issues. +### Security +* bump golang-jwt to v4.5.1 (by dependabot) +* bump golang.org/x/net from 0.23.0 to 0.33.0 (by dependabot) diff --git a/.changes/v0.6.1.md b/.changes/v0.6.1.md new file mode 100644 index 00000000..2f7a24f4 --- /dev/null +++ b/.changes/v0.6.1.md @@ -0,0 +1,3 @@ +## v0.6.1 - 2025-02-12 +### Fixed +* fix passing interconnet TLS volume in blobstorage-init job diff --git a/.changes/v0.6.2.md b/.changes/v0.6.2.md new file mode 100644 index 00000000..f7d29295 --- /dev/null +++ b/.changes/v0.6.2.md @@ -0,0 +1,3 @@ +## v0.6.2 - 2025-02-24 +### Fixed +* bug: regression with pod name in grpc-public-host arg diff --git a/.changie.yaml b/.changie.yaml new file mode 100644 index 00000000..78ab6e36 --- /dev/null +++ b/.changie.yaml @@ -0,0 +1,26 @@ +changesDir: .changes +unreleasedDir: unreleased +headerPath: header.tpl.md +changelogPath: CHANGELOG.md +versionExt: md +versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}' +kindFormat: '### {{.Kind}}' +changeFormat: '* {{.Body}}' +kinds: + - label: Added + auto: minor + - label: Changed + auto: major + - label: Deprecated + auto: minor + - label: Removed + auto: major + - label: Fixed + auto: patch + - label: Security + auto: patch +newlines: + afterChangelogHeader: 1 + beforeChangelogVersion: 1 + endOfVersion: 1 +envPrefix: CHANGIE_ diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 784c093c..7a8c08e7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,3 @@ -I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en - ## Pull request type diff --git a/.github/scripts/check-work-copy-equals-to-committed.sh b/.github/scripts/check-work-copy-equals-to-committed.sh deleted file mode 100644 index 9d4b455a..00000000 --- a/.github/scripts/check-work-copy-equals-to-committed.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -MESSAGE="$1" - -CODE_DIFF="$(git diff)" -if [ -n "$CODE_DIFF" ]; then - echo "$MESSAGE" - echo - echo "$CODE_DIFF" - exit 1; -fi diff --git a/.github/scripts/format-all-go-code.sh b/.github/scripts/format-all-go-code.sh deleted file mode 100644 index 6057a36f..00000000 --- a/.github/scripts/format-all-go-code.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -DIR="$1" - -cd "$DIR" - -export PATH="$(go env GOPATH)/bin:$PATH" -for FILE in $(find . -name '*.go'); do - if [ "YES" == "$(bash ./.github/scripts/is_autogenerated_file.sh "$FILE")" ]; then - echo "Skip autogenerated file: $FILE" >&2 - continue - fi - - if [[ "$FILE" == *"allocator_go1.18.go"* ]]; then - echo "Skip allocator_go1.18.go rule: $FILE" >&2 - continue - fi - - bash ./.github/scripts/format-go-code.sh "$FILE" -done diff --git a/.github/scripts/format-go-code.sh b/.github/scripts/format-go-code.sh deleted file mode 100644 index b1ed4cf9..00000000 --- a/.github/scripts/format-go-code.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -FILEPATH="$1" - -gofmt -s -w "$FILEPATH" - -# https://github.com/rinchsan/gosimports -gosimports -local github.com/ydb-platform/ydb-kubernetes-operator -w "$FILEPATH" - -# https://github.com/mvdan/gofumpt -gofumpt -w "$FILEPATH" diff --git a/.github/scripts/is_autogenerated_file.sh b/.github/scripts/is_autogenerated_file.sh deleted file mode 100644 index 04a5d4b1..00000000 --- a/.github/scripts/is_autogenerated_file.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -FILEPATH="$1" - -grep -q "Code generated by gtrace. DO NOT EDIT." "$FILEPATH" && echo YES && exit 0 -grep -q "Code generated by MockGen. DO NOT EDIT." "$FILEPATH" && echo YES && exit 0 -grep -q "Code generated by controller-gen. DO NOT EDIT." "$FILEPATH" && echo YES && exit 0 - -echo NO -exit 0 diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml deleted file mode 100644 index 7dfb9dec..00000000 --- a/.github/workflows/check-pr.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: check-pr -on: - pull_request_target: - branches: - - 'master' - paths-ignore: - - 'docs/**' - types: - - 'opened' - - 'synchronize' - - 'reopened' - - 'labeled' -jobs: - check-running-allowed: - runs-on: ubuntu-latest - outputs: - result: ${{ steps.check-ownership-membership.outputs.result }} - steps: - - id: check-ownership-membership - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - script: | - // This is used primarily in forks. Repository owner - // should be allowed to run anything. - const userLogin = context.payload.pull_request.user.login; - - // How to interpret membership status code: - // https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user - const isOrgMember = async function () { - try { - const response = await github.rest.orgs.checkMembershipForUser({ - org: context.payload.organization.login, - username: userLogin, - }); - return response.status == 204; - } catch (error) { - if (error.status && error.status == 404) { - return false; - } - throw error; - } - } - - if (context.payload.repository.owner.login == userLogin) { - return true; - } - - if (await isOrgMember()) { - return true; - } - - const labels = context.payload.pull_request.labels; - const okToTestLabel = labels.find( - label => label.name == 'ok-to-test' - ); - return okToTestLabel !== undefined; - - name: comment-if-waiting-on-ok - if: steps.check-ownership-membership.outputs.result == 'false' && - github.event.action == 'opened' - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hi! Thank you for contributing!\nThe tests on this PR will run after a maintainer adds an `ok-to-test` label to this PR manually. Thank you for your patience!' - }); - - name: cleanup-test-label - uses: actions/github-script@v6 - with: - script: | - const { owner, repo } = context.repo; - const prNumber = context.payload.pull_request.number; - const labelToRemove = 'ok-to-test'; - try { - const result = await github.rest.issues.removeLabel({ - owner, - repo, - issue_number: prNumber, - name: labelToRemove - }); - } catch(e) { - // ignore the 404 error that arises - // when the label did not exist for the - // organization member - console.log(e); - } - run-tests: - needs: - - check-running-allowed - if: needs.check-running-allowed.outputs.result == 'true' - uses: ./.github/workflows/run-tests.yml - secrets: inherit diff --git a/.github/workflows/compatibility-tests.yaml b/.github/workflows/compatibility-tests.yaml new file mode 100644 index 00000000..931c0bcd --- /dev/null +++ b/.github/workflows/compatibility-tests.yaml @@ -0,0 +1,124 @@ +name: compatibility-tests + +on: + workflow_dispatch: + repository_dispatch: + types: [compatibility-tests] + +jobs: + test-compatibility: + runs-on: ubuntu-latest + steps: + - name: Maximize build space + uses: AdityaGarg8/remove-unwanted-software@v4.1 + with: + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + remove-dotnet: 'true' + remove-swapfile: 'true' + + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # we need to know about previous tags + + - name: print the latest version without "v" + id: latest-no-v + uses: miniscruff/changie-action@v2 + with: + version: latest + args: latest --remove-prefix + + - name: determine-versions + run: | + NEW_VERSION=${{ steps.latest-no-v.outputs.output }} + + # Extract the major and minor parts of the version + MAJOR=$(echo $NEW_VERSION | cut -d. -f1) + MINOR=$(echo $NEW_VERSION | cut -d. -f2) + PREV_MINOR=$((MINOR - 1)) + + # Find the previous version tag in the format ".." + PREVIOUS_VERSION=$(git tag -l "${MAJOR}.${PREV_MINOR}.*" | sort --version-sort | tail -1) + + # If no previous version is found, fallback to a default or handle the error somehow + if [ -z "$PREVIOUS_VERSION" ]; then + echo "No previous version found, ensure your repository has proper tags." + exit 1 + fi + + echo "Current version is $NEW_VERSION" + echo "Will be tested for compatibility from $PREVIOUS_VERSION" + + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.22' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential + + curl -LO https://dl.k8s.io/release/v1.25.3/bin/linux/amd64/kubectl + chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin + + HELM_VERSION="v3.10.3" + curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxvf - --strip-components=1 linux-amd64/helm + chmod +x ./helm && sudo mv ./helm /usr/local/bin + + go install sigs.k8s.io/kind@v0.25.0 + + curl -sSL https://storage.yandexcloud.net/yandexcloud-ydb/install.sh | bash + + echo "$(pwd)" >> $GITHUB_PATH + echo "$HOME/ydb/bin" >> $GITHUB_PATH + echo "$HOME/go/bin" >> $GITHUB_PATH + + - name: Check dependencies + run: | + gcc --version + go version + kind version + kubectl version --client=true + helm version + ydb version + + - name: Setup k8s cluster + run: | + kind create cluster \ + --image=kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e \ + --config=./tests/cfg/kind-cluster-config.yaml + + kubectl wait --timeout=5m --for=condition=ready node -l worker=true + + - name: Run compatibility tests + env: + NEW_VERSION: ${{ env.NEW_VERSION }} + PREVIOUS_VERSION: ${{ env.PREVIOUS_VERSION }} + run: | + go install gotest.tools/gotestsum@v1.12.0 + gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./tests/compatibility/... -ginkgo.vv -coverprofile cover.out + + - name: convert-to-human-readable + run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true + + - name: artifact-upload-step + uses: actions/upload-artifact@v4 + id: artifact-upload-step + if: always() + with: + name: compat-tests-log + path: log.txt + if-no-files-found: error + + - name: echo-tests-log-url + run: echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' + + - name: Teardown k8s cluster + run: | + kind delete cluster diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 00000000..2848731b --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -0,0 +1,64 @@ +name: create-release-pr + +on: + workflow_dispatch: + inputs: + bump_type: + description: 'Which version to bump when creating a release PR: minor or patch?' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + +jobs: + create-release-pr: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: batch-changes + uses: miniscruff/changie-action@v2 + with: + version: latest + args: batch ${{ github.event.inputs.bump_type }} + + - name: merge-changes + uses: miniscruff/changie-action@v2 + with: + version: latest + args: merge + + - name: print the latest version + id: latest + uses: miniscruff/changie-action@v2 + with: + version: latest + args: latest + + - name: print the latest version without "v" + id: latest-no-v + uses: miniscruff/changie-action@v2 + with: + version: latest + args: latest --remove-prefix + + - name: bump-chart-version + run: | + VERSION=${{ steps.latest-no-v.outputs.output }} + sed -i "s/^appVersion:.*/appVersion: \"$VERSION\"/" ./deploy/ydb-operator/Chart.yaml + sed -i "s/^version:.*/version: \"$VERSION\"/" ./deploy/ydb-operator/Chart.yaml + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + title: Release ${{ steps.latest.outputs.output }} + branch: release/${{ steps.latest.outputs.output }} + commit-message: Release ${{ steps.latest.outputs.output }} + body: | + Here is what a new entry in changelog would look like: + + [`.changes/${{ steps.latest.outputs.output }}.md`](https://github.com/${{ github.repository }}/blob/release/${{ steps.latest.outputs.output }}/.changes/${{ steps.latest.outputs.output }}.md) + token: ${{ github.token }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d51af620..36fbacfa 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,118 +1,93 @@ -# Implicit requirements -# runner must have `docker` and `curl` installed (true on github-runners) - name: run-tests on: - workflow_call: + - pull_request + - workflow_dispatch jobs: - start-runner: - runs-on: ubuntu-latest - outputs: - runner-label: ${{ steps.start-yc-runner.outputs.label }} - instance-id: ${{ steps.start-yc-runner.outputs.instance-id }} - steps: - - name: start-yc-runner - id: start-yc-runner - uses: yc-actions/yc-github-runner@v1 - with: - mode: start - yc-sa-json-credentials: ${{ secrets.CI_RUNNER_CREATOR_KEY }} - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - folder-id: b1gmgbhccra2qca8v5g6 - image-id: fd80o2eikcn22b229tsa - cores: 16 - disk-type: network-ssd-nonreplicated - disk-size: 465GB - memory: 32GB - core-fraction: 100 - subnet-id: e9bu12i8ocv6q8kl83ru - user: yc-admin - ssh-public-key: ${{ secrets.CI_RUNNER_DEBUG_SHH_PUBLIC_KEY }} - smart-checkout: - needs: - - start-runner - runs-on: ${{ needs.start-runner.outputs.runner-label }} - steps: - - name: checkout-when-fork-source - uses: actions/checkout@v3 - if: github.event.pull_request.head.sha != '' - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: checkout-when-this-repo-source - uses: actions/checkout@v3 - if: github.event.pull_request.head.sha == '' lint: concurrency: - group: lint-golangci-${{ github.ref }} + group: lint-golangci-${{ github.head_ref || github.ref_name }} cancel-in-progress: true - needs: - - start-runner - - smart-checkout - runs-on: ${{ needs.start-runner.outputs.runner-label }} + runs-on: ubuntu-latest steps: - - name: setup-go - uses: actions/setup-go@v3 - with: - go-version: 1.19 - - name: set-env-vars - run: | - echo "HOME=/actions-runner" >> $GITHUB_ENV + - name: checkout + uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v6 with: - version: v1.48.0 - code-format-check: + version: v1.61.0 + run-unit-tests: concurrency: - group: lint-autoformat-${{ github.ref }} + group: run-unit-tests-${{ github.head_ref || github.ref_name }} cancel-in-progress: true - needs: - - start-runner - - smart-checkout - runs-on: ${{ needs.start-runner.outputs.runner-label }} + runs-on: ubuntu-latest steps: + - name: checkout + uses: actions/checkout@v3 - name: setup-go uses: actions/setup-go@v3 with: - go-version: 1.19 - - name: set-env-vars + go-version: '1.20' + - name: setup-medium-test-class-binaries + run: | + # This installs kube-apiserver and etcd binaries for `medium` + # class tests. Refer to the writing tests docs for more info. + make envtest + KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path) + echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV + - name: setup-gotestsum run: | - echo "HOME=/actions-runner" >> $GITHUB_ENV - - name: Install utilities + go install gotest.tools/gotestsum@v1.12.0 + - name: run-unit-tests + id: run-unit-tests run: | - go install mvdan.cc/gofumpt@v0.3.1 - go install github.com/rinchsan/gosimports/cmd/gosimports@v0.1.5 - - name: format all files with auto-formatter - run: bash ./.github/scripts/format-all-go-code.sh "$PWD" - - name: Check repository diff - run: bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken" - run-tests: + gotestsum --format pkgname --jsonfile log.json -- -v -timeout 900s -p 1 ./internal/... -ginkgo.vv -coverprofile cover.out + - name: convert-to-human-readable + run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true + - name: artifact-upload-step + uses: actions/upload-artifact@v4 + id: artifact-upload-step + if: always() + with: + name: unit-tests-log + path: log.txt + if-no-files-found: error + - name: echo-tests-log-url + run: echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' + run-e2e-tests: + concurrency: + group: run-e2e-tests-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true needs: - - start-runner - - smart-checkout - runs-on: ${{ needs.start-runner.outputs.runner-label }} - outputs: - result: ${{ steps.run-tests.outputs.result }} + - run-unit-tests + runs-on: ubuntu-latest steps: + - name: maximize-build-space + uses: AdityaGarg8/remove-unwanted-software@v4.1 + with: + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + remove-dotnet: 'true' + remove-swapfile: 'true' + - name: checkout + uses: actions/checkout@v3 - name: setup-go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: install-dependencies run: | sudo apt-get update sudo apt-get install -y build-essential - export HOME=/actions-runner - echo "HOME=/actions-runner" >> $GITHUB_ENV + go install sigs.k8s.io/kind@v0.25.0 - go install sigs.k8s.io/kind@v0.17.0 - - curl -LO https://dl.k8s.io/release/v1.25.0/bin/linux/amd64/kubectl + curl -LO https://dl.k8s.io/release/v1.25.3/bin/linux/amd64/kubectl chmod +x ./kubectl - HELM_PKG="helm-v3.10.3-linux-amd64.tar.gz" + HELM_PKG="helm-v3.13.3-linux-amd64.tar.gz" curl -LO https://get.helm.sh/"${HELM_PKG}" tar -zxvf "${HELM_PKG}" mv ./linux-amd64/helm . @@ -122,30 +97,20 @@ jobs: echo "$(pwd)" >> $GITHUB_PATH echo "$HOME/ydb/bin" >> $GITHUB_PATH echo "$HOME/go/bin" >> $GITHUB_PATH - - name: configure-system - run: | - sudo sysctl fs.inotify.max_user_instances=1280 - sudo sysctl fs.inotify.max_user_watches=655360 - name: check-dependencies run: | gcc --version go version kind version - kubectl version --short --client=true + kubectl version --client=true helm version - - name: setup-medium-test-class-binaries - run: | - # This installs kube-apiserver and etcd binaries for `medium` - # class tests. Refer to the writing tests docs for more info. - make envtest - KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path) - echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV - name: setup-k8s-cluster run: | kind delete cluster kind create cluster \ - --image=kindest/node:v1.25.3@sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5 \ - --config=./e2e/kind-cluster-config.yaml + --image=kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e \ + --config=./tests/cfg/kind-cluster-config.yaml + kubectl wait --timeout=5m --for=condition=ready node -l worker=true - name: build-operator-image uses: docker/build-push-action@v3 @@ -157,35 +122,41 @@ jobs: tags: kind/ydb-operator:current - name: load-and-deploy-operator run: | - kind load docker-image kind/ydb-operator:current - - name: pull-and-load-other-images + kind load docker-image kind/ydb-operator:current --nodes kind-worker,kind-worker2,kind-worker3 + - name: pull-and-load-kube-webhook-certgen-image + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + retry_wait_seconds: 20 + max_attempts: 3 + command: | + docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 + kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --nodes kind-worker,kind-worker2,kind-worker3 + - name: pull-and-load-ydb-image run: | - docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 - kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 - - # TODO would be cool to parse YDB image from manifests to avoid duplicating information - docker pull cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 - kind load docker-image cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 - - name: run-tests + YDB_IMAGE=$(grep "anchor_for_fetching_image_from_workflow" ./tests/**/*.go | grep -o -E '"cr\.yandex.*"') + YDB_IMAGE=${YDB_IMAGE:1:-1} # strip "" + docker pull $YDB_IMAGE + kind load docker-image $YDB_IMAGE --nodes kind-worker,kind-worker2,kind-worker3 + - name: setup-gotestsum run: | - go test -v -timeout 1800s -p 1 ./... -args -ginkgo.v + go install gotest.tools/gotestsum@v1.12.0 + - name: run-e2e-tests + id: run-e2e-tests + run: | + gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./tests/e2e/... -ginkgo.vv + - name: convert-json-log-to-human-readable + run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true + - name: artifact-upload-step + uses: actions/upload-artifact@v4 + id: artifact-upload-step + if: always() + with: + name: e2e-tests-log + path: log.txt + if-no-files-found: error + - name: echo-tests-log-url + run: echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' - name: teardown-k8s-cluster run: | kind delete cluster - stop-runner: - needs: - - start-runner - - run-tests - - lint - - code-format-check - runs-on: ubuntu-latest - if: always() - steps: - - name: stop-yc-runner - uses: yc-actions/yc-github-runner@v1 - with: - mode: stop - yc-sa-json-credentials: ${{ secrets.CI_RUNNER_CREATOR_KEY }} - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - label: ${{ needs.start-runner.outputs.runner-label }} - instance-id: ${{ needs.start-runner.outputs.instance-id }} diff --git a/.github/workflows/upload-artifacts.yml b/.github/workflows/upload-artifacts.yml index e636e988..40da712e 100644 --- a/.github/workflows/upload-artifacts.yml +++ b/.github/workflows/upload-artifacts.yml @@ -1,32 +1,34 @@ -# Implicit requirements -# runner must have `docker` and `curl` installed (true on github-runners) - name: upload-artifacts + on: push: branches: - master + paths: + - 'CHANGELOG.md' + workflow_dispatch: + +permissions: + contents: write + jobs: - tag-job: + tag-and-release: runs-on: ubuntu-latest - outputs: - tagcreated: ${{steps.tag-step.outputs.tagcreated}} steps: - - uses: actions/checkout@v3 - - id: tag-step - uses: butlerlogic/action-autotag@1.1.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + + - name: parse-version-from-chart + run: | + VERSION=$(cat ./deploy/ydb-operator/Chart.yaml | sed -n 's/^version: //p' | tr -d '\"') + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: create-tag + uses: mathieudutour/github-tag-action@v6.2 with: - strategy: regex - root: "./deploy/ydb-operator/Chart.yaml" - regex_pattern: 'version:[\s]*(["]?[0-9\.]{3,}["]?)' - upload-artifacts: - runs-on: ubuntu-latest - needs: tag-job - if: ${{ needs.tag-job.outputs.tagcreated == 'yes' }} - steps: - - uses: actions/checkout@v3 + tag_prefix: "" + custom_tag: ${{ env.VERSION }} + github_token: ${{ github.token }} + - name: install-dependencies run: | HELM_PKG="helm-v3.10.3-linux-amd64.tar.gz" @@ -37,7 +39,7 @@ jobs: - name: install-aws-cli uses: unfor19/install-aws-cli-action@v1 with: - version: 2 + version: "2.22.35" - name: initialize-aws-cli run: | aws configure set aws_access_key_id ${{ secrets.CI_PUBLIC_HELM_S3_KEY_IDENTIFIER }} @@ -59,10 +61,6 @@ jobs: yc config --profile private-docker-helm-public-docker set service-account-key sa-key.json env: SA_KEYS_FOR_PRIVATE_DOCKER_HELM_AND_PUBLIC_DOCKER: ${{ secrets.SA_KEYS_FOR_PRIVATE_DOCKER_HELM_AND_PUBLIC_DOCKER }} - - name: parse-version-from-chart - run: | - VERSION=$(cat ./deploy/ydb-operator/Chart.yaml | sed -n 's/^version: //p') - echo "VERSION=$VERSION" >> $GITHUB_ENV - name: login-to-registries run: | cat sa-key.json | docker login --username json_key --password-stdin cr.yandex @@ -72,12 +70,15 @@ jobs: # Public: docker build -t cr.yandex/crpl7ipeu79oseqhcgn2/ydb-operator:"$VERSION" . docker push cr.yandex/crpl7ipeu79oseqhcgn2/ydb-operator:"$VERSION" + # Private: # no rebuild will happen, docker will fetch from cache and just retag: docker build -t cr.yandex/crpsjg1coh47p81vh2lc/ydb-kubernetes-operator:"$VERSION" . docker push cr.yandex/crpsjg1coh47p81vh2lc/ydb-kubernetes-operator:"$VERSION" - name: package-and-push-helm-chart run: | + make manifests + helm package ./deploy/ydb-operator # Push into internal oci-based registry @@ -99,3 +100,39 @@ jobs: aws s3 --endpoint-url=https://storage.yandexcloud.net \ cp ./charts/index.yaml s3://charts.ydb.tech/index.yaml + + - name: login-to-dockerhub + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + username: ydbplatform + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: retag-and-push-operator-image-to-dockerhub + run: | + docker build -t ydbplatform/ydb-kubernetes-operator:"$VERSION" . + docker push ydbplatform/ydb-kubernetes-operator:"$VERSION" + + - name: append-artifacts-info-to-release-notes + run: | + echo "" >> .changes/v$VERSION.md + + echo "### Docker images" >> .changes/v$VERSION.md + echo "New docker images are available from:" >> .changes/v$VERSION.md + echo "- ydbplatform/ydb-kubernetes-operator:$VERSION" >> .changes/v$VERSION.md + echo "- cr.yandex/yc/ydb-kubernetes-operator:$VERSION" >> .changes/v$VERSION.md + echo "" >> .changes/v$VERSION.md + + echo "### Helm charts" >> .changes/v$VERSION.md + echo "New helm chart 'ydb-operator', version $VERSION is available from https://charts.ydb.tech" >> .changes/v$VERSION.md + + - name: create-github-release + uses: softprops/action-gh-release@v1 + with: + body_path: .changes/v${{ env.VERSION }}.md + tag_name: ${{ env.VERSION }} + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: dispatch-compatibility-tests + uses: peter-evans/repository-dispatch@v3 + with: + event-type: compatibility-tests diff --git a/.gitignore b/.gitignore index ae53d4ce..8d25f855 100644 --- a/.gitignore +++ b/.gitignore @@ -5,34 +5,17 @@ *.dylib *.test *.out -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf -.idea/**/contentModel.xml -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml -.idea/**/gradle.xml -.idea/**/libraries -cmake-build-*/ -.idea/**/mongoSettings.xml *.iws out/ +.idea/* .idea_modules/ atlassian-ide-plugin.xml -.idea/replstate.xml com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties -.idea/httpRequests -.idea/caches/build_file_checksums.ser +log.json +log.txt bin/ config/ diff --git a/.golangci.yml b/.golangci.yml index c605df0f..38c43fd7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,7 @@ run: concurrency: 4 # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 5m + timeout: 5m # exit code when at least one issue was found, default is 1 issues-exit-code: 1 @@ -35,17 +35,25 @@ run: # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" - format: colored-line-number + formats: + - format: colored-line-number - # print lines of code with issue, default is true print-issued-lines: true - # print linter name in the end of issue text, default is true print-linter-name: true # all available settings of specific linters linters-settings: + stylecheck: + dot-import-whitelist: + # used in tests only + - "github.com/onsi/ginkgo/v2" + # used in tests only + - "github.com/onsi/gomega" + # it's nice having string constants in a separate package, but without boilerplate + - "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" + errcheck: # report about not checking of errors in types assetions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. @@ -54,13 +62,6 @@ linters-settings: # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; # default is false: such cases aren't reported by default. check-blank: false - govet: - # report about shadowed variables - check-shadowing: true - fieldalignment: true - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true @@ -76,9 +77,8 @@ linters-settings: gosec: excludes: - G101 - fieldalignment: - # print struct with more effective memory layout or not, false by default - suggest-new: true + - G115 + - G601 # no longer actual since 1.22 misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. @@ -109,17 +109,7 @@ linters-settings: - name: empty-block - name: superfluous-else - name: unreachable-code - unused: - # treat code as a program (not a library) and report unused exported identifiers; default is false. - # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find funcs usages. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false unparam: - # call graph construction algorithm (cha, rta). In general, use cha for libraries, - # and rta for programs with main packages. Default is cha. - algo: cha - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations @@ -130,66 +120,35 @@ linters: disable-all: true enable: # - cyclop - - deadcode - - depguard + # - depguardgolang - dogsled -# - dupl - errcheck - errorlint -# - exhaustive -# - exhaustivestruct -# - forbidigo -# - funlen -# - gci -# - gocognit - goconst - gocritic - gocyclo -# - godot -# - godox # tmp disable due to FIXME & XXX - gofmt # On why gofmt when goimports is enabled - https://github.com/golang/go/issues/21476 - gofumpt - goheader - goimports -# - gomnd -# - gomoddirectives -# - gomodguard - gosec - gosimple - govet - - depguard -# - ifshort -# - ireturn -# - lll # disable due to kubebuilder comments - makezero - misspell - ineffassign - misspell - nakedret - nestif -# - nilnil -# - nlreturn -# - nolintlint -# - prealloc - predeclared - rowserrcheck - - revive - staticcheck - stylecheck - - structcheck -# - tagliatelle -# - testpackage -# - thelper -# - tenv - typecheck - unconvert - unparam - unused -# - varnamelen - - varcheck - whitespace -# - wrapcheck -# - wsl issues: # List of regexps of issue texts to exclude, empty list by default. @@ -214,9 +173,6 @@ issues: # Default value for this option is true. exclude-use-default: true - # Maximum issues count per one linter. Set to 0 to disable. Default is 50. - max-per-linter: 0 - # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. max-same-issues: 0 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..b27a5f44 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,46 @@ +# Changelog + + +## v0.6.2 - 2025-02-24 +### Fixed +* bug: regression with pod name in grpc-public-host arg + +## v0.6.1 - 2025-02-12 +### Fixed +* fix passing interconnet TLS volume in blobstorage-init job + +## v0.6.0 - 2025-01-29 +### Added +* starting with this release, deploying to dockerhub (ydbplatform/ydb-kubernetes-operator) +* added the ability to create metadata announce for customize dns domain (default: cluster.local) +* new field additionalPodLabels for Storage and Database CRD +* new method buildPodTemplateLabels to append additionalPodLabels for statefulset builders +* compatibility tests running automatically on each new tag +* customize Database and Storage container securityContext +* field externalPort for grpc service to override --grpc-public-port arg +* annotations overrides default secret name and key for arg --auth-token-file +* field ObservedGeneration inside .status.conditions +### Changed +* up CONTROLLER_GEN_VERSION to 0.16.5 and ENVTEST_VERSION to release-0.17 +* refactor package labels to separate methods buildLabels, buildSelectorLabels and buildeNodeSetLabels for each resource +* propagate labels ydb.tech/database-nodeset, ydb.tech/storage-nodeset and ydb.tech/remote-cluster with method makeCommonLabels between resource recasting +### Fixed +* e2e tests and unit tests flapped because of the race between storage finalizers and uninstalling operator helm chart +* regenerate CRDs in upload-artifacts workflow (as opposed to manually) +* additional kind worker to maintain affinity rules for blobstorage init job +* update the Makefile with the changes in GitHub CI +* bug: missing error handler for arg --auth-token-file +* fix field resourceVersion inside .status.remoteResources.conditions +* panic when create object with .spec.pause is true +* Passing additional secret volumes to blobstorage-init. The init container can now use them without issues. +### Security +* bump golang-jwt to v4.5.1 (by dependabot) +* bump golang.org/x/net from 0.23.0 to 0.33.0 (by dependabot) + +## v0.5.32 - 2024-11-05 +### Fixed +* Chart.yaml version is bumped up automatically when a new release PR is created + +## v0.5.31 - 2024-11-04 +### Added +* Initialized a changelog diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a89a89ec..891a3437 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,37 +1,21 @@ # Notice to external contributors -## How do I start? +## Common -We try to maintain a small but helpful selection of information on how ydb-k8s-operator is developed and released, -as well as some details of its architecture. Please, have a look at the [docs folder](./docs/), its README functions -as a table of content. +YDB is a free and open project and we appreciate to receive contributions from our community. -## A note on legal terms +## Contributing code changes -Hello! In order for us to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**”). The current version of the CLA you may find here https://yandex.ru/legal/cla/?lang=en +If you would like to contribute a new feature or a bug fix, please discuss your idea first on the GitHub issue. +If there is no issue for your idea, please open one. It may be that somebody is already working on it, +or that there are some complex obstacles that you should know about before starting the implementation. +Usually there are several ways to fix a problem and it is important to find the right approach before spending time on a PR +that cannot be merged. -By adopting the CLA, you state the following: +## Provide a contribution -* You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA, -* You has read the terms and conditions of the CLA and agree with them in full, -* You are legally able to provide and license your contributions as stated, -* We may use your contributions for our open source projects and for any other our project too, -* We rely on your assurances concerning the rights of third parties in relation to your contributions. - -If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you has already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA. - -## How to agree to CLA - -If you are willing to adopt terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it: - -``` -I hereby agree to the terms of the CLA available at: [link]. -``` - -Replace the bracketed text as follows: -* [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en. - -It is enough to provide us such notification once. +To make a contribution you should submit a pull request. There will probably be discussion about the pull request and, +if any changes are needed, we would love to work with you to get your pull request merged. ## Other questions diff --git a/Dockerfile b/Dockerfile index 20e1bc32..a10dbef1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19 as builder +FROM golang:1.20 as builder WORKDIR /workspace COPY go.mod go.mod diff --git a/Makefile b/Makefile index 8cc9915f..a3266722 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,10 @@ VERSION ?= 0.1.0 # Image URL to use all building/pushing image targets IMG ?= cr.yandex/yc/ydb-operator:latest -# Produce CRDs that work back to Kubernetes 1.11 (no version conversion) -CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false" # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.21 +ENVTEST_K8S_VERSION = 1.26 +# Image URL which uses in tests +YDB_IMAGE ?= $(shell grep "anchor_for_fetching_image_from_workflow" ./tests/**/*.go | grep -o -E '"cr\.yandex.*"' | tr -d '"') # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -46,11 +46,13 @@ help: ## Display this help. ##@ Development manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases + $(CONTROLLER_GEN) crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases cp config/crd/bases/ydb.tech_storages.yaml deploy/ydb-operator/crds/storage.yaml cp config/crd/bases/ydb.tech_databases.yaml deploy/ydb-operator/crds/database.yaml cp config/crd/bases/ydb.tech_storagenodesets.yaml deploy/ydb-operator/crds/storagenodeset.yaml cp config/crd/bases/ydb.tech_databasenodesets.yaml deploy/ydb-operator/crds/databasenodeset.yaml + cp config/crd/bases/ydb.tech_remotestoragenodesets.yaml deploy/ydb-operator/crds/remotestoragenodeset.yaml + cp config/crd/bases/ydb.tech_remotedatabasenodesets.yaml deploy/ydb-operator/crds/remotedatabasenodeset.yaml cp config/crd/bases/ydb.tech_databasemonitorings.yaml deploy/ydb-operator/crds/databasemonitoring.yaml cp config/crd/bases/ydb.tech_storagemonitorings.yaml deploy/ydb-operator/crds/storagemonitoring.yaml @@ -65,19 +67,33 @@ vet: ## Run go vet against code. kind-init: if kind get clusters | grep "kind-ydb-operator"; then exit 0; fi; \ - kind create cluster --config e2e/kind-cluster-config.yaml --name kind-ydb-operator; \ - docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0; \ - kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --name kind-ydb-operator; \ - docker pull cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44; \ - kind load docker-image cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 --name kind-ydb-operator + kind create cluster \ + --config tests/cfg/kind-cluster-config.yaml \ + --image=kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e \ + --name kind-ydb-operator + docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 + kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --name kind-ydb-operator + kubectl cluster-info --context kind-kind-ydb-operator # yes, kind prefixes all context with one more 'kind-' + docker pull ${YDB_IMAGE} + kind load docker-image ${YDB_IMAGE} --name kind-ydb-operator kind-load: - docker tag cr.yandex/yc/ydb-operator:latest kind/ydb-operator:current + docker tag ${IMG} kind/ydb-operator:current kind load docker-image kind/ydb-operator:current --name kind-ydb-operator +opts ?= '' + +.PHONY: unit-test +unit-test: manifests generate fmt vet envtest ## Run unit tests + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use --arch=amd64 $(ENVTEST_K8S_VERSION) -p path)" \ + go test -v -timeout 900s -p 1 ./internal/... -ginkgo.vv -coverprofile cover.out $(opts) + +.PHONY: e2e-test +e2e-test: manifests generate fmt vet docker-build kind-init kind-load ## Run e2e tests + go test -v -timeout 3600s -p 1 ./tests/e2e/... -ginkgo.vv $(opts) + .PHONY: test -test: manifests generate fmt vet docker-build kind-init kind-load envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -timeout 1800s -p 1 ./... -ginkgo.v -coverprofile cover.out +test: unit-test e2e-test ## Run all tests .PHONY: clean clean: @@ -95,12 +111,17 @@ docker-push: ## Push docker image with the manager. docker push ${IMG} CONTROLLER_GEN = $(shell pwd)/bin/controller-gen +CONTROLLER_GEN_VERSION ?= v0.16.5 controller-gen: ## Download controller-gen locally if necessary. - $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION)) +# ENVTEST_VERSION is usually latest, but might need to be pinned from time to time. +# Version pinning is needed due to version incompatibility between controller-runtime and setup-envtest. +# For more information: https://github.com/kubernetes-sigs/controller-runtime/issues/2744 ENVTEST = $(shell pwd)/bin/setup-envtest +ENVTEST_VERSION ?= release-0.17 envtest: ## Download envtest-setup locally if necessary. - $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest) + $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION)) # go-get-tool will 'go install' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/README.md b/README.md index 6cf94a4c..1323b427 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![check-pr](https://github.com/ydb-platform/ydb-kubernetes-operator/actions/workflows/check-pr.yml/badge.svg)](https://github.com/ydb-platform/ydb-kubernetes-operator/actions/workflows/check-pr.yml) [![upload-artifacts](https://github.com/ydb-platform/ydb-kubernetes-operator/actions/workflows/upload-artifacts.yml/badge.svg)](https://github.com/ydb-platform/ydb-kubernetes-operator/actions/workflows/upload-artifacts.yml) +[![compatibility-tests](https://github.com/ydb-platform/ydb-kubernetes-operator/actions/workflows/compatibility-tests.yaml/badge.svg)](https://github.com/ydb-platform/ydb-kubernetes-operator/actions/workflows/compatibility-tests.yaml) # YDB Kubernetes Operator diff --git a/api/v1alpha1/common_types.go b/api/v1alpha1/common_types.go index 4e39a214..6ce115ee 100644 --- a/api/v1alpha1/common_types.go +++ b/api/v1alpha1/common_types.go @@ -1,6 +1,11 @@ package v1alpha1 -import corev1 "k8s.io/api/core/v1" +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" +) // NamespacedRef TODO: replace StorageRef type NamespacedRef struct { @@ -34,3 +39,18 @@ type PodImage struct { // +optional PullSecret *string `json:"pullSecret,omitempty"` } + +type RemoteSpec struct { + // Remote cluster to deploy NodeSet into + // +required + Cluster string `json:"cluster"` +} + +type RemoteResource struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + State constants.RemoteResourceState `json:"state"` + Conditions []metav1.Condition `json:"conditions,omitempty"` +} diff --git a/api/v1alpha1/configuration.go b/api/v1alpha1/configuration.go index e5d65454..cd21274f 100644 --- a/api/v1alpha1/configuration.go +++ b/api/v1alpha1/configuration.go @@ -1,9 +1,9 @@ package v1alpha1 import ( - "crypto/sha256" + "bytes" + "errors" "fmt" - "path" "strconv" "gopkg.in/yaml.v3" @@ -11,20 +11,7 @@ import ( "github.com/ydb-platform/ydb-kubernetes-operator/internal/configuration/schema" ) -const ( - DatabaseEncryptionKeyPath = "/opt/ydb/secrets/database_encryption" - DatabaseEncryptionKeyFile = "key" - DatastreamsIAMServiceAccountKeyPath = "/opt/ydb/secrets/datastreams" - DatastreamsIAMServiceAccountKeyFile = "sa_key.json" -) - -func hash(text string) string { - h := sha256.New() - h.Write([]byte(text)) - return fmt.Sprintf("%x", h.Sum(nil)) -} - -func generateSomeDefaults(cr *Storage, crDB *Database) schema.Configuration { +func generateHosts(cr *Storage) []schema.Host { var hosts []schema.Host for i := 0; i < int(cr.Spec.Nodes); i++ { @@ -57,39 +44,10 @@ func generateSomeDefaults(cr *Storage, crDB *Database) schema.Configuration { } } - var keyConfig *schema.KeyConfig - if crDB != nil && crDB.Spec.Encryption != nil && crDB.Spec.Encryption.Enabled { - keyConfig = &schema.KeyConfig{ - Keys: []schema.Key{ - { - ContainerPath: path.Join(DatabaseEncryptionKeyPath, DatabaseEncryptionKeyFile), - ID: hash(cr.Name), - Pin: crDB.Spec.Encryption.Pin, - Version: 1, - }, - }, - } - } - - return schema.Configuration{ - Hosts: hosts, - KeyConfig: keyConfig, - } -} - -func tryFillMissingSections( - resultConfig map[string]interface{}, - generatedConfig schema.Configuration, -) { - if resultConfig["hosts"] == nil { - resultConfig["hosts"] = generatedConfig.Hosts - } - if generatedConfig.KeyConfig != nil { - resultConfig["key_config"] = generatedConfig.KeyConfig - } + return hosts } -func buildConfiguration(cr *Storage, crDB *Database) (string, error) { +func BuildConfiguration(cr *Storage, crDB *Database) ([]byte, error) { config := make(map[string]interface{}) // If any kind of configuration exists on Database object, then @@ -103,18 +61,89 @@ func buildConfiguration(cr *Storage, crDB *Database) (string, error) { rawYamlConfiguration = cr.Spec.Configuration } - err := yaml.Unmarshal([]byte(rawYamlConfiguration), &config) + success, dynConfig, err := ParseDynConfig(rawYamlConfiguration) + if success { + if err != nil { + return nil, fmt.Errorf("failed to parse dynconfig, error: %w", err) + } + if dynConfig.Config["hosts"] == nil { + hosts := generateHosts(cr) + dynConfig.Config["hosts"] = hosts + } + + return yaml.Marshal(dynConfig) + } + + err = yaml.Unmarshal([]byte(rawYamlConfiguration), &config) + if err != nil { + return nil, fmt.Errorf("failed to serialize YAML config, error: %w", err) + } + + if config["hosts"] == nil { + hosts := generateHosts(cr) + config["hosts"] = hosts + } + + return yaml.Marshal(config) +} + +func ParseConfiguration(rawYamlConfiguration string) (schema.Configuration, error) { + dec := yaml.NewDecoder(bytes.NewReader([]byte(rawYamlConfiguration))) + dec.KnownFields(false) + + var configuration schema.Configuration + err := dec.Decode(&configuration) if err != nil { - return "", err + return schema.Configuration{}, nil } - generatedConfig := generateSomeDefaults(cr, crDB) - tryFillMissingSections(config, generatedConfig) + return configuration, nil +} + +func ParseDynConfig(rawYamlConfiguration string) (bool, schema.DynConfig, error) { + dec := yaml.NewDecoder(bytes.NewReader([]byte(rawYamlConfiguration))) + dec.KnownFields(true) - data, err := yaml.Marshal(config) + var dynConfig schema.DynConfig + err := dec.Decode(&dynConfig) if err != nil { - return "", err + return false, schema.DynConfig{}, fmt.Errorf("error unmarshal yaml to dynconfig: %w", err) + } + + err = validateDynConfig(dynConfig) + if err != nil { + return true, dynConfig, fmt.Errorf("error validate dynconfig: %w", err) + } + + return true, dynConfig, err +} + +func validateDynConfig(dynConfig schema.DynConfig) error { + if _, exist := dynConfig.Config["yaml_config_enabled"]; !exist { + return errors.New("failed to find mandatory `yaml_config_enabled` field inside config") + } + + if _, exist := dynConfig.Config["static_erasure"]; !exist { + return errors.New("failed to find mandatory `static_erasure` field inside config") + } + + if _, exist := dynConfig.Config["host_configs"]; !exist { + return errors.New("failed to find mandatory `host_configs` field inside config") } - return string(data), nil + if _, exist := dynConfig.Config["blob_storage_config"]; !exist { + return errors.New("failed to find mandatory `blob_storage_config` field inside config") + } + + return nil +} + +func GetConfigForCMS(dynConfig schema.DynConfig) ([]byte, error) { + delete(dynConfig.Config, "static_erasure") + delete(dynConfig.Config, "host_configs") + delete(dynConfig.Config, "nameservice_config") + delete(dynConfig.Config, "blob_storage_config") + delete(dynConfig.Config, "hosts") + + return yaml.Marshal(dynConfig) } diff --git a/api/v1alpha1/connection_types.go b/api/v1alpha1/connection_types.go index 05e67156..3d66cb1c 100644 --- a/api/v1alpha1/connection_types.go +++ b/api/v1alpha1/connection_types.go @@ -5,8 +5,9 @@ import ( ) type ConnectionOptions struct { - AccessToken *AccessTokenAuth `json:"accessToken,omitempty"` - StaticCredentials *StaticCredentialsAuth `json:"staticCredentials,omitempty"` + AccessToken *AccessTokenAuth `json:"accessToken,omitempty"` + StaticCredentials *StaticCredentialsAuth `json:"staticCredentials,omitempty"` + Oauth2TokenExchange *Oauth2TokenExchange `json:"oauth2TokenExchange,omitempty"` } type AccessTokenAuth struct { @@ -18,6 +19,24 @@ type StaticCredentialsAuth struct { Password *CredentialSource `json:"password,omitempty"` } +type Oauth2TokenExchange struct { + Endpoint string `json:"endpoint"` + PrivateKey *CredentialSource `json:"privateKey"` + JWTHeader `json:",inline"` + JWTClaims `json:",inline"` +} + +type JWTHeader struct { + KeyID *string `json:"keyID"` + SignAlg string `json:"signAlg,omitempty"` +} +type JWTClaims struct { + Issuer string `json:"issuer,omitempty"` + Subject string `json:"subject,omitempty"` + Audience string `json:"audience,omitempty"` + ID string `json:"id,omitempty"` +} + type CredentialSource struct { SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef"` } diff --git a/api/v1alpha1/const.go b/api/v1alpha1/const.go index a17c6c75..0fe9e0ec 100644 --- a/api/v1alpha1/const.go +++ b/api/v1alpha1/const.go @@ -6,15 +6,18 @@ const ( ImagePathFormat = "%s:%s" + DefaultDomainName = "cluster.local" + DNSDomainAnnotation = "dns.domain" + GRPCPort = 2135 GRPCServicePortName = "grpc" GRPCProto = "grpc://" GRPCSProto = "grpcs://" - GRPCServiceFQDNFormat = "%s-grpc.%s.svc.cluster.local" + GRPCServiceFQDNFormat = "%s-grpc.%s.svc.%s" InterconnectPort = 19001 InterconnectServicePortName = "interconnect" - InterconnectServiceFQDNFormat = "%s-interconnect.%s.svc.cluster.local" + InterconnectServiceFQDNFormat = "%s-interconnect.%s.svc.%s" StatusPort = 8765 StatusServicePortName = "status" @@ -25,7 +28,14 @@ const ( DiskPathPrefix = "/dev/kikimr_ssd" DiskNumberMaxDigits = 2 DiskFilePath = "/data" - YdbAuthToken = "ydb-auth-token-file" + + AuthTokenSecretName = "ydb-auth-token-file" + AuthTokenSecretKey = "ydb-auth-token-file" + AuthTokenFileArg = "--auth-token-file" + + DatabaseEncryptionKeySecretDir = "database_encryption" + DatabaseEncryptionKeySecretFile = "key" + DatabaseEncryptionKeyConfigFile = "key.txt" ConfigDir = "/opt/ydb/cfg" ConfigFileName = "config.yaml" @@ -33,16 +43,32 @@ const ( BinariesDir = "/opt/ydb/bin" DaemonBinaryName = "ydbd" - DefaultRootUsername = "root" - DefaultRootPassword = "" + AdditionalSecretsDir = "/opt/ydb/secrets" + AdditionalVolumesDir = "/opt/ydb/volumes" + + DefaultRootUsername = "root" + DefaultRootPassword = "" + DefaultDatabaseDomain = "Root" + DefaultDatabaseEncryptionPin = "EmptyPin" + DefaultSignAlgorithm = "RS256" + + LabelDeploymentKey = "deployment" + LabelDeploymentValueKubernetes = "kubernetes" + LabelSharedDatabaseKey = "shared" + LabelSharedDatabaseValueTrue = "true" + LabelSharedDatabaseValueFalse = "false" AnnotationUpdateStrategyOnDelete = "ydb.tech/update-strategy-on-delete" AnnotationUpdateDNSPolicy = "ydb.tech/update-dns-policy" AnnotationSkipInitialization = "ydb.tech/skip-initialization" AnnotationDisableLivenessProbe = "ydb.tech/disable-liveness-probe" AnnotationDataCenter = "ydb.tech/data-center" + AnnotationGRPCPublicHost = "ydb.tech/grpc-public-host" + AnnotationGRPCPublicPort = "ydb.tech/grpc-public-port" AnnotationNodeHost = "ydb.tech/node-host" AnnotationNodeDomain = "ydb.tech/node-domain" + AnnotationAuthTokenSecretName = "ydb.tech/auth-token-secret-name" + AnnotationAuthTokenSecretKey = "ydb.tech/auth-token-secret-key" AnnotationValueTrue = "true" diff --git a/api/v1alpha1/database_types.go b/api/v1alpha1/database_types.go index 3097af48..a9f59db6 100644 --- a/api/v1alpha1/database_types.go +++ b/api/v1alpha1/database_types.go @@ -165,9 +165,15 @@ type DatabaseNodeSpec struct { // +optional AdditionalLabels map[string]string `json:"additionalLabels,omitempty"` + // (Optional) Additional custom resource labels that are added to Pods + // +optional + AdditionalPodLabels map[string]string `json:"additionalPodLabels,omitempty"` + // (Optional) Additional custom resource annotations that are added to all resources // +optional AdditionalAnnotations map[string]string `json:"additionalAnnotations,omitempty"` + + SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"` } type DatabaseResources struct { @@ -249,9 +255,6 @@ type EncryptionConfig struct { type DatastreamsConfig struct { // +required Enabled bool `json:"enabled"` - - // +required - IAMServiceAccountKey *corev1.SecretKeySelector `json:"iam_service_account_key,omitempty"` } type DatabaseServices struct { @@ -264,3 +267,10 @@ type DatabaseServices struct { func init() { SchemeBuilder.Register(&Database{}, &DatabaseList{}) } + +func (r *Database) AnyCertificatesAdded() bool { + return len(r.Spec.CABundle) > 0 || + r.Spec.Service.GRPC.TLSConfiguration.Enabled || + r.Spec.Service.Interconnect.TLSConfiguration.Enabled || + r.Spec.Service.Status.TLSConfiguration.Enabled +} diff --git a/api/v1alpha1/database_webhook.go b/api/v1alpha1/database_webhook.go index db284e1d..bf716115 100644 --- a/api/v1alpha1/database_webhook.go +++ b/api/v1alpha1/database_webhook.go @@ -17,10 +17,6 @@ import ( . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck ) -const ( - DefaultDatabaseDomain = "Root" -) - // log is for logging in this package. var databaselog = logf.Log.WithName("database-resource") @@ -58,6 +54,10 @@ func (r *DatabaseDefaulter) Default(ctx context.Context, obj runtime.Object) err database := obj.(*Database) databaselog.Info("default", "name", database.Name) + if !database.Spec.OperatorSync { + return nil + } + if database.Spec.StorageClusterRef.Namespace == "" { database.Spec.StorageClusterRef.Namespace = database.Namespace } @@ -68,7 +68,11 @@ func (r *DatabaseDefaulter) Default(ctx context.Context, obj runtime.Object) err } } - if database.Spec.Image == nil && database.Spec.Image.Name == "" { + if database.Spec.Image == nil { + database.Spec.Image = &PodImage{} + } + + if database.Spec.Image.Name == "" { if database.Spec.YDBVersion == "" { database.Spec.Image.Name = fmt.Sprintf(ImagePathFormat, RegistryPath, DefaultTag) } else { @@ -102,6 +106,10 @@ func (r *DatabaseDefaulter) Default(ctx context.Context, obj runtime.Object) err database.Spec.Service.Datastreams.TLSConfiguration = &TLSConfiguration{Enabled: false} } + if database.Spec.Service.Status.TLSConfiguration == nil { + database.Spec.Service.Status.TLSConfiguration = &TLSConfiguration{Enabled: false} + } + if database.Spec.Domain == "" { database.Spec.Domain = DefaultDatabaseDomain } @@ -114,6 +122,13 @@ func (r *DatabaseDefaulter) Default(ctx context.Context, obj runtime.Object) err database.Spec.Encryption = &EncryptionConfig{Enabled: false} } + if database.Spec.Encryption.Enabled && database.Spec.Encryption.Key == nil { + if database.Spec.Encryption.Pin == nil || len(*database.Spec.Encryption.Pin) == 0 { + encryptionPin := DefaultDatabaseEncryptionPin + database.Spec.Encryption.Pin = &encryptionPin + } + } + if database.Spec.Datastreams == nil { database.Spec.Datastreams = &DatastreamsConfig{Enabled: false} } @@ -137,11 +152,13 @@ func (r *DatabaseDefaulter) Default(ctx context.Context, obj runtime.Object) err database.Spec.StorageEndpoint = storage.GetStorageEndpointWithProto() } - configuration, err := buildConfiguration(storage, database) - if err != nil { - return err + if database.Spec.Configuration != "" { + configuration, err := BuildConfiguration(storage, database) + if err != nil { + return err + } + database.Spec.Configuration = string(configuration) } - database.Spec.Configuration = configuration return nil } diff --git a/api/v1alpha1/databasenodeset_types.go b/api/v1alpha1/databasenodeset_types.go index d86fd9af..fa3ed356 100644 --- a/api/v1alpha1/databasenodeset_types.go +++ b/api/v1alpha1/databasenodeset_types.go @@ -19,9 +19,8 @@ type DatabaseNodeSetSpec struct { // DatabaseNodeSetStatus defines the observed state type DatabaseNodeSetStatus struct { - State constants.ClusterState `json:"state"` - Conditions []metav1.Condition `json:"conditions,omitempty"` - ObservedDatabaseGeneration int64 `json:"observedDatabaseGeneration,omitempty"` + State constants.ClusterState `json:"state"` + Conditions []metav1.Condition `json:"conditions,omitempty"` } // DatabaseNodeSetSpecInline describes an group nodes object inside parent object @@ -30,9 +29,17 @@ type DatabaseNodeSetSpecInline struct { // +required Name string `json:"name,omitempty"` - // (Optional) Object should be reference to remote object + // Labels for DatabaseNodeSet object // +optional - Remote bool `json:"remote,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + + // Annotations for DatabaseNodeSet object + // +optional + Annotations map[string]string `json:"annotations,omitempty"` + + // (Optional) Object should be reference to RemoteDatabaseNodeSet object + // +optional + Remote *RemoteSpec `json:"remote,omitempty"` DatabaseNodeSpec `json:",inline"` } @@ -66,3 +73,18 @@ type DatabaseNodeSetList struct { func init() { SchemeBuilder.Register(&DatabaseNodeSet{}, &DatabaseNodeSetList{}) } + +func RecastDatabaseNodeSet(databaseNodeSet *DatabaseNodeSet) *Database { + return &Database{ + ObjectMeta: metav1.ObjectMeta{ + Name: databaseNodeSet.Spec.DatabaseRef.Name, + Namespace: databaseNodeSet.Spec.DatabaseRef.Namespace, + Labels: databaseNodeSet.Labels, + Annotations: databaseNodeSet.Annotations, + }, + Spec: DatabaseSpec{ + DatabaseClusterSpec: databaseNodeSet.Spec.DatabaseClusterSpec, + DatabaseNodeSpec: databaseNodeSet.Spec.DatabaseNodeSpec, + }, + } +} diff --git a/api/v1alpha1/remotedatabasenodeset_types.go b/api/v1alpha1/remotedatabasenodeset_types.go new file mode 100644 index 00000000..a6ee9e34 --- /dev/null +++ b/api/v1alpha1/remotedatabasenodeset_types.go @@ -0,0 +1,44 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" +) + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state",description="The status of this RemoteDatabaseNodeSet" +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// RemoteDatabaseNodeSet declares NodeSet spec and status for objects in remote cluster +type RemoteDatabaseNodeSet struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + // +optional + Spec DatabaseNodeSetSpec `json:"spec,omitempty"` + // +optional + // +kubebuilder:default:={state: "Pending"} + Status RemoteDatabaseNodeSetStatus `json:"status,omitempty"` +} + +// DatabaseNodeSetStatus defines the observed state +type RemoteDatabaseNodeSetStatus struct { + State constants.ClusterState `json:"state"` + Conditions []metav1.Condition `json:"conditions,omitempty"` + RemoteResources []RemoteResource `json:"remoteResources,omitempty"` +} + +//+kubebuilder:object:root=true + +// RemoteDatabaseNodeSetList contains a list of RemoteDatabaseNodeSet +type RemoteDatabaseNodeSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RemoteDatabaseNodeSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&RemoteDatabaseNodeSet{}, &RemoteDatabaseNodeSetList{}) +} diff --git a/api/v1alpha1/remotestoragenodeset_types.go b/api/v1alpha1/remotestoragenodeset_types.go new file mode 100644 index 00000000..2728bf24 --- /dev/null +++ b/api/v1alpha1/remotestoragenodeset_types.go @@ -0,0 +1,44 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" +) + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.state",description="The status of this RemoteStorageNodeSet" +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// RemoteStorageNodeSet declares NodeSet spec and status for objects in remote cluster +type RemoteStorageNodeSet struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + // +optional + Spec StorageNodeSetSpec `json:"spec,omitempty"` + // +optional + // +kubebuilder:default:={state: "Pending"} + Status RemoteStorageNodeSetStatus `json:"status,omitempty"` +} + +// StorageNodeSetStatus defines the observed state +type RemoteStorageNodeSetStatus struct { + State constants.ClusterState `json:"state"` + Conditions []metav1.Condition `json:"conditions,omitempty"` + RemoteResources []RemoteResource `json:"remoteResources,omitempty"` +} + +//+kubebuilder:object:root=true + +// RemoteStorageNodeSetList contains a list of RemoteStorageNodeSet +type RemoteStorageNodeSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RemoteStorageNodeSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&RemoteStorageNodeSet{}, &RemoteStorageNodeSetList{}) +} diff --git a/api/v1alpha1/service_types.go b/api/v1alpha1/service_types.go index e7c0aca9..8c540c74 100644 --- a/api/v1alpha1/service_types.go +++ b/api/v1alpha1/service_types.go @@ -21,7 +21,9 @@ type GRPCService struct { Service `json:""` TLSConfiguration *TLSConfiguration `json:"tls,omitempty"` - ExternalHost string `json:"externalHost,omitempty"` // TODO implementation + ExternalHost string `json:"externalHost,omitempty"` + ExternalPort int32 `json:"externalPort,omitempty"` + IPDiscovery *IPDiscovery `json:"ipDiscovery,omitempty"` } type InterconnectService struct { @@ -32,6 +34,8 @@ type InterconnectService struct { type StatusService struct { Service `json:""` + + TLSConfiguration *TLSConfiguration `json:"tls,omitempty"` } type DatastreamsService struct { @@ -39,3 +43,9 @@ type DatastreamsService struct { TLSConfiguration *TLSConfiguration `json:"tls,omitempty"` } + +type IPDiscovery struct { + Enabled bool `json:"enabled"` + TargetNameOverride string `json:"targetNameOverride,omitempty"` + IPFamily corev1.IPFamily `json:"ipFamily,omitempty"` +} diff --git a/api/v1alpha1/storage_types.go b/api/v1alpha1/storage_types.go index a909338b..967440db 100644 --- a/api/v1alpha1/storage_types.go +++ b/api/v1alpha1/storage_types.go @@ -13,6 +13,16 @@ type StorageSpec struct { StorageNodeSpec `json:",inline"` + // (Optional) Operator connection settings + // Default: (not specified) + // +optional + OperatorConnection *ConnectionOptions `json:"operatorConnection,omitempty"` + + // (Optional) Init blobstorage Job settings + // Default: (not specified) + // +optional + InitJob *StorageInitJobSpec `json:"initJob,omitempty"` + // (Optional) NodeSet inline configuration to split into multiple StatefulSets // Default: (not specified) // +optional @@ -28,11 +38,6 @@ type StorageClusterSpec struct { // +optional Domain string `json:"domain"` - // (Optional) Operator connection settings - // Default: (not specified) - // +optional - OperatorConnection *ConnectionOptions `json:"operatorConnection,omitempty"` - // Data storage topology mode // For details, see https://ydb.tech/docs/en/cluster/topology // FIXME mirror-3-dc is only supported with external configuration @@ -157,6 +162,42 @@ type StorageNodeSpec struct { // +optional AdditionalLabels map[string]string `json:"additionalLabels,omitempty"` + // (Optional) Additional custom resource labels that are added to Pods + // +optional + AdditionalPodLabels map[string]string `json:"additionalPodLabels,omitempty"` + + // (Optional) Additional custom resource annotations that are added to all resources + // +optional + AdditionalAnnotations map[string]string `json:"additionalAnnotations,omitempty"` + + SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"` +} + +type StorageInitJobSpec struct { + // (Optional) Container resource limits. Any container limits + // can be specified. + // Default: (not specified) + // +optional + Resources *corev1.ResourceRequirements `json:"resources,omitempty"` + + // (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + // Selector which must match a node's labels for the pod to be scheduled on that node. + // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + + // (Optional) If specified, the pod's scheduling constraints + // +optional + Affinity *corev1.Affinity `json:"affinity,omitempty"` + + // (Optional) If specified, the pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + + // (Optional) Additional custom resource labels that are added to all resources + // +optional + AdditionalLabels map[string]string `json:"additionalLabels,omitempty"` + // (Optional) Additional custom resource annotations that are added to all resources // +optional AdditionalAnnotations map[string]string `json:"additionalAnnotations,omitempty"` @@ -203,3 +244,10 @@ type StorageServices struct { func init() { SchemeBuilder.Register(&Storage{}, &StorageList{}) } + +func (r *Storage) AnyCertificatesAdded() bool { + return len(r.Spec.CABundle) > 0 || + r.Spec.Service.GRPC.TLSConfiguration.Enabled || + r.Spec.Service.Interconnect.TLSConfiguration.Enabled || + r.Spec.Service.Status.TLSConfiguration.Enabled +} diff --git a/api/v1alpha1/storage_webhook.go b/api/v1alpha1/storage_webhook.go index ef71c5a0..d6be5085 100644 --- a/api/v1alpha1/storage_webhook.go +++ b/api/v1alpha1/storage_webhook.go @@ -3,11 +3,13 @@ package v1alpha1 import ( "context" "fmt" + "math/rand" + "github.com/golang-jwt/jwt/v4" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "gopkg.in/yaml.v3" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/strings/slices" ctrl "sigs.k8s.io/controller-runtime" @@ -15,6 +17,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/configuration/schema" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck ) @@ -29,16 +32,33 @@ func (r *Storage) SetupWebhookWithManager(mgr ctrl.Manager) error { } func (r *Storage) GetStorageEndpointWithProto() string { + return fmt.Sprintf("%s%s", r.GetStorageProto(), r.GetStorageEndpoint()) +} + +func (r *Storage) GetStorageProto() string { proto := GRPCProto if r.IsStorageEndpointSecure() { proto = GRPCSProto } - return fmt.Sprintf("%s%s", proto, r.GetStorageEndpoint()) + return proto } func (r *Storage) GetStorageEndpoint() string { - host := fmt.Sprintf(GRPCServiceFQDNFormat, r.Name, r.Namespace) + endpoint := r.GetGRPCServiceEndpoint() + if r.IsRemoteNodeSetsOnly() { + endpoint = r.GetHostFromConfigEndpoint() + } + + return endpoint +} + +func (r *Storage) GetGRPCServiceEndpoint() string { + domain := DefaultDomainName + if dnsAnnotation, ok := r.GetAnnotations()[DNSDomainAnnotation]; ok { + domain = dnsAnnotation + } + host := fmt.Sprintf(GRPCServiceFQDNFormat, r.Name, r.Namespace, domain) if r.Spec.Service.GRPC.ExternalHost != "" { host = r.Spec.Service.GRPC.ExternalHost } @@ -46,6 +66,22 @@ func (r *Storage) GetStorageEndpoint() string { return fmt.Sprintf("%s:%d", host, GRPCPort) } +func (r *Storage) GetHostFromConfigEndpoint() string { + var rawYamlConfiguration string + // skip handle error because we already checked in webhook + success, dynConfig, _ := ParseDynConfig(r.Spec.Configuration) + if success { + config, _ := yaml.Marshal(dynConfig.Config) + rawYamlConfiguration = string(config) + } else { + rawYamlConfiguration = r.Spec.Configuration + } + + configuration, _ := ParseConfiguration(rawYamlConfiguration) + randNum := rand.Intn(len(configuration.Hosts)) // #nosec G404 + return fmt.Sprintf("%s:%d", configuration.Hosts[randNum].Host, GRPCPort) +} + func (r *Storage) IsStorageEndpointSecure() bool { if r.Spec.Service.GRPC.TLSConfiguration != nil { return r.Spec.Service.GRPC.TLSConfiguration.Enabled @@ -53,13 +89,18 @@ func (r *Storage) IsStorageEndpointSecure() bool { return false } -// +k8s:deepcopy-gen=false -type PartialYamlConfig struct { - DomainsConfig struct { - SecurityConfig struct { - EnforceUserTokenRequirement bool `yaml:"enforce_user_token_requirement"` - } `yaml:"security_config"` - } `yaml:"domains_config"` +func (r *Storage) IsRemoteNodeSetsOnly() bool { + if len(r.Spec.NodeSets) == 0 { + return false + } + + for _, nodeSet := range r.Spec.NodeSets { + if nodeSet.Remote == nil { + return false + } + } + + return true } // StorageDefaulter mutates Storages @@ -75,7 +116,23 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro storage := obj.(*Storage) storagelog.Info("default", "name", storage.Name) - if storage.Spec.Image == nil || storage.Spec.Image.Name == "" { + if !storage.Spec.OperatorSync { + return nil + } + + if storage.Spec.OperatorConnection != nil { + if storage.Spec.OperatorConnection.Oauth2TokenExchange != nil { + if storage.Spec.OperatorConnection.Oauth2TokenExchange.SignAlg == "" { + storage.Spec.OperatorConnection.Oauth2TokenExchange.SignAlg = DefaultSignAlgorithm + } + } + } + + if storage.Spec.Image == nil { + storage.Spec.Image = &PodImage{} + } + + if storage.Spec.Image.Name == "" { if storage.Spec.YDBVersion == "" { storage.Spec.Image.Name = fmt.Sprintf(ImagePathFormat, RegistryPath, DefaultTag) } else { @@ -84,12 +141,12 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro } if storage.Spec.Image.PullPolicyName == nil { - policy := v1.PullIfNotPresent + policy := corev1.PullIfNotPresent storage.Spec.Image.PullPolicyName = &policy } if storage.Spec.Resources == nil { - storage.Spec.Resources = &v1.ResourceRequirements{} + storage.Spec.Resources = &corev1.ResourceRequirements{} } if storage.Spec.Service == nil { @@ -108,6 +165,10 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro storage.Spec.Service.Interconnect.TLSConfiguration = &TLSConfiguration{Enabled: false} } + if storage.Spec.Service.Status.TLSConfiguration == nil { + storage.Spec.Service.Status.TLSConfiguration = &TLSConfiguration{Enabled: false} + } + if storage.Spec.Monitoring == nil { storage.Spec.Monitoring = &MonitoringOptions{ Enabled: false, @@ -118,11 +179,11 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro storage.Spec.Domain = DefaultDatabaseDomain } - configuration, err := buildConfiguration(storage, nil) + configuration, err := BuildConfiguration(storage, nil) if err != nil { return err } - storage.Spec.Configuration = configuration + storage.Spec.Configuration = string(configuration) return nil } @@ -131,48 +192,78 @@ func (r *StorageDefaulter) Default(ctx context.Context, obj runtime.Object) erro var _ webhook.Validator = &Storage{} +func isSignAlgorithmSupported(alg string) bool { + supportedAlgs := jwt.GetAlgorithms() + + for _, supportedAlg := range supportedAlgs { + if alg == supportedAlg { + return true + } + } + return false +} + // ValidateCreate implements webhook.Validator so a webhook will be registered for the type func (r *Storage) ValidateCreate() error { storagelog.Info("validate create", "name", r.Name) - configuration := make(map[string]interface{}) - err := yaml.Unmarshal([]byte(r.Spec.Configuration), &configuration) + var rawYamlConfiguration string + success, dynConfig, err := ParseDynConfig(r.Spec.Configuration) + if success { + if err != nil { + return fmt.Errorf("failed to parse dynconfig, error: %w", err) + } + config, err := yaml.Marshal(dynConfig.Config) + if err != nil { + return fmt.Errorf("failed to serialize YAML config, error: %w", err) + } + rawYamlConfiguration = string(config) + } else { + rawYamlConfiguration = r.Spec.Configuration + } + + var configuration schema.Configuration + configuration, err = ParseConfiguration(rawYamlConfiguration) if err != nil { - return fmt.Errorf("failed to parse Storage.spec.configuration, error: %w", err) + return fmt.Errorf("failed to parse configuration, error: %w", err) } + var nodesNumber int32 - if configuration["hosts"] == nil { + if len(configuration.Hosts) == 0 { nodesNumber = r.Spec.Nodes } else { - hosts, ok := configuration["hosts"].([]interface{}) - if !ok { - return fmt.Errorf("failed to parse Storage.spec.configuration, error: invalid hosts section") - } - nodesNumber = int32(len(hosts)) + nodesNumber = int32(len(configuration.Hosts)) } - yamlConfig := PartialYamlConfig{} - err = yaml.Unmarshal([]byte(r.Spec.Configuration), &yamlConfig) - if err != nil { - return fmt.Errorf("failed to parse YAML to determine `enforce_user_token_requirement`") + minNodesPerErasure := map[ErasureType]int32{ + ErasureMirror3DC: 3, + ErasureBlock42: 8, + None: 1, + } + + if nodesNumber < minNodesPerErasure[r.Spec.Erasure] { + return fmt.Errorf("erasure type %v requires at least %v storage nodes", r.Spec.Erasure, minNodesPerErasure[r.Spec.Erasure]) } var authEnabled bool - if yamlConfig.DomainsConfig.SecurityConfig.EnforceUserTokenRequirement { - authEnabled = true + if configuration.DomainsConfig.SecurityConfig != nil { + if configuration.DomainsConfig.SecurityConfig.EnforceUserTokenRequirement != nil { + authEnabled = *configuration.DomainsConfig.SecurityConfig.EnforceUserTokenRequirement + } } - if (authEnabled && r.Spec.OperatorConnection == nil) || (!authEnabled && r.Spec.OperatorConnection != nil) { + if authEnabled && r.Spec.OperatorConnection == nil { return fmt.Errorf("field 'spec.operatorConnection' does not satisfy with config option `enforce_user_token_requirement: %t`", authEnabled) } - minNodesPerErasure := map[ErasureType]int32{ - ErasureMirror3DC: 9, - ErasureBlock42: 8, - None: 1, - } - if nodesNumber < minNodesPerErasure[r.Spec.Erasure] { - return fmt.Errorf("erasure type %v requires at least %v storage nodes", r.Spec.Erasure, minNodesPerErasure[r.Spec.Erasure]) + if r.Spec.OperatorConnection != nil && r.Spec.OperatorConnection.Oauth2TokenExchange != nil { + auth := r.Spec.OperatorConnection.Oauth2TokenExchange + if auth.KeyID == nil { + return fmt.Errorf("field keyID is required for OAuth2TokenExchange type") + } + if !isSignAlgorithmSupported(auth.SignAlg) { + return fmt.Errorf("signAlg %s does not supported for OAuth2TokenExchange type", auth.SignAlg) + } } if r.Spec.NodeSets != nil { @@ -230,10 +321,63 @@ func hasUpdatesBesidesFrozen(oldStorage, newStorage *Storage) (bool, string) { func (r *Storage) ValidateUpdate(old runtime.Object) error { storagelog.Info("validate update", "name", r.Name) - configuration := make(map[string]interface{}) - err := yaml.Unmarshal([]byte(r.Spec.Configuration), &configuration) + var rawYamlConfiguration string + success, dynConfig, err := ParseDynConfig(r.Spec.Configuration) + if success { + if err != nil { + return fmt.Errorf("failed to parse dynconfig, error: %w", err) + } + config, err := yaml.Marshal(dynConfig.Config) + if err != nil { + return fmt.Errorf("failed to serialize YAML config, error: %w", err) + } + rawYamlConfiguration = string(config) + } else { + rawYamlConfiguration = r.Spec.Configuration + } + + var configuration schema.Configuration + configuration, err = ParseConfiguration(rawYamlConfiguration) if err != nil { - return fmt.Errorf("failed to parse Storage.spec.configuration, error: %w", err) + return fmt.Errorf("failed to parse configuration, error: %w", err) + } + + var nodesNumber int32 + if len(configuration.Hosts) == 0 { + nodesNumber = r.Spec.Nodes + } else { + nodesNumber = int32(len(configuration.Hosts)) + } + + minNodesPerErasure := map[ErasureType]int32{ + ErasureMirror3DC: 3, + ErasureBlock42: 8, + None: 1, + } + + if nodesNumber < minNodesPerErasure[r.Spec.Erasure] { + return fmt.Errorf("erasure type %v requires at least %v storage nodes", r.Spec.Erasure, minNodesPerErasure[r.Spec.Erasure]) + } + + var authEnabled bool + if configuration.DomainsConfig.SecurityConfig != nil { + if configuration.DomainsConfig.SecurityConfig.EnforceUserTokenRequirement != nil { + authEnabled = *configuration.DomainsConfig.SecurityConfig.EnforceUserTokenRequirement + } + } + + if authEnabled && r.Spec.OperatorConnection == nil { + return fmt.Errorf("field 'spec.operatorConnection' does not align with config option `enforce_user_token_requirement: %t`", authEnabled) + } + + if r.Spec.OperatorConnection != nil && r.Spec.OperatorConnection.Oauth2TokenExchange != nil { + auth := r.Spec.OperatorConnection.Oauth2TokenExchange + if auth.KeyID == nil { + return fmt.Errorf("field keyID is required for OAuth2TokenExchange type") + } + if !isSignAlgorithmSupported(auth.SignAlg) { + return fmt.Errorf("signAlg %s does not supported for OAuth2TokenExchange type", auth.SignAlg) + } } if !r.Spec.OperatorSync { @@ -254,21 +398,6 @@ func (r *Storage) ValidateUpdate(old runtime.Object) error { } } - yamlConfig := PartialYamlConfig{} - err = yaml.Unmarshal([]byte(r.Spec.Configuration), &yamlConfig) - if err != nil { - return fmt.Errorf("failed to parse YAML to determine `enforce_user_token_requirement`") - } - - var authEnabled bool - if yamlConfig.DomainsConfig.SecurityConfig.EnforceUserTokenRequirement { - authEnabled = true - } - - if (authEnabled && r.Spec.OperatorConnection == nil) || (!authEnabled && r.Spec.OperatorConnection != nil) { - return fmt.Errorf("field 'spec.operatorConnection' does not align with config option `enforce_user_token_requirement: %t`", authEnabled) - } - if r.Spec.NodeSets != nil { var nodesInSetsCount int32 for _, nodeSetInline := range r.Spec.NodeSets { diff --git a/api/v1alpha1/storagenodeset_types.go b/api/v1alpha1/storagenodeset_types.go index 9f2e7d13..868dff40 100644 --- a/api/v1alpha1/storagenodeset_types.go +++ b/api/v1alpha1/storagenodeset_types.go @@ -19,20 +19,27 @@ type StorageNodeSetSpec struct { // StorageNodeSetStatus defines the observed state type StorageNodeSetStatus struct { - State constants.ClusterState `json:"state"` - Conditions []metav1.Condition `json:"conditions,omitempty"` - ObservedStorageGeneration int64 `json:"observedStorageGeneration,omitempty"` + State constants.ClusterState `json:"state"` + Conditions []metav1.Condition `json:"conditions,omitempty"` } // StorageNodeSetSpecInline describes an group nodes object inside parent object type StorageNodeSetSpecInline struct { - // Name of child *NodeSet object + // Name of StorageNodeSet object // +required Name string `json:"name"` - // (Optional) Object should be reference to remote object + // Labels for StorageNodeSet object // +optional - Remote bool `json:"remote,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + + // Annotations for StorageNodeSet object + // +optional + Annotations map[string]string `json:"annotations,omitempty"` + + // (Optional) Object should be reference to RemoteStorageNodeSet object + // +optional + Remote *RemoteSpec `json:"remote,omitempty"` StorageNodeSpec `json:",inline"` } @@ -66,3 +73,18 @@ type StorageNodeSetList struct { func init() { SchemeBuilder.Register(&StorageNodeSet{}, &StorageNodeSetList{}) } + +func RecastStorageNodeSet(storageNodeSet *StorageNodeSet) *Storage { + return &Storage{ + ObjectMeta: metav1.ObjectMeta{ + Name: storageNodeSet.Spec.StorageRef.Name, + Namespace: storageNodeSet.Spec.StorageRef.Namespace, + Labels: storageNodeSet.Labels, + Annotations: storageNodeSet.Annotations, + }, + Spec: StorageSpec{ + StorageClusterSpec: storageNodeSet.Spec.StorageClusterSpec, + StorageNodeSpec: storageNodeSet.Spec.StorageNodeSpec, + }, + } +} diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 680db768..57d7e4f8 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated // Code generated by controller-gen. DO NOT EDIT. @@ -45,6 +44,11 @@ func (in *ConnectionOptions) DeepCopyInto(out *ConnectionOptions) { *out = new(StaticCredentialsAuth) (*in).DeepCopyInto(*out) } + if in.Oauth2TokenExchange != nil { + in, out := &in.Oauth2TokenExchange, &out.Oauth2TokenExchange + *out = new(Oauth2TokenExchange) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectionOptions. @@ -138,7 +142,7 @@ func (in *DatabaseClusterSpec) DeepCopyInto(out *DatabaseClusterSpec) { if in.Datastreams != nil { in, out := &in.Datastreams, &out.Datastreams *out = new(DatastreamsConfig) - (*in).DeepCopyInto(*out) + **out = **in } if in.Monitoring != nil { in, out := &in.Monitoring, &out.Monitoring @@ -395,6 +399,25 @@ func (in *DatabaseNodeSetSpec) DeepCopy() *DatabaseNodeSetSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DatabaseNodeSetSpecInline) DeepCopyInto(out *DatabaseNodeSetSpecInline) { *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Remote != nil { + in, out := &in.Remote, &out.Remote + *out = new(RemoteSpec) + **out = **in + } in.DatabaseNodeSpec.DeepCopyInto(&out.DatabaseNodeSpec) } @@ -469,6 +492,11 @@ func (in *DatabaseNodeSpec) DeepCopyInto(out *DatabaseNodeSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.TerminationGracePeriodSeconds != nil { + in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds + *out = new(int64) + **out = **in + } if in.AdditionalLabels != nil { in, out := &in.AdditionalLabels, &out.AdditionalLabels *out = make(map[string]string, len(*in)) @@ -476,6 +504,13 @@ func (in *DatabaseNodeSpec) DeepCopyInto(out *DatabaseNodeSpec) { (*out)[key] = val } } + if in.AdditionalPodLabels != nil { + in, out := &in.AdditionalPodLabels, &out.AdditionalPodLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.AdditionalAnnotations != nil { in, out := &in.AdditionalAnnotations, &out.AdditionalAnnotations *out = make(map[string]string, len(*in)) @@ -483,10 +518,10 @@ func (in *DatabaseNodeSpec) DeepCopyInto(out *DatabaseNodeSpec) { (*out)[key] = val } } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + *out = new(v1.SecurityContext) + (*in).DeepCopyInto(*out) } } @@ -589,11 +624,6 @@ func (in *DatabaseStatus) DeepCopy() *DatabaseStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DatastreamsConfig) DeepCopyInto(out *DatastreamsConfig) { *out = *in - if in.IAMServiceAccountKey != nil { - in, out := &in.IAMServiceAccountKey, &out.IAMServiceAccountKey - *out = new(v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastreamsConfig. @@ -661,6 +691,11 @@ func (in *GRPCService) DeepCopyInto(out *GRPCService) { *out = new(TLSConfiguration) (*in).DeepCopyInto(*out) } + if in.IPDiscovery != nil { + in, out := &in.IPDiscovery, &out.IPDiscovery + *out = new(IPDiscovery) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GRPCService. @@ -673,6 +708,21 @@ func (in *GRPCService) DeepCopy() *GRPCService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPDiscovery) DeepCopyInto(out *IPDiscovery) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPDiscovery. +func (in *IPDiscovery) DeepCopy() *IPDiscovery { + if in == nil { + return nil + } + out := new(IPDiscovery) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InterconnectService) DeepCopyInto(out *InterconnectService) { *out = *in @@ -694,6 +744,41 @@ func (in *InterconnectService) DeepCopy() *InterconnectService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JWTClaims) DeepCopyInto(out *JWTClaims) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTClaims. +func (in *JWTClaims) DeepCopy() *JWTClaims { + if in == nil { + return nil + } + out := new(JWTClaims) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JWTHeader) DeepCopyInto(out *JWTHeader) { + *out = *in + if in.KeyID != nil { + in, out := &in.KeyID, &out.KeyID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTHeader. +func (in *JWTHeader) DeepCopy() *JWTHeader { + if in == nil { + return nil + } + out := new(JWTHeader) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MonitoringOptions) DeepCopyInto(out *MonitoringOptions) { *out = *in @@ -735,6 +820,28 @@ func (in *NamespacedRef) DeepCopy() *NamespacedRef { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Oauth2TokenExchange) DeepCopyInto(out *Oauth2TokenExchange) { + *out = *in + if in.PrivateKey != nil { + in, out := &in.PrivateKey, &out.PrivateKey + *out = new(CredentialSource) + (*in).DeepCopyInto(*out) + } + in.JWTHeader.DeepCopyInto(&out.JWTHeader) + out.JWTClaims = in.JWTClaims +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Oauth2TokenExchange. +func (in *Oauth2TokenExchange) DeepCopy() *Oauth2TokenExchange { + if in == nil { + return nil + } + out := new(Oauth2TokenExchange) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodImage) DeepCopyInto(out *PodImage) { *out = *in @@ -760,6 +867,219 @@ func (in *PodImage) DeepCopy() *PodImage { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteDatabaseNodeSet) DeepCopyInto(out *RemoteDatabaseNodeSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteDatabaseNodeSet. +func (in *RemoteDatabaseNodeSet) DeepCopy() *RemoteDatabaseNodeSet { + if in == nil { + return nil + } + out := new(RemoteDatabaseNodeSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RemoteDatabaseNodeSet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteDatabaseNodeSetList) DeepCopyInto(out *RemoteDatabaseNodeSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RemoteDatabaseNodeSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteDatabaseNodeSetList. +func (in *RemoteDatabaseNodeSetList) DeepCopy() *RemoteDatabaseNodeSetList { + if in == nil { + return nil + } + out := new(RemoteDatabaseNodeSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RemoteDatabaseNodeSetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteDatabaseNodeSetStatus) DeepCopyInto(out *RemoteDatabaseNodeSetStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RemoteResources != nil { + in, out := &in.RemoteResources, &out.RemoteResources + *out = make([]RemoteResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteDatabaseNodeSetStatus. +func (in *RemoteDatabaseNodeSetStatus) DeepCopy() *RemoteDatabaseNodeSetStatus { + if in == nil { + return nil + } + out := new(RemoteDatabaseNodeSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteResource) DeepCopyInto(out *RemoteResource) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteResource. +func (in *RemoteResource) DeepCopy() *RemoteResource { + if in == nil { + return nil + } + out := new(RemoteResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteSpec) DeepCopyInto(out *RemoteSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteSpec. +func (in *RemoteSpec) DeepCopy() *RemoteSpec { + if in == nil { + return nil + } + out := new(RemoteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteStorageNodeSet) DeepCopyInto(out *RemoteStorageNodeSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteStorageNodeSet. +func (in *RemoteStorageNodeSet) DeepCopy() *RemoteStorageNodeSet { + if in == nil { + return nil + } + out := new(RemoteStorageNodeSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RemoteStorageNodeSet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteStorageNodeSetList) DeepCopyInto(out *RemoteStorageNodeSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RemoteStorageNodeSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteStorageNodeSetList. +func (in *RemoteStorageNodeSetList) DeepCopy() *RemoteStorageNodeSetList { + if in == nil { + return nil + } + out := new(RemoteStorageNodeSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RemoteStorageNodeSetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteStorageNodeSetStatus) DeepCopyInto(out *RemoteStorageNodeSetStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RemoteResources != nil { + in, out := &in.RemoteResources, &out.RemoteResources + *out = make([]RemoteResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteStorageNodeSetStatus. +func (in *RemoteStorageNodeSetStatus) DeepCopy() *RemoteStorageNodeSetStatus { + if in == nil { + return nil + } + out := new(RemoteStorageNodeSetStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServerlessDatabaseResources) DeepCopyInto(out *ServerlessDatabaseResources) { *out = *in @@ -839,6 +1159,11 @@ func (in *StaticCredentialsAuth) DeepCopy() *StaticCredentialsAuth { func (in *StatusService) DeepCopyInto(out *StatusService) { *out = *in in.Service.DeepCopyInto(&out.Service) + if in.TLSConfiguration != nil { + in, out := &in.TLSConfiguration, &out.TLSConfiguration + *out = new(TLSConfiguration) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusService. @@ -881,11 +1206,6 @@ func (in *Storage) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StorageClusterSpec) DeepCopyInto(out *StorageClusterSpec) { *out = *in - if in.OperatorConnection != nil { - in, out := &in.OperatorConnection, &out.OperatorConnection - *out = new(ConnectionOptions) - (*in).DeepCopyInto(*out) - } if in.Image != nil { in, out := &in.Image, &out.Image *out = new(PodImage) @@ -942,6 +1262,59 @@ func (in *StorageClusterSpec) DeepCopy() *StorageClusterSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageInitJobSpec) DeepCopyInto(out *StorageInitJobSpec) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AdditionalLabels != nil { + in, out := &in.AdditionalLabels, &out.AdditionalLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.AdditionalAnnotations != nil { + in, out := &in.AdditionalAnnotations, &out.AdditionalAnnotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageInitJobSpec. +func (in *StorageInitJobSpec) DeepCopy() *StorageInitJobSpec { + if in == nil { + return nil + } + out := new(StorageInitJobSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StorageList) DeepCopyInto(out *StorageList) { *out = *in @@ -1158,6 +1531,25 @@ func (in *StorageNodeSetSpec) DeepCopy() *StorageNodeSetSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StorageNodeSetSpecInline) DeepCopyInto(out *StorageNodeSetSpecInline) { *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Remote != nil { + in, out := &in.Remote, &out.Remote + *out = new(RemoteSpec) + **out = **in + } in.StorageNodeSpec.DeepCopyInto(&out.StorageNodeSpec) } @@ -1234,6 +1626,11 @@ func (in *StorageNodeSpec) DeepCopyInto(out *StorageNodeSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.TerminationGracePeriodSeconds != nil { + in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds + *out = new(int64) + **out = **in + } if in.AdditionalLabels != nil { in, out := &in.AdditionalLabels, &out.AdditionalLabels *out = make(map[string]string, len(*in)) @@ -1241,6 +1638,13 @@ func (in *StorageNodeSpec) DeepCopyInto(out *StorageNodeSpec) { (*out)[key] = val } } + if in.AdditionalPodLabels != nil { + in, out := &in.AdditionalPodLabels, &out.AdditionalPodLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.AdditionalAnnotations != nil { in, out := &in.AdditionalAnnotations, &out.AdditionalAnnotations *out = make(map[string]string, len(*in)) @@ -1248,10 +1652,10 @@ func (in *StorageNodeSpec) DeepCopyInto(out *StorageNodeSpec) { (*out)[key] = val } } - if in.TerminationGracePeriodSeconds != nil { - in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds - *out = new(int64) - **out = **in + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + *out = new(v1.SecurityContext) + (*in).DeepCopyInto(*out) } } @@ -1288,6 +1692,16 @@ func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { *out = *in in.StorageClusterSpec.DeepCopyInto(&out.StorageClusterSpec) in.StorageNodeSpec.DeepCopyInto(&out.StorageNodeSpec) + if in.OperatorConnection != nil { + in, out := &in.OperatorConnection, &out.OperatorConnection + *out = new(ConnectionOptions) + (*in).DeepCopyInto(*out) + } + if in.InitJob != nil { + in, out := &in.InitJob, &out.InitJob + *out = new(StorageInitJobSpec) + (*in).DeepCopyInto(*out) + } if in.NodeSets != nil { in, out := &in.NodeSets, &out.NodeSets *out = make([]StorageNodeSetSpecInline, len(*in)) diff --git a/cmd/ydb-kubernetes-operator/main.go b/cmd/ydb-kubernetes-operator/main.go index 809f82ee..383d4554 100644 --- a/cmd/ydb-kubernetes-operator/main.go +++ b/cmd/ydb-kubernetes-operator/main.go @@ -9,7 +9,10 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" _ "k8s.io/client-go/plugin/pkg/client/auth" + "k8s.io/client-go/tools/clientcmd" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/cluster" "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -17,6 +20,8 @@ import ( "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/databasenodeset" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/monitoring" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/remotedatabasenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/remotestoragenodeset" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storagenodeset" ) @@ -39,6 +44,8 @@ func main() { var disableWebhooks bool var enableServiceMonitors bool var probeAddr string + var mgmtClusterKubeconfig string + var mgmtClusterName string flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, @@ -46,6 +53,8 @@ func main() { "Enabling this will ensure there is only one active controller manager.") flag.BoolVar(&disableWebhooks, "disable-webhooks", false, "Disable webhooks registration on start.") flag.BoolVar(&enableServiceMonitors, "with-service-monitors", false, "Enables service monitoring") + flag.StringVar(&mgmtClusterKubeconfig, "mgmt-cluster-kubeconfig", "/mgmt-cluster/kubeconfig", "Path to kubeconfig for mgmt remote k8s cluster. Only required if using Remote objects") + flag.StringVar(&mgmtClusterName, "mgmt-cluster-name", "", "The name of mgmt remote cluster to sync k8s resources. Only required if using Remote objects") opts := zap.Options{ Development: true, } @@ -143,6 +152,36 @@ func main() { os.Exit(1) } } + + if mgmtClusterName != "" && mgmtClusterKubeconfig != "" { + remoteCluster, err := createRemoteCluster(mgmtClusterName, mgmtClusterKubeconfig) + if err != nil { + setupLog.Error(err, "unable to create mgmt cluster client") + os.Exit(1) + } + + if err = mgr.Add(remoteCluster); err != nil { + setupLog.Error(err, "unable to add mgmt cluster client to controller manager") + os.Exit(1) + } + + if err = (&remotestoragenodeset.Reconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + }).SetupWithManager(mgr, &remoteCluster); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "RemoteStorageNodeSet") + os.Exit(1) + } + + if err = (&remotedatabasenodeset.Reconciler{ + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + }).SetupWithManager(mgr, &remoteCluster); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "RemoteDatabaseNodeSet") + os.Exit(1) + } + } + //+kubebuilder:scaffold:builder if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { @@ -160,3 +199,33 @@ func main() { os.Exit(1) } } + +func createRemoteCluster(mgmtClusterName, mgmtClusterKubeconfig string) (cluster.Cluster, error) { + remoteConfig, err := clientcmd.BuildConfigFromFlags("", mgmtClusterKubeconfig) + if err != nil { + setupLog.Error(err, "unable to read mgmt cluster kubeconfig") + return nil, err + } + + storageSelector, err := remotestoragenodeset.BuildRemoteSelector(mgmtClusterName) + if err != nil { + setupLog.Error(err, "unable to create label selector", "selector", "RemoteStorageNodeSet") + return nil, err + } + + databaseSelector, err := remotedatabasenodeset.BuildRemoteSelector(mgmtClusterName) + if err != nil { + setupLog.Error(err, "unable to create label selector", "selector", "RemoteDatabaseNodeSet") + return nil, err + } + + return cluster.New(remoteConfig, func(o *cluster.Options) { + o.Scheme = scheme + o.NewCache = cache.BuilderWithOptions(cache.Options{ + SelectorsByObject: cache.SelectorsByObject{ + &ydbv1alpha1.RemoteStorageNodeSet{}: {Label: storageSelector}, + &ydbv1alpha1.RemoteDatabaseNodeSet{}: {Label: databaseSelector}, + }, + }) + }) +} diff --git a/deploy/ydb-operator/Chart.yaml b/deploy/ydb-operator/Chart.yaml index 9cbf4dd3..6bf8e4ed 100644 --- a/deploy/ydb-operator/Chart.yaml +++ b/deploy/ydb-operator/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.40 +version: "0.6.2" # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.4.40" +appVersion: "0.6.2" diff --git a/deploy/ydb-operator/crds/database.yaml b/deploy/ydb-operator/crds/database.yaml index c9836447..7493ceec 100644 --- a/deploy/ydb-operator/crds/database.yaml +++ b/deploy/ydb-operator/crds/database.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.16.5 name: databases.ydb.tech spec: group: ydb.tech @@ -30,14 +28,19 @@ spec: description: Database is the Schema for the databases API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -56,6 +59,12 @@ spec: description: (Optional) Additional custom resource labels that are added to all resources type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to Pods + type: object affinity: description: (Optional) If specified, the pod's scheduling constraints properties: @@ -64,22 +73,20 @@ spec: pod. properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node matches - the corresponding matchExpressions; the node(s) with the - highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. items: - description: An empty preferred scheduling term matches - all objects with implicit weight 0 (i.e. it's a no-op). - A null preferred scheduling term matches no objects (i.e. - is also a no-op). + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). properties: preference: description: A node selector term, associated with the @@ -89,30 +96,26 @@ spec: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -125,30 +128,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -158,6 +157,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. @@ -169,50 +169,46 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to an update), the system may or may not try to - eventually evict the pod from its node. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. properties: nodeSelectorTerms: description: Required. A list of node selector terms. The terms are ORed. items: - description: A null or empty node selector term matches - no objects. The requirements of them are ANDed. The - TopologySelectorTerm type implements a subset of the - NodeSelectorTerm. + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. properties: matchExpressions: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -225,30 +221,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -258,26 +250,27 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -296,28 +289,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -330,50 +319,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -386,39 +369,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -427,23 +408,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to a pod label update), the system may or may - not try to eventually evict the pod from its node. When - there are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all terms - must be satisfied. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -453,26 +433,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -484,46 +463,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -535,31 +512,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -573,16 +547,15 @@ spec: other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the anti-affinity expressions specified - by this field, but it may choose a node that violates one - or more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -601,28 +574,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -635,50 +604,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -691,39 +654,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -732,23 +693,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified by - this field are not met at scheduling time, the pod will - not be scheduled onto the node. If the anti-affinity requirements - specified by this field cease to be met at some point during - pod execution (e.g. due to a pod label update), the system - may or may not try to eventually evict the pod from its - node. When there are multiple elements, the lists of nodes - corresponding to each podAffinityTerm are intersected, i.e. - all terms must be satisfied. + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -758,26 +718,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -789,46 +748,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -840,31 +797,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -874,8 +828,9 @@ spec: type: object type: object caBundle: - description: User-defined root certificate authority that is added - to system trust store of Storage pods on startup. + description: |- + User-defined root certificate authority that is added to system trust + store of Storage pods on startup. type: string configuration: description: YDB configuration in YAML format. Will be applied on @@ -886,31 +841,14 @@ spec: properties: enabled: type: boolean - iam_service_account_key: - description: SecretKeySelector selects a key of a Secret. - properties: - key: - description: The key of the secret to select from. Must be - a valid secret key. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the Secret or its key must be - defined - type: boolean - required: - - key - type: object required: - enabled type: object domain: default: Root - description: '(Optional) Name of the root storage domain Default: - Root' + description: |- + (Optional) Name of the root storage domain + Default: Root maxLength: 63 pattern: '[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?' type: string @@ -927,8 +865,9 @@ spec: a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key must be @@ -937,6 +876,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic pin: type: string required: @@ -946,57 +886,60 @@ spec: description: (Optional) YDB Image properties: name: - description: 'Container image with supported YDB version. This - defaults to the version pinned to the operator and requires - a full container and tag/sha name. For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22' + description: |- + Container image with supported YDB version. + This defaults to the version pinned to the operator and requires a full container and tag/sha name. + For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22 type: string pullPolicy: - description: '(Optional) PullPolicy for the image, which defaults - to IfNotPresent. Default: IfNotPresent' + description: |- + (Optional) PullPolicy for the image, which defaults to IfNotPresent. + Default: IfNotPresent type: string pullSecret: - description: (Optional) Secret name containing the dockerconfig - to use for a registry that requires authentication. The secret + description: |- + (Optional) Secret name containing the dockerconfig to use for a registry that requires authentication. The secret must be configured first by the user. type: string type: object initContainers: - description: '(Optional) List of initialization containers belonging - to the pod. Init containers are executed in order prior to containers - being started. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/' + description: |- + (Optional) List of initialization containers belonging to the pod. + Init containers are executed in order prior to containers being started. + More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ items: description: A single application container that you want to run within a pod. properties: args: - description: 'Arguments to the entrypoint. The container image''s - CMD is used if this is not provided. Variable references $(VAR_NAME) - are expanded using the container''s environment. If a variable - cannot be resolved, the reference in the input string will - be unchanged. Double $$ are reduced to a single $, which allows - for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references - will never be expanded, regardless of whether the variable - exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Arguments to the entrypoint. + The container image's CMD is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array command: - description: 'Entrypoint array. Not executed within a shell. - The container image''s ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container''s - environment. If a variable cannot be resolved, the reference - in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: - i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether - the variable exists or not. Cannot be updated. More info: - https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Entrypoint array. Not executed within a shell. + The container image's ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array env: - description: List of environment variables to set in the container. + description: |- + List of environment variables to set in the container. Cannot be updated. items: description: EnvVar represents an environment variable present @@ -1007,16 +950,16 @@ spec: a C_IDENTIFIER. type: string value: - description: 'Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in - the container and any service environment variables. - If a variable cannot be resolved, the reference in the - input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) - syntax: i.e. "$$(VAR_NAME)" will produce the string - literal "$(VAR_NAME)". Escaped references will never - be expanded, regardless of whether the variable exists - or not. Defaults to "".' + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". type: string valueFrom: description: Source for the environment variable's value. @@ -1029,10 +972,9 @@ spec: description: The key to select. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap or @@ -1041,12 +983,11 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: - description: 'Selects a field of the pod: supports - metadata.name, metadata.namespace, `metadata.labels['''']`, - `metadata.annotations['''']`, spec.nodeName, - spec.serviceAccountName, status.hostIP, status.podIP, - status.podIPs.' + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. properties: apiVersion: description: Version of the schema the FieldPath @@ -1059,12 +1000,11 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, limits.ephemeral-storage, requests.cpu, - requests.memory and requests.ephemeral-storage) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -1084,6 +1024,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -1093,10 +1034,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its @@ -1105,19 +1045,20 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name type: object type: array envFrom: - description: List of sources to populate environment variables - in the container. The keys defined within a source must be - a C_IDENTIFIER. All invalid keys will be reported as an event - when the container is starting. When a key exists in multiple - sources, the value associated with the last source will take - precedence. Values defined by an Env with a duplicate key - will take precedence. Cannot be updated. + description: |- + List of sources to populate environment variables in the container. + The keys defined within a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will take precedence. + Cannot be updated. items: description: EnvFromSource represents the source of a set of ConfigMaps @@ -1126,15 +1067,16 @@ spec: description: The ConfigMap to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -1143,51 +1085,54 @@ spec: description: The Secret to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: - description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management - to default or override container images in workload controllers - like Deployments and StatefulSets.' + description: |- + Container image name. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. type: string imagePullPolicy: - description: 'Image pull policy. One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent - otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + description: |- + Image pull policy. + One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images type: string lifecycle: - description: Actions that the management system should take - in response to container lifecycle events. Cannot be updated. + description: |- + Actions that the management system should take in response to container lifecycle events. + Cannot be updated. properties: postStart: - description: 'PostStart is called immediately after a container - is created. If the handler fails, the container is terminated - and restarted according to its restart policy. Other management - of the container blocks until the hook completes. More - info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PostStart is called immediately after a container is created. If the handler fails, + the container is terminated and restarted according to its restart policy. + Other management of the container blocks until the hook completes. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1196,9 +1141,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1208,7 +1153,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1225,22 +1172,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1250,40 +1199,37 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object type: object preStop: - description: 'PreStop is called immediately before a container - is terminated due to an API request or management event - such as liveness/startup probe failure, preemption, resource - contention, etc. The handler is not called if the container - crashes or exits. The Pod''s termination grace period - countdown begins before the PreStop hook is executed. - Regardless of the outcome of the handler, the container - will eventually terminate within the Pod''s termination - grace period (unless delayed by finalizers). Other management - of the container blocks until the hook completes or until - the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PreStop is called immediately before a container is terminated due to an + API request or management event such as liveness/startup probe failure, + preemption, resource contention, etc. The handler is not called if the + container crashes or exits. The Pod's termination grace period countdown begins before the + PreStop hook is executed. Regardless of the outcome of the handler, the + container will eventually terminate within the Pod's termination grace + period (unless delayed by finalizers). Other management of the container blocks until the hook completes + or until the termination grace period is reached. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1292,9 +1238,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1304,7 +1250,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1321,22 +1269,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1346,9 +1296,10 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port @@ -1356,36 +1307,36 @@ spec: type: object type: object livenessProbe: - description: 'Periodic probe of container liveness. Container - will be restarted if the probe fails. Cannot be updated. More - info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container liveness. + Container will be restarted if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1393,10 +1344,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1405,9 +1358,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1417,7 +1370,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1434,33 +1389,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1475,78 +1432,82 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object name: - description: Name of the container specified as a DNS_LABEL. + description: |- + Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. type: string ports: - description: List of ports to expose from the container. Not - specifying a port here DOES NOT prevent that port from being - exposed. Any port which is listening on the default "0.0.0.0" - address inside a container will be accessible from the network. - Modifying this array with strategic merge patch may corrupt - the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. + description: |- + List of ports to expose from the container. Not specifying a port here + DOES NOT prevent that port from being exposed. Any port which is + listening on the default "0.0.0.0" address inside a container will be + accessible from the network. + Modifying this array with strategic merge patch may corrupt the data. + For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated. items: description: ContainerPort represents a network port in a single container. properties: containerPort: - description: Number of port to expose on the pod's IP - address. This must be a valid port number, 0 < x < 65536. + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. format: int32 type: integer hostIP: description: What host IP to bind the external port to. type: string hostPort: - description: Number of port to expose on the host. If - specified, this must be a valid port number, 0 < x < - 65536. If HostNetwork is specified, this must match - ContainerPort. Most containers do not need this. + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. format: int32 type: integer name: - description: If specified, this must be an IANA_SVC_NAME - and unique within the pod. Each named port in a pod - must have a unique name. Name for the port that can - be referred to by services. + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. type: string protocol: default: TCP - description: Protocol for port. Must be UDP, TCP, or SCTP. + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP". type: string required: @@ -1558,36 +1519,36 @@ spec: - protocol x-kubernetes-list-type: map readinessProbe: - description: 'Periodic probe of container service readiness. - Container will be removed from service endpoints if the probe - fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1595,10 +1556,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1607,9 +1570,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1619,7 +1582,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1636,33 +1601,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1677,53 +1644,58 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object resources: - description: 'Compute Resources required by this container. - Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Compute Resources required by this container. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -1740,8 +1712,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -1750,33 +1723,34 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object securityContext: - description: 'SecurityContext defines the security options the - container should be run with. If set, the fields of SecurityContext - override the equivalent fields of PodSecurityContext. More - info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + description: |- + SecurityContext defines the security options the container should be run with. + If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ properties: allowPrivilegeEscalation: - description: 'AllowPrivilegeEscalation controls whether - a process can gain more privileges than its parent process. - This bool directly controls if the no_new_privs flag will - be set on the container process. AllowPrivilegeEscalation - is true always when the container is: 1) run as Privileged - 2) has CAP_SYS_ADMIN Note that this field cannot be set - when spec.os.name is windows.' + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. type: boolean capabilities: - description: The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by - the container runtime. Note that this field cannot be - set when spec.os.name is windows. + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. properties: add: description: Added capabilities @@ -1794,60 +1768,60 @@ spec: type: array type: object privileged: - description: Run container in privileged mode. Processes - in privileged containers are essentially equivalent to - root on the host. Defaults to false. Note that this field - cannot be set when spec.os.name is windows. + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. type: boolean procMount: - description: procMount denotes the type of proc mount to - use for the containers. The default is DefaultProcMount - which uses the container runtime defaults for readonly - paths and masked paths. This requires the ProcMountType - feature flag to be enabled. Note that this field cannot - be set when spec.os.name is windows. + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. type: string readOnlyRootFilesystem: - description: Whether this container has a read-only root - filesystem. Default is false. Note that this field cannot - be set when spec.os.name is windows. + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. type: boolean runAsGroup: - description: The GID to run the entrypoint of the container - process. Uses runtime default if unset. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer runAsNonRoot: - description: Indicates that the container must run as a - non-root user. If true, the Kubelet will validate the - image at runtime to ensure that it does not run as UID - 0 (root) and fail to start the container if it does. If - unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both - SecurityContext and PodSecurityContext, the value specified - in SecurityContext takes precedence. + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: boolean runAsUser: - description: The UID to run the entrypoint of the container - process. Defaults to user specified in image metadata - if unspecified. May also be set in PodSecurityContext. If - set in both SecurityContext and PodSecurityContext, the - value specified in SecurityContext takes precedence. Note - that this field cannot be set when spec.os.name is windows. + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer seLinuxOptions: - description: The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a - random SELinux context for each container. May also be - set in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. properties: level: description: Level is SELinux level label that applies @@ -1867,108 +1841,101 @@ spec: type: string type: object seccompProfile: - description: The seccomp options to use by this container. - If seccomp options are provided at both the pod & container - level, the container options override the pod options. - Note that this field cannot be set when spec.os.name is - windows. + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. properties: localhostProfile: - description: localhostProfile indicates a profile defined - in a file on the node should be used. The profile - must be preconfigured on the node to work. Must be - a descending path, relative to the kubelet's configured - seccomp profile location. Must only be set if type - is "Localhost". + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". type: string type: - description: "type indicates which kind of seccomp profile - will be applied. Valid options are: \n Localhost - - a profile defined in a file on the node should be - used. RuntimeDefault - the container runtime default - profile should be used. Unconfined - no profile should - be applied." + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. type: string required: - type type: object windowsOptions: - description: The Windows specific settings applied to all - containers. If unspecified, the options from the PodSecurityContext - will be used. If set in both SecurityContext and PodSecurityContext, - the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is - linux. + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. properties: gmsaCredentialSpec: - description: GMSACredentialSpec is where the GMSA admission - webhook (https://github.com/kubernetes-sigs/windows-gmsa) - inlines the contents of the GMSA credential spec named - by the GMSACredentialSpecName field. + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. type: string gmsaCredentialSpecName: description: GMSACredentialSpecName is the name of the GMSA credential spec to use. type: string hostProcess: - description: HostProcess determines if a container should - be run as a 'Host Process' container. This field is - alpha-level and will only be honored by components - that enable the WindowsHostProcessContainers feature - flag. Setting this field without the feature flag - will result in errors when validating the Pod. All - of a Pod's containers must have the same effective - HostProcess value (it is not allowed to have a mix - of HostProcess containers and non-HostProcess containers). In - addition, if HostProcess is true then HostNetwork - must also be set to true. + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. type: boolean runAsUserName: - description: The UserName in Windows to run the entrypoint - of the container process. Defaults to the user specified - in image metadata if unspecified. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: string type: object type: object startupProbe: - description: 'StartupProbe indicates that the Pod has successfully - initialized. If specified, no other probes are executed until - this completes successfully. If this probe fails, the Pod - will be restarted, just as if the livenessProbe failed. This - can be used to provide different probe parameters at the beginning - of a Pod''s lifecycle, when it might take a long time to load - data or warm a cache, than during steady-state operation. - This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + StartupProbe indicates that the Pod has successfully initialized. + If specified, no other probes are executed until this completes successfully. + If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + when it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1976,10 +1943,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1988,9 +1957,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -2000,7 +1969,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -2017,33 +1988,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -2058,77 +2031,76 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object stdin: - description: Whether this container should allocate a buffer - for stdin in the container runtime. If this is not set, reads - from stdin in the container will always result in EOF. Default - is false. + description: |- + Whether this container should allocate a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will always result in EOF. + Default is false. type: boolean stdinOnce: - description: Whether the container runtime should close the - stdin channel after it has been opened by a single attach. - When stdin is true the stdin stream will remain open across - multiple attach sessions. If stdinOnce is set to true, stdin - is opened on container start, is empty until the first client - attaches to stdin, and then remains open and accepts data - until the client disconnects, at which time stdin is closed - and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin - will never receive an EOF. Default is false + description: |- + Whether the container runtime should close the stdin channel after it has been opened by + a single attach. When stdin is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + first client attaches to stdin, and then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container is restarted. If this + flag is false, a container processes that reads from stdin will never receive an EOF. + Default is false type: boolean terminationMessagePath: - description: 'Optional: Path at which the file to which the - container''s termination message will be written is mounted - into the container''s filesystem. Message written is intended - to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. - The total message length across all containers will be limited - to 12kb. Defaults to /dev/termination-log. Cannot be updated.' + description: |- + Optional: Path at which the file to which the container's termination message + will be written is mounted into the container's filesystem. + Message written is intended to be brief final status, such as an assertion failure message. + Will be truncated by the node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. + Defaults to /dev/termination-log. + Cannot be updated. type: string terminationMessagePolicy: - description: Indicate how the termination message should be - populated. File will use the contents of terminationMessagePath - to populate the container status message on both success and - failure. FallbackToLogsOnError will use the last chunk of - container log output if the termination message file is empty - and the container exited with an error. The log output is - limited to 2048 bytes or 80 lines, whichever is smaller. Defaults - to File. Cannot be updated. + description: |- + Indicate how the termination message should be populated. File will use the contents of + terminationMessagePath to populate the container status message on both success and failure. + FallbackToLogsOnError will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + Defaults to File. + Cannot be updated. type: string tty: - description: Whether this container should allocate a TTY for - itself, also requires 'stdin' to be true. Default is false. + description: |- + Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + Default is false. type: boolean volumeDevices: description: volumeDevices is the list of block devices to be @@ -2151,40 +2123,44 @@ spec: type: object type: array volumeMounts: - description: Pod volumes to mount into the container's filesystem. + description: |- + Pod volumes to mount into the container's filesystem. Cannot be updated. items: description: VolumeMount describes a mounting of a Volume within a container. properties: mountPath: - description: Path within the container at which the volume - should be mounted. Must not contain ':'. + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. type: string mountPropagation: - description: mountPropagation determines how mounts are - propagated from the host to container and the other - way around. When not set, MountPropagationNone is used. + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. This field is beta in 1.10. type: string name: description: This must match the Name of a Volume. type: string readOnly: - description: Mounted read-only if true, read-write otherwise - (false or unspecified). Defaults to false. + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. type: boolean subPath: - description: Path within the volume from which the container's - volume should be mounted. Defaults to "" (volume's root). + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). type: string subPathExpr: - description: Expanded path within the volume from which - the container's volume should be mounted. Behaves similarly - to SubPath but environment variable references $(VAR_NAME) - are expanded using the container's environment. Defaults - to "" (volume's root). SubPathExpr and SubPath are mutually - exclusive. + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. type: string required: - mountPath @@ -2192,17 +2168,20 @@ spec: type: object type: array workingDir: - description: Container's working directory. If not specified, - the container runtime's default will be used, which might - be configured in the container image. Cannot be updated. + description: |- + Container's working directory. + If not specified, the container runtime's default will be used, which + might be configured in the container image. + Cannot be updated. type: string required: - name type: object type: array monitoring: - description: '(Optional) Monitoring sets configuration options for - YDB observability Default: ""' + description: |- + (Optional) Monitoring sets configuration options for YDB observability + Default: "" properties: enabled: type: boolean @@ -2213,10 +2192,10 @@ spec: description: RelabelConfig allows dynamic rewriting of the label set, being applied to sample before ingestion. items: - description: 'RelabelConfig allows dynamic rewriting of the - label set, being applied to samples before ingestion. It defines - ``-section of Prometheus configuration. - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs' + description: |- + RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. + It defines ``-section of Prometheus configuration. + More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs properties: action: description: Action to perform based on regex matching. @@ -2232,26 +2211,26 @@ spec: value is matched. Default is '(.*)' type: string replacement: - description: Replacement value against which a regex replace - is performed if the regular expression matches. Regex - capture groups are available. Default is '$1' + description: |- + Replacement value against which a regex replace is performed if the + regular expression matches. Regex capture groups are available. Default is '$1' type: string separator: description: Separator placed between concatenated source label values. default is ';'. type: string sourceLabels: - description: The source labels select values from existing - labels. Their content is concatenated using the configured - separator and matched against the configured regular expression + description: |- + The source labels select values from existing labels. Their content is concatenated + using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions. items: type: string type: array targetLabel: - description: Label to which the resulting value is written - in a replace action. It is mandatory for replace actions. - Regex capture groups are available. + description: |- + Label to which the resulting value is written in a replace action. + It is mandatory for replace actions. Regex capture groups are available. type: string type: object type: array @@ -2261,13 +2240,15 @@ spec: nodeSelector: additionalProperties: type: string - description: '(Optional) NodeSelector is a selector which must be - true for the pod to fit on a node. Selector which must match a node''s - labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object nodeSets: - description: (Optional) NodeSet inline configuration to split into - multiple StatefulSets + description: |- + (Optional) NodeSet inline configuration to split into multiple StatefulSets + Default: (not specified) items: description: DatabaseNodeSetSpecInline describes an group nodes object inside parent object @@ -2284,6 +2265,12 @@ spec: description: (Optional) Additional custom resource labels that are added to all resources type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that + are added to Pods + type: object affinity: description: (Optional) If specified, the pod's scheduling constraints properties: @@ -2292,22 +2279,20 @@ spec: the pod. properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods - to nodes that satisfy the affinity expressions specified - by this field, but it may choose a node that violates - one or more of the expressions. The node that is most - preferred is the one with the greatest sum of weights, - i.e. for each node that meets all of the scheduling - requirements (resource request, requiredDuringScheduling - affinity expressions, etc.), compute a sum by iterating - through the elements of this field and adding "weight" - to the sum if the node matches the corresponding matchExpressions; - the node(s) with the highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. items: - description: An empty preferred scheduling term matches - all objects with implicit weight 0 (i.e. it's a - no-op). A null preferred scheduling term matches - no objects (i.e. is also a no-op). + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). properties: preference: description: A node selector term, associated @@ -2317,32 +2302,26 @@ spec: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2355,32 +2334,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2390,6 +2363,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the range @@ -2402,53 +2376,46 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified - by this field are not met at scheduling time, the - pod will not be scheduled onto the node. If the affinity - requirements specified by this field cease to be met - at some point during pod execution (e.g. due to an - update), the system may or may not try to eventually - evict the pod from its node. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. properties: nodeSelectorTerms: description: Required. A list of node selector terms. The terms are ORed. items: - description: A null or empty node selector term - matches no objects. The requirements of them - are ANDed. The TopologySelectorTerm type implements - a subset of the NodeSelectorTerm. + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. properties: matchExpressions: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2461,32 +2428,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2496,10 +2457,12 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. @@ -2507,18 +2470,16 @@ spec: other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods - to nodes that satisfy the affinity expressions specified - by this field, but it may choose a node that violates - one or more of the expressions. The node that is most - preferred is the one with the greatest sum of weights, - i.e. for each node that meets all of the scheduling - requirements (resource request, requiredDuringScheduling - affinity expressions, etc.), compute a sum by iterating - through the elements of this field and adding "weight" - to the sum if the node has pods which matches the - corresponding podAffinityTerm; the node(s) with the - highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred @@ -2537,29 +2498,24 @@ spec: of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2572,52 +2528,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of - namespaces that the term applies to. The - term is applied to the union of the namespaces - selected by this field and the ones listed - in the namespaces field. null selector and - null or empty namespaces list means "this - pod's namespace". An empty selector ({}) - matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2630,43 +2578,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static - list of namespace names that the term applies - to. The term is applied to the union of - the namespaces listed in this field and - the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector - means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located - (affinity) or not co-located (anti-affinity) - with the pods matching the labelSelector - in the specified namespaces, where co-located - is defined as running on a node whose value - of the label with key topologyKey matches - that of any node on which any of the selected - pods is running. Empty topologyKey is not - allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the - corresponding podAffinityTerm, in the range - 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -2675,24 +2617,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified - by this field are not met at scheduling time, the - pod will not be scheduled onto the node. If the affinity - requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a - pod label update), the system may or may not try to - eventually evict the pod from its node. When there - are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all - terms must be satisfied. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or - not co-located (anti-affinity) with, where co-located - is defined as running on a node whose value of the - label with key matches that of any - node on which a pod of the set of pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -2703,28 +2643,24 @@ spec: label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2737,50 +2673,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces - field. null selector and null or empty namespaces - list means "this pod's namespace". An empty - selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2793,34 +2723,29 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. - The term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces - list and null namespaceSelector means "this - pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified - namespaces, where co-located is defined as running - on a node whose value of the label with key - topologyKey matches that of any node on which - any of the selected pods is running. Empty topologyKey - is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey @@ -2833,18 +2758,16 @@ spec: as some other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods - to nodes that satisfy the anti-affinity expressions - specified by this field, but it may choose a node - that violates one or more of the expressions. The - node that is most preferred is the one with the greatest - sum of weights, i.e. for each node that meets all - of the scheduling requirements (resource request, - requiredDuringScheduling anti-affinity expressions, - etc.), compute a sum by iterating through the elements - of this field and adding "weight" to the sum if the - node has pods which matches the corresponding podAffinityTerm; - the node(s) with the highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred @@ -2863,29 +2786,24 @@ spec: of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2898,52 +2816,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of - namespaces that the term applies to. The - term is applied to the union of the namespaces - selected by this field and the ones listed - in the namespaces field. null selector and - null or empty namespaces list means "this - pod's namespace". An empty selector ({}) - matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2956,43 +2866,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static - list of namespace names that the term applies - to. The term is applied to the union of - the namespaces listed in this field and - the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector - means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located - (affinity) or not co-located (anti-affinity) - with the pods matching the labelSelector - in the specified namespaces, where co-located - is defined as running on a node whose value - of the label with key topologyKey matches - that of any node on which any of the selected - pods is running. Empty topologyKey is not - allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the - corresponding podAffinityTerm, in the range - 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -3001,24 +2905,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified - by this field are not met at scheduling time, the - pod will not be scheduled onto the node. If the anti-affinity - requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a - pod label update), the system may or may not try to - eventually evict the pod from its node. When there - are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all - terms must be satisfied. + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or - not co-located (anti-affinity) with, where co-located - is defined as running on a node whose value of the - label with key matches that of any - node on which a pod of the set of pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -3029,28 +2931,24 @@ spec: label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3063,50 +2961,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces - field. null selector and null or empty namespaces - list means "this pod's namespace". An empty - selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3119,34 +3011,29 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. - The term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces - list and null namespaceSelector means "this - pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified - namespaces, where co-located is defined as running - on a node whose value of the label with key - topologyKey matches that of any node on which - any of the selected pods is running. Empty topologyKey - is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey @@ -3154,16 +3041,26 @@ spec: type: array type: object type: object + annotations: + additionalProperties: + type: string + description: Annotations for DatabaseNodeSet object + type: object + labels: + additionalProperties: + type: string + description: Labels for DatabaseNodeSet object + type: object name: description: Name of DatabaseNodeSet object type: string nodeSelector: additionalProperties: type: string - description: '(Optional) NodeSelector is a selector which must - be true for the pod to fit on a node. Selector which must - match a node''s labels for the pod to be scheduled on that - node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object nodes: description: Number of nodes (pods) in the cluster @@ -3173,30 +3070,41 @@ spec: description: (Optional) If specified, the pod's priorityClassName. type: string remote: - description: (Optional) Object should be reference to remote + description: (Optional) Object should be reference to RemoteDatabaseNodeSet object - type: boolean + properties: + cluster: + description: Remote cluster to deploy NodeSet into + type: string + required: + - cluster + type: object resources: description: (Optional) Database storage and compute resources properties: containerResources: - description: '(Optional) Database container resource limits. - Any container limits can be specified. Default: (not specified)' + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the - DynamicResourceAllocation feature gate. \n This field - is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where - this field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -3213,8 +3121,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of - compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3223,17 +3132,18 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount - of compute resources required. If Requests is omitted - for a container, it defaults to Limits if that is - explicitly specified, otherwise to an implementation-defined - value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object storageUnits: - description: 'Kind of the storage unit. Determine guarantees + description: |- + Kind of the storage unit. Determine guarantees for all main unit parameters: used hard disk type, capacity - throughput, IOPS etc.' + throughput, IOPS etc. items: properties: count: @@ -3241,38 +3151,218 @@ spec: format: int64 type: integer unitKind: - description: 'Kind of the storage unit. Determine - guarantees for all main unit parameters: used hard - disk type, capacity throughput, IOPS etc.' + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. type: string required: - count - unitKind type: object type: array + required: + - storageUnits + type: object + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object type: object sharedResources: description: (Optional) Shared resources can be used by serverless databases. properties: containerResources: - description: '(Optional) Database container resource limits. - Any container limits can be specified. Default: (not specified)' + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the - DynamicResourceAllocation feature gate. \n This field - is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where - this field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -3289,8 +3379,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of - compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3299,17 +3390,18 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount - of compute resources required. If Requests is omitted - for a container, it defaults to Limits if that is - explicitly specified, otherwise to an implementation-defined - value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object storageUnits: - description: 'Kind of the storage unit. Determine guarantees + description: |- + Kind of the storage unit. Determine guarantees for all main unit parameters: used hard disk type, capacity - throughput, IOPS etc.' + throughput, IOPS etc. items: properties: count: @@ -3317,76 +3409,82 @@ spec: format: int64 type: integer unitKind: - description: 'Kind of the storage unit. Determine - guarantees for all main unit parameters: used hard - disk type, capacity throughput, IOPS etc.' + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. type: string required: - count - unitKind type: object type: array + required: + - storageUnits type: object + terminationGracePeriodSeconds: + description: (Optional) If specified, the pod's terminationGracePeriodSeconds. + format: int64 + type: integer tolerations: description: (Optional) If specified, the pod's tolerations. items: - description: The pod this Toleration is attached to tolerates - any taint that matches the triple using - the matching operator . + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . properties: effect: - description: Effect indicates the taint effect to match. - Empty means match all taint effects. When specified, - allowed values are NoSchedule, PreferNoSchedule and - NoExecute. + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. type: string key: - description: Key is the taint key that the toleration - applies to. Empty means match all taint keys. If the - key is empty, operator must be Exists; this combination - means to match all values and all keys. + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. type: string operator: - description: Operator represents a key's relationship - to the value. Valid operators are Exists and Equal. - Defaults to Equal. Exists is equivalent to wildcard - for value, so that a pod can tolerate all taints of - a particular category. + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. type: string tolerationSeconds: - description: TolerationSeconds represents the period of - time the toleration (which must be of effect NoExecute, - otherwise this field is ignored) tolerates the taint. - By default, it is not set, which means tolerate the - taint forever (do not evict). Zero and negative values - will be treated as 0 (evict immediately) by the system. + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. format: int64 type: integer value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. type: string type: object type: array topologySpreadConstraints: - description: (Optional) If specified, the pod's topologySpreadConstraints. + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. All topologySpreadConstraints are ANDed. items: description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. properties: labelSelector: - description: LabelSelector is used to find matching pods. - Pods that match this label selector are counted to determine - the number of pods in their corresponding topology domain. + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. properties: key: @@ -3394,17 +3492,16 @@ spec: applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values - array must be non-empty. If the operator is - Exists or DoesNotExist, the values array must - be empty. This array is replaced during a - strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -3416,130 +3513,125 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field - is "key", the operator is "In", and the values array - contains only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys - to select the pods over which spreading will be calculated. - The keys are used to lookup values from the incoming - pod labels, those key-value labels are ANDed with labelSelector - to select the group of existing pods over which spreading - will be calculated for the incoming pod. Keys that don't - exist in the incoming pod labels will be ignored. A - null or empty list means only match against labelSelector. + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. items: type: string type: array x-kubernetes-list-type: atomic maxSkew: - description: 'MaxSkew describes the degree to which pods - may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, - it is the maximum permitted difference between the number - of matching pods in the target topology and the global - minimum. The global minimum is the minimum number of - matching pods in an eligible domain or zero if the number - of eligible domains is less than MinDomains. For example, - in a 3-zone cluster, MaxSkew is set to 1, and pods with - the same labelSelector spread as 2/2/1: In this case, - the global minimum is 1. | zone1 | zone2 | zone3 | | P - P | P P | P | - if MaxSkew is 1, incoming pod - can only be scheduled to zone3 to become 2/2/2; scheduling - it onto zone1(zone2) would make the ActualSkew(3-1) - on zone1(zone2) violate MaxSkew(1). - if MaxSkew is - 2, incoming pod can be scheduled onto any zone. When - `whenUnsatisfiable=ScheduleAnyway`, it is used to give - higher precedence to topologies that satisfy it. It''s - a required field. Default value is 1 and 0 is not allowed.' + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. format: int32 type: integer minDomains: - description: "MinDomains indicates a minimum number of - eligible domains. When the number of eligible domains - with matching topology keys is less than minDomains, - Pod Topology Spread treats \"global minimum\" as 0, - and then the calculation of Skew is performed. And when - the number of eligible domains with matching topology - keys equals or greater than minDomains, this value has - no effect on scheduling. As a result, when the number - of eligible domains is less than minDomains, scheduler - won't schedule more than maxSkew Pods to those domains. - If value is nil, the constraint behaves as if MinDomains - is equal to 1. Valid values are integers greater than - 0. When value is not nil, WhenUnsatisfiable must be - DoNotSchedule. \n For example, in a 3-zone cluster, - MaxSkew is set to 2, MinDomains is set to 5 and pods - with the same labelSelector spread as 2/2/2: | zone1 - | zone2 | zone3 | | P P | P P | P P | The number - of domains is less than 5(MinDomains), so \"global minimum\" - is treated as 0. In this situation, new pod with the - same labelSelector cannot be scheduled, because computed - skew will be 3(3 - 0) if new Pod is scheduled to any - of the three zones, it will violate MaxSkew. \n This - is a beta field and requires the MinDomainsInPodTopologySpread - feature gate to be enabled (enabled by default)." + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). format: int32 type: integer nodeAffinityPolicy: - description: "NodeAffinityPolicy indicates how we will - treat Pod's nodeAffinity/nodeSelector when calculating - pod topology spread skew. Options are: - Honor: only - nodes matching nodeAffinity/nodeSelector are included - in the calculations. - Ignore: nodeAffinity/nodeSelector - are ignored. All nodes are included in the calculations. - \n If this value is nil, the behavior is equivalent - to the Honor policy. This is a beta-level feature default - enabled by the NodeInclusionPolicyInPodTopologySpread - feature flag." + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string nodeTaintsPolicy: - description: "NodeTaintsPolicy indicates how we will treat - node taints when calculating pod topology spread skew. - Options are: - Honor: nodes without taints, along with - tainted nodes for which the incoming pod has a toleration, - are included. - Ignore: node taints are ignored. All - nodes are included. \n If this value is nil, the behavior - is equivalent to the Ignore policy. This is a beta-level - feature default enabled by the NodeInclusionPolicyInPodTopologySpread - feature flag." + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. + - Ignore: node taints are ignored. All nodes are included. + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string topologyKey: - description: TopologyKey is the key of node labels. Nodes - that have a label with this key and identical values - are considered to be in the same topology. We consider - each as a "bucket", and try to put balanced - number of pods into each bucket. We define a domain - as a particular instance of a topology. Also, we define - an eligible domain as a domain whose nodes meet the - requirements of nodeAffinityPolicy and nodeTaintsPolicy. - e.g. If TopologyKey is "kubernetes.io/hostname", each - Node is a domain of that topology. And, if TopologyKey - is "topology.kubernetes.io/zone", each zone is a domain - of that topology. It's a required field. + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. type: string whenUnsatisfiable: - description: 'WhenUnsatisfiable indicates how to deal - with a pod if it doesn''t satisfy the spread constraint. - - DoNotSchedule (default) tells the scheduler not to - schedule it. - ScheduleAnyway tells the scheduler to - schedule the pod in any location, but giving higher - precedence to topologies that would help reduce the skew. - A constraint is considered "Unsatisfiable" for an incoming - pod if and only if every possible node assignment for - that pod would violate "MaxSkew" on some topology. For - example, in a 3-zone cluster, MaxSkew is set to 1, and - pods with the same labelSelector spread as 3/1/1: | - zone1 | zone2 | zone3 | | P P P | P | P | If - WhenUnsatisfiable is set to DoNotSchedule, incoming - pod can only be scheduled to zone2(zone3) to become - 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies - MaxSkew(1). In other words, the cluster can still be - imbalanced, but scheduler won''t make it *more* imbalanced. - It''s a required field.' + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. type: string required: - maxSkew @@ -3552,6 +3644,7 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map required: + - name - nodes type: object type: array @@ -3561,24 +3654,25 @@ spec: type: integer operatorSync: default: true - description: Enables or disables operator's reconcile loop. `false` - means all the Pods are running, but the reconcile is effectively - turned off. `true` means the default state of the system, all Pods - running, operator reacts to specification change of this Database - resource. + description: |- + Enables or disables operator's reconcile loop. + `false` means all the Pods are running, but the reconcile is effectively turned off. + `true` means the default state of the system, all Pods running, operator reacts + to specification change of this Database resource. type: boolean path: - description: '(Optional) Custom database path in schemeshard Default: - //' + description: |- + (Optional) Custom database path in schemeshard + Default: // maxLength: 255 pattern: /[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?/[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?(/[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?)* type: string pause: default: false - description: The state of the Database processes. `true` means all - the Database Pods are being killed, but the Database resource is - persisted. `false` means the default state of the system, all Pods - running. + description: |- + The state of the Database processes. + `true` means all the Database Pods are being killed, but the Database resource is persisted. + `false` means the default state of the system, all Pods running. type: boolean priorityClassName: description: (Optional) If specified, the pod's priorityClassName. @@ -3587,22 +3681,28 @@ spec: description: (Optional) Database storage and compute resources properties: containerResources: - description: '(Optional) Database container resource limits. Any - container limits can be specified. Default: (not specified)' + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry in - pod.spec.resourceClaims of the Pod where this field - is used. It makes that resource available inside a - container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -3618,8 +3718,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3628,16 +3729,18 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object storageUnits: - description: 'Kind of the storage unit. Determine guarantees for - all main unit parameters: used hard disk type, capacity throughput, - IOPS etc.' + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. items: properties: count: @@ -3645,29 +3748,206 @@ spec: format: int64 type: integer unitKind: - description: 'Kind of the storage unit. Determine guarantees + description: |- + Kind of the storage unit. Determine guarantees for all main unit parameters: used hard disk type, capacity - throughput, IOPS etc.' + throughput, IOPS etc. type: string required: - count - unitKind type: object type: array + required: + - storageUnits type: object secrets: - description: 'Secret names that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/secrets//`' + description: |- + Secret names that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/secrets//` items: - description: LocalObjectReference contains enough information to - let you locate the referenced object inside the same namespace. + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic type: array + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies to + the container. + type: string + role: + description: Role is a SELinux role label that applies to + the container. + type: string + type: + description: Type is a SELinux type label that applies to + the container. + type: string + user: + description: User is a SELinux user label that applies to + the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the GMSA + credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object serverlessResources: description: (Optional) If specified, created database will be "serverless". properties: @@ -3690,8 +3970,9 @@ spec: - sharedDatabaseRef type: object service: - description: '(Optional) Storage services parameter overrides Default: - (not specified)' + description: |- + (Optional) Storage services parameter overrides + Default: (not specified) properties: datastreams: properties: @@ -3705,9 +3986,9 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -3724,9 +4005,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3735,6 +4016,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -3743,9 +4025,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3754,6 +4036,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -3764,9 +4047,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3775,6 +4058,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -3791,11 +4075,28 @@ spec: type: object externalHost: type: string + externalPort: + format: int32 + type: integer + ipDiscovery: + properties: + enabled: + type: boolean + ipFamily: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + targetNameOverride: + type: string + required: + - enabled + type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -3812,9 +4113,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3823,6 +4124,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -3831,9 +4133,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3842,6 +4144,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -3852,9 +4155,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3863,6 +4166,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -3879,9 +4183,9 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -3898,9 +4202,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3909,6 +4213,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -3917,9 +4222,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3928,6 +4233,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -3938,9 +4244,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3949,6 +4255,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -3965,15 +4272,82 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: description: IPFamilyPolicy represents the dual-stack-ness requested or required by a Service type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object type: object type: object sharedResources: @@ -3981,22 +4355,28 @@ spec: databases. properties: containerResources: - description: '(Optional) Database container resource limits. Any - container limits can be specified. Default: (not specified)' + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry in - pod.spec.resourceClaims of the Pod where this field - is used. It makes that resource available inside a - container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -4012,8 +4392,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -4022,16 +4403,18 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object storageUnits: - description: 'Kind of the storage unit. Determine guarantees for - all main unit parameters: used hard disk type, capacity throughput, - IOPS etc.' + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. items: properties: count: @@ -4039,15 +4422,18 @@ spec: format: int64 type: integer unitKind: - description: 'Kind of the storage unit. Determine guarantees + description: |- + Kind of the storage unit. Determine guarantees for all main unit parameters: used hard disk type, capacity - throughput, IOPS etc.' + throughput, IOPS etc. type: string required: - count - unitKind type: object type: array + required: + - storageUnits type: object storageClusterRef: description: YDB Storage cluster reference @@ -4063,88 +4449,89 @@ spec: required: - name type: object + storageEndpoint: + description: YDB Storage Node broker address + type: string terminationGracePeriodSeconds: description: (Optional) If specified, the pod's terminationGracePeriodSeconds. format: int64 type: integer - storageEndpoint: - description: YDB Storage Node broker address - type: string tolerations: description: (Optional) If specified, the pod's tolerations. items: - description: The pod this Toleration is attached to tolerates any - taint that matches the triple using the matching - operator . + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . properties: effect: - description: Effect indicates the taint effect to match. Empty - means match all taint effects. When specified, allowed values - are NoSchedule, PreferNoSchedule and NoExecute. + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. type: string key: - description: Key is the taint key that the toleration applies - to. Empty means match all taint keys. If the key is empty, - operator must be Exists; this combination means to match all - values and all keys. + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. type: string operator: - description: Operator represents a key's relationship to the - value. Valid operators are Exists and Equal. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod - can tolerate all taints of a particular category. + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. type: string tolerationSeconds: - description: TolerationSeconds represents the period of time - the toleration (which must be of effect NoExecute, otherwise - this field is ignored) tolerates the taint. By default, it - is not set, which means tolerate the taint forever (do not - evict). Zero and negative values will be treated as 0 (evict - immediately) by the system. + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. format: int64 type: integer value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. type: string type: object type: array topologySpreadConstraints: - description: (Optional) If specified, the pod's topologySpreadConstraints. + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. All topologySpreadConstraints are ANDed. items: description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. properties: labelSelector: - description: LabelSelector is used to find matching pods. Pods - that match this label selector are counted to determine the - number of pods in their corresponding topology domain. + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists or - DoesNotExist, the values array must be empty. This - array is replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -4156,121 +4543,125 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is - "key", the operator is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select - the pods over which spreading will be calculated. The keys - are used to lookup values from the incoming pod labels, those - key-value labels are ANDed with labelSelector to select the - group of existing pods over which spreading will be calculated - for the incoming pod. Keys that don't exist in the incoming - pod labels will be ignored. A null or empty list means only - match against labelSelector. + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. items: type: string type: array x-kubernetes-list-type: atomic maxSkew: - description: 'MaxSkew describes the degree to which pods may - be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, - it is the maximum permitted difference between the number - of matching pods in the target topology and the global minimum. - The global minimum is the minimum number of matching pods - in an eligible domain or zero if the number of eligible domains - is less than MinDomains. For example, in a 3-zone cluster, - MaxSkew is set to 1, and pods with the same labelSelector - spread as 2/2/1: In this case, the global minimum is 1. | - zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew - is 1, incoming pod can only be scheduled to zone3 to become - 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) - on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming - pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, - it is used to give higher precedence to topologies that satisfy - it. It''s a required field. Default value is 1 and 0 is not - allowed.' + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. format: int32 type: integer minDomains: - description: "MinDomains indicates a minimum number of eligible - domains. When the number of eligible domains with matching - topology keys is less than minDomains, Pod Topology Spread - treats \"global minimum\" as 0, and then the calculation of - Skew is performed. And when the number of eligible domains - with matching topology keys equals or greater than minDomains, - this value has no effect on scheduling. As a result, when - the number of eligible domains is less than minDomains, scheduler - won't schedule more than maxSkew Pods to those domains. If - value is nil, the constraint behaves as if MinDomains is equal - to 1. Valid values are integers greater than 0. When value - is not nil, WhenUnsatisfiable must be DoNotSchedule. \n For - example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains - is set to 5 and pods with the same labelSelector spread as - 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | - The number of domains is less than 5(MinDomains), so \"global - minimum\" is treated as 0. In this situation, new pod with - the same labelSelector cannot be scheduled, because computed - skew will be 3(3 - 0) if new Pod is scheduled to any of the - three zones, it will violate MaxSkew. \n This is a beta field - and requires the MinDomainsInPodTopologySpread feature gate - to be enabled (enabled by default)." + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). format: int32 type: integer nodeAffinityPolicy: - description: "NodeAffinityPolicy indicates how we will treat - Pod's nodeAffinity/nodeSelector when calculating pod topology - spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector - are included in the calculations. - Ignore: nodeAffinity/nodeSelector - are ignored. All nodes are included in the calculations. \n - If this value is nil, the behavior is equivalent to the Honor - policy. This is a beta-level feature default enabled by the - NodeInclusionPolicyInPodTopologySpread feature flag." + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string nodeTaintsPolicy: - description: "NodeTaintsPolicy indicates how we will treat node - taints when calculating pod topology spread skew. Options - are: - Honor: nodes without taints, along with tainted nodes - for which the incoming pod has a toleration, are included. + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - \n If this value is nil, the behavior is equivalent to the - Ignore policy. This is a beta-level feature default enabled - by the NodeInclusionPolicyInPodTopologySpread feature flag." + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string topologyKey: - description: TopologyKey is the key of node labels. Nodes that - have a label with this key and identical values are considered - to be in the same topology. We consider each - as a "bucket", and try to put balanced number of pods into - each bucket. We define a domain as a particular instance of - a topology. Also, we define an eligible domain as a domain - whose nodes meet the requirements of nodeAffinityPolicy and - nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", - each Node is a domain of that topology. And, if TopologyKey - is "topology.kubernetes.io/zone", each zone is a domain of - that topology. It's a required field. + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. type: string whenUnsatisfiable: - description: 'WhenUnsatisfiable indicates how to deal with a - pod if it doesn''t satisfy the spread constraint. - DoNotSchedule - (default) tells the scheduler not to schedule it. - ScheduleAnyway - tells the scheduler to schedule the pod in any location, but - giving higher precedence to topologies that would help reduce - the skew. A constraint is considered "Unsatisfiable" for - an incoming pod if and only if every possible node assignment - for that pod would violate "MaxSkew" on some topology. For - example, in a 3-zone cluster, MaxSkew is set to 1, and pods - with the same labelSelector spread as 3/1/1: | zone1 | zone2 - | zone3 | | P P P | P | P | If WhenUnsatisfiable is - set to DoNotSchedule, incoming pod can only be scheduled to - zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on - zone2(zone3) satisfies MaxSkew(1). In other words, the cluster - can still be imbalanced, but scheduler won''t make it *more* - imbalanced. It''s a required field.' + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. type: string required: - maxSkew @@ -4283,46 +4674,49 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map version: - description: '(Optional) YDBVersion sets the explicit version of the - YDB image Default: ""' + description: |- + (Optional) YDBVersion sets the explicit version of the YDB image + Default: "" type: string volumes: - description: 'Additional volumes that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/volumes/`. - Only `hostPath` volume type is supported for now.' + description: |- + Additional volumes that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/volumes/`. + Only `hostPath` volume type is supported for now. items: description: Volume represents a named volume in a pod that may be accessed by any container in the pod. properties: awsElasticBlockStore: - description: 'awsElasticBlockStore represents an AWS Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty).' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). format: int32 type: integer readOnly: - description: 'readOnly value true will force the readOnly - setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: boolean volumeID: - description: 'volumeID is unique ID of the persistent disk - resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string required: - volumeID @@ -4344,10 +4738,10 @@ spec: storage type: string fsType: - description: fsType is Filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string kind: description: 'kind expected values are Shared: multiple @@ -4356,8 +4750,9 @@ spec: disk (only in managed availability set). defaults to shared' type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean required: - diskName @@ -4368,8 +4763,9 @@ spec: on the host and bind mount to the pod. properties: readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretName: description: secretName is the name of secret that contains @@ -4387,8 +4783,9 @@ spec: shares a pod's lifetime properties: monitors: - description: 'monitors is Required: Monitors is a collection - of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it items: type: string type: array @@ -4397,59 +4794,70 @@ spec: rather than the full Ceph tree, default is /' type: string readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: boolean secretFile: - description: 'secretFile is Optional: SecretFile is the - path to key ring for User, default is /etc/ceph/user.secret - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string secretRef: - description: 'secretRef is Optional: SecretRef is reference - to the authentication secret for User, default is empty. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is optional: User is the rados user name, - default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string required: - monitors type: object cinder: - description: 'cinder represents a cinder volume attached and - mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to - be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string readOnly: - description: 'readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: boolean secretRef: - description: 'secretRef is optional: points to a secret - object containing parameters used to connect to OpenStack.' + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeID: - description: 'volumeID used to identify the volume in cinder. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string required: - volumeID @@ -4459,27 +4867,25 @@ spec: this volume properties: defaultMode: - description: 'defaultMode is optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items if unspecified, each key-value pair in - the Data field of the referenced ConfigMap will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the ConfigMap, the volume setup will error unless it is - marked optional. Paths must be relative and may not contain - the '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -4487,22 +4893,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4510,54 +4915,58 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic csi: description: csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature). properties: driver: - description: driver is the name of the CSI driver that handles - this volume. Consult with your admin for the correct name - as registered in the cluster. + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. type: string fsType: - description: fsType to mount. Ex. "ext4", "xfs", "ntfs". - If not provided, the empty value is passed to the associated - CSI driver which will determine the default filesystem - to apply. + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. type: string nodePublishSecretRef: - description: nodePublishSecretRef is a reference to the - secret object containing sensitive information to pass - to the CSI driver to complete the CSI NodePublishVolume - and NodeUnpublishVolume calls. This field is optional, - and may be empty if no secret is required. If the secret - object contains more than one secret, all secret references - are passed. + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic readOnly: - description: readOnly specifies a read-only configuration - for the volume. Defaults to false (read/write). + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). type: boolean volumeAttributes: additionalProperties: type: string - description: volumeAttributes stores driver-specific properties - that are passed to the CSI driver. Consult your driver's - documentation for supported values. + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. type: object required: - driver @@ -4567,16 +4976,15 @@ spec: that should populate this volume properties: defaultMode: - description: 'Optional: mode bits to use on created files - by default. Must be a Optional: mode bits used to set - permissions on created files by default. Must be an octal - value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: @@ -4601,16 +5009,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to set permissions - on this file, must be an octal value between 0000 - and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires - decimal values for mode bits. If not specified, - the volume defaultMode will be used. This might - be in conflict with other options that affect the - file mode, like fsGroup, and the result can be other - mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -4621,10 +5028,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, requests.cpu and requests.memory) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -4644,113 +5050,125 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object type: array type: object emptyDir: - description: 'emptyDir represents a temporary directory that - shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir properties: medium: - description: 'medium represents what type of storage medium - should back this directory. The default is "" which means - to use the node''s default medium. Must be an empty string - (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir type: string sizeLimit: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage - required for this EmptyDir volume. The size limit is also - applicable for memory medium. The maximum usage on memory - medium EmptyDir would be the minimum value between the - SizeLimit specified here and the sum of memory limits - of all containers in a pod. The default is nil which means - that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: http://kubernetes.io/docs/user-guide/volumes#emptydir pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object ephemeral: - description: "ephemeral represents a volume that is handled - by a cluster storage driver. The volume's lifecycle is tied - to the pod that defines it - it will be created before the - pod starts, and deleted when the pod is removed. \n Use this - if: a) the volume is only needed while the pod runs, b) features - of normal volumes like restoring from snapshot or capacity - \ tracking are needed, c) the storage driver is specified - through a storage class, and d) the storage driver supports - dynamic volume provisioning through a PersistentVolumeClaim - (see EphemeralVolumeSource for more information on the - connection between this volume type and PersistentVolumeClaim). - \n Use PersistentVolumeClaim or one of the vendor-specific + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle - of an individual pod. \n Use CSI for light-weight local ephemeral - volumes if the CSI driver is meant to be used that way - see - the documentation of the driver for more information. \n A - pod can use both types of ephemeral volumes and persistent - volumes at the same time." + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. properties: volumeClaimTemplate: - description: "Will be used to create a stand-alone PVC to - provision the volume. The pod in which this EphemeralVolumeSource - is embedded will be the owner of the PVC, i.e. the PVC - will be deleted together with the pod. The name of the - PVC will be `-` where `` is the name from the `PodSpec.Volumes` array entry. - Pod validation will reject the pod if the concatenated - name is not valid for a PVC (for example, too long). \n - An existing PVC with that name that is not owned by the - pod will *not* be used for the pod to avoid using an unrelated + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until - the unrelated PVC is removed. If such a pre-created PVC - is meant to be used by the pod, the PVC has to updated - with an owner reference to the pod once the pod exists. - Normally this should not be necessary, but it may be useful - when manually reconstructing a broken cluster. \n This - field is read-only and no changes will be made by Kubernetes - to the PVC after it has been created. \n Required, must - not be nil." + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. properties: metadata: - description: May contain labels and annotations that - will be copied into the PVC when creating it. No other - fields are allowed and will be rejected during validation. + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. type: object spec: - description: The specification for the PersistentVolumeClaim. - The entire content is copied unchanged into the PVC - that gets created from this template. The same fields - as in a PersistentVolumeClaim are also valid here. + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. properties: accessModes: - description: 'accessModes contains the desired access - modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify - either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the - provisioner or an external controller can support - the specified data source, it will create a new - volume based on the contents of the specified - data source. When the AnyVolumeDataSource feature - gate is enabled, dataSource contents will be copied - to dataSourceRef, and dataSourceRef contents will - be copied to dataSource when dataSourceRef.namespace - is not specified. If the namespace is specified, - then dataSourceRef will not be copied to dataSource.' + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -4764,46 +5182,38 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object - from which to populate the volume with data, if - a non-empty volume is desired. This may be any - object from a non-empty API group (non core object) - or a PersistentVolumeClaim object. When this field - is specified, volume binding will only succeed - if the type of the specified object matches some - installed volume populator or dynamic provisioner. - This field will replace the functionality of the - dataSource field and as such if both fields are - non-empty, they must have the same value. For - backwards compatibility, when namespace isn''t - specified in dataSourceRef, both fields (dataSource - and dataSourceRef) will be set to the same value - automatically if one of them is empty and the - other is non-empty. When namespace is specified - in dataSourceRef, dataSource isn''t set to the - same value and must be empty. There are three - important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types - of objects, dataSourceRef allows any non-core - object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping - them), dataSourceRef preserves all values, and - generates an error if a disallowed value is specified. - * While dataSource only allows local objects, - dataSourceRef allows objects in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource - feature gate to be enabled. (Alpha) Using the - namespace field of dataSourceRef requires the - CrossNamespaceVolumeDataSource feature gate to - be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -4814,44 +5224,41 @@ spec: referenced type: string namespace: - description: Namespace is the namespace of resource - being referenced Note that when a namespace - is specified, a gateway.networking.k8s.io/ReferenceGrant - object is required in the referent namespace - to allow that namespace's owner to accept - the reference. See the ReferenceGrant documentation - for details. (Alpha) This field requires the - CrossNamespaceVolumeDataSource feature gate - to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources - the volume should have. If RecoverVolumeExpansionFailure - feature is enabled users are allowed to specify - resource requirements that are lower than previous - value but must still be higher than capacity recorded - in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, - defined in spec.resourceClaims, that are used - by this container. \n This is an alpha field - and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name - of one entry in pod.spec.resourceClaims - of the Pod where this field is used. - It makes that resource available inside - a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -4867,8 +5274,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount - of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -4877,12 +5285,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum - amount of compute resources required. If Requests - is omitted for a container, it defaults to - Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -4894,28 +5301,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -4928,23 +5331,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the - StorageClass required by the claim. More info: - https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume - is required by the claim. Value of Filesystem - is implied when not included in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference @@ -4961,19 +5363,19 @@ spec: pod. properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. TODO: how do we prevent errors in the - filesystem from compromising the machine' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string lun: description: 'lun is Optional: FC target lun number' format: int32 type: integer readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean targetWWNs: description: 'targetWWNs is Optional: FC target worldwide @@ -4982,26 +5384,27 @@ spec: type: string type: array wwids: - description: 'wwids Optional: FC volume world wide identifiers - (wwids) Either wwids or combination of targetWWNs and - lun must be set, but not both simultaneously.' + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. items: type: string type: array type: object flexVolume: - description: flexVolume represents a generic volume resource - that is provisioned/attached using an exec based plugin. + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. properties: driver: description: driver is the name of the driver to use for this volume. type: string fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". The default filesystem depends - on FlexVolume script. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. type: string options: additionalProperties: @@ -5010,22 +5413,25 @@ spec: command options if any.' type: object readOnly: - description: 'readOnly is Optional: defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: 'secretRef is Optional: secretRef is reference - to the secret object containing sensitive information - to pass to the plugin scripts. This may be empty if no - secret object is specified. If the secret object contains - more than one secret, all secrets are passed to the plugin - scripts.' + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic required: - driver type: object @@ -5035,9 +5441,9 @@ spec: service being running properties: datasetName: - description: datasetName is Name of the dataset stored as - metadata -> name on the dataset for Flocker should be - considered as deprecated + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated type: string datasetUUID: description: datasetUUID is the UUID of the dataset. This @@ -5045,52 +5451,54 @@ spec: type: string type: object gcePersistentDisk: - description: 'gcePersistentDisk represents a GCE Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk properties: fsType: - description: 'fsType is filesystem type of the volume that - you want to mount. Tip: Ensure that the filesystem type - is supported by the host operating system. Examples: "ext4", - "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - TODO: how do we prevent errors in the filesystem from - compromising the machine' type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty). - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk format: int32 type: integer pdName: - description: 'pdName is unique name of the PD resource in - GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: boolean required: - pdName type: object gitRepo: - description: 'gitRepo represents a git repository at a particular - revision. DEPRECATED: GitRepo is deprecated. To provision - a container with a git repo, mount an EmptyDir into an InitContainer - that clones the repo using git, then mount the EmptyDir into - the Pod''s container.' + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. properties: directory: - description: directory is the target directory name. Must - not contain or start with '..'. If '.' is supplied, the - volume directory will be the git repository. Otherwise, - if specified, the volume will contain the git repository - in the subdirectory with the given name. + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. type: string repository: description: repository is the URL @@ -5103,51 +5511,58 @@ spec: - repository type: object glusterfs: - description: 'glusterfs represents a Glusterfs mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md' + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md properties: endpoints: - description: 'endpoints is the endpoint name that details - Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string path: - description: 'path is the Glusterfs volume path. More info: - https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string readOnly: - description: 'readOnly here will force the Glusterfs volume - to be mounted with read-only permissions. Defaults to - false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: boolean required: - endpoints - path type: object hostPath: - description: 'hostPath represents a pre-existing file or directory - on the host machine that is directly exposed to the container. - This is generally used for system agents or other privileged - things that are allowed to see the host machine. Most containers - will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - --- TODO(jonesdl) We need to restrict who can use host directory - mounts and who can/can not mount host directories as read/write.' + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath properties: path: - description: 'path of the directory on the host. If the - path is a symlink, it will follow the link to the real - path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string type: - description: 'type for HostPath Volume Defaults to "" More - info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string required: - path type: object iscsi: - description: 'iscsi represents an ISCSI Disk resource that is - attached to a kubelet''s host machine and then exposed to - the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md properties: chapAuthDiscovery: description: chapAuthDiscovery defines whether support iSCSI @@ -5158,55 +5573,57 @@ spec: Session CHAP authentication type: boolean fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi type: string initiatorName: - description: initiatorName is the custom iSCSI Initiator - Name. If initiatorName is specified with iscsiInterface - simultaneously, new iSCSI interface : will be created for the connection. + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. type: string iqn: description: iqn is the target iSCSI Qualified Name. type: string iscsiInterface: - description: iscsiInterface is the interface Name that uses - an iSCSI transport. Defaults to 'default' (tcp). + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). type: string lun: description: lun represents iSCSI Target Lun number. format: int32 type: integer portals: - description: portals is the iSCSI Target Portal List. The - portal is either an IP or ip_addr:port if the port is - other than default (typically TCP ports 860 and 3260). + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). items: type: string type: array readOnly: - description: readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. type: boolean secretRef: description: secretRef is the CHAP Secret for iSCSI target and initiator authentication properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic targetPortal: - description: targetPortal is iSCSI Target Portal. The Portal - is either an IP or ip_addr:port if the port is other than - default (typically TCP ports 860 and 3260). + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). type: string required: - iqn @@ -5214,43 +5631,51 @@ spec: - targetPortal type: object name: - description: 'name of the volume. Must be a DNS_LABEL and unique - within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string nfs: - description: 'nfs represents an NFS mount on the host that shares - a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs properties: path: - description: 'path that is exported by the NFS server. More - info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string readOnly: - description: 'readOnly here will force the NFS export to - be mounted with read-only permissions. Defaults to false. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: boolean server: - description: 'server is the hostname or IP address of the - NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string required: - path - server type: object persistentVolumeClaim: - description: 'persistentVolumeClaimVolumeSource represents a - reference to a PersistentVolumeClaim in the same namespace. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims properties: claimName: - description: 'claimName is the name of a PersistentVolumeClaim - in the same namespace as the pod using this volume. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims type: string readOnly: - description: readOnly Will force the ReadOnly setting in - VolumeMounts. Default false. + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. type: boolean required: - claimName @@ -5260,10 +5685,10 @@ spec: persistent disk attached and mounted on kubelets host machine properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string pdID: description: pdID is the ID that identifies Photon Controller @@ -5277,14 +5702,15 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fSType represents the filesystem type to mount - Must be a filesystem type supported by the host operating - system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean volumeID: description: volumeID uniquely identifies a Portworx volume @@ -5297,14 +5723,13 @@ spec: configmaps, and downward API properties: defaultMode: - description: defaultMode are the mode bits used to set permissions - on created files by default. Must be an octal value between - 0000 and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires decimal - values for mode bits. Directories within the path are - not affected by this setting. This might be in conflict - with other options that affect the file mode, like fsGroup, - and the result can be other mode bits set. + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer sources: @@ -5318,17 +5743,14 @@ spec: data to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced ConfigMap - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the ConfigMap, the volume - setup will error unless it is marked optional. - Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -5337,25 +5759,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -5363,16 +5781,16 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic downwardAPI: description: downwardAPI information about the downwardAPI data to project @@ -5402,18 +5820,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to - set permissions on this file, must be - an octal value between 0000 and 0777 or - a decimal value between 0 and 511. YAML - accepts both octal and decimal values, - JSON requires decimal values for mode - bits. If not specified, the volume defaultMode - will be used. This might be in conflict - with other options that affect the file - mode, like fsGroup, and the result can - be other mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -5425,10 +5840,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the - container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu - and requests.memory) are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required @@ -5450,6 +5864,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -5460,17 +5875,14 @@ spec: to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced Secret - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the Secret, the volume setup - will error unless it is marked optional. Paths - must be relative and may not contain the '..' - path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -5479,25 +5891,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -5505,44 +5913,41 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional field specify whether the Secret or its key must be defined type: boolean type: object + x-kubernetes-map-type: atomic serviceAccountToken: description: serviceAccountToken is information about the serviceAccountToken data to project properties: audience: - description: audience is the intended audience - of the token. A recipient of a token must identify - itself with an identifier specified in the audience - of the token, and otherwise should reject the - token. The audience defaults to the identifier - of the apiserver. + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. type: string expirationSeconds: - description: expirationSeconds is the requested - duration of validity of the service account - token. As the token approaches expiration, the - kubelet volume plugin will proactively rotate - the service account token. The kubelet will - start trying to rotate the token if the token - is older than 80 percent of its time to live - or if the token is older than 24 hours.Defaults - to 1 hour and must be at least 10 minutes. + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. format: int64 type: integer path: - description: path is the path relative to the - mount point of the file to project the token - into. + description: |- + path is the path relative to the mount point of the file to project the + token into. type: string required: - path @@ -5555,28 +5960,30 @@ spec: that shares a pod's lifetime properties: group: - description: group to map volume access to Default is no - group + description: |- + group to map volume access to + Default is no group type: string readOnly: - description: readOnly here will force the Quobyte volume - to be mounted with read-only permissions. Defaults to - false. + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. type: boolean registry: - description: registry represents a single or multiple Quobyte - Registry services specified as a string as host:port pair - (multiple entries are separated with commas) which acts - as the central registry for volumes + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes type: string tenant: - description: tenant owning the given Quobyte volume in the - Backend Used with dynamically provisioned Quobyte volumes, - value is set by the plugin + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin type: string user: - description: user to map volume access to Defaults to serivceaccount - user + description: |- + user to map volume access to + Defaults to serivceaccount user type: string volume: description: volume is a string that references an already @@ -5587,53 +5994,66 @@ spec: - volume type: object rbd: - description: 'rbd represents a Rados Block Device mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md' + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd type: string image: - description: 'image is the rados image name. More info: - https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string keyring: - description: 'keyring is the path to key ring for RBDUser. - Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string monitors: - description: 'monitors is a collection of Ceph monitors. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it items: type: string type: array pool: - description: 'pool is the rados pool name. Default is rbd. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: boolean secretRef: - description: 'secretRef is name of the authentication secret - for RBDUser. If provided overrides keyring. Default is - nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is the rados user name. Default is admin. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string required: - image @@ -5644,9 +6064,11 @@ spec: attached and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Default is "xfs". + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". type: string gateway: description: gateway is the host address of the ScaleIO @@ -5657,26 +6079,29 @@ spec: Protection Domain for the configured storage. type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef references to the secret for ScaleIO - user and other sensitive information. If this is not provided, - Login operation will fail. + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic sslEnabled: description: sslEnabled Flag enable/disable SSL communication with Gateway, default false type: boolean storageMode: - description: storageMode indicates whether the storage for - a volume should be ThickProvisioned or ThinProvisioned. + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. type: string storagePool: @@ -5688,9 +6113,9 @@ spec: configured in ScaleIO. type: string volumeName: - description: volumeName is the name of a volume already - created in the ScaleIO system that is associated with - this volume source. + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. type: string required: - gateway @@ -5698,31 +6123,30 @@ spec: - system type: object secret: - description: 'secret represents a secret that should populate - this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret properties: defaultMode: - description: 'defaultMode is Optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items If unspecified, each key-value pair in - the Data field of the referenced Secret will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the Secret, the volume setup will error unless it is marked - optional. Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -5730,22 +6154,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -5757,8 +6180,9 @@ spec: its keys must be defined type: boolean secretName: - description: 'secretName is the name of the secret in the - pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret type: string type: object storageos: @@ -5766,39 +6190,41 @@ spec: and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef specifies the secret to use for obtaining - the StorageOS API credentials. If not specified, default - values will be attempted. + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeName: - description: volumeName is the human-readable name of the - StorageOS volume. Volume names are only unique within - a namespace. + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. type: string volumeNamespace: - description: volumeNamespace specifies the scope of the - volume within StorageOS. If no namespace is specified - then the Pod's namespace will be used. This allows the - Kubernetes name scoping to be mirrored within StorageOS - for tighter integration. Set VolumeName to any name to - override the default behaviour. Set to "default" if you - are not using namespaces within StorageOS. Namespaces - that do not pre-exist within StorageOS will be created. + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. type: string type: object vsphereVolume: @@ -5806,10 +6232,10 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fsType is filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string storagePolicyID: description: storagePolicyID is the storage Policy Based @@ -5841,45 +6267,35 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -5894,10 +6310,6 @@ spec: type: string type: description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -5919,9 +6331,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/deploy/ydb-operator/crds/databasemonitoring.yaml b/deploy/ydb-operator/crds/databasemonitoring.yaml index c3212b7b..22545d8e 100644 --- a/deploy/ydb-operator/crds/databasemonitoring.yaml +++ b/deploy/ydb-operator/crds/databasemonitoring.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.16.5 name: databasemonitorings.ydb.tech spec: group: ydb.tech @@ -31,14 +29,19 @@ spec: API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -73,45 +76,35 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -126,10 +119,6 @@ spec: type: string type: description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -151,9 +140,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/deploy/ydb-operator/crds/databasenodeset.yaml b/deploy/ydb-operator/crds/databasenodeset.yaml index f2c3330f..d5164b28 100644 --- a/deploy/ydb-operator/crds/databasenodeset.yaml +++ b/deploy/ydb-operator/crds/databasenodeset.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.16.5 name: databasenodesets.ydb.tech spec: group: ydb.tech @@ -30,14 +28,19 @@ spec: description: DatabaseNodeSet declares StatefulSet parameters for storageRef properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -57,6 +60,12 @@ spec: description: (Optional) Additional custom resource labels that are added to all resources type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to Pods + type: object affinity: description: (Optional) If specified, the pod's scheduling constraints properties: @@ -65,22 +74,20 @@ spec: pod. properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node matches - the corresponding matchExpressions; the node(s) with the - highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. items: - description: An empty preferred scheduling term matches - all objects with implicit weight 0 (i.e. it's a no-op). - A null preferred scheduling term matches no objects (i.e. - is also a no-op). + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). properties: preference: description: A node selector term, associated with the @@ -90,30 +97,26 @@ spec: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -126,30 +129,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -159,6 +158,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. @@ -170,50 +170,46 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to an update), the system may or may not try to - eventually evict the pod from its node. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. properties: nodeSelectorTerms: description: Required. A list of node selector terms. The terms are ORed. items: - description: A null or empty node selector term matches - no objects. The requirements of them are ANDed. The - TopologySelectorTerm type implements a subset of the - NodeSelectorTerm. + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. properties: matchExpressions: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -226,30 +222,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -259,26 +251,27 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -297,28 +290,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -331,50 +320,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -387,39 +370,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -428,23 +409,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to a pod label update), the system may or may - not try to eventually evict the pod from its node. When - there are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all terms - must be satisfied. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -454,26 +434,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -485,46 +464,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -536,31 +513,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -574,16 +548,15 @@ spec: other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the anti-affinity expressions specified - by this field, but it may choose a node that violates one - or more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -602,28 +575,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -636,50 +605,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -692,39 +655,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -733,23 +694,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified by - this field are not met at scheduling time, the pod will - not be scheduled onto the node. If the anti-affinity requirements - specified by this field cease to be met at some point during - pod execution (e.g. due to a pod label update), the system - may or may not try to eventually evict the pod from its - node. When there are multiple elements, the lists of nodes - corresponding to each podAffinityTerm are intersected, i.e. - all terms must be satisfied. + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -759,26 +719,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -790,46 +749,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -841,31 +798,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -875,8 +829,9 @@ spec: type: object type: object caBundle: - description: User-defined root certificate authority that is added - to system trust store of Storage pods on startup. + description: |- + User-defined root certificate authority that is added to system trust + store of Storage pods on startup. type: string configuration: description: YDB configuration in YAML format. Will be applied on @@ -901,31 +856,14 @@ spec: properties: enabled: type: boolean - iam_service_account_key: - description: SecretKeySelector selects a key of a Secret. - properties: - key: - description: The key of the secret to select from. Must be - a valid secret key. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the Secret or its key must be - defined - type: boolean - required: - - key - type: object required: - enabled type: object domain: default: Root - description: '(Optional) Name of the root storage domain Default: - Root' + description: |- + (Optional) Name of the root storage domain + Default: Root maxLength: 63 pattern: '[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?' type: string @@ -942,8 +880,9 @@ spec: a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key must be @@ -952,6 +891,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic pin: type: string required: @@ -961,57 +901,60 @@ spec: description: (Optional) YDB Image properties: name: - description: 'Container image with supported YDB version. This - defaults to the version pinned to the operator and requires - a full container and tag/sha name. For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22' + description: |- + Container image with supported YDB version. + This defaults to the version pinned to the operator and requires a full container and tag/sha name. + For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22 type: string pullPolicy: - description: '(Optional) PullPolicy for the image, which defaults - to IfNotPresent. Default: IfNotPresent' + description: |- + (Optional) PullPolicy for the image, which defaults to IfNotPresent. + Default: IfNotPresent type: string pullSecret: - description: (Optional) Secret name containing the dockerconfig - to use for a registry that requires authentication. The secret + description: |- + (Optional) Secret name containing the dockerconfig to use for a registry that requires authentication. The secret must be configured first by the user. type: string type: object initContainers: - description: '(Optional) List of initialization containers belonging - to the pod. Init containers are executed in order prior to containers - being started. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/' + description: |- + (Optional) List of initialization containers belonging to the pod. + Init containers are executed in order prior to containers being started. + More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ items: description: A single application container that you want to run within a pod. properties: args: - description: 'Arguments to the entrypoint. The container image''s - CMD is used if this is not provided. Variable references $(VAR_NAME) - are expanded using the container''s environment. If a variable - cannot be resolved, the reference in the input string will - be unchanged. Double $$ are reduced to a single $, which allows - for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references - will never be expanded, regardless of whether the variable - exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Arguments to the entrypoint. + The container image's CMD is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array command: - description: 'Entrypoint array. Not executed within a shell. - The container image''s ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container''s - environment. If a variable cannot be resolved, the reference - in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: - i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether - the variable exists or not. Cannot be updated. More info: - https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Entrypoint array. Not executed within a shell. + The container image's ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array env: - description: List of environment variables to set in the container. + description: |- + List of environment variables to set in the container. Cannot be updated. items: description: EnvVar represents an environment variable present @@ -1022,16 +965,16 @@ spec: a C_IDENTIFIER. type: string value: - description: 'Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in - the container and any service environment variables. - If a variable cannot be resolved, the reference in the - input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) - syntax: i.e. "$$(VAR_NAME)" will produce the string - literal "$(VAR_NAME)". Escaped references will never - be expanded, regardless of whether the variable exists - or not. Defaults to "".' + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". type: string valueFrom: description: Source for the environment variable's value. @@ -1044,10 +987,9 @@ spec: description: The key to select. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap or @@ -1056,12 +998,11 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: - description: 'Selects a field of the pod: supports - metadata.name, metadata.namespace, `metadata.labels['''']`, - `metadata.annotations['''']`, spec.nodeName, - spec.serviceAccountName, status.hostIP, status.podIP, - status.podIPs.' + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. properties: apiVersion: description: Version of the schema the FieldPath @@ -1074,12 +1015,11 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, limits.ephemeral-storage, requests.cpu, - requests.memory and requests.ephemeral-storage) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -1099,6 +1039,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -1108,10 +1049,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its @@ -1120,19 +1060,20 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name type: object type: array envFrom: - description: List of sources to populate environment variables - in the container. The keys defined within a source must be - a C_IDENTIFIER. All invalid keys will be reported as an event - when the container is starting. When a key exists in multiple - sources, the value associated with the last source will take - precedence. Values defined by an Env with a duplicate key - will take precedence. Cannot be updated. + description: |- + List of sources to populate environment variables in the container. + The keys defined within a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will take precedence. + Cannot be updated. items: description: EnvFromSource represents the source of a set of ConfigMaps @@ -1141,15 +1082,16 @@ spec: description: The ConfigMap to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -1158,51 +1100,54 @@ spec: description: The Secret to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: - description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management - to default or override container images in workload controllers - like Deployments and StatefulSets.' + description: |- + Container image name. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. type: string imagePullPolicy: - description: 'Image pull policy. One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent - otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + description: |- + Image pull policy. + One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images type: string lifecycle: - description: Actions that the management system should take - in response to container lifecycle events. Cannot be updated. + description: |- + Actions that the management system should take in response to container lifecycle events. + Cannot be updated. properties: postStart: - description: 'PostStart is called immediately after a container - is created. If the handler fails, the container is terminated - and restarted according to its restart policy. Other management - of the container blocks until the hook completes. More - info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PostStart is called immediately after a container is created. If the handler fails, + the container is terminated and restarted according to its restart policy. + Other management of the container blocks until the hook completes. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1211,9 +1156,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1223,7 +1168,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1240,22 +1187,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1265,40 +1214,37 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object type: object preStop: - description: 'PreStop is called immediately before a container - is terminated due to an API request or management event - such as liveness/startup probe failure, preemption, resource - contention, etc. The handler is not called if the container - crashes or exits. The Pod''s termination grace period - countdown begins before the PreStop hook is executed. - Regardless of the outcome of the handler, the container - will eventually terminate within the Pod''s termination - grace period (unless delayed by finalizers). Other management - of the container blocks until the hook completes or until - the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PreStop is called immediately before a container is terminated due to an + API request or management event such as liveness/startup probe failure, + preemption, resource contention, etc. The handler is not called if the + container crashes or exits. The Pod's termination grace period countdown begins before the + PreStop hook is executed. Regardless of the outcome of the handler, the + container will eventually terminate within the Pod's termination grace + period (unless delayed by finalizers). Other management of the container blocks until the hook completes + or until the termination grace period is reached. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1307,9 +1253,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1319,7 +1265,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1336,22 +1284,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1361,9 +1311,10 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port @@ -1371,36 +1322,36 @@ spec: type: object type: object livenessProbe: - description: 'Periodic probe of container liveness. Container - will be restarted if the probe fails. Cannot be updated. More - info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container liveness. + Container will be restarted if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1408,10 +1359,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1420,9 +1373,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1432,7 +1385,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1449,33 +1404,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1490,78 +1447,82 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object name: - description: Name of the container specified as a DNS_LABEL. + description: |- + Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. type: string ports: - description: List of ports to expose from the container. Not - specifying a port here DOES NOT prevent that port from being - exposed. Any port which is listening on the default "0.0.0.0" - address inside a container will be accessible from the network. - Modifying this array with strategic merge patch may corrupt - the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. + description: |- + List of ports to expose from the container. Not specifying a port here + DOES NOT prevent that port from being exposed. Any port which is + listening on the default "0.0.0.0" address inside a container will be + accessible from the network. + Modifying this array with strategic merge patch may corrupt the data. + For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated. items: description: ContainerPort represents a network port in a single container. properties: containerPort: - description: Number of port to expose on the pod's IP - address. This must be a valid port number, 0 < x < 65536. + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. format: int32 type: integer hostIP: description: What host IP to bind the external port to. type: string hostPort: - description: Number of port to expose on the host. If - specified, this must be a valid port number, 0 < x < - 65536. If HostNetwork is specified, this must match - ContainerPort. Most containers do not need this. + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. format: int32 type: integer name: - description: If specified, this must be an IANA_SVC_NAME - and unique within the pod. Each named port in a pod - must have a unique name. Name for the port that can - be referred to by services. + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. type: string protocol: default: TCP - description: Protocol for port. Must be UDP, TCP, or SCTP. + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP". type: string required: @@ -1573,36 +1534,36 @@ spec: - protocol x-kubernetes-list-type: map readinessProbe: - description: 'Periodic probe of container service readiness. - Container will be removed from service endpoints if the probe - fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1610,10 +1571,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1622,9 +1585,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1634,7 +1597,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1651,33 +1616,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1692,53 +1659,58 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object resources: - description: 'Compute Resources required by this container. - Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Compute Resources required by this container. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -1755,8 +1727,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -1765,33 +1738,34 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object securityContext: - description: 'SecurityContext defines the security options the - container should be run with. If set, the fields of SecurityContext - override the equivalent fields of PodSecurityContext. More - info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + description: |- + SecurityContext defines the security options the container should be run with. + If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ properties: allowPrivilegeEscalation: - description: 'AllowPrivilegeEscalation controls whether - a process can gain more privileges than its parent process. - This bool directly controls if the no_new_privs flag will - be set on the container process. AllowPrivilegeEscalation - is true always when the container is: 1) run as Privileged - 2) has CAP_SYS_ADMIN Note that this field cannot be set - when spec.os.name is windows.' + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. type: boolean capabilities: - description: The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by - the container runtime. Note that this field cannot be - set when spec.os.name is windows. + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. properties: add: description: Added capabilities @@ -1809,60 +1783,60 @@ spec: type: array type: object privileged: - description: Run container in privileged mode. Processes - in privileged containers are essentially equivalent to - root on the host. Defaults to false. Note that this field - cannot be set when spec.os.name is windows. + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. type: boolean procMount: - description: procMount denotes the type of proc mount to - use for the containers. The default is DefaultProcMount - which uses the container runtime defaults for readonly - paths and masked paths. This requires the ProcMountType - feature flag to be enabled. Note that this field cannot - be set when spec.os.name is windows. + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. type: string readOnlyRootFilesystem: - description: Whether this container has a read-only root - filesystem. Default is false. Note that this field cannot - be set when spec.os.name is windows. + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. type: boolean runAsGroup: - description: The GID to run the entrypoint of the container - process. Uses runtime default if unset. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer runAsNonRoot: - description: Indicates that the container must run as a - non-root user. If true, the Kubelet will validate the - image at runtime to ensure that it does not run as UID - 0 (root) and fail to start the container if it does. If - unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both - SecurityContext and PodSecurityContext, the value specified - in SecurityContext takes precedence. + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: boolean runAsUser: - description: The UID to run the entrypoint of the container - process. Defaults to user specified in image metadata - if unspecified. May also be set in PodSecurityContext. If - set in both SecurityContext and PodSecurityContext, the - value specified in SecurityContext takes precedence. Note - that this field cannot be set when spec.os.name is windows. + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer seLinuxOptions: - description: The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a - random SELinux context for each container. May also be - set in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. properties: level: description: Level is SELinux level label that applies @@ -1882,108 +1856,101 @@ spec: type: string type: object seccompProfile: - description: The seccomp options to use by this container. - If seccomp options are provided at both the pod & container - level, the container options override the pod options. - Note that this field cannot be set when spec.os.name is - windows. + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. properties: localhostProfile: - description: localhostProfile indicates a profile defined - in a file on the node should be used. The profile - must be preconfigured on the node to work. Must be - a descending path, relative to the kubelet's configured - seccomp profile location. Must only be set if type - is "Localhost". + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". type: string type: - description: "type indicates which kind of seccomp profile - will be applied. Valid options are: \n Localhost - - a profile defined in a file on the node should be - used. RuntimeDefault - the container runtime default - profile should be used. Unconfined - no profile should - be applied." + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. type: string required: - type type: object windowsOptions: - description: The Windows specific settings applied to all - containers. If unspecified, the options from the PodSecurityContext - will be used. If set in both SecurityContext and PodSecurityContext, - the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is - linux. + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. properties: gmsaCredentialSpec: - description: GMSACredentialSpec is where the GMSA admission - webhook (https://github.com/kubernetes-sigs/windows-gmsa) - inlines the contents of the GMSA credential spec named - by the GMSACredentialSpecName field. + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. type: string gmsaCredentialSpecName: description: GMSACredentialSpecName is the name of the GMSA credential spec to use. type: string hostProcess: - description: HostProcess determines if a container should - be run as a 'Host Process' container. This field is - alpha-level and will only be honored by components - that enable the WindowsHostProcessContainers feature - flag. Setting this field without the feature flag - will result in errors when validating the Pod. All - of a Pod's containers must have the same effective - HostProcess value (it is not allowed to have a mix - of HostProcess containers and non-HostProcess containers). In - addition, if HostProcess is true then HostNetwork - must also be set to true. + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. type: boolean runAsUserName: - description: The UserName in Windows to run the entrypoint - of the container process. Defaults to the user specified - in image metadata if unspecified. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: string type: object type: object startupProbe: - description: 'StartupProbe indicates that the Pod has successfully - initialized. If specified, no other probes are executed until - this completes successfully. If this probe fails, the Pod - will be restarted, just as if the livenessProbe failed. This - can be used to provide different probe parameters at the beginning - of a Pod''s lifecycle, when it might take a long time to load - data or warm a cache, than during steady-state operation. - This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + StartupProbe indicates that the Pod has successfully initialized. + If specified, no other probes are executed until this completes successfully. + If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + when it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1991,10 +1958,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -2003,9 +1972,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -2015,7 +1984,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -2032,33 +2003,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -2073,77 +2046,76 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object stdin: - description: Whether this container should allocate a buffer - for stdin in the container runtime. If this is not set, reads - from stdin in the container will always result in EOF. Default - is false. + description: |- + Whether this container should allocate a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will always result in EOF. + Default is false. type: boolean stdinOnce: - description: Whether the container runtime should close the - stdin channel after it has been opened by a single attach. - When stdin is true the stdin stream will remain open across - multiple attach sessions. If stdinOnce is set to true, stdin - is opened on container start, is empty until the first client - attaches to stdin, and then remains open and accepts data - until the client disconnects, at which time stdin is closed - and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin - will never receive an EOF. Default is false + description: |- + Whether the container runtime should close the stdin channel after it has been opened by + a single attach. When stdin is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + first client attaches to stdin, and then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container is restarted. If this + flag is false, a container processes that reads from stdin will never receive an EOF. + Default is false type: boolean terminationMessagePath: - description: 'Optional: Path at which the file to which the - container''s termination message will be written is mounted - into the container''s filesystem. Message written is intended - to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. - The total message length across all containers will be limited - to 12kb. Defaults to /dev/termination-log. Cannot be updated.' + description: |- + Optional: Path at which the file to which the container's termination message + will be written is mounted into the container's filesystem. + Message written is intended to be brief final status, such as an assertion failure message. + Will be truncated by the node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. + Defaults to /dev/termination-log. + Cannot be updated. type: string terminationMessagePolicy: - description: Indicate how the termination message should be - populated. File will use the contents of terminationMessagePath - to populate the container status message on both success and - failure. FallbackToLogsOnError will use the last chunk of - container log output if the termination message file is empty - and the container exited with an error. The log output is - limited to 2048 bytes or 80 lines, whichever is smaller. Defaults - to File. Cannot be updated. + description: |- + Indicate how the termination message should be populated. File will use the contents of + terminationMessagePath to populate the container status message on both success and failure. + FallbackToLogsOnError will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + Defaults to File. + Cannot be updated. type: string tty: - description: Whether this container should allocate a TTY for - itself, also requires 'stdin' to be true. Default is false. + description: |- + Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + Default is false. type: boolean volumeDevices: description: volumeDevices is the list of block devices to be @@ -2166,40 +2138,44 @@ spec: type: object type: array volumeMounts: - description: Pod volumes to mount into the container's filesystem. + description: |- + Pod volumes to mount into the container's filesystem. Cannot be updated. items: description: VolumeMount describes a mounting of a Volume within a container. properties: mountPath: - description: Path within the container at which the volume - should be mounted. Must not contain ':'. + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. type: string mountPropagation: - description: mountPropagation determines how mounts are - propagated from the host to container and the other - way around. When not set, MountPropagationNone is used. + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. This field is beta in 1.10. type: string name: description: This must match the Name of a Volume. type: string readOnly: - description: Mounted read-only if true, read-write otherwise - (false or unspecified). Defaults to false. + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. type: boolean subPath: - description: Path within the volume from which the container's - volume should be mounted. Defaults to "" (volume's root). + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). type: string subPathExpr: - description: Expanded path within the volume from which - the container's volume should be mounted. Behaves similarly - to SubPath but environment variable references $(VAR_NAME) - are expanded using the container's environment. Defaults - to "" (volume's root). SubPathExpr and SubPath are mutually - exclusive. + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. type: string required: - mountPath @@ -2207,17 +2183,20 @@ spec: type: object type: array workingDir: - description: Container's working directory. If not specified, - the container runtime's default will be used, which might - be configured in the container image. Cannot be updated. + description: |- + Container's working directory. + If not specified, the container runtime's default will be used, which + might be configured in the container image. + Cannot be updated. type: string required: - name type: object type: array monitoring: - description: '(Optional) Monitoring sets configuration options for - YDB observability Default: ""' + description: |- + (Optional) Monitoring sets configuration options for YDB observability + Default: "" properties: enabled: type: boolean @@ -2228,10 +2207,10 @@ spec: description: RelabelConfig allows dynamic rewriting of the label set, being applied to sample before ingestion. items: - description: 'RelabelConfig allows dynamic rewriting of the - label set, being applied to samples before ingestion. It defines - ``-section of Prometheus configuration. - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs' + description: |- + RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. + It defines ``-section of Prometheus configuration. + More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs properties: action: description: Action to perform based on regex matching. @@ -2247,26 +2226,26 @@ spec: value is matched. Default is '(.*)' type: string replacement: - description: Replacement value against which a regex replace - is performed if the regular expression matches. Regex - capture groups are available. Default is '$1' + description: |- + Replacement value against which a regex replace is performed if the + regular expression matches. Regex capture groups are available. Default is '$1' type: string separator: description: Separator placed between concatenated source label values. default is ';'. type: string sourceLabels: - description: The source labels select values from existing - labels. Their content is concatenated using the configured - separator and matched against the configured regular expression + description: |- + The source labels select values from existing labels. Their content is concatenated + using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions. items: type: string type: array targetLabel: - description: Label to which the resulting value is written - in a replace action. It is mandatory for replace actions. - Regex capture groups are available. + description: |- + Label to which the resulting value is written in a replace action. + It is mandatory for replace actions. Regex capture groups are available. type: string type: object type: array @@ -2276,9 +2255,10 @@ spec: nodeSelector: additionalProperties: type: string - description: '(Optional) NodeSelector is a selector which must be - true for the pod to fit on a node. Selector which must match a node''s - labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object nodes: description: Number of nodes (pods) in the cluster @@ -2286,24 +2266,25 @@ spec: type: integer operatorSync: default: true - description: Enables or disables operator's reconcile loop. `false` - means all the Pods are running, but the reconcile is effectively - turned off. `true` means the default state of the system, all Pods - running, operator reacts to specification change of this Database - resource. + description: |- + Enables or disables operator's reconcile loop. + `false` means all the Pods are running, but the reconcile is effectively turned off. + `true` means the default state of the system, all Pods running, operator reacts + to specification change of this Database resource. type: boolean path: - description: '(Optional) Custom database path in schemeshard Default: - //' + description: |- + (Optional) Custom database path in schemeshard + Default: // maxLength: 255 pattern: /[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?/[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?(/[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?)* type: string pause: default: false - description: The state of the Database processes. `true` means all - the Database Pods are being killed, but the Database resource is - persisted. `false` means the default state of the system, all Pods - running. + description: |- + The state of the Database processes. + `true` means all the Database Pods are being killed, but the Database resource is persisted. + `false` means the default state of the system, all Pods running. type: boolean priorityClassName: description: (Optional) If specified, the pod's priorityClassName. @@ -2312,22 +2293,28 @@ spec: description: (Optional) Database storage and compute resources properties: containerResources: - description: '(Optional) Database container resource limits. Any - container limits can be specified. Default: (not specified)' + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry in - pod.spec.resourceClaims of the Pod where this field - is used. It makes that resource available inside a - container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -2343,8 +2330,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -2353,16 +2341,18 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object storageUnits: - description: 'Kind of the storage unit. Determine guarantees for - all main unit parameters: used hard disk type, capacity throughput, - IOPS etc.' + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. items: properties: count: @@ -2370,29 +2360,206 @@ spec: format: int64 type: integer unitKind: - description: 'Kind of the storage unit. Determine guarantees + description: |- + Kind of the storage unit. Determine guarantees for all main unit parameters: used hard disk type, capacity - throughput, IOPS etc.' + throughput, IOPS etc. type: string required: - count - unitKind type: object type: array + required: + - storageUnits type: object secrets: - description: 'Secret names that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/secrets//`' + description: |- + Secret names that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/secrets//` items: - description: LocalObjectReference contains enough information to - let you locate the referenced object inside the same namespace. + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic type: array + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies to + the container. + type: string + role: + description: Role is a SELinux role label that applies to + the container. + type: string + type: + description: Type is a SELinux type label that applies to + the container. + type: string + user: + description: User is a SELinux user label that applies to + the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the GMSA + credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object serverlessResources: description: (Optional) If specified, created database will be "serverless". properties: @@ -2415,8 +2582,9 @@ spec: - sharedDatabaseRef type: object service: - description: '(Optional) Storage services parameter overrides Default: - (not specified)' + description: |- + (Optional) Storage services parameter overrides + Default: (not specified) properties: datastreams: properties: @@ -2430,9 +2598,9 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -2449,9 +2617,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2460,6 +2628,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -2468,9 +2637,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2479,6 +2648,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -2489,9 +2659,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2500,6 +2670,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -2516,11 +2687,28 @@ spec: type: object externalHost: type: string + externalPort: + format: int32 + type: integer + ipDiscovery: + properties: + enabled: + type: boolean + ipFamily: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + targetNameOverride: + type: string + required: + - enabled + type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -2537,9 +2725,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2548,6 +2736,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -2556,9 +2745,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2567,6 +2756,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -2577,9 +2767,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2588,6 +2778,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -2604,9 +2795,9 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -2623,9 +2814,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2634,6 +2825,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -2642,9 +2834,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2653,6 +2845,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -2663,9 +2856,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2674,6 +2867,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -2690,15 +2884,82 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: description: IPFamilyPolicy represents the dual-stack-ness requested or required by a Service type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object type: object type: object sharedResources: @@ -2706,22 +2967,28 @@ spec: databases. properties: containerResources: - description: '(Optional) Database container resource limits. Any - container limits can be specified. Default: (not specified)' + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry in - pod.spec.resourceClaims of the Pod where this field - is used. It makes that resource available inside a - container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -2737,8 +3004,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -2747,16 +3015,18 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object storageUnits: - description: 'Kind of the storage unit. Determine guarantees for - all main unit parameters: used hard disk type, capacity throughput, - IOPS etc.' + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. items: properties: count: @@ -2764,15 +3034,18 @@ spec: format: int64 type: integer unitKind: - description: 'Kind of the storage unit. Determine guarantees + description: |- + Kind of the storage unit. Determine guarantees for all main unit parameters: used hard disk type, capacity - throughput, IOPS etc.' + throughput, IOPS etc. type: string required: - count - unitKind type: object type: array + required: + - storageUnits type: object storageClusterRef: description: YDB Storage cluster reference @@ -2791,81 +3064,86 @@ spec: storageEndpoint: description: YDB Storage Node broker address type: string + terminationGracePeriodSeconds: + description: (Optional) If specified, the pod's terminationGracePeriodSeconds. + format: int64 + type: integer tolerations: description: (Optional) If specified, the pod's tolerations. items: - description: The pod this Toleration is attached to tolerates any - taint that matches the triple using the matching - operator . + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . properties: effect: - description: Effect indicates the taint effect to match. Empty - means match all taint effects. When specified, allowed values - are NoSchedule, PreferNoSchedule and NoExecute. + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. type: string key: - description: Key is the taint key that the toleration applies - to. Empty means match all taint keys. If the key is empty, - operator must be Exists; this combination means to match all - values and all keys. + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. type: string operator: - description: Operator represents a key's relationship to the - value. Valid operators are Exists and Equal. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod - can tolerate all taints of a particular category. + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. type: string tolerationSeconds: - description: TolerationSeconds represents the period of time - the toleration (which must be of effect NoExecute, otherwise - this field is ignored) tolerates the taint. By default, it - is not set, which means tolerate the taint forever (do not - evict). Zero and negative values will be treated as 0 (evict - immediately) by the system. + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. format: int64 type: integer value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. type: string type: object type: array topologySpreadConstraints: - description: (Optional) If specified, the pod's topologySpreadConstraints. + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. All topologySpreadConstraints are ANDed. items: description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. properties: labelSelector: - description: LabelSelector is used to find matching pods. Pods - that match this label selector are counted to determine the - number of pods in their corresponding topology domain. + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists or - DoesNotExist, the values array must be empty. This - array is replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -2877,121 +3155,125 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is - "key", the operator is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select - the pods over which spreading will be calculated. The keys - are used to lookup values from the incoming pod labels, those - key-value labels are ANDed with labelSelector to select the - group of existing pods over which spreading will be calculated - for the incoming pod. Keys that don't exist in the incoming - pod labels will be ignored. A null or empty list means only - match against labelSelector. + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. items: type: string type: array x-kubernetes-list-type: atomic maxSkew: - description: 'MaxSkew describes the degree to which pods may - be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, - it is the maximum permitted difference between the number - of matching pods in the target topology and the global minimum. - The global minimum is the minimum number of matching pods - in an eligible domain or zero if the number of eligible domains - is less than MinDomains. For example, in a 3-zone cluster, - MaxSkew is set to 1, and pods with the same labelSelector - spread as 2/2/1: In this case, the global minimum is 1. | - zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew - is 1, incoming pod can only be scheduled to zone3 to become - 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) - on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming - pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, - it is used to give higher precedence to topologies that satisfy - it. It''s a required field. Default value is 1 and 0 is not - allowed.' + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. format: int32 type: integer minDomains: - description: "MinDomains indicates a minimum number of eligible - domains. When the number of eligible domains with matching - topology keys is less than minDomains, Pod Topology Spread - treats \"global minimum\" as 0, and then the calculation of - Skew is performed. And when the number of eligible domains - with matching topology keys equals or greater than minDomains, - this value has no effect on scheduling. As a result, when - the number of eligible domains is less than minDomains, scheduler - won't schedule more than maxSkew Pods to those domains. If - value is nil, the constraint behaves as if MinDomains is equal - to 1. Valid values are integers greater than 0. When value - is not nil, WhenUnsatisfiable must be DoNotSchedule. \n For - example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains - is set to 5 and pods with the same labelSelector spread as - 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | - The number of domains is less than 5(MinDomains), so \"global - minimum\" is treated as 0. In this situation, new pod with - the same labelSelector cannot be scheduled, because computed - skew will be 3(3 - 0) if new Pod is scheduled to any of the - three zones, it will violate MaxSkew. \n This is a beta field - and requires the MinDomainsInPodTopologySpread feature gate - to be enabled (enabled by default)." + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). format: int32 type: integer nodeAffinityPolicy: - description: "NodeAffinityPolicy indicates how we will treat - Pod's nodeAffinity/nodeSelector when calculating pod topology - spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector - are included in the calculations. - Ignore: nodeAffinity/nodeSelector - are ignored. All nodes are included in the calculations. \n - If this value is nil, the behavior is equivalent to the Honor - policy. This is a beta-level feature default enabled by the - NodeInclusionPolicyInPodTopologySpread feature flag." + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string nodeTaintsPolicy: - description: "NodeTaintsPolicy indicates how we will treat node - taints when calculating pod topology spread skew. Options - are: - Honor: nodes without taints, along with tainted nodes - for which the incoming pod has a toleration, are included. + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - \n If this value is nil, the behavior is equivalent to the - Ignore policy. This is a beta-level feature default enabled - by the NodeInclusionPolicyInPodTopologySpread feature flag." + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string topologyKey: - description: TopologyKey is the key of node labels. Nodes that - have a label with this key and identical values are considered - to be in the same topology. We consider each - as a "bucket", and try to put balanced number of pods into - each bucket. We define a domain as a particular instance of - a topology. Also, we define an eligible domain as a domain - whose nodes meet the requirements of nodeAffinityPolicy and - nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", - each Node is a domain of that topology. And, if TopologyKey - is "topology.kubernetes.io/zone", each zone is a domain of - that topology. It's a required field. + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. type: string whenUnsatisfiable: - description: 'WhenUnsatisfiable indicates how to deal with a - pod if it doesn''t satisfy the spread constraint. - DoNotSchedule - (default) tells the scheduler not to schedule it. - ScheduleAnyway - tells the scheduler to schedule the pod in any location, but - giving higher precedence to topologies that would help reduce - the skew. A constraint is considered "Unsatisfiable" for - an incoming pod if and only if every possible node assignment - for that pod would violate "MaxSkew" on some topology. For - example, in a 3-zone cluster, MaxSkew is set to 1, and pods - with the same labelSelector spread as 3/1/1: | zone1 | zone2 - | zone3 | | P P P | P | P | If WhenUnsatisfiable is - set to DoNotSchedule, incoming pod can only be scheduled to - zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on - zone2(zone3) satisfies MaxSkew(1). In other words, the cluster - can still be imbalanced, but scheduler won''t make it *more* - imbalanced. It''s a required field.' + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. type: string required: - maxSkew @@ -3004,46 +3286,49 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map version: - description: '(Optional) YDBVersion sets the explicit version of the - YDB image Default: ""' + description: |- + (Optional) YDBVersion sets the explicit version of the YDB image + Default: "" type: string volumes: - description: 'Additional volumes that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/volumes/`. - Only `hostPath` volume type is supported for now.' + description: |- + Additional volumes that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/volumes/`. + Only `hostPath` volume type is supported for now. items: description: Volume represents a named volume in a pod that may be accessed by any container in the pod. properties: awsElasticBlockStore: - description: 'awsElasticBlockStore represents an AWS Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty).' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). format: int32 type: integer readOnly: - description: 'readOnly value true will force the readOnly - setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: boolean volumeID: - description: 'volumeID is unique ID of the persistent disk - resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string required: - volumeID @@ -3065,10 +3350,10 @@ spec: storage type: string fsType: - description: fsType is Filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string kind: description: 'kind expected values are Shared: multiple @@ -3077,8 +3362,9 @@ spec: disk (only in managed availability set). defaults to shared' type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean required: - diskName @@ -3089,8 +3375,9 @@ spec: on the host and bind mount to the pod. properties: readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretName: description: secretName is the name of secret that contains @@ -3108,8 +3395,9 @@ spec: shares a pod's lifetime properties: monitors: - description: 'monitors is Required: Monitors is a collection - of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it items: type: string type: array @@ -3118,59 +3406,70 @@ spec: rather than the full Ceph tree, default is /' type: string readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: boolean secretFile: - description: 'secretFile is Optional: SecretFile is the - path to key ring for User, default is /etc/ceph/user.secret - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string secretRef: - description: 'secretRef is Optional: SecretRef is reference - to the authentication secret for User, default is empty. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is optional: User is the rados user name, - default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string required: - monitors type: object cinder: - description: 'cinder represents a cinder volume attached and - mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to - be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string readOnly: - description: 'readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: boolean secretRef: - description: 'secretRef is optional: points to a secret - object containing parameters used to connect to OpenStack.' + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeID: - description: 'volumeID used to identify the volume in cinder. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string required: - volumeID @@ -3180,27 +3479,25 @@ spec: this volume properties: defaultMode: - description: 'defaultMode is optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items if unspecified, each key-value pair in - the Data field of the referenced ConfigMap will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the ConfigMap, the volume setup will error unless it is - marked optional. Paths must be relative and may not contain - the '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -3208,22 +3505,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -3231,54 +3527,58 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic csi: description: csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature). properties: driver: - description: driver is the name of the CSI driver that handles - this volume. Consult with your admin for the correct name - as registered in the cluster. + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. type: string fsType: - description: fsType to mount. Ex. "ext4", "xfs", "ntfs". - If not provided, the empty value is passed to the associated - CSI driver which will determine the default filesystem - to apply. + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. type: string nodePublishSecretRef: - description: nodePublishSecretRef is a reference to the - secret object containing sensitive information to pass - to the CSI driver to complete the CSI NodePublishVolume - and NodeUnpublishVolume calls. This field is optional, - and may be empty if no secret is required. If the secret - object contains more than one secret, all secret references - are passed. + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic readOnly: - description: readOnly specifies a read-only configuration - for the volume. Defaults to false (read/write). + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). type: boolean volumeAttributes: additionalProperties: type: string - description: volumeAttributes stores driver-specific properties - that are passed to the CSI driver. Consult your driver's - documentation for supported values. + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. type: object required: - driver @@ -3288,16 +3588,15 @@ spec: that should populate this volume properties: defaultMode: - description: 'Optional: mode bits to use on created files - by default. Must be a Optional: mode bits used to set - permissions on created files by default. Must be an octal - value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: @@ -3322,16 +3621,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to set permissions - on this file, must be an octal value between 0000 - and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires - decimal values for mode bits. If not specified, - the volume defaultMode will be used. This might - be in conflict with other options that affect the - file mode, like fsGroup, and the result can be other - mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -3342,10 +3640,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, requests.cpu and requests.memory) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -3365,113 +3662,125 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object type: array type: object emptyDir: - description: 'emptyDir represents a temporary directory that - shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir properties: medium: - description: 'medium represents what type of storage medium - should back this directory. The default is "" which means - to use the node''s default medium. Must be an empty string - (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir type: string sizeLimit: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage - required for this EmptyDir volume. The size limit is also - applicable for memory medium. The maximum usage on memory - medium EmptyDir would be the minimum value between the - SizeLimit specified here and the sum of memory limits - of all containers in a pod. The default is nil which means - that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: http://kubernetes.io/docs/user-guide/volumes#emptydir pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object ephemeral: - description: "ephemeral represents a volume that is handled - by a cluster storage driver. The volume's lifecycle is tied - to the pod that defines it - it will be created before the - pod starts, and deleted when the pod is removed. \n Use this - if: a) the volume is only needed while the pod runs, b) features - of normal volumes like restoring from snapshot or capacity - \ tracking are needed, c) the storage driver is specified - through a storage class, and d) the storage driver supports - dynamic volume provisioning through a PersistentVolumeClaim - (see EphemeralVolumeSource for more information on the - connection between this volume type and PersistentVolumeClaim). - \n Use PersistentVolumeClaim or one of the vendor-specific + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle - of an individual pod. \n Use CSI for light-weight local ephemeral - volumes if the CSI driver is meant to be used that way - see - the documentation of the driver for more information. \n A - pod can use both types of ephemeral volumes and persistent - volumes at the same time." + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. properties: volumeClaimTemplate: - description: "Will be used to create a stand-alone PVC to - provision the volume. The pod in which this EphemeralVolumeSource - is embedded will be the owner of the PVC, i.e. the PVC - will be deleted together with the pod. The name of the - PVC will be `-` where `` is the name from the `PodSpec.Volumes` array entry. - Pod validation will reject the pod if the concatenated - name is not valid for a PVC (for example, too long). \n - An existing PVC with that name that is not owned by the - pod will *not* be used for the pod to avoid using an unrelated + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until - the unrelated PVC is removed. If such a pre-created PVC - is meant to be used by the pod, the PVC has to updated - with an owner reference to the pod once the pod exists. - Normally this should not be necessary, but it may be useful - when manually reconstructing a broken cluster. \n This - field is read-only and no changes will be made by Kubernetes - to the PVC after it has been created. \n Required, must - not be nil." + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. properties: metadata: - description: May contain labels and annotations that - will be copied into the PVC when creating it. No other - fields are allowed and will be rejected during validation. + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. type: object spec: - description: The specification for the PersistentVolumeClaim. - The entire content is copied unchanged into the PVC - that gets created from this template. The same fields - as in a PersistentVolumeClaim are also valid here. + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. properties: accessModes: - description: 'accessModes contains the desired access - modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify - either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the - provisioner or an external controller can support - the specified data source, it will create a new - volume based on the contents of the specified - data source. When the AnyVolumeDataSource feature - gate is enabled, dataSource contents will be copied - to dataSourceRef, and dataSourceRef contents will - be copied to dataSource when dataSourceRef.namespace - is not specified. If the namespace is specified, - then dataSourceRef will not be copied to dataSource.' + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -3485,46 +3794,38 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object - from which to populate the volume with data, if - a non-empty volume is desired. This may be any - object from a non-empty API group (non core object) - or a PersistentVolumeClaim object. When this field - is specified, volume binding will only succeed - if the type of the specified object matches some - installed volume populator or dynamic provisioner. - This field will replace the functionality of the - dataSource field and as such if both fields are - non-empty, they must have the same value. For - backwards compatibility, when namespace isn''t - specified in dataSourceRef, both fields (dataSource - and dataSourceRef) will be set to the same value - automatically if one of them is empty and the - other is non-empty. When namespace is specified - in dataSourceRef, dataSource isn''t set to the - same value and must be empty. There are three - important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types - of objects, dataSourceRef allows any non-core - object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping - them), dataSourceRef preserves all values, and - generates an error if a disallowed value is specified. - * While dataSource only allows local objects, - dataSourceRef allows objects in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource - feature gate to be enabled. (Alpha) Using the - namespace field of dataSourceRef requires the - CrossNamespaceVolumeDataSource feature gate to - be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -3535,44 +3836,41 @@ spec: referenced type: string namespace: - description: Namespace is the namespace of resource - being referenced Note that when a namespace - is specified, a gateway.networking.k8s.io/ReferenceGrant - object is required in the referent namespace - to allow that namespace's owner to accept - the reference. See the ReferenceGrant documentation - for details. (Alpha) This field requires the - CrossNamespaceVolumeDataSource feature gate - to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources - the volume should have. If RecoverVolumeExpansionFailure - feature is enabled users are allowed to specify - resource requirements that are lower than previous - value but must still be higher than capacity recorded - in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, - defined in spec.resourceClaims, that are used - by this container. \n This is an alpha field - and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name - of one entry in pod.spec.resourceClaims - of the Pod where this field is used. - It makes that resource available inside - a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -3588,8 +3886,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount - of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3598,12 +3897,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum - amount of compute resources required. If Requests - is omitted for a container, it defaults to - Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -3615,28 +3913,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3649,23 +3943,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the - StorageClass required by the claim. More info: - https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume - is required by the claim. Value of Filesystem - is implied when not included in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference @@ -3682,19 +3975,19 @@ spec: pod. properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. TODO: how do we prevent errors in the - filesystem from compromising the machine' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string lun: description: 'lun is Optional: FC target lun number' format: int32 type: integer readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean targetWWNs: description: 'targetWWNs is Optional: FC target worldwide @@ -3703,26 +3996,27 @@ spec: type: string type: array wwids: - description: 'wwids Optional: FC volume world wide identifiers - (wwids) Either wwids or combination of targetWWNs and - lun must be set, but not both simultaneously.' + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. items: type: string type: array type: object flexVolume: - description: flexVolume represents a generic volume resource - that is provisioned/attached using an exec based plugin. + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. properties: driver: description: driver is the name of the driver to use for this volume. type: string fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". The default filesystem depends - on FlexVolume script. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. type: string options: additionalProperties: @@ -3731,22 +4025,25 @@ spec: command options if any.' type: object readOnly: - description: 'readOnly is Optional: defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: 'secretRef is Optional: secretRef is reference - to the secret object containing sensitive information - to pass to the plugin scripts. This may be empty if no - secret object is specified. If the secret object contains - more than one secret, all secrets are passed to the plugin - scripts.' + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic required: - driver type: object @@ -3756,9 +4053,9 @@ spec: service being running properties: datasetName: - description: datasetName is Name of the dataset stored as - metadata -> name on the dataset for Flocker should be - considered as deprecated + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated type: string datasetUUID: description: datasetUUID is the UUID of the dataset. This @@ -3766,52 +4063,54 @@ spec: type: string type: object gcePersistentDisk: - description: 'gcePersistentDisk represents a GCE Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk properties: fsType: - description: 'fsType is filesystem type of the volume that - you want to mount. Tip: Ensure that the filesystem type - is supported by the host operating system. Examples: "ext4", - "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - TODO: how do we prevent errors in the filesystem from - compromising the machine' type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty). - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk format: int32 type: integer pdName: - description: 'pdName is unique name of the PD resource in - GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: boolean required: - pdName type: object gitRepo: - description: 'gitRepo represents a git repository at a particular - revision. DEPRECATED: GitRepo is deprecated. To provision - a container with a git repo, mount an EmptyDir into an InitContainer - that clones the repo using git, then mount the EmptyDir into - the Pod''s container.' + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. properties: directory: - description: directory is the target directory name. Must - not contain or start with '..'. If '.' is supplied, the - volume directory will be the git repository. Otherwise, - if specified, the volume will contain the git repository - in the subdirectory with the given name. + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. type: string repository: description: repository is the URL @@ -3824,51 +4123,58 @@ spec: - repository type: object glusterfs: - description: 'glusterfs represents a Glusterfs mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md' + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md properties: endpoints: - description: 'endpoints is the endpoint name that details - Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string path: - description: 'path is the Glusterfs volume path. More info: - https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string readOnly: - description: 'readOnly here will force the Glusterfs volume - to be mounted with read-only permissions. Defaults to - false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: boolean required: - endpoints - path type: object hostPath: - description: 'hostPath represents a pre-existing file or directory - on the host machine that is directly exposed to the container. - This is generally used for system agents or other privileged - things that are allowed to see the host machine. Most containers - will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - --- TODO(jonesdl) We need to restrict who can use host directory - mounts and who can/can not mount host directories as read/write.' + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath properties: path: - description: 'path of the directory on the host. If the - path is a symlink, it will follow the link to the real - path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string type: - description: 'type for HostPath Volume Defaults to "" More - info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string required: - path type: object iscsi: - description: 'iscsi represents an ISCSI Disk resource that is - attached to a kubelet''s host machine and then exposed to - the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md properties: chapAuthDiscovery: description: chapAuthDiscovery defines whether support iSCSI @@ -3879,55 +4185,57 @@ spec: Session CHAP authentication type: boolean fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi type: string initiatorName: - description: initiatorName is the custom iSCSI Initiator - Name. If initiatorName is specified with iscsiInterface - simultaneously, new iSCSI interface : will be created for the connection. + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. type: string iqn: description: iqn is the target iSCSI Qualified Name. type: string iscsiInterface: - description: iscsiInterface is the interface Name that uses - an iSCSI transport. Defaults to 'default' (tcp). + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). type: string lun: description: lun represents iSCSI Target Lun number. format: int32 type: integer portals: - description: portals is the iSCSI Target Portal List. The - portal is either an IP or ip_addr:port if the port is - other than default (typically TCP ports 860 and 3260). + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). items: type: string type: array readOnly: - description: readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. type: boolean secretRef: description: secretRef is the CHAP Secret for iSCSI target and initiator authentication properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic targetPortal: - description: targetPortal is iSCSI Target Portal. The Portal - is either an IP or ip_addr:port if the port is other than - default (typically TCP ports 860 and 3260). + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). type: string required: - iqn @@ -3935,43 +4243,51 @@ spec: - targetPortal type: object name: - description: 'name of the volume. Must be a DNS_LABEL and unique - within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string nfs: - description: 'nfs represents an NFS mount on the host that shares - a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs properties: path: - description: 'path that is exported by the NFS server. More - info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string readOnly: - description: 'readOnly here will force the NFS export to - be mounted with read-only permissions. Defaults to false. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: boolean server: - description: 'server is the hostname or IP address of the - NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string required: - path - server type: object persistentVolumeClaim: - description: 'persistentVolumeClaimVolumeSource represents a - reference to a PersistentVolumeClaim in the same namespace. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims properties: claimName: - description: 'claimName is the name of a PersistentVolumeClaim - in the same namespace as the pod using this volume. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims type: string readOnly: - description: readOnly Will force the ReadOnly setting in - VolumeMounts. Default false. + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. type: boolean required: - claimName @@ -3981,10 +4297,10 @@ spec: persistent disk attached and mounted on kubelets host machine properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string pdID: description: pdID is the ID that identifies Photon Controller @@ -3998,14 +4314,15 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fSType represents the filesystem type to mount - Must be a filesystem type supported by the host operating - system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean volumeID: description: volumeID uniquely identifies a Portworx volume @@ -4018,14 +4335,13 @@ spec: configmaps, and downward API properties: defaultMode: - description: defaultMode are the mode bits used to set permissions - on created files by default. Must be an octal value between - 0000 and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires decimal - values for mode bits. Directories within the path are - not affected by this setting. This might be in conflict - with other options that affect the file mode, like fsGroup, - and the result can be other mode bits set. + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer sources: @@ -4039,17 +4355,14 @@ spec: data to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced ConfigMap - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the ConfigMap, the volume - setup will error unless it is marked optional. - Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -4058,25 +4371,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4084,16 +4393,16 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic downwardAPI: description: downwardAPI information about the downwardAPI data to project @@ -4123,18 +4432,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to - set permissions on this file, must be - an octal value between 0000 and 0777 or - a decimal value between 0 and 511. YAML - accepts both octal and decimal values, - JSON requires decimal values for mode - bits. If not specified, the volume defaultMode - will be used. This might be in conflict - with other options that affect the file - mode, like fsGroup, and the result can - be other mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -4146,10 +4452,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the - container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu - and requests.memory) are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required @@ -4171,6 +4476,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -4181,17 +4487,14 @@ spec: to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced Secret - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the Secret, the volume setup - will error unless it is marked optional. Paths - must be relative and may not contain the '..' - path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -4200,25 +4503,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4226,44 +4525,41 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional field specify whether the Secret or its key must be defined type: boolean type: object + x-kubernetes-map-type: atomic serviceAccountToken: description: serviceAccountToken is information about the serviceAccountToken data to project properties: audience: - description: audience is the intended audience - of the token. A recipient of a token must identify - itself with an identifier specified in the audience - of the token, and otherwise should reject the - token. The audience defaults to the identifier - of the apiserver. + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. type: string expirationSeconds: - description: expirationSeconds is the requested - duration of validity of the service account - token. As the token approaches expiration, the - kubelet volume plugin will proactively rotate - the service account token. The kubelet will - start trying to rotate the token if the token - is older than 80 percent of its time to live - or if the token is older than 24 hours.Defaults - to 1 hour and must be at least 10 minutes. + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. format: int64 type: integer path: - description: path is the path relative to the - mount point of the file to project the token - into. + description: |- + path is the path relative to the mount point of the file to project the + token into. type: string required: - path @@ -4276,28 +4572,30 @@ spec: that shares a pod's lifetime properties: group: - description: group to map volume access to Default is no - group + description: |- + group to map volume access to + Default is no group type: string readOnly: - description: readOnly here will force the Quobyte volume - to be mounted with read-only permissions. Defaults to - false. + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. type: boolean registry: - description: registry represents a single or multiple Quobyte - Registry services specified as a string as host:port pair - (multiple entries are separated with commas) which acts - as the central registry for volumes + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes type: string tenant: - description: tenant owning the given Quobyte volume in the - Backend Used with dynamically provisioned Quobyte volumes, - value is set by the plugin + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin type: string user: - description: user to map volume access to Defaults to serivceaccount - user + description: |- + user to map volume access to + Defaults to serivceaccount user type: string volume: description: volume is a string that references an already @@ -4308,53 +4606,66 @@ spec: - volume type: object rbd: - description: 'rbd represents a Rados Block Device mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md' + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd type: string image: - description: 'image is the rados image name. More info: - https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string keyring: - description: 'keyring is the path to key ring for RBDUser. - Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string monitors: - description: 'monitors is a collection of Ceph monitors. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it items: type: string type: array pool: - description: 'pool is the rados pool name. Default is rbd. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: boolean secretRef: - description: 'secretRef is name of the authentication secret - for RBDUser. If provided overrides keyring. Default is - nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is the rados user name. Default is admin. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string required: - image @@ -4365,9 +4676,11 @@ spec: attached and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Default is "xfs". + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". type: string gateway: description: gateway is the host address of the ScaleIO @@ -4378,26 +4691,29 @@ spec: Protection Domain for the configured storage. type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef references to the secret for ScaleIO - user and other sensitive information. If this is not provided, - Login operation will fail. + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic sslEnabled: description: sslEnabled Flag enable/disable SSL communication with Gateway, default false type: boolean storageMode: - description: storageMode indicates whether the storage for - a volume should be ThickProvisioned or ThinProvisioned. + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. type: string storagePool: @@ -4409,9 +4725,9 @@ spec: configured in ScaleIO. type: string volumeName: - description: volumeName is the name of a volume already - created in the ScaleIO system that is associated with - this volume source. + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. type: string required: - gateway @@ -4419,31 +4735,30 @@ spec: - system type: object secret: - description: 'secret represents a secret that should populate - this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret properties: defaultMode: - description: 'defaultMode is Optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items If unspecified, each key-value pair in - the Data field of the referenced Secret will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the Secret, the volume setup will error unless it is marked - optional. Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -4451,22 +4766,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4478,8 +4792,9 @@ spec: its keys must be defined type: boolean secretName: - description: 'secretName is the name of the secret in the - pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret type: string type: object storageos: @@ -4487,39 +4802,41 @@ spec: and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef specifies the secret to use for obtaining - the StorageOS API credentials. If not specified, default - values will be attempted. + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeName: - description: volumeName is the human-readable name of the - StorageOS volume. Volume names are only unique within - a namespace. + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. type: string volumeNamespace: - description: volumeNamespace specifies the scope of the - volume within StorageOS. If no namespace is specified - then the Pod's namespace will be used. This allows the - Kubernetes name scoping to be mirrored within StorageOS - for tighter integration. Set VolumeName to any name to - override the default behaviour. Set to "default" if you - are not using namespaces within StorageOS. Namespaces - that do not pre-exist within StorageOS will be created. + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. type: string type: object vsphereVolume: @@ -4527,10 +4844,10 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fsType is filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string storagePolicyID: description: storagePolicyID is the storage Policy Based @@ -4563,45 +4880,35 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -4616,10 +4923,6 @@ spec: type: string type: description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -4631,9 +4934,6 @@ spec: - type type: object type: array - observedDatabaseGeneration: - format: int64 - type: integer state: type: string required: @@ -4644,9 +4944,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/deploy/ydb-operator/crds/remotedatabasenodeset.yaml b/deploy/ydb-operator/crds/remotedatabasenodeset.yaml new file mode 100644 index 00000000..ac65fe56 --- /dev/null +++ b/deploy/ydb-operator/crds/remotedatabasenodeset.yaml @@ -0,0 +1,5025 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.5 + name: remotedatabasenodesets.ydb.tech +spec: + group: ydb.tech + names: + kind: RemoteDatabaseNodeSet + listKind: RemoteDatabaseNodeSetList + plural: remotedatabasenodesets + singular: remotedatabasenodeset + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: The status of this RemoteDatabaseNodeSet + jsonPath: .status.state + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: RemoteDatabaseNodeSet declares NodeSet spec and status for objects + in remote cluster + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: DatabaseNodeSetSpec describes an group nodes of Database + object + properties: + additionalAnnotations: + additionalProperties: + type: string + description: (Optional) Additional custom resource annotations that + are added to all resources + type: object + additionalLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to all resources + type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to Pods + type: object + affinity: + description: (Optional) If specified, the pod's scheduling constraints + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for the + pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. + items: + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. co-locate + this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules (e.g. + avoid putting this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + caBundle: + description: |- + User-defined root certificate authority that is added to system trust + store of Storage pods on startup. + type: string + configuration: + description: YDB configuration in YAML format. Will be applied on + top of generated one in internal/configuration + type: string + databaseRef: + description: YDB Database namespaced reference + properties: + name: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + namespace: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + required: + - name + type: object + datastreams: + description: Datastreams config + properties: + enabled: + type: boolean + required: + - enabled + type: object + domain: + default: Root + description: |- + (Optional) Name of the root storage domain + Default: Root + maxLength: 63 + pattern: '[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?' + type: string + encryption: + description: Encryption configuration + properties: + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must be + a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key must be + defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + pin: + type: string + required: + - enabled + type: object + image: + description: (Optional) YDB Image + properties: + name: + description: |- + Container image with supported YDB version. + This defaults to the version pinned to the operator and requires a full container and tag/sha name. + For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22 + type: string + pullPolicy: + description: |- + (Optional) PullPolicy for the image, which defaults to IfNotPresent. + Default: IfNotPresent + type: string + pullSecret: + description: |- + (Optional) Secret name containing the dockerconfig to use for a registry that requires authentication. The secret + must be configured first by the user. + type: string + type: object + initContainers: + description: |- + (Optional) List of initialization containers belonging to the pod. + Init containers are executed in order prior to containers being started. + More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ + items: + description: A single application container that you want to run + within a pod. + properties: + args: + description: |- + Arguments to the entrypoint. + The container image's CMD is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array + command: + description: |- + Entrypoint array. Not executed within a shell. + The container image's ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array + env: + description: |- + List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be + a C_IDENTIFIER. + type: string + value: + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the ConfigMap or + its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: |- + List of sources to populate environment variables in the container. + The keys defined within a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will take precedence. + Cannot be updated. + items: + description: EnvFromSource represents the source of a set + of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the ConfigMap must be + defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each + key in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: |- + Container image name. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. + type: string + imagePullPolicy: + description: |- + Image pull policy. + One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + type: string + lifecycle: + description: |- + Actions that the management system should take in response to container lifecycle events. + Cannot be updated. + properties: + postStart: + description: |- + PostStart is called immediately after a container is created. If the handler fails, + the container is terminated and restarted according to its restart policy. + Other management of the container blocks until the hook completes. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, + defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: |- + PreStop is called immediately before a container is terminated due to an + API request or management event such as liveness/startup probe failure, + preemption, resource contention, etc. The handler is not called if the + container crashes or exits. The Pod's termination grace period countdown begins before the + PreStop hook is executed. Regardless of the outcome of the handler, the + container will eventually terminate within the Pod's termination grace + period (unless delayed by finalizers). Other management of the container blocks until the hook completes + or until the termination grace period is reached. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, + defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: |- + Periodic probe of container liveness. + Container will be restarted if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. + properties: + port: + description: Port number of the gRPC service. Number + must be in the range 1 to 65535. + format: int32 + type: integer + service: + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + periodSeconds: + description: |- + How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + type: object + name: + description: |- + Name of the container specified as a DNS_LABEL. + Each container in a pod must have a unique name (DNS_LABEL). + Cannot be updated. + type: string + ports: + description: |- + List of ports to expose from the container. Not specifying a port here + DOES NOT prevent that port from being exposed. Any port which is + listening on the default "0.0.0.0" address inside a container will be + accessible from the network. + Modifying this array with strategic merge patch may corrupt the data. + For more information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a + single container. + properties: + containerPort: + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. + format: int32 + type: integer + name: + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. + type: string + protocol: + default: TCP + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: |- + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. + properties: + port: + description: Port number of the gRPC service. Number + must be in the range 1 to 65535. + format: int32 + type: integer + service: + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + periodSeconds: + description: |- + How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + type: object + resources: + description: |- + Compute Resources required by this container. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + securityContext: + description: |- + SecurityContext defines the security options the container should be run with. + If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object + startupProbe: + description: |- + StartupProbe indicates that the Pod has successfully initialized. + If specified, no other probes are executed until this completes successfully. + If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + when it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. + properties: + port: + description: Port number of the gRPC service. Number + must be in the range 1 to 65535. + format: int32 + type: integer + service: + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + periodSeconds: + description: |- + How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + type: object + stdin: + description: |- + Whether this container should allocate a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will always result in EOF. + Default is false. + type: boolean + stdinOnce: + description: |- + Whether the container runtime should close the stdin channel after it has been opened by + a single attach. When stdin is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + first client attaches to stdin, and then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container is restarted. If this + flag is false, a container processes that reads from stdin will never receive an EOF. + Default is false + type: boolean + terminationMessagePath: + description: |- + Optional: Path at which the file to which the container's termination message + will be written is mounted into the container's filesystem. + Message written is intended to be brief final status, such as an assertion failure message. + Will be truncated by the node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. + Defaults to /dev/termination-log. + Cannot be updated. + type: string + terminationMessagePolicy: + description: |- + Indicate how the termination message should be populated. File will use the contents of + terminationMessagePath to populate the container status message on both success and failure. + FallbackToLogsOnError will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + Defaults to File. + Cannot be updated. + type: string + tty: + description: |- + Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: |- + Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume + within a container. + properties: + mountPath: + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. + type: string + mountPropagation: + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. + This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. + type: boolean + subPath: + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + type: string + subPathExpr: + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: |- + Container's working directory. + If not specified, the container runtime's default will be used, which + might be configured in the container image. + Cannot be updated. + type: string + required: + - name + type: object + type: array + monitoring: + description: |- + (Optional) Monitoring sets configuration options for YDB observability + Default: "" + properties: + enabled: + type: boolean + interval: + description: Interval at which metrics should be scraped + type: string + metricRelabelings: + description: RelabelConfig allows dynamic rewriting of the label + set, being applied to sample before ingestion. + items: + description: |- + RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. + It defines ``-section of Prometheus configuration. + More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs + properties: + action: + description: Action to perform based on regex matching. + Default is 'replace' + type: string + modulus: + description: Modulus to take of the hash of the source label + values. + format: int64 + type: integer + regex: + description: Regular expression against which the extracted + value is matched. Default is '(.*)' + type: string + replacement: + description: |- + Replacement value against which a regex replace is performed if the + regular expression matches. Regex capture groups are available. Default is '$1' + type: string + separator: + description: Separator placed between concatenated source + label values. default is ';'. + type: string + sourceLabels: + description: |- + The source labels select values from existing labels. Their content is concatenated + using the configured separator and matched against the configured regular expression + for the replace, keep, and drop actions. + items: + type: string + type: array + targetLabel: + description: |- + Label to which the resulting value is written in a replace action. + It is mandatory for replace actions. Regex capture groups are available. + type: string + type: object + type: array + required: + - enabled + type: object + nodeSelector: + additionalProperties: + type: string + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + type: object + nodes: + description: Number of nodes (pods) in the cluster + format: int32 + type: integer + operatorSync: + default: true + description: |- + Enables or disables operator's reconcile loop. + `false` means all the Pods are running, but the reconcile is effectively turned off. + `true` means the default state of the system, all Pods running, operator reacts + to specification change of this Database resource. + type: boolean + path: + description: |- + (Optional) Custom database path in schemeshard + Default: // + maxLength: 255 + pattern: /[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?/[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?(/[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?)* + type: string + pause: + default: false + description: |- + The state of the Database processes. + `true` means all the Database Pods are being killed, but the Database resource is persisted. + `false` means the default state of the system, all Pods running. + type: boolean + priorityClassName: + description: (Optional) If specified, the pod's priorityClassName. + type: string + resources: + description: (Optional) Database storage and compute resources + properties: + containerResources: + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + storageUnits: + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. + items: + properties: + count: + description: Number of units in this set. + format: int64 + type: integer + unitKind: + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. + type: string + required: + - count + - unitKind + type: object + type: array + required: + - storageUnits + type: object + secrets: + description: |- + Secret names that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/secrets//` + items: + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + type: array + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies to + the container. + type: string + role: + description: Role is a SELinux role label that applies to + the container. + type: string + type: + description: Type is a SELinux type label that applies to + the container. + type: string + user: + description: User is a SELinux user label that applies to + the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the GMSA + credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object + serverlessResources: + description: (Optional) If specified, created database will be "serverless". + properties: + sharedDatabaseRef: + description: Reference to YDB Database with configured shared + resources + properties: + name: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + namespace: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + required: + - name + type: object + required: + - sharedDatabaseRef + type: object + service: + description: |- + (Optional) Storage services parameter overrides + Default: (not specified) + properties: + datastreams: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + grpc: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + externalHost: + type: string + externalPort: + format: int32 + type: integer + ipDiscovery: + properties: + enabled: + type: boolean + ipFamily: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + targetNameOverride: + type: string + required: + - enabled + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + interconnect: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + status: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + type: object + sharedResources: + description: (Optional) Shared resources can be used by serverless + databases. + properties: + containerResources: + description: |- + (Optional) Database container resource limits. Any container limits + can be specified. + Default: (not specified) + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + storageUnits: + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. + items: + properties: + count: + description: Number of units in this set. + format: int64 + type: integer + unitKind: + description: |- + Kind of the storage unit. Determine guarantees + for all main unit parameters: used hard disk type, capacity + throughput, IOPS etc. + type: string + required: + - count + - unitKind + type: object + type: array + required: + - storageUnits + type: object + storageClusterRef: + description: YDB Storage cluster reference + properties: + name: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + namespace: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + required: + - name + type: object + storageEndpoint: + description: YDB Storage Node broker address + type: string + terminationGracePeriodSeconds: + description: (Optional) If specified, the pod's terminationGracePeriodSeconds. + format: int64 + type: integer + tolerations: + description: (Optional) If specified, the pod's tolerations. + items: + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. + type: string + tolerationSeconds: + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array + topologySpreadConstraints: + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. + All topologySpreadConstraints are ANDed. + items: + description: TopologySpreadConstraint specifies how to spread matching + pods among the given topology. + properties: + labelSelector: + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. + items: + type: string + type: array + x-kubernetes-list-type: atomic + maxSkew: + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. + format: int32 + type: integer + minDomains: + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). + format: int32 + type: integer + nodeAffinityPolicy: + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + type: string + nodeTaintsPolicy: + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. + - Ignore: node taints are ignored. All nodes are included. + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + type: string + topologyKey: + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. + type: string + whenUnsatisfiable: + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. + type: string + required: + - maxSkew + - topologyKey + - whenUnsatisfiable + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + - whenUnsatisfiable + x-kubernetes-list-type: map + version: + description: |- + (Optional) YDBVersion sets the explicit version of the YDB image + Default: "" + type: string + volumes: + description: |- + Additional volumes that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/volumes/`. + Only `hostPath` volume type is supported for now. + items: + description: Volume represents a named volume in a pod that may + be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + format: int32 + type: integer + readOnly: + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: boolean + volumeID: + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + required: + - volumeID + type: object + azureDisk: + description: azureDisk represents an Azure Data Disk mount on + the host and bind mount to the pod. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: None, + Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk in the + blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in the blob + storage + type: string + fsType: + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single blob + disk per storage account Managed: azure managed data + disk (only in managed availability set). defaults to shared' + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: azureFile represents an Azure File Service mount + on the host and bind mount to the pod. + properties: + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that contains + Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: cephFS represents a Ceph FS mount on the host that + shares a pod's lifetime + properties: + monitors: + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + items: + type: string + type: array + path: + description: 'path is Optional: Used as the mounted root, + rather than the full Ceph tree, default is /' + type: string + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: boolean + secretFile: + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + secretRef: + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + required: + - monitors + type: object + cinder: + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: boolean + secretRef: + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should populate + this volume + properties: + defaultMode: + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the ConfigMap or its + keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents ephemeral + storage that is handled by certain external CSI drivers (Beta + feature). + properties: + driver: + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about the pod + that should populate this volume + properties: + defaultMode: + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: Items is a list of downward API volume file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the pod: + only annotations, labels, name and namespace are + supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative path + name of the file to be created. Must not be absolute + or contain the ''..'' path. Must be utf-8 encoded. + The first item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + properties: + medium: + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: http://kubernetes.io/docs/user-guide/volumes#emptydir + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the lifecycle + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. + properties: + volumeClaimTemplate: + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated + volume by mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. + properties: + metadata: + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. + type: object + spec: + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one + entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over volumes + to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource that is + attached to a kubelet's host machine and then exposed to the + pod. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target worldwide + names (WWNs)' + items: + type: string + type: array + wwids: + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + items: + type: string + type: array + type: object + flexVolume: + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. + properties: + driver: + description: driver is the name of the driver to use for + this volume. + type: string + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds extra + command options if any.' + type: object + readOnly: + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: flocker represents a Flocker volume attached to + a kubelet's host machine. This depends on the Flocker control + service being running + properties: + datasetName: + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. This + is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + properties: + fsType: + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + format: int32 + type: integer + pdName: + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: boolean + required: + - pdName + type: object + gitRepo: + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. + properties: + directory: + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the specified + revision. + type: string + required: + - repository + type: object + glusterfs: + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md + properties: + endpoints: + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + path: + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + readOnly: + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + properties: + path: + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + type: + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + required: + - path + type: object + iscsi: + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support iSCSI + Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support iSCSI + Session CHAP authentication + type: boolean + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + type: string + initiatorName: + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI target + and initiator authentication + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + nfs: + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + properties: + path: + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + readOnly: + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: boolean + server: + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: photonPersistentDisk represents a PhotonController + persistent disk attached and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon Controller + persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: portworxVolume represents a portworx volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources secrets, + configmaps, and downward API + properties: + defaultMode: + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: sources is the list of volume projections + items: + description: Projection that may be projected along with + other supported volume types + properties: + configMap: + description: configMap information about the configMap + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the downwardAPI + data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects a field + of the pod: only annotations, labels, + name and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, + defaults to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must + not be absolute or contain the ''..'' + path. Must be utf-8 encoded. The first + item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults + to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to + select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + description: secret information about the secret data + to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional field specify whether the + Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information about + the serviceAccountToken data to project + properties: + audience: + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. + type: string + expirationSeconds: + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. + format: int64 + type: integer + path: + description: |- + path is the path relative to the mount point of the file to project the + token into. + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + description: quobyte represents a Quobyte mount on the host + that shares a pod's lifetime + properties: + group: + description: |- + group to map volume access to + Default is no group + type: string + readOnly: + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes + type: string + tenant: + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: |- + user to map volume access to + Defaults to serivceaccount user + type: string + volume: + description: volume is a string that references an already + created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + type: string + image: + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + keyring: + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + monitors: + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + items: + type: string + type: array + pool: + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: boolean + secretRef: + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + required: + - image + - monitors + type: object + scaleIO: + description: scaleIO represents a ScaleIO persistent volume + attached and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". + type: string + gateway: + description: gateway is the host address of the ScaleIO + API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the ScaleIO + Protection Domain for the configured storage. + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL communication + with Gateway, default false + type: boolean + storageMode: + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage Pool associated + with the protection domain. + type: string + system: + description: system is the name of the storage system as + configured in ScaleIO. + type: string + volumeName: + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + properties: + defaultMode: + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + optional: + description: optional field specify whether the Secret or + its keys must be defined + type: boolean + secretName: + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + type: string + type: object + storageos: + description: storageOS represents a StorageOS volume attached + and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. + type: string + volumeNamespace: + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: vsphereVolume represents a vSphere volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy Based + Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy Based + Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies vSphere + volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + required: + - databaseRef + - nodes + - storageClusterRef + type: object + status: + default: + state: Pending + description: DatabaseNodeSetStatus defines the observed state + properties: + conditions: + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + remoteResources: + items: + properties: + conditions: + items: + description: Condition contains details for one aspect of + the current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + group: + type: string + kind: + type: string + name: + type: string + state: + type: string + version: + type: string + required: + - group + - kind + - name + - state + - version + type: object + type: array + state: + type: string + required: + - state + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/deploy/ydb-operator/crds/remotestoragenodeset.yaml b/deploy/ydb-operator/crds/remotestoragenodeset.yaml new file mode 100644 index 00000000..ce30bb27 --- /dev/null +++ b/deploy/ydb-operator/crds/remotestoragenodeset.yaml @@ -0,0 +1,4964 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.5 + name: remotestoragenodesets.ydb.tech +spec: + group: ydb.tech + names: + kind: RemoteStorageNodeSet + listKind: RemoteStorageNodeSetList + plural: remotestoragenodesets + singular: remotestoragenodeset + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: The status of this RemoteStorageNodeSet + jsonPath: .status.state + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: RemoteStorageNodeSet declares NodeSet spec and status for objects + in remote cluster + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: StorageNodeSetSpec describes an group nodes of Storage object + properties: + additionalAnnotations: + additionalProperties: + type: string + description: (Optional) Additional custom resource annotations that + are added to all resources + type: object + additionalLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to all resources + type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to Pods + type: object + affinity: + description: (Optional) If specified, the pod's scheduling constraints + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for the + pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. + items: + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. co-locate + this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules (e.g. + avoid putting this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + caBundle: + description: |- + User-defined root certificate authority that is added to system trust + store of Storage pods on startup. + type: string + configuration: + description: YDB configuration in YAML format. Will be applied on + top of generated one in internal/configuration + type: string + dataStore: + description: (Optional) Where cluster data should be kept + items: + description: |- + PersistentVolumeClaimSpec describes the common attributes of storage devices + and allows a Source for provider-specific attributes + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over volumes to consider + for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference to the PersistentVolume + backing this claim. + type: string + type: object + type: array + domain: + default: Root + description: |- + (Optional) Name of the root storage domain + Default: root + maxLength: 63 + pattern: '[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?' + type: string + erasure: + default: block-4-2 + description: |- + Data storage topology mode + For details, see https://ydb.tech/docs/en/cluster/topology + FIXME mirror-3-dc is only supported with external configuration + enum: + - mirror-3-dc + - block-4-2 + - none + type: string + hostNetwork: + description: |- + (Optional) Whether host network should be enabled. + Default: false + type: boolean + image: + description: (Optional) Container image information + properties: + name: + description: |- + Container image with supported YDB version. + This defaults to the version pinned to the operator and requires a full container and tag/sha name. + For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22 + type: string + pullPolicy: + description: |- + (Optional) PullPolicy for the image, which defaults to IfNotPresent. + Default: IfNotPresent + type: string + pullSecret: + description: |- + (Optional) Secret name containing the dockerconfig to use for a registry that requires authentication. The secret + must be configured first by the user. + type: string + type: object + initContainers: + description: |- + (Optional) List of initialization containers belonging to the pod. + Init containers are executed in order prior to containers being started. + More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ + items: + description: A single application container that you want to run + within a pod. + properties: + args: + description: |- + Arguments to the entrypoint. + The container image's CMD is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array + command: + description: |- + Entrypoint array. Not executed within a shell. + The container image's ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array + env: + description: |- + List of environment variables to set in the container. + Cannot be updated. + items: + description: EnvVar represents an environment variable present + in a Container. + properties: + name: + description: Name of the environment variable. Must be + a C_IDENTIFIER. + type: string + value: + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". + type: string + valueFrom: + description: Source for the environment variable's value. + Cannot be used if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the ConfigMap or + its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + description: Selects a key of a secret in the pod's + namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its + key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + description: |- + List of sources to populate environment variables in the container. + The keys defined within a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will take precedence. + Cannot be updated. + items: + description: EnvFromSource represents the source of a set + of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the ConfigMap must be + defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each + key in the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + description: |- + Container image name. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. + type: string + imagePullPolicy: + description: |- + Image pull policy. + One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + type: string + lifecycle: + description: |- + Actions that the management system should take in response to container lifecycle events. + Cannot be updated. + properties: + postStart: + description: |- + PostStart is called immediately after a container is created. If the handler fails, + the container is terminated and restarted according to its restart policy. + Other management of the container blocks until the hook completes. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, + defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + description: |- + PreStop is called immediately before a container is terminated due to an + API request or management event such as liveness/startup probe failure, + preemption, resource contention, etc. The handler is not called if the + container crashes or exits. The Pod's termination grace period countdown begins before the + PreStop hook is executed. Regardless of the outcome of the handler, the + container will eventually terminate within the Pod's termination grace + period (unless delayed by finalizers). Other management of the container blocks until the hook completes + or until the termination grace period is reached. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. + HTTP allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + tcpSocket: + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. + properties: + host: + description: 'Optional: Host name to connect to, + defaults to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + description: |- + Periodic probe of container liveness. + Container will be restarted if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. + properties: + port: + description: Port number of the gRPC service. Number + must be in the range 1 to 65535. + format: int32 + type: integer + service: + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + periodSeconds: + description: |- + How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + type: object + name: + description: |- + Name of the container specified as a DNS_LABEL. + Each container in a pod must have a unique name (DNS_LABEL). + Cannot be updated. + type: string + ports: + description: |- + List of ports to expose from the container. Not specifying a port here + DOES NOT prevent that port from being exposed. Any port which is + listening on the default "0.0.0.0" address inside a container will be + accessible from the network. + Modifying this array with strategic merge patch may corrupt the data. + For more information See https://github.com/kubernetes/kubernetes/issues/108255. + Cannot be updated. + items: + description: ContainerPort represents a network port in a + single container. + properties: + containerPort: + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. + format: int32 + type: integer + hostIP: + description: What host IP to bind the external port to. + type: string + hostPort: + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. + format: int32 + type: integer + name: + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. + type: string + protocol: + default: TCP + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + description: |- + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. + properties: + port: + description: Port number of the gRPC service. Number + must be in the range 1 to 65535. + format: int32 + type: integer + service: + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + periodSeconds: + description: |- + How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + type: object + resources: + description: |- + Compute Resources required by this container. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + securityContext: + description: |- + SecurityContext defines the security options the container should be run with. + If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object + startupProbe: + description: |- + StartupProbe indicates that the Pod has successfully initialized. + If specified, no other probes are executed until this completes successfully. + If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + when it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + properties: + exec: + description: Exec specifies the action to take. + properties: + command: + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + items: + type: string + type: array + type: object + failureThreshold: + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. + format: int32 + type: integer + grpc: + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. + properties: + port: + description: Port number of the gRPC service. Number + must be in the range 1 to 65535. + format: int32 + type: integer + service: + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. + type: string + required: + - port + type: object + httpGet: + description: HTTPGet specifies the http request to perform. + properties: + host: + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. + type: string + httpHeaders: + description: Custom headers to set in the request. HTTP + allows repeated headers. + items: + description: HTTPHeader describes a custom header + to be used in HTTP probes + properties: + name: + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. + type: string + value: + description: The header field value + type: string + required: + - name + - value + type: object + type: array + path: + description: Path to access on the HTTP server. + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + scheme: + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. + type: string + required: + - port + type: object + initialDelaySeconds: + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + periodSeconds: + description: |- + How often (in seconds) to perform the probe. + Default to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. + format: int32 + type: integer + tcpSocket: + description: TCPSocket specifies an action involving a TCP + port. + properties: + host: + description: 'Optional: Host name to connect to, defaults + to the pod IP.' + type: string + port: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. + format: int64 + type: integer + timeoutSeconds: + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + format: int32 + type: integer + type: object + stdin: + description: |- + Whether this container should allocate a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will always result in EOF. + Default is false. + type: boolean + stdinOnce: + description: |- + Whether the container runtime should close the stdin channel after it has been opened by + a single attach. When stdin is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + first client attaches to stdin, and then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container is restarted. If this + flag is false, a container processes that reads from stdin will never receive an EOF. + Default is false + type: boolean + terminationMessagePath: + description: |- + Optional: Path at which the file to which the container's termination message + will be written is mounted into the container's filesystem. + Message written is intended to be brief final status, such as an assertion failure message. + Will be truncated by the node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. + Defaults to /dev/termination-log. + Cannot be updated. + type: string + terminationMessagePolicy: + description: |- + Indicate how the termination message should be populated. File will use the contents of + terminationMessagePath to populate the container status message on both success and failure. + FallbackToLogsOnError will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + Defaults to File. + Cannot be updated. + type: string + tty: + description: |- + Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + Default is false. + type: boolean + volumeDevices: + description: volumeDevices is the list of block devices to be + used by the container. + items: + description: volumeDevice describes a mapping of a raw block + device within a container. + properties: + devicePath: + description: devicePath is the path inside of the container + that the device will be mapped to. + type: string + name: + description: name must match the name of a persistentVolumeClaim + in the pod + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + description: |- + Pod volumes to mount into the container's filesystem. + Cannot be updated. + items: + description: VolumeMount describes a mounting of a Volume + within a container. + properties: + mountPath: + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. + type: string + mountPropagation: + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. + This field is beta in 1.10. + type: string + name: + description: This must match the Name of a Volume. + type: string + readOnly: + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. + type: boolean + subPath: + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). + type: string + subPathExpr: + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + description: |- + Container's working directory. + If not specified, the container runtime's default will be used, which + might be configured in the container image. + Cannot be updated. + type: string + required: + - name + type: object + type: array + monitoring: + description: |- + (Optional) Monitoring sets configuration options for YDB observability + Default: "" + properties: + enabled: + type: boolean + interval: + description: Interval at which metrics should be scraped + type: string + metricRelabelings: + description: RelabelConfig allows dynamic rewriting of the label + set, being applied to sample before ingestion. + items: + description: |- + RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. + It defines ``-section of Prometheus configuration. + More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs + properties: + action: + description: Action to perform based on regex matching. + Default is 'replace' + type: string + modulus: + description: Modulus to take of the hash of the source label + values. + format: int64 + type: integer + regex: + description: Regular expression against which the extracted + value is matched. Default is '(.*)' + type: string + replacement: + description: |- + Replacement value against which a regex replace is performed if the + regular expression matches. Regex capture groups are available. Default is '$1' + type: string + separator: + description: Separator placed between concatenated source + label values. default is ';'. + type: string + sourceLabels: + description: |- + The source labels select values from existing labels. Their content is concatenated + using the configured separator and matched against the configured regular expression + for the replace, keep, and drop actions. + items: + type: string + type: array + targetLabel: + description: |- + Label to which the resulting value is written in a replace action. + It is mandatory for replace actions. Regex capture groups are available. + type: string + type: object + type: array + required: + - enabled + type: object + nodeSelector: + additionalProperties: + type: string + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + type: object + nodes: + description: Number of nodes (pods) + format: int32 + type: integer + operatorSync: + default: true + description: |- + Enables or disables operator's reconcile loop. + `false` means all the Pods are running, but the reconcile is effectively turned off. + `true` means the default state of the system, all Pods running, operator reacts + to specification change of this Storage resource. + type: boolean + pause: + default: false + description: |- + The state of the Storage processes. + `true` means all the Storage Pods are being killed, but the Storage resource is persisted. + `false` means the default state of the system, all Pods running. + type: boolean + priorityClassName: + description: (Optional) If specified, the pod's priorityClassName. + type: string + resources: + description: |- + (Optional) Container resource limits. Any container limits + can be specified. + Default: (not specified) + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + secrets: + description: |- + Secret names that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/secrets//` + items: + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + type: array + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies to + the container. + type: string + role: + description: Role is a SELinux role label that applies to + the container. + type: string + type: + description: Type is a SELinux type label that applies to + the container. + type: string + user: + description: User is a SELinux user label that applies to + the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the GMSA + credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object + service: + description: |- + (Optional) Storage services parameter overrides + Default: (not specified) + properties: + grpc: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + externalHost: + type: string + externalPort: + format: int32 + type: integer + ipDiscovery: + properties: + enabled: + type: boolean + ipFamily: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + targetNameOverride: + type: string + required: + - enabled + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + interconnect: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + status: + properties: + additionalAnnotations: + additionalProperties: + type: string + type: object + additionalLabels: + additionalProperties: + type: string + type: object + ipFamilies: + items: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + type: array + ipFamilyPolicy: + description: IPFamilyPolicy represents the dual-stack-ness + requested or required by a Service + type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object + type: object + type: object + storageRef: + description: YDB Storage reference + properties: + name: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + namespace: + maxLength: 63 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?' + type: string + required: + - name + type: object + terminationGracePeriodSeconds: + description: (Optional) If specified, the pod's terminationGracePeriodSeconds. + format: int64 + type: integer + tolerations: + description: (Optional) If specified, the pod's tolerations. + items: + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. + type: string + tolerationSeconds: + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array + topologySpreadConstraints: + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. + All topologySpreadConstraints are ANDed. + items: + description: TopologySpreadConstraint specifies how to spread matching + pods among the given topology. + properties: + labelSelector: + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. + items: + type: string + type: array + x-kubernetes-list-type: atomic + maxSkew: + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. + format: int32 + type: integer + minDomains: + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). + format: int32 + type: integer + nodeAffinityPolicy: + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + type: string + nodeTaintsPolicy: + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. + - Ignore: node taints are ignored. All nodes are included. + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. + type: string + topologyKey: + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. + type: string + whenUnsatisfiable: + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. + type: string + required: + - maxSkew + - topologyKey + - whenUnsatisfiable + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + - whenUnsatisfiable + x-kubernetes-list-type: map + version: + description: |- + (Optional) YDBVersion sets the explicit version of the YDB image + Default: "" + type: string + volumes: + description: |- + Additional volumes that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/volumes/`. + Only `hostPath` volume type is supported for now. + items: + description: Volume represents a named volume in a pod that may + be accessed by any container in the pod. + properties: + awsElasticBlockStore: + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + format: int32 + type: integer + readOnly: + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: boolean + volumeID: + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore + type: string + required: + - volumeID + type: object + azureDisk: + description: azureDisk represents an Azure Data Disk mount on + the host and bind mount to the pod. + properties: + cachingMode: + description: 'cachingMode is the Host Caching mode: None, + Read Only, Read Write.' + type: string + diskName: + description: diskName is the Name of the data disk in the + blob storage + type: string + diskURI: + description: diskURI is the URI of data disk in the blob + storage + type: string + fsType: + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + kind: + description: 'kind expected values are Shared: multiple + blob disks per storage account Dedicated: single blob + disk per storage account Managed: azure managed data + disk (only in managed availability set). defaults to shared' + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + description: azureFile represents an Azure File Service mount + on the host and bind mount to the pod. + properties: + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretName: + description: secretName is the name of secret that contains + Azure Storage Account Name and Key + type: string + shareName: + description: shareName is the azure share Name + type: string + required: + - secretName + - shareName + type: object + cephfs: + description: cephFS represents a Ceph FS mount on the host that + shares a pod's lifetime + properties: + monitors: + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + items: + type: string + type: array + path: + description: 'path is Optional: Used as the mounted root, + rather than the full Ceph tree, default is /' + type: string + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: boolean + secretFile: + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + secretRef: + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it + type: string + required: + - monitors + type: object + cinder: + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: boolean + secretRef: + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md + type: string + required: + - volumeID + type: object + configMap: + description: configMap represents a configMap that should populate + this volume + properties: + defaultMode: + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the ConfigMap or its + keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + description: csi (Container Storage Interface) represents ephemeral + storage that is handled by certain external CSI drivers (Beta + feature). + properties: + driver: + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. + type: string + fsType: + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. + type: string + nodePublishSecretRef: + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). + type: boolean + volumeAttributes: + additionalProperties: + type: string + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. + type: object + required: + - driver + type: object + downwardAPI: + description: downwardAPI represents downward API about the pod + that should populate this volume + properties: + defaultMode: + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: Items is a list of downward API volume file + items: + description: DownwardAPIVolumeFile represents information + to create the file containing the pod field + properties: + fieldRef: + description: 'Required: Selects a field of the pod: + only annotations, labels, name and namespace are + supported.' + properties: + apiVersion: + description: Version of the schema the FieldPath + is written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the + specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative path + name of the file to be created. Must not be absolute + or contain the ''..'' path. Must be utf-8 encoded. + The first item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the + exposed resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + properties: + medium: + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir + type: string + sizeLimit: + anyOf: + - type: integer + - type: string + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: http://kubernetes.io/docs/user-guide/volumes#emptydir + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + ephemeral: + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific + APIs for volumes that persist for longer than the lifecycle + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. + properties: + volumeClaimTemplate: + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated + volume by mistake. Starting the pod is then blocked until + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. + properties: + metadata: + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. + type: object + spec: + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. + properties: + accessModes: + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 + items: + type: string + type: array + dataSource: + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + properties: + apiGroup: + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being + referenced + type: string + name: + description: Name is the name of resource being + referenced + type: string + namespace: + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. + type: string + required: + - kind + - name + type: object + resources: + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one + entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + selector: + description: selector is a label query over volumes + to consider for binding. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 + type: string + volumeMode: + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. + type: string + volumeName: + description: volumeName is the binding reference + to the PersistentVolume backing this claim. + type: string + type: object + required: + - spec + type: object + type: object + fc: + description: fc represents a Fibre Channel resource that is + attached to a kubelet's host machine and then exposed to the + pod. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + lun: + description: 'lun is Optional: FC target lun number' + format: int32 + type: integer + readOnly: + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + targetWWNs: + description: 'targetWWNs is Optional: FC target worldwide + names (WWNs)' + items: + type: string + type: array + wwids: + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. + items: + type: string + type: array + type: object + flexVolume: + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. + properties: + driver: + description: driver is the name of the driver to use for + this volume. + type: string + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. + type: string + options: + additionalProperties: + type: string + description: 'options is Optional: this field holds extra + command options if any.' + type: object + readOnly: + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + description: flocker represents a Flocker volume attached to + a kubelet's host machine. This depends on the Flocker control + service being running + properties: + datasetName: + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated + type: string + datasetUUID: + description: datasetUUID is the UUID of the dataset. This + is unique identifier of a Flocker dataset + type: string + type: object + gcePersistentDisk: + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + properties: + fsType: + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + partition: + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + format: int32 + type: integer + pdName: + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk + type: boolean + required: + - pdName + type: object + gitRepo: + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. + properties: + directory: + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. + type: string + repository: + description: repository is the URL + type: string + revision: + description: revision is the commit hash for the specified + revision. + type: string + required: + - repository + type: object + glusterfs: + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md + properties: + endpoints: + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + path: + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: string + readOnly: + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod + type: boolean + required: + - endpoints + - path + type: object + hostPath: + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + properties: + path: + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + type: + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath + type: string + required: + - path + type: object + iscsi: + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md + properties: + chapAuthDiscovery: + description: chapAuthDiscovery defines whether support iSCSI + Discovery CHAP authentication + type: boolean + chapAuthSession: + description: chapAuthSession defines whether support iSCSI + Session CHAP authentication + type: boolean + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi + type: string + initiatorName: + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. + type: string + iqn: + description: iqn is the target iSCSI Qualified Name. + type: string + iscsiInterface: + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). + type: string + lun: + description: lun represents iSCSI Target Lun number. + format: int32 + type: integer + portals: + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + items: + type: string + type: array + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + type: boolean + secretRef: + description: secretRef is the CHAP Secret for iSCSI target + and initiator authentication + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + nfs: + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + properties: + path: + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + readOnly: + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: boolean + server: + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + properties: + claimName: + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims + type: string + readOnly: + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + description: photonPersistentDisk represents a PhotonController + persistent disk attached and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + pdID: + description: pdID is the ID that identifies Photon Controller + persistent disk + type: string + required: + - pdID + type: object + portworxVolume: + description: portworxVolume represents a portworx volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + volumeID: + description: volumeID uniquely identifies a Portworx volume + type: string + required: + - volumeID + type: object + projected: + description: projected items for all in one resources secrets, + configmaps, and downward API + properties: + defaultMode: + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + sources: + description: sources is the list of volume projections + items: + description: Projection that may be projected along with + other supported volume types + properties: + configMap: + description: configMap information about the configMap + data to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional specify whether the ConfigMap + or its keys must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + description: downwardAPI information about the downwardAPI + data to project + properties: + items: + description: Items is a list of DownwardAPIVolume + file + items: + description: DownwardAPIVolumeFile represents + information to create the file containing + the pod field + properties: + fieldRef: + description: 'Required: Selects a field + of the pod: only annotations, labels, + name and namespace are supported.' + properties: + apiVersion: + description: Version of the schema the + FieldPath is written in terms of, + defaults to "v1". + type: string + fieldPath: + description: Path of the field to select + in the specified API version. + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: 'Required: Path is the relative + path name of the file to be created. Must + not be absolute or contain the ''..'' + path. Must be utf-8 encoded. The first + item of the relative path must not start + with ''..''' + type: string + resourceFieldRef: + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. + properties: + containerName: + description: 'Container name: required + for volumes, optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format + of the exposed resources, defaults + to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to + select' + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + description: secret information about the secret data + to project + properties: + items: + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within + a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: optional field specify whether the + Secret or its key must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + description: serviceAccountToken is information about + the serviceAccountToken data to project + properties: + audience: + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. + type: string + expirationSeconds: + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. + format: int64 + type: integer + path: + description: |- + path is the path relative to the mount point of the file to project the + token into. + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + description: quobyte represents a Quobyte mount on the host + that shares a pod's lifetime + properties: + group: + description: |- + group to map volume access to + Default is no group + type: string + readOnly: + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. + type: boolean + registry: + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes + type: string + tenant: + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin + type: string + user: + description: |- + user to map volume access to + Defaults to serivceaccount user + type: string + volume: + description: volume is a string that references an already + created Quobyte volume by name. + type: string + required: + - registry + - volume + type: object + rbd: + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md + properties: + fsType: + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd + type: string + image: + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + keyring: + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + monitors: + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + items: + type: string + type: array + pool: + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + readOnly: + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: boolean + secretRef: + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + user: + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it + type: string + required: + - image + - monitors + type: object + scaleIO: + description: scaleIO represents a ScaleIO persistent volume + attached and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". + type: string + gateway: + description: gateway is the host address of the ScaleIO + API Gateway. + type: string + protectionDomain: + description: protectionDomain is the name of the ScaleIO + Protection Domain for the configured storage. + type: string + readOnly: + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + description: sslEnabled Flag enable/disable SSL communication + with Gateway, default false + type: boolean + storageMode: + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. + Default is ThinProvisioned. + type: string + storagePool: + description: storagePool is the ScaleIO Storage Pool associated + with the protection domain. + type: string + system: + description: system is the name of the storage system as + configured in ScaleIO. + type: string + volumeName: + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + properties: + defaultMode: + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + items: + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. + items: + description: Maps a string key to a path within a volume. + properties: + key: + description: key is the key to project. + type: string + mode: + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. + format: int32 + type: integer + path: + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. + type: string + required: + - key + - path + type: object + type: array + optional: + description: optional field specify whether the Secret or + its keys must be defined + type: boolean + secretName: + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret + type: string + type: object + storageos: + description: storageOS represents a StorageOS volume attached + and mounted on Kubernetes nodes. + properties: + fsType: + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + readOnly: + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + type: boolean + secretRef: + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. + type: string + volumeNamespace: + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. + type: string + type: object + vsphereVolume: + description: vsphereVolume represents a vSphere volume attached + and mounted on kubelets host machine + properties: + fsType: + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + type: string + storagePolicyID: + description: storagePolicyID is the storage Policy Based + Management (SPBM) profile ID associated with the StoragePolicyName. + type: string + storagePolicyName: + description: storagePolicyName is the storage Policy Based + Management (SPBM) profile name. + type: string + volumePath: + description: volumePath is the path that identifies vSphere + volume vmdk + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + required: + - erasure + - nodes + - storageRef + type: object + status: + default: + state: Pending + description: StorageNodeSetStatus defines the observed state + properties: + conditions: + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + remoteResources: + items: + properties: + conditions: + items: + description: Condition contains details for one aspect of + the current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + group: + type: string + kind: + type: string + name: + type: string + state: + type: string + version: + type: string + required: + - group + - kind + - name + - state + - version + type: object + type: array + state: + type: string + required: + - state + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/deploy/ydb-operator/crds/storage.yaml b/deploy/ydb-operator/crds/storage.yaml index 7aa5f140..1fed259e 100644 --- a/deploy/ydb-operator/crds/storage.yaml +++ b/deploy/ydb-operator/crds/storage.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.16.5 name: storages.ydb.tech spec: group: ydb.tech @@ -30,14 +28,19 @@ spec: description: Storage is the Schema for the Storages API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -56,6 +59,12 @@ spec: description: (Optional) Additional custom resource labels that are added to all resources type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to Pods + type: object affinity: description: (Optional) If specified, the pod's scheduling constraints properties: @@ -64,22 +73,20 @@ spec: pod. properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node matches - the corresponding matchExpressions; the node(s) with the - highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. items: - description: An empty preferred scheduling term matches - all objects with implicit weight 0 (i.e. it's a no-op). - A null preferred scheduling term matches no objects (i.e. - is also a no-op). + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). properties: preference: description: A node selector term, associated with the @@ -89,30 +96,26 @@ spec: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -125,30 +128,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -158,6 +157,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. @@ -169,50 +169,46 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to an update), the system may or may not try to - eventually evict the pod from its node. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. properties: nodeSelectorTerms: description: Required. A list of node selector terms. The terms are ORed. items: - description: A null or empty node selector term matches - no objects. The requirements of them are ANDed. The - TopologySelectorTerm type implements a subset of the - NodeSelectorTerm. + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. properties: matchExpressions: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -225,30 +221,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -258,26 +250,27 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -296,28 +289,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -330,50 +319,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -386,39 +369,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -427,23 +408,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to a pod label update), the system may or may - not try to eventually evict the pod from its node. When - there are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all terms - must be satisfied. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -453,26 +433,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -484,46 +463,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -535,31 +512,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -573,16 +547,15 @@ spec: other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the anti-affinity expressions specified - by this field, but it may choose a node that violates one - or more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -601,28 +574,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -635,50 +604,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -691,39 +654,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -732,23 +693,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified by - this field are not met at scheduling time, the pod will - not be scheduled onto the node. If the anti-affinity requirements - specified by this field cease to be met at some point during - pod execution (e.g. due to a pod label update), the system - may or may not try to eventually evict the pod from its - node. When there are multiple elements, the lists of nodes - corresponding to each podAffinityTerm are intersected, i.e. - all terms must be satisfied. + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -758,26 +718,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -789,46 +748,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -840,31 +797,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -874,8 +828,9 @@ spec: type: object type: object caBundle: - description: User-defined root certificate authority that is added - to system trust store of Storage pods on startup. + description: |- + User-defined root certificate authority that is added to system trust + store of Storage pods on startup. type: string configuration: description: YDB configuration in YAML format. Will be applied on @@ -884,32 +839,33 @@ spec: dataStore: description: (Optional) Where cluster data should be kept items: - description: PersistentVolumeClaimSpec describes the common attributes - of storage devices and allows a Source for provider-specific attributes + description: |- + PersistentVolumeClaimSpec describes the common attributes of storage devices + and allows a Source for provider-specific attributes properties: accessModes: - description: 'accessModes contains the desired access modes - the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify either: + description: |- + dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the provisioner - or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified - data source. When the AnyVolumeDataSource feature gate is - enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when - dataSourceRef.namespace is not specified. If the namespace - is specified, then dataSourceRef will not be copied to dataSource.' + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource being - referenced. If APIGroup is not specified, the specified - Kind must be in the core API group. For any other third-party - types, APIGroup is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being referenced @@ -921,38 +877,38 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object from which - to populate the volume with data, if a non-empty volume is - desired. This may be any object from a non-empty API group - (non core object) or a PersistentVolumeClaim object. When - this field is specified, volume binding will only succeed - if the type of the specified object matches some installed - volume populator or dynamic provisioner. This field will replace - the functionality of the dataSource field and as such if both - fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn''t specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to - the same value automatically if one of them is empty and the - other is non-empty. When namespace is specified in dataSourceRef, - dataSource isn''t set to the same value and must be empty. - There are three important differences between dataSource and - dataSourceRef: * While dataSource only allows two specific - types of objects, dataSourceRef allows any non-core object, - as well as PersistentVolumeClaim objects. * While dataSource - ignores disallowed values (dropping them), dataSourceRef preserves - all values, and generates an error if a disallowed value is specified. - * While dataSource only allows local objects, dataSourceRef - allows objects in any namespaces. (Beta) Using this field - requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires - the CrossNamespaceVolumeDataSource feature gate to be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource being - referenced. If APIGroup is not specified, the specified - Kind must be in the core API group. For any other third-party - types, APIGroup is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being referenced @@ -961,38 +917,39 @@ spec: description: Name is the name of resource being referenced type: string namespace: - description: Namespace is the namespace of resource being - referenced Note that when a namespace is specified, a - gateway.networking.k8s.io/ReferenceGrant object is required - in the referent namespace to allow that namespace's owner - to accept the reference. See the ReferenceGrant documentation - for details. (Alpha) This field requires the CrossNamespaceVolumeDataSource - feature gate to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources the - volume should have. If RecoverVolumeExpansionFailure feature - is enabled users are allowed to specify resource requirements - that are lower than previous value but must still be higher - than capacity recorded in the status field of the claim. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -1009,8 +966,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -1019,11 +977,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -1034,25 +992,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists or - DoesNotExist, the values array must be empty. This - array is replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -1064,21 +1022,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is - "key", the operator is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the StorageClass - required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume is required - by the claim. Value of Filesystem is implied when not included - in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference to the PersistentVolume @@ -1088,14 +1047,17 @@ spec: type: array domain: default: Root - description: '(Optional) Name of the root storage domain Default: - root' + description: |- + (Optional) Name of the root storage domain + Default: root maxLength: 63 pattern: '[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?' type: string erasure: default: block-4-2 - description: Data storage topology mode For details, see https://ydb.tech/docs/en/cluster/topology + description: |- + Data storage topology mode + For details, see https://ydb.tech/docs/en/cluster/topology FIXME mirror-3-dc is only supported with external configuration enum: - mirror-3-dc @@ -1103,64 +1065,68 @@ spec: - none type: string hostNetwork: - description: '(Optional) Whether host network should be enabled. Default: - false' + description: |- + (Optional) Whether host network should be enabled. + Default: false type: boolean image: description: (Optional) Container image information properties: name: - description: 'Container image with supported YDB version. This - defaults to the version pinned to the operator and requires - a full container and tag/sha name. For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22' + description: |- + Container image with supported YDB version. + This defaults to the version pinned to the operator and requires a full container and tag/sha name. + For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22 type: string pullPolicy: - description: '(Optional) PullPolicy for the image, which defaults - to IfNotPresent. Default: IfNotPresent' + description: |- + (Optional) PullPolicy for the image, which defaults to IfNotPresent. + Default: IfNotPresent type: string pullSecret: - description: (Optional) Secret name containing the dockerconfig - to use for a registry that requires authentication. The secret + description: |- + (Optional) Secret name containing the dockerconfig to use for a registry that requires authentication. The secret must be configured first by the user. type: string type: object initContainers: - description: '(Optional) List of initialization containers belonging - to the pod. Init containers are executed in order prior to containers - being started. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/' + description: |- + (Optional) List of initialization containers belonging to the pod. + Init containers are executed in order prior to containers being started. + More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ items: description: A single application container that you want to run within a pod. properties: args: - description: 'Arguments to the entrypoint. The container image''s - CMD is used if this is not provided. Variable references $(VAR_NAME) - are expanded using the container''s environment. If a variable - cannot be resolved, the reference in the input string will - be unchanged. Double $$ are reduced to a single $, which allows - for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references - will never be expanded, regardless of whether the variable - exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Arguments to the entrypoint. + The container image's CMD is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array command: - description: 'Entrypoint array. Not executed within a shell. - The container image''s ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container''s - environment. If a variable cannot be resolved, the reference - in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: - i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether - the variable exists or not. Cannot be updated. More info: - https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Entrypoint array. Not executed within a shell. + The container image's ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array env: - description: List of environment variables to set in the container. + description: |- + List of environment variables to set in the container. Cannot be updated. items: description: EnvVar represents an environment variable present @@ -1171,16 +1137,16 @@ spec: a C_IDENTIFIER. type: string value: - description: 'Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in - the container and any service environment variables. - If a variable cannot be resolved, the reference in the - input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) - syntax: i.e. "$$(VAR_NAME)" will produce the string - literal "$(VAR_NAME)". Escaped references will never - be expanded, regardless of whether the variable exists - or not. Defaults to "".' + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". type: string valueFrom: description: Source for the environment variable's value. @@ -1193,10 +1159,9 @@ spec: description: The key to select. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap or @@ -1205,12 +1170,11 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: - description: 'Selects a field of the pod: supports - metadata.name, metadata.namespace, `metadata.labels['''']`, - `metadata.annotations['''']`, spec.nodeName, - spec.serviceAccountName, status.hostIP, status.podIP, - status.podIPs.' + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. properties: apiVersion: description: Version of the schema the FieldPath @@ -1223,12 +1187,11 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, limits.ephemeral-storage, requests.cpu, - requests.memory and requests.ephemeral-storage) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -1248,6 +1211,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -1257,10 +1221,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its @@ -1269,19 +1232,20 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name type: object type: array envFrom: - description: List of sources to populate environment variables - in the container. The keys defined within a source must be - a C_IDENTIFIER. All invalid keys will be reported as an event - when the container is starting. When a key exists in multiple - sources, the value associated with the last source will take - precedence. Values defined by an Env with a duplicate key - will take precedence. Cannot be updated. + description: |- + List of sources to populate environment variables in the container. + The keys defined within a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will take precedence. + Cannot be updated. items: description: EnvFromSource represents the source of a set of ConfigMaps @@ -1290,15 +1254,16 @@ spec: description: The ConfigMap to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -1307,51 +1272,54 @@ spec: description: The Secret to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: - description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management - to default or override container images in workload controllers - like Deployments and StatefulSets.' + description: |- + Container image name. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. type: string imagePullPolicy: - description: 'Image pull policy. One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent - otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + description: |- + Image pull policy. + One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images type: string lifecycle: - description: Actions that the management system should take - in response to container lifecycle events. Cannot be updated. + description: |- + Actions that the management system should take in response to container lifecycle events. + Cannot be updated. properties: postStart: - description: 'PostStart is called immediately after a container - is created. If the handler fails, the container is terminated - and restarted according to its restart policy. Other management - of the container blocks until the hook completes. More - info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PostStart is called immediately after a container is created. If the handler fails, + the container is terminated and restarted according to its restart policy. + Other management of the container blocks until the hook completes. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1360,9 +1328,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1372,7 +1340,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1389,22 +1359,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1414,40 +1386,37 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object type: object preStop: - description: 'PreStop is called immediately before a container - is terminated due to an API request or management event - such as liveness/startup probe failure, preemption, resource - contention, etc. The handler is not called if the container - crashes or exits. The Pod''s termination grace period - countdown begins before the PreStop hook is executed. - Regardless of the outcome of the handler, the container - will eventually terminate within the Pod''s termination - grace period (unless delayed by finalizers). Other management - of the container blocks until the hook completes or until - the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PreStop is called immediately before a container is terminated due to an + API request or management event such as liveness/startup probe failure, + preemption, resource contention, etc. The handler is not called if the + container crashes or exits. The Pod's termination grace period countdown begins before the + PreStop hook is executed. Regardless of the outcome of the handler, the + container will eventually terminate within the Pod's termination grace + period (unless delayed by finalizers). Other management of the container blocks until the hook completes + or until the termination grace period is reached. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1456,9 +1425,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1468,7 +1437,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1485,22 +1456,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1510,9 +1483,10 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port @@ -1520,36 +1494,36 @@ spec: type: object type: object livenessProbe: - description: 'Periodic probe of container liveness. Container - will be restarted if the probe fails. Cannot be updated. More - info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container liveness. + Container will be restarted if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1557,10 +1531,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1569,9 +1545,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1581,7 +1557,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1598,33 +1576,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1639,78 +1619,82 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object name: - description: Name of the container specified as a DNS_LABEL. + description: |- + Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. type: string ports: - description: List of ports to expose from the container. Not - specifying a port here DOES NOT prevent that port from being - exposed. Any port which is listening on the default "0.0.0.0" - address inside a container will be accessible from the network. - Modifying this array with strategic merge patch may corrupt - the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. + description: |- + List of ports to expose from the container. Not specifying a port here + DOES NOT prevent that port from being exposed. Any port which is + listening on the default "0.0.0.0" address inside a container will be + accessible from the network. + Modifying this array with strategic merge patch may corrupt the data. + For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated. items: description: ContainerPort represents a network port in a single container. properties: containerPort: - description: Number of port to expose on the pod's IP - address. This must be a valid port number, 0 < x < 65536. + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. format: int32 type: integer hostIP: description: What host IP to bind the external port to. type: string hostPort: - description: Number of port to expose on the host. If - specified, this must be a valid port number, 0 < x < - 65536. If HostNetwork is specified, this must match - ContainerPort. Most containers do not need this. + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. format: int32 type: integer name: - description: If specified, this must be an IANA_SVC_NAME - and unique within the pod. Each named port in a pod - must have a unique name. Name for the port that can - be referred to by services. + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. type: string protocol: default: TCP - description: Protocol for port. Must be UDP, TCP, or SCTP. + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP". type: string required: @@ -1722,36 +1706,36 @@ spec: - protocol x-kubernetes-list-type: map readinessProbe: - description: 'Periodic probe of container service readiness. - Container will be removed from service endpoints if the probe - fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1759,10 +1743,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1771,9 +1757,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1783,7 +1769,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1800,33 +1788,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1841,53 +1831,58 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object resources: - description: 'Compute Resources required by this container. - Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Compute Resources required by this container. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -1904,8 +1899,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -1914,33 +1910,34 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object securityContext: - description: 'SecurityContext defines the security options the - container should be run with. If set, the fields of SecurityContext - override the equivalent fields of PodSecurityContext. More - info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + description: |- + SecurityContext defines the security options the container should be run with. + If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ properties: allowPrivilegeEscalation: - description: 'AllowPrivilegeEscalation controls whether - a process can gain more privileges than its parent process. - This bool directly controls if the no_new_privs flag will - be set on the container process. AllowPrivilegeEscalation - is true always when the container is: 1) run as Privileged - 2) has CAP_SYS_ADMIN Note that this field cannot be set - when spec.os.name is windows.' + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. type: boolean capabilities: - description: The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by - the container runtime. Note that this field cannot be - set when spec.os.name is windows. + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. properties: add: description: Added capabilities @@ -1958,60 +1955,60 @@ spec: type: array type: object privileged: - description: Run container in privileged mode. Processes - in privileged containers are essentially equivalent to - root on the host. Defaults to false. Note that this field - cannot be set when spec.os.name is windows. + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. type: boolean procMount: - description: procMount denotes the type of proc mount to - use for the containers. The default is DefaultProcMount - which uses the container runtime defaults for readonly - paths and masked paths. This requires the ProcMountType - feature flag to be enabled. Note that this field cannot - be set when spec.os.name is windows. + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. type: string readOnlyRootFilesystem: - description: Whether this container has a read-only root - filesystem. Default is false. Note that this field cannot - be set when spec.os.name is windows. + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. type: boolean runAsGroup: - description: The GID to run the entrypoint of the container - process. Uses runtime default if unset. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer runAsNonRoot: - description: Indicates that the container must run as a - non-root user. If true, the Kubelet will validate the - image at runtime to ensure that it does not run as UID - 0 (root) and fail to start the container if it does. If - unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both - SecurityContext and PodSecurityContext, the value specified - in SecurityContext takes precedence. + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: boolean runAsUser: - description: The UID to run the entrypoint of the container - process. Defaults to user specified in image metadata - if unspecified. May also be set in PodSecurityContext. If - set in both SecurityContext and PodSecurityContext, the - value specified in SecurityContext takes precedence. Note - that this field cannot be set when spec.os.name is windows. + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer seLinuxOptions: - description: The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a - random SELinux context for each container. May also be - set in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. properties: level: description: Level is SELinux level label that applies @@ -2031,108 +2028,101 @@ spec: type: string type: object seccompProfile: - description: The seccomp options to use by this container. - If seccomp options are provided at both the pod & container - level, the container options override the pod options. - Note that this field cannot be set when spec.os.name is - windows. + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. properties: localhostProfile: - description: localhostProfile indicates a profile defined - in a file on the node should be used. The profile - must be preconfigured on the node to work. Must be - a descending path, relative to the kubelet's configured - seccomp profile location. Must only be set if type - is "Localhost". + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". type: string type: - description: "type indicates which kind of seccomp profile - will be applied. Valid options are: \n Localhost - - a profile defined in a file on the node should be - used. RuntimeDefault - the container runtime default - profile should be used. Unconfined - no profile should - be applied." + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. type: string required: - type type: object windowsOptions: - description: The Windows specific settings applied to all - containers. If unspecified, the options from the PodSecurityContext - will be used. If set in both SecurityContext and PodSecurityContext, - the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is - linux. + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. properties: gmsaCredentialSpec: - description: GMSACredentialSpec is where the GMSA admission - webhook (https://github.com/kubernetes-sigs/windows-gmsa) - inlines the contents of the GMSA credential spec named - by the GMSACredentialSpecName field. + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. type: string gmsaCredentialSpecName: description: GMSACredentialSpecName is the name of the GMSA credential spec to use. type: string hostProcess: - description: HostProcess determines if a container should - be run as a 'Host Process' container. This field is - alpha-level and will only be honored by components - that enable the WindowsHostProcessContainers feature - flag. Setting this field without the feature flag - will result in errors when validating the Pod. All - of a Pod's containers must have the same effective - HostProcess value (it is not allowed to have a mix - of HostProcess containers and non-HostProcess containers). In - addition, if HostProcess is true then HostNetwork - must also be set to true. + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. type: boolean runAsUserName: - description: The UserName in Windows to run the entrypoint - of the container process. Defaults to the user specified - in image metadata if unspecified. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: string type: object type: object startupProbe: - description: 'StartupProbe indicates that the Pod has successfully - initialized. If specified, no other probes are executed until - this completes successfully. If this probe fails, the Pod - will be restarted, just as if the livenessProbe failed. This - can be used to provide different probe parameters at the beginning - of a Pod''s lifecycle, when it might take a long time to load - data or warm a cache, than during steady-state operation. - This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + StartupProbe indicates that the Pod has successfully initialized. + If specified, no other probes are executed until this completes successfully. + If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + when it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -2140,10 +2130,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -2152,9 +2144,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -2164,7 +2156,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -2181,33 +2175,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -2222,77 +2218,76 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object stdin: - description: Whether this container should allocate a buffer - for stdin in the container runtime. If this is not set, reads - from stdin in the container will always result in EOF. Default - is false. + description: |- + Whether this container should allocate a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will always result in EOF. + Default is false. type: boolean stdinOnce: - description: Whether the container runtime should close the - stdin channel after it has been opened by a single attach. - When stdin is true the stdin stream will remain open across - multiple attach sessions. If stdinOnce is set to true, stdin - is opened on container start, is empty until the first client - attaches to stdin, and then remains open and accepts data - until the client disconnects, at which time stdin is closed - and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin - will never receive an EOF. Default is false + description: |- + Whether the container runtime should close the stdin channel after it has been opened by + a single attach. When stdin is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + first client attaches to stdin, and then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container is restarted. If this + flag is false, a container processes that reads from stdin will never receive an EOF. + Default is false type: boolean terminationMessagePath: - description: 'Optional: Path at which the file to which the - container''s termination message will be written is mounted - into the container''s filesystem. Message written is intended - to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. - The total message length across all containers will be limited - to 12kb. Defaults to /dev/termination-log. Cannot be updated.' + description: |- + Optional: Path at which the file to which the container's termination message + will be written is mounted into the container's filesystem. + Message written is intended to be brief final status, such as an assertion failure message. + Will be truncated by the node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. + Defaults to /dev/termination-log. + Cannot be updated. type: string terminationMessagePolicy: - description: Indicate how the termination message should be - populated. File will use the contents of terminationMessagePath - to populate the container status message on both success and - failure. FallbackToLogsOnError will use the last chunk of - container log output if the termination message file is empty - and the container exited with an error. The log output is - limited to 2048 bytes or 80 lines, whichever is smaller. Defaults - to File. Cannot be updated. + description: |- + Indicate how the termination message should be populated. File will use the contents of + terminationMessagePath to populate the container status message on both success and failure. + FallbackToLogsOnError will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + Defaults to File. + Cannot be updated. type: string tty: - description: Whether this container should allocate a TTY for - itself, also requires 'stdin' to be true. Default is false. + description: |- + Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + Default is false. type: boolean volumeDevices: description: volumeDevices is the list of block devices to be @@ -2315,40 +2310,44 @@ spec: type: object type: array volumeMounts: - description: Pod volumes to mount into the container's filesystem. + description: |- + Pod volumes to mount into the container's filesystem. Cannot be updated. items: description: VolumeMount describes a mounting of a Volume within a container. properties: mountPath: - description: Path within the container at which the volume - should be mounted. Must not contain ':'. + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. type: string mountPropagation: - description: mountPropagation determines how mounts are - propagated from the host to container and the other - way around. When not set, MountPropagationNone is used. + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. This field is beta in 1.10. type: string name: description: This must match the Name of a Volume. type: string readOnly: - description: Mounted read-only if true, read-write otherwise - (false or unspecified). Defaults to false. + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. type: boolean subPath: - description: Path within the volume from which the container's - volume should be mounted. Defaults to "" (volume's root). + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). type: string subPathExpr: - description: Expanded path within the volume from which - the container's volume should be mounted. Behaves similarly - to SubPath but environment variable references $(VAR_NAME) - are expanded using the container's environment. Defaults - to "" (volume's root). SubPathExpr and SubPath are mutually - exclusive. + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. type: string required: - mountPath @@ -2356,17 +2355,910 @@ spec: type: object type: array workingDir: - description: Container's working directory. If not specified, - the container runtime's default will be used, which might - be configured in the container image. Cannot be updated. + description: |- + Container's working directory. + If not specified, the container runtime's default will be used, which + might be configured in the container image. + Cannot be updated. type: string required: - name type: object type: array + initJob: + description: |- + (Optional) Init blobstorage Job settings + Default: (not specified) + properties: + additionalAnnotations: + additionalProperties: + type: string + description: (Optional) Additional custom resource annotations + that are added to all resources + type: object + additionalLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that + are added to all resources + type: object + affinity: + description: (Optional) If specified, the pod's scheduling constraints + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for + the pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. + items: + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with + the corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the + corresponding nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. + co-locate this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred + node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules + (e.g. avoid putting this pod in the same node, zone, etc. + as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred + node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + nodeSelector: + additionalProperties: + type: string + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + type: object + resources: + description: |- + (Optional) Container resource limits. Any container limits + can be specified. + Default: (not specified) + properties: + claims: + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. + items: + description: ResourceClaim references one entry in PodSpec.ResourceClaims. + properties: + name: + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + tolerations: + description: (Optional) If specified, the pod's tolerations. + items: + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. + type: string + tolerationSeconds: + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array + type: object monitoring: - description: '(Optional) Monitoring sets configuration options for - YDB observability Default: ""' + description: |- + (Optional) Monitoring sets configuration options for YDB observability + Default: "" properties: enabled: type: boolean @@ -2377,10 +3269,10 @@ spec: description: RelabelConfig allows dynamic rewriting of the label set, being applied to sample before ingestion. items: - description: 'RelabelConfig allows dynamic rewriting of the - label set, being applied to samples before ingestion. It defines - ``-section of Prometheus configuration. - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs' + description: |- + RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. + It defines ``-section of Prometheus configuration. + More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs properties: action: description: Action to perform based on regex matching. @@ -2396,26 +3288,26 @@ spec: value is matched. Default is '(.*)' type: string replacement: - description: Replacement value against which a regex replace - is performed if the regular expression matches. Regex - capture groups are available. Default is '$1' + description: |- + Replacement value against which a regex replace is performed if the + regular expression matches. Regex capture groups are available. Default is '$1' type: string separator: description: Separator placed between concatenated source label values. default is ';'. type: string sourceLabels: - description: The source labels select values from existing - labels. Their content is concatenated using the configured - separator and matched against the configured regular expression + description: |- + The source labels select values from existing labels. Their content is concatenated + using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions. items: type: string type: array targetLabel: - description: Label to which the resulting value is written - in a replace action. It is mandatory for replace actions. - Regex capture groups are available. + description: |- + Label to which the resulting value is written in a replace action. + It is mandatory for replace actions. Regex capture groups are available. type: string type: object type: array @@ -2425,13 +3317,15 @@ spec: nodeSelector: additionalProperties: type: string - description: '(Optional) NodeSelector is a selector which must be - true for the pod to fit on a node. Selector which must match a node''s - labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object nodeSets: - description: '(Optional) NodeSet inline configuration to split into - multiple StatefulSets Default: (not specified)' + description: |- + (Optional) NodeSet inline configuration to split into multiple StatefulSets + Default: (not specified) items: description: StorageNodeSetSpecInline describes an group nodes object inside parent object @@ -2448,6 +3342,12 @@ spec: description: (Optional) Additional custom resource labels that are added to all resources type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that + are added to Pods + type: object affinity: description: (Optional) If specified, the pod's scheduling constraints properties: @@ -2456,22 +3356,20 @@ spec: the pod. properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods - to nodes that satisfy the affinity expressions specified - by this field, but it may choose a node that violates - one or more of the expressions. The node that is most - preferred is the one with the greatest sum of weights, - i.e. for each node that meets all of the scheduling - requirements (resource request, requiredDuringScheduling - affinity expressions, etc.), compute a sum by iterating - through the elements of this field and adding "weight" - to the sum if the node matches the corresponding matchExpressions; - the node(s) with the highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. items: - description: An empty preferred scheduling term matches - all objects with implicit weight 0 (i.e. it's a - no-op). A null preferred scheduling term matches - no objects (i.e. is also a no-op). + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). properties: preference: description: A node selector term, associated @@ -2481,32 +3379,26 @@ spec: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2519,32 +3411,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2554,6 +3440,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the range @@ -2566,53 +3453,46 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified - by this field are not met at scheduling time, the - pod will not be scheduled onto the node. If the affinity - requirements specified by this field cease to be met - at some point during pod execution (e.g. due to an - update), the system may or may not try to eventually - evict the pod from its node. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. properties: nodeSelectorTerms: description: Required. A list of node selector terms. The terms are ORed. items: - description: A null or empty node selector term - matches no objects. The requirements of them - are ANDed. The TopologySelectorTerm type implements - a subset of the NodeSelectorTerm. + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. properties: matchExpressions: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2625,32 +3505,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators - are In, NotIn, Exists, DoesNotExist. - Gt, and Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. - If the operator is In or NotIn, the - values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. If - the operator is Gt or Lt, the values - array must have a single element, - which will be interpreted as an integer. - This array is replaced during a strategic - merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -2660,10 +3534,12 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. @@ -2671,18 +3547,16 @@ spec: other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods - to nodes that satisfy the affinity expressions specified - by this field, but it may choose a node that violates - one or more of the expressions. The node that is most - preferred is the one with the greatest sum of weights, - i.e. for each node that meets all of the scheduling - requirements (resource request, requiredDuringScheduling - affinity expressions, etc.), compute a sum by iterating - through the elements of this field and adding "weight" - to the sum if the node has pods which matches the - corresponding podAffinityTerm; the node(s) with the - highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred @@ -2701,29 +3575,24 @@ spec: of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2736,52 +3605,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of - namespaces that the term applies to. The - term is applied to the union of the namespaces - selected by this field and the ones listed - in the namespaces field. null selector and - null or empty namespaces list means "this - pod's namespace". An empty selector ({}) - matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2794,43 +3655,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static - list of namespace names that the term applies - to. The term is applied to the union of - the namespaces listed in this field and - the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector - means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located - (affinity) or not co-located (anti-affinity) - with the pods matching the labelSelector - in the specified namespaces, where co-located - is defined as running on a node whose value - of the label with key topologyKey matches - that of any node on which any of the selected - pods is running. Empty topologyKey is not - allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the - corresponding podAffinityTerm, in the range - 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -2839,24 +3694,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified - by this field are not met at scheduling time, the - pod will not be scheduled onto the node. If the affinity - requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a - pod label update), the system may or may not try to - eventually evict the pod from its node. When there - are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all - terms must be satisfied. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or - not co-located (anti-affinity) with, where co-located - is defined as running on a node whose value of the - label with key matches that of any - node on which a pod of the set of pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -2867,28 +3720,24 @@ spec: label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2901,50 +3750,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces - field. null selector and null or empty namespaces - list means "this pod's namespace". An empty - selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -2957,34 +3800,29 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. - The term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces - list and null namespaceSelector means "this - pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified - namespaces, where co-located is defined as running - on a node whose value of the label with key - topologyKey matches that of any node on which - any of the selected pods is running. Empty topologyKey - is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey @@ -2997,18 +3835,16 @@ spec: as some other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods - to nodes that satisfy the anti-affinity expressions - specified by this field, but it may choose a node - that violates one or more of the expressions. The - node that is most preferred is the one with the greatest - sum of weights, i.e. for each node that meets all - of the scheduling requirements (resource request, - requiredDuringScheduling anti-affinity expressions, - etc.), compute a sum by iterating through the elements - of this field and adding "weight" to the sum if the - node has pods which matches the corresponding podAffinityTerm; - the node(s) with the highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred @@ -3027,29 +3863,24 @@ spec: of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3062,52 +3893,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of - namespaces that the term applies to. The - term is applied to the union of the namespaces - selected by this field and the ones listed - in the namespaces field. null selector and - null or empty namespaces list means "this - pod's namespace". An empty selector ({}) - matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, - a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents - a key's relationship to a set - of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3120,43 +3943,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator - is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static - list of namespace names that the term applies - to. The term is applied to the union of - the namespaces listed in this field and - the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector - means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located - (affinity) or not co-located (anti-affinity) - with the pods matching the labelSelector - in the specified namespaces, where co-located - is defined as running on a node whose value - of the label with key topologyKey matches - that of any node on which any of the selected - pods is running. Empty topologyKey is not - allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the - corresponding podAffinityTerm, in the range - 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -3165,24 +3982,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified - by this field are not met at scheduling time, the - pod will not be scheduled onto the node. If the anti-affinity - requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a - pod label update), the system may or may not try to - eventually evict the pod from its node. When there - are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all - terms must be satisfied. + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or - not co-located (anti-affinity) with, where co-located - is defined as running on a node whose value of the - label with key matches that of any - node on which a pod of the set of pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -3193,28 +4008,24 @@ spec: label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3227,50 +4038,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces - field. null selector and null or empty namespaces - list means "this pod's namespace". An empty - selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a - key, and an operator that relates the - key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3283,34 +4088,29 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only - "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. - The term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces - list and null namespaceSelector means "this - pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified - namespaces, where co-located is defined as running - on a node whose value of the label with key - topologyKey matches that of any node on which - any of the selected pods is running. Empty topologyKey - is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey @@ -3318,36 +4118,40 @@ spec: type: array type: object type: object + annotations: + additionalProperties: + type: string + description: Annotations for StorageNodeSet object + type: object dataStore: description: (Optional) Where cluster data should be kept items: - description: PersistentVolumeClaimSpec describes the common - attributes of storage devices and allows a Source for provider-specific - attributes + description: |- + PersistentVolumeClaimSpec describes the common attributes of storage devices + and allows a Source for provider-specific attributes properties: accessModes: - description: 'accessModes contains the desired access - modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify - either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the provisioner - or an external controller can support the specified - data source, it will create a new volume based on the - contents of the specified data source. When the AnyVolumeDataSource - feature gate is enabled, dataSource contents will be - copied to dataSourceRef, and dataSourceRef contents - will be copied to dataSource when dataSourceRef.namespace - is not specified. If the namespace is specified, then - dataSourceRef will not be copied to dataSource.' + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API group. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. type: string kind: @@ -3360,40 +4164,37 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object from - which to populate the volume with data, if a non-empty - volume is desired. This may be any object from a non-empty - API group (non core object) or a PersistentVolumeClaim - object. When this field is specified, volume binding - will only succeed if the type of the specified object - matches some installed volume populator or dynamic provisioner. - This field will replace the functionality of the dataSource - field and as such if both fields are non-empty, they - must have the same value. For backwards compatibility, - when namespace isn''t specified in dataSourceRef, both - fields (dataSource and dataSourceRef) will be set to - the same value automatically if one of them is empty - and the other is non-empty. When namespace is specified - in dataSourceRef, dataSource isn''t set to the same - value and must be empty. There are three important differences - between dataSource and dataSourceRef: * While dataSource - only allows two specific types of objects, dataSourceRef allows - any non-core object, as well as PersistentVolumeClaim - objects. * While dataSource ignores disallowed values - (dropping them), dataSourceRef preserves all values, - and generates an error if a disallowed value is specified. - * While dataSource only allows local objects, dataSourceRef - allows objects in any namespaces. (Beta) Using this - field requires the AnyVolumeDataSource feature gate - to be enabled. (Alpha) Using the namespace field of - dataSourceRef requires the CrossNamespaceVolumeDataSource - feature gate to be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API group. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. type: string kind: @@ -3403,42 +4204,41 @@ spec: description: Name is the name of resource being referenced type: string namespace: - description: Namespace is the namespace of resource - being referenced Note that when a namespace is specified, - a gateway.networking.k8s.io/ReferenceGrant object - is required in the referent namespace to allow that - namespace's owner to accept the reference. See the - ReferenceGrant documentation for details. (Alpha) - This field requires the CrossNamespaceVolumeDataSource - feature gate to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources - the volume should have. If RecoverVolumeExpansionFailure - feature is enabled users are allowed to specify resource - requirements that are lower than previous value but - must still be higher than capacity recorded in the status - field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, - defined in spec.resourceClaims, that are used by - this container. \n This is an alpha field and requires - enabling the DynamicResourceAllocation feature gate. - \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one - entry in pod.spec.resourceClaims of the Pod - where this field is used. It makes that resource - available inside a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -3454,8 +4254,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount - of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3464,11 +4265,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount - of compute resources required. If Requests is omitted - for a container, it defaults to Limits if that is - explicitly specified, otherwise to an implementation-defined - value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -3479,8 +4280,8 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. properties: key: @@ -3488,17 +4289,16 @@ spec: applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values - array must be non-empty. If the operator is - Exists or DoesNotExist, the values array must - be empty. This array is replaced during a - strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -3510,21 +4310,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field - is "key", the operator is "In", and the values array - contains only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the StorageClass - required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume is - required by the claim. Value of Filesystem is implied - when not included in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference to the @@ -3533,19 +4334,25 @@ spec: type: object type: array hostNetwork: - description: '(Optional) Whether host network should be enabled. - Default: false' + description: |- + (Optional) Whether host network should be enabled. + Default: false type: boolean + labels: + additionalProperties: + type: string + description: Labels for StorageNodeSet object + type: object name: - description: Name of child *NodeSet object + description: Name of StorageNodeSet object type: string nodeSelector: additionalProperties: type: string - description: '(Optional) NodeSelector is a selector which must - be true for the pod to fit on a node. Selector which must - match a node''s labels for the pod to be scheduled on that - node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object nodes: description: Number of nodes (pods) @@ -3555,25 +4362,37 @@ spec: description: (Optional) If specified, the pod's priorityClassName. type: string remote: - description: (Optional) Object should be reference to remote + description: (Optional) Object should be reference to RemoteStorageNodeSet object - type: boolean + properties: + cluster: + description: Remote cluster to deploy NodeSet into + type: string + required: + - cluster + type: object resources: - description: '(Optional) Container resource limits. Any container - limits can be specified. Default: (not specified)' + description: |- + (Optional) Container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -3590,8 +4409,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3600,73 +4420,248 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + type: object + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities + type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies + to the container. + type: string + role: + description: Role is a SELinux role label that applies + to the container. + type: string + type: + description: Type is a SELinux type label that applies + to the container. + type: string + user: + description: User is a SELinux user label that applies + to the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the + GMSA credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string type: object type: object + terminationGracePeriodSeconds: + description: (Optional) If specified, the pod's terminationGracePeriodSeconds. + format: int64 + type: integer tolerations: description: (Optional) If specified, the pod's tolerations. items: - description: The pod this Toleration is attached to tolerates - any taint that matches the triple using - the matching operator . + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . properties: effect: - description: Effect indicates the taint effect to match. - Empty means match all taint effects. When specified, - allowed values are NoSchedule, PreferNoSchedule and - NoExecute. + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. type: string key: - description: Key is the taint key that the toleration - applies to. Empty means match all taint keys. If the - key is empty, operator must be Exists; this combination - means to match all values and all keys. + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. type: string operator: - description: Operator represents a key's relationship - to the value. Valid operators are Exists and Equal. - Defaults to Equal. Exists is equivalent to wildcard - for value, so that a pod can tolerate all taints of - a particular category. + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. type: string tolerationSeconds: - description: TolerationSeconds represents the period of - time the toleration (which must be of effect NoExecute, - otherwise this field is ignored) tolerates the taint. - By default, it is not set, which means tolerate the - taint forever (do not evict). Zero and negative values - will be treated as 0 (evict immediately) by the system. + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. format: int64 type: integer value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. type: string type: object type: array topologySpreadConstraints: - description: (Optional) If specified, the pod's topologySpreadConstraints. + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. All topologySpreadConstraints are ANDed. items: description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. properties: labelSelector: - description: LabelSelector is used to find matching pods. - Pods that match this label selector are counted to determine - the number of pods in their corresponding topology domain. + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. properties: key: @@ -3674,17 +4669,16 @@ spec: applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values - array must be non-empty. If the operator is - Exists or DoesNotExist, the values array must - be empty. This array is replaced during a - strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -3696,130 +4690,125 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field - is "key", the operator is "In", and the values array - contains only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys - to select the pods over which spreading will be calculated. - The keys are used to lookup values from the incoming - pod labels, those key-value labels are ANDed with labelSelector - to select the group of existing pods over which spreading - will be calculated for the incoming pod. Keys that don't - exist in the incoming pod labels will be ignored. A - null or empty list means only match against labelSelector. + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. items: type: string type: array x-kubernetes-list-type: atomic maxSkew: - description: 'MaxSkew describes the degree to which pods - may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, - it is the maximum permitted difference between the number - of matching pods in the target topology and the global - minimum. The global minimum is the minimum number of - matching pods in an eligible domain or zero if the number - of eligible domains is less than MinDomains. For example, - in a 3-zone cluster, MaxSkew is set to 1, and pods with - the same labelSelector spread as 2/2/1: In this case, - the global minimum is 1. | zone1 | zone2 | zone3 | | P - P | P P | P | - if MaxSkew is 1, incoming pod - can only be scheduled to zone3 to become 2/2/2; scheduling - it onto zone1(zone2) would make the ActualSkew(3-1) - on zone1(zone2) violate MaxSkew(1). - if MaxSkew is - 2, incoming pod can be scheduled onto any zone. When - `whenUnsatisfiable=ScheduleAnyway`, it is used to give - higher precedence to topologies that satisfy it. It''s - a required field. Default value is 1 and 0 is not allowed.' + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. format: int32 type: integer minDomains: - description: "MinDomains indicates a minimum number of - eligible domains. When the number of eligible domains - with matching topology keys is less than minDomains, - Pod Topology Spread treats \"global minimum\" as 0, - and then the calculation of Skew is performed. And when - the number of eligible domains with matching topology - keys equals or greater than minDomains, this value has - no effect on scheduling. As a result, when the number - of eligible domains is less than minDomains, scheduler - won't schedule more than maxSkew Pods to those domains. - If value is nil, the constraint behaves as if MinDomains - is equal to 1. Valid values are integers greater than - 0. When value is not nil, WhenUnsatisfiable must be - DoNotSchedule. \n For example, in a 3-zone cluster, - MaxSkew is set to 2, MinDomains is set to 5 and pods - with the same labelSelector spread as 2/2/2: | zone1 - | zone2 | zone3 | | P P | P P | P P | The number - of domains is less than 5(MinDomains), so \"global minimum\" - is treated as 0. In this situation, new pod with the - same labelSelector cannot be scheduled, because computed - skew will be 3(3 - 0) if new Pod is scheduled to any - of the three zones, it will violate MaxSkew. \n This - is a beta field and requires the MinDomainsInPodTopologySpread - feature gate to be enabled (enabled by default)." + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). format: int32 type: integer nodeAffinityPolicy: - description: "NodeAffinityPolicy indicates how we will - treat Pod's nodeAffinity/nodeSelector when calculating - pod topology spread skew. Options are: - Honor: only - nodes matching nodeAffinity/nodeSelector are included - in the calculations. - Ignore: nodeAffinity/nodeSelector - are ignored. All nodes are included in the calculations. - \n If this value is nil, the behavior is equivalent - to the Honor policy. This is a beta-level feature default - enabled by the NodeInclusionPolicyInPodTopologySpread - feature flag." + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string nodeTaintsPolicy: - description: "NodeTaintsPolicy indicates how we will treat - node taints when calculating pod topology spread skew. - Options are: - Honor: nodes without taints, along with - tainted nodes for which the incoming pod has a toleration, - are included. - Ignore: node taints are ignored. All - nodes are included. \n If this value is nil, the behavior - is equivalent to the Ignore policy. This is a beta-level - feature default enabled by the NodeInclusionPolicyInPodTopologySpread - feature flag." + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. + - Ignore: node taints are ignored. All nodes are included. + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string topologyKey: - description: TopologyKey is the key of node labels. Nodes - that have a label with this key and identical values - are considered to be in the same topology. We consider - each as a "bucket", and try to put balanced - number of pods into each bucket. We define a domain - as a particular instance of a topology. Also, we define - an eligible domain as a domain whose nodes meet the - requirements of nodeAffinityPolicy and nodeTaintsPolicy. - e.g. If TopologyKey is "kubernetes.io/hostname", each - Node is a domain of that topology. And, if TopologyKey - is "topology.kubernetes.io/zone", each zone is a domain - of that topology. It's a required field. + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. type: string whenUnsatisfiable: - description: 'WhenUnsatisfiable indicates how to deal - with a pod if it doesn''t satisfy the spread constraint. - - DoNotSchedule (default) tells the scheduler not to - schedule it. - ScheduleAnyway tells the scheduler to - schedule the pod in any location, but giving higher - precedence to topologies that would help reduce the skew. - A constraint is considered "Unsatisfiable" for an incoming - pod if and only if every possible node assignment for - that pod would violate "MaxSkew" on some topology. For - example, in a 3-zone cluster, MaxSkew is set to 1, and - pods with the same labelSelector spread as 3/1/1: | - zone1 | zone2 | zone3 | | P P P | P | P | If - WhenUnsatisfiable is set to DoNotSchedule, incoming - pod can only be scheduled to zone2(zone3) to become - 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies - MaxSkew(1). In other words, the cluster can still be - imbalanced, but scheduler won''t make it *more* imbalanced. - It''s a required field.' + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. type: string required: - maxSkew @@ -3841,8 +4830,9 @@ spec: format: int32 type: integer operatorConnection: - description: '(Optional) Operator connection settings Default: (not - specified)' + description: |- + (Optional) Operator connection settings + Default: (not specified) properties: accessToken: properties: @@ -3854,8 +4844,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key must @@ -3864,9 +4855,56 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - secretKeyRef type: object + oauth2TokenExchange: + properties: + audience: + type: string + endpoint: + type: string + id: + type: string + issuer: + type: string + keyID: + type: string + privateKey: + properties: + secretKeyRef: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - secretKeyRef + type: object + signAlg: + type: string + subject: + type: string + required: + - endpoint + - keyID + - privateKey + type: object staticCredentials: properties: password: @@ -3879,9 +4917,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -3890,6 +4928,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - secretKeyRef type: object @@ -3901,37 +4940,45 @@ spec: type: object operatorSync: default: true - description: Enables or disables operator's reconcile loop. `false` - means all the Pods are running, but the reconcile is effectively - turned off. `true` means the default state of the system, all Pods - running, operator reacts to specification change of this Storage - resource. + description: |- + Enables or disables operator's reconcile loop. + `false` means all the Pods are running, but the reconcile is effectively turned off. + `true` means the default state of the system, all Pods running, operator reacts + to specification change of this Storage resource. type: boolean pause: default: false - description: The state of the Storage processes. `true` means all - the Storage Pods are being killed, but the Storage resource is persisted. + description: |- + The state of the Storage processes. + `true` means all the Storage Pods are being killed, but the Storage resource is persisted. `false` means the default state of the system, all Pods running. type: boolean priorityClassName: description: (Optional) If specified, the pod's priorityClassName. type: string resources: - description: '(Optional) Container resource limits. Any container - limits can be specified. Default: (not specified)' + description: |- + (Optional) Container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined in - spec.resourceClaims, that are used by this container. \n This - is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry in pod.spec.resourceClaims - of the Pod where this field is used. It makes that resource - available inside a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -3947,8 +4994,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute resources - allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3957,28 +5005,204 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object secrets: - description: 'Secret names that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/secrets//`' + description: |- + Secret names that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/secrets//` items: - description: LocalObjectReference contains enough information to - let you locate the referenced object inside the same namespace. + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic type: array + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies to + the container. + type: string + role: + description: Role is a SELinux role label that applies to + the container. + type: string + type: + description: Type is a SELinux type label that applies to + the container. + type: string + user: + description: User is a SELinux user label that applies to + the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the GMSA + credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object service: - description: '(Optional) Storage services parameter overrides Default: - (not specified)' + description: |- + (Optional) Storage services parameter overrides + Default: (not specified) properties: grpc: properties: @@ -3992,11 +5216,28 @@ spec: type: object externalHost: type: string + externalPort: + format: int32 + type: integer + ipDiscovery: + properties: + enabled: + type: boolean + ipFamily: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + targetNameOverride: + type: string + required: + - enabled + type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -4013,9 +5254,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -4024,6 +5265,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -4032,9 +5274,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -4043,6 +5285,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -4053,9 +5296,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -4064,6 +5307,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -4080,9 +5324,9 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -4099,9 +5343,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -4110,6 +5354,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -4118,9 +5363,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -4129,6 +5374,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -4139,9 +5385,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -4150,6 +5396,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -4166,15 +5413,82 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: description: IPFamilyPolicy represents the dual-stack-ness requested or required by a Service type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object type: object type: object terminationGracePeriodSeconds: @@ -4184,78 +5498,79 @@ spec: tolerations: description: (Optional) If specified, the pod's tolerations. items: - description: The pod this Toleration is attached to tolerates any - taint that matches the triple using the matching - operator . + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . properties: effect: - description: Effect indicates the taint effect to match. Empty - means match all taint effects. When specified, allowed values - are NoSchedule, PreferNoSchedule and NoExecute. + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. type: string key: - description: Key is the taint key that the toleration applies - to. Empty means match all taint keys. If the key is empty, - operator must be Exists; this combination means to match all - values and all keys. + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. type: string operator: - description: Operator represents a key's relationship to the - value. Valid operators are Exists and Equal. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod - can tolerate all taints of a particular category. + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. type: string tolerationSeconds: - description: TolerationSeconds represents the period of time - the toleration (which must be of effect NoExecute, otherwise - this field is ignored) tolerates the taint. By default, it - is not set, which means tolerate the taint forever (do not - evict). Zero and negative values will be treated as 0 (evict - immediately) by the system. + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. format: int64 type: integer value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. type: string type: object type: array topologySpreadConstraints: - description: (Optional) If specified, the pod's topologySpreadConstraints. + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. All topologySpreadConstraints are ANDed. items: description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. properties: labelSelector: - description: LabelSelector is used to find matching pods. Pods - that match this label selector are counted to determine the - number of pods in their corresponding topology domain. + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists or - DoesNotExist, the values array must be empty. This - array is replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -4267,121 +5582,125 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is - "key", the operator is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select - the pods over which spreading will be calculated. The keys - are used to lookup values from the incoming pod labels, those - key-value labels are ANDed with labelSelector to select the - group of existing pods over which spreading will be calculated - for the incoming pod. Keys that don't exist in the incoming - pod labels will be ignored. A null or empty list means only - match against labelSelector. + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. items: type: string type: array x-kubernetes-list-type: atomic maxSkew: - description: 'MaxSkew describes the degree to which pods may - be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, - it is the maximum permitted difference between the number - of matching pods in the target topology and the global minimum. - The global minimum is the minimum number of matching pods - in an eligible domain or zero if the number of eligible domains - is less than MinDomains. For example, in a 3-zone cluster, - MaxSkew is set to 1, and pods with the same labelSelector - spread as 2/2/1: In this case, the global minimum is 1. | - zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew - is 1, incoming pod can only be scheduled to zone3 to become - 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) - on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming - pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, - it is used to give higher precedence to topologies that satisfy - it. It''s a required field. Default value is 1 and 0 is not - allowed.' + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. format: int32 type: integer minDomains: - description: "MinDomains indicates a minimum number of eligible - domains. When the number of eligible domains with matching - topology keys is less than minDomains, Pod Topology Spread - treats \"global minimum\" as 0, and then the calculation of - Skew is performed. And when the number of eligible domains - with matching topology keys equals or greater than minDomains, - this value has no effect on scheduling. As a result, when - the number of eligible domains is less than minDomains, scheduler - won't schedule more than maxSkew Pods to those domains. If - value is nil, the constraint behaves as if MinDomains is equal - to 1. Valid values are integers greater than 0. When value - is not nil, WhenUnsatisfiable must be DoNotSchedule. \n For - example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains - is set to 5 and pods with the same labelSelector spread as - 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | - The number of domains is less than 5(MinDomains), so \"global - minimum\" is treated as 0. In this situation, new pod with - the same labelSelector cannot be scheduled, because computed - skew will be 3(3 - 0) if new Pod is scheduled to any of the - three zones, it will violate MaxSkew. \n This is a beta field - and requires the MinDomainsInPodTopologySpread feature gate - to be enabled (enabled by default)." + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). format: int32 type: integer nodeAffinityPolicy: - description: "NodeAffinityPolicy indicates how we will treat - Pod's nodeAffinity/nodeSelector when calculating pod topology - spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector - are included in the calculations. - Ignore: nodeAffinity/nodeSelector - are ignored. All nodes are included in the calculations. \n - If this value is nil, the behavior is equivalent to the Honor - policy. This is a beta-level feature default enabled by the - NodeInclusionPolicyInPodTopologySpread feature flag." + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string nodeTaintsPolicy: - description: "NodeTaintsPolicy indicates how we will treat node - taints when calculating pod topology spread skew. Options - are: - Honor: nodes without taints, along with tainted nodes - for which the incoming pod has a toleration, are included. + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - \n If this value is nil, the behavior is equivalent to the - Ignore policy. This is a beta-level feature default enabled - by the NodeInclusionPolicyInPodTopologySpread feature flag." + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string topologyKey: - description: TopologyKey is the key of node labels. Nodes that - have a label with this key and identical values are considered - to be in the same topology. We consider each - as a "bucket", and try to put balanced number of pods into - each bucket. We define a domain as a particular instance of - a topology. Also, we define an eligible domain as a domain - whose nodes meet the requirements of nodeAffinityPolicy and - nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", - each Node is a domain of that topology. And, if TopologyKey - is "topology.kubernetes.io/zone", each zone is a domain of - that topology. It's a required field. + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. type: string whenUnsatisfiable: - description: 'WhenUnsatisfiable indicates how to deal with a - pod if it doesn''t satisfy the spread constraint. - DoNotSchedule - (default) tells the scheduler not to schedule it. - ScheduleAnyway - tells the scheduler to schedule the pod in any location, but - giving higher precedence to topologies that would help reduce - the skew. A constraint is considered "Unsatisfiable" for - an incoming pod if and only if every possible node assignment - for that pod would violate "MaxSkew" on some topology. For - example, in a 3-zone cluster, MaxSkew is set to 1, and pods - with the same labelSelector spread as 3/1/1: | zone1 | zone2 - | zone3 | | P P P | P | P | If WhenUnsatisfiable is - set to DoNotSchedule, incoming pod can only be scheduled to - zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on - zone2(zone3) satisfies MaxSkew(1). In other words, the cluster - can still be imbalanced, but scheduler won''t make it *more* - imbalanced. It''s a required field.' + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. type: string required: - maxSkew @@ -4394,46 +5713,49 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map version: - description: '(Optional) YDBVersion sets the explicit version of the - YDB image Default: ""' + description: |- + (Optional) YDBVersion sets the explicit version of the YDB image + Default: "" type: string volumes: - description: 'Additional volumes that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/volumes/`. - Only `hostPath` volume type is supported for now.' + description: |- + Additional volumes that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/volumes/`. + Only `hostPath` volume type is supported for now. items: description: Volume represents a named volume in a pod that may be accessed by any container in the pod. properties: awsElasticBlockStore: - description: 'awsElasticBlockStore represents an AWS Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty).' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). format: int32 type: integer readOnly: - description: 'readOnly value true will force the readOnly - setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: boolean volumeID: - description: 'volumeID is unique ID of the persistent disk - resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string required: - volumeID @@ -4455,10 +5777,10 @@ spec: storage type: string fsType: - description: fsType is Filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string kind: description: 'kind expected values are Shared: multiple @@ -4467,8 +5789,9 @@ spec: disk (only in managed availability set). defaults to shared' type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean required: - diskName @@ -4479,8 +5802,9 @@ spec: on the host and bind mount to the pod. properties: readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretName: description: secretName is the name of secret that contains @@ -4498,8 +5822,9 @@ spec: shares a pod's lifetime properties: monitors: - description: 'monitors is Required: Monitors is a collection - of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it items: type: string type: array @@ -4508,59 +5833,70 @@ spec: rather than the full Ceph tree, default is /' type: string readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: boolean secretFile: - description: 'secretFile is Optional: SecretFile is the - path to key ring for User, default is /etc/ceph/user.secret - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string secretRef: - description: 'secretRef is Optional: SecretRef is reference - to the authentication secret for User, default is empty. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is optional: User is the rados user name, - default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string required: - monitors type: object cinder: - description: 'cinder represents a cinder volume attached and - mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to - be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string readOnly: - description: 'readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: boolean secretRef: - description: 'secretRef is optional: points to a secret - object containing parameters used to connect to OpenStack.' + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeID: - description: 'volumeID used to identify the volume in cinder. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string required: - volumeID @@ -4570,27 +5906,25 @@ spec: this volume properties: defaultMode: - description: 'defaultMode is optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items if unspecified, each key-value pair in - the Data field of the referenced ConfigMap will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the ConfigMap, the volume setup will error unless it is - marked optional. Paths must be relative and may not contain - the '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -4598,22 +5932,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4621,54 +5954,58 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic csi: description: csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature). properties: driver: - description: driver is the name of the CSI driver that handles - this volume. Consult with your admin for the correct name - as registered in the cluster. + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. type: string fsType: - description: fsType to mount. Ex. "ext4", "xfs", "ntfs". - If not provided, the empty value is passed to the associated - CSI driver which will determine the default filesystem - to apply. + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. type: string nodePublishSecretRef: - description: nodePublishSecretRef is a reference to the - secret object containing sensitive information to pass - to the CSI driver to complete the CSI NodePublishVolume - and NodeUnpublishVolume calls. This field is optional, - and may be empty if no secret is required. If the secret - object contains more than one secret, all secret references - are passed. + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic readOnly: - description: readOnly specifies a read-only configuration - for the volume. Defaults to false (read/write). + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). type: boolean volumeAttributes: additionalProperties: type: string - description: volumeAttributes stores driver-specific properties - that are passed to the CSI driver. Consult your driver's - documentation for supported values. + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. type: object required: - driver @@ -4678,16 +6015,15 @@ spec: that should populate this volume properties: defaultMode: - description: 'Optional: mode bits to use on created files - by default. Must be a Optional: mode bits used to set - permissions on created files by default. Must be an octal - value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: @@ -4712,16 +6048,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to set permissions - on this file, must be an octal value between 0000 - and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires - decimal values for mode bits. If not specified, - the volume defaultMode will be used. This might - be in conflict with other options that affect the - file mode, like fsGroup, and the result can be other - mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -4732,10 +6067,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, requests.cpu and requests.memory) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -4755,113 +6089,125 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object type: array type: object emptyDir: - description: 'emptyDir represents a temporary directory that - shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir properties: medium: - description: 'medium represents what type of storage medium - should back this directory. The default is "" which means - to use the node''s default medium. Must be an empty string - (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir type: string sizeLimit: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage - required for this EmptyDir volume. The size limit is also - applicable for memory medium. The maximum usage on memory - medium EmptyDir would be the minimum value between the - SizeLimit specified here and the sum of memory limits - of all containers in a pod. The default is nil which means - that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: http://kubernetes.io/docs/user-guide/volumes#emptydir pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object ephemeral: - description: "ephemeral represents a volume that is handled - by a cluster storage driver. The volume's lifecycle is tied - to the pod that defines it - it will be created before the - pod starts, and deleted when the pod is removed. \n Use this - if: a) the volume is only needed while the pod runs, b) features - of normal volumes like restoring from snapshot or capacity - \ tracking are needed, c) the storage driver is specified - through a storage class, and d) the storage driver supports - dynamic volume provisioning through a PersistentVolumeClaim - (see EphemeralVolumeSource for more information on the - connection between this volume type and PersistentVolumeClaim). - \n Use PersistentVolumeClaim or one of the vendor-specific + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle - of an individual pod. \n Use CSI for light-weight local ephemeral - volumes if the CSI driver is meant to be used that way - see - the documentation of the driver for more information. \n A - pod can use both types of ephemeral volumes and persistent - volumes at the same time." + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. properties: volumeClaimTemplate: - description: "Will be used to create a stand-alone PVC to - provision the volume. The pod in which this EphemeralVolumeSource - is embedded will be the owner of the PVC, i.e. the PVC - will be deleted together with the pod. The name of the - PVC will be `-` where `` is the name from the `PodSpec.Volumes` array entry. - Pod validation will reject the pod if the concatenated - name is not valid for a PVC (for example, too long). \n - An existing PVC with that name that is not owned by the - pod will *not* be used for the pod to avoid using an unrelated + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until - the unrelated PVC is removed. If such a pre-created PVC - is meant to be used by the pod, the PVC has to updated - with an owner reference to the pod once the pod exists. - Normally this should not be necessary, but it may be useful - when manually reconstructing a broken cluster. \n This - field is read-only and no changes will be made by Kubernetes - to the PVC after it has been created. \n Required, must - not be nil." + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. properties: metadata: - description: May contain labels and annotations that - will be copied into the PVC when creating it. No other - fields are allowed and will be rejected during validation. + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. type: object spec: - description: The specification for the PersistentVolumeClaim. - The entire content is copied unchanged into the PVC - that gets created from this template. The same fields - as in a PersistentVolumeClaim are also valid here. + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. properties: accessModes: - description: 'accessModes contains the desired access - modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify - either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the - provisioner or an external controller can support - the specified data source, it will create a new - volume based on the contents of the specified - data source. When the AnyVolumeDataSource feature - gate is enabled, dataSource contents will be copied - to dataSourceRef, and dataSourceRef contents will - be copied to dataSource when dataSourceRef.namespace - is not specified. If the namespace is specified, - then dataSourceRef will not be copied to dataSource.' + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -4875,46 +6221,38 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object - from which to populate the volume with data, if - a non-empty volume is desired. This may be any - object from a non-empty API group (non core object) - or a PersistentVolumeClaim object. When this field - is specified, volume binding will only succeed - if the type of the specified object matches some - installed volume populator or dynamic provisioner. - This field will replace the functionality of the - dataSource field and as such if both fields are - non-empty, they must have the same value. For - backwards compatibility, when namespace isn''t - specified in dataSourceRef, both fields (dataSource - and dataSourceRef) will be set to the same value - automatically if one of them is empty and the - other is non-empty. When namespace is specified - in dataSourceRef, dataSource isn''t set to the - same value and must be empty. There are three - important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types - of objects, dataSourceRef allows any non-core - object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping - them), dataSourceRef preserves all values, and - generates an error if a disallowed value is specified. - * While dataSource only allows local objects, - dataSourceRef allows objects in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource - feature gate to be enabled. (Alpha) Using the - namespace field of dataSourceRef requires the - CrossNamespaceVolumeDataSource feature gate to - be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -4925,44 +6263,41 @@ spec: referenced type: string namespace: - description: Namespace is the namespace of resource - being referenced Note that when a namespace - is specified, a gateway.networking.k8s.io/ReferenceGrant - object is required in the referent namespace - to allow that namespace's owner to accept - the reference. See the ReferenceGrant documentation - for details. (Alpha) This field requires the - CrossNamespaceVolumeDataSource feature gate - to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources - the volume should have. If RecoverVolumeExpansionFailure - feature is enabled users are allowed to specify - resource requirements that are lower than previous - value but must still be higher than capacity recorded - in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, - defined in spec.resourceClaims, that are used - by this container. \n This is an alpha field - and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name - of one entry in pod.spec.resourceClaims - of the Pod where this field is used. - It makes that resource available inside - a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -4978,8 +6313,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount - of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -4988,12 +6324,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum - amount of compute resources required. If Requests - is omitted for a container, it defaults to - Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -5005,28 +6340,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -5039,23 +6370,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the - StorageClass required by the claim. More info: - https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume - is required by the claim. Value of Filesystem - is implied when not included in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference @@ -5072,19 +6402,19 @@ spec: pod. properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. TODO: how do we prevent errors in the - filesystem from compromising the machine' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string lun: description: 'lun is Optional: FC target lun number' format: int32 type: integer readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean targetWWNs: description: 'targetWWNs is Optional: FC target worldwide @@ -5093,26 +6423,27 @@ spec: type: string type: array wwids: - description: 'wwids Optional: FC volume world wide identifiers - (wwids) Either wwids or combination of targetWWNs and - lun must be set, but not both simultaneously.' + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. items: type: string type: array type: object flexVolume: - description: flexVolume represents a generic volume resource - that is provisioned/attached using an exec based plugin. + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. properties: driver: description: driver is the name of the driver to use for this volume. type: string fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". The default filesystem depends - on FlexVolume script. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. type: string options: additionalProperties: @@ -5121,22 +6452,25 @@ spec: command options if any.' type: object readOnly: - description: 'readOnly is Optional: defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: 'secretRef is Optional: secretRef is reference - to the secret object containing sensitive information - to pass to the plugin scripts. This may be empty if no - secret object is specified. If the secret object contains - more than one secret, all secrets are passed to the plugin - scripts.' + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic required: - driver type: object @@ -5146,9 +6480,9 @@ spec: service being running properties: datasetName: - description: datasetName is Name of the dataset stored as - metadata -> name on the dataset for Flocker should be - considered as deprecated + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated type: string datasetUUID: description: datasetUUID is the UUID of the dataset. This @@ -5156,52 +6490,54 @@ spec: type: string type: object gcePersistentDisk: - description: 'gcePersistentDisk represents a GCE Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk properties: fsType: - description: 'fsType is filesystem type of the volume that - you want to mount. Tip: Ensure that the filesystem type - is supported by the host operating system. Examples: "ext4", - "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - TODO: how do we prevent errors in the filesystem from - compromising the machine' type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty). - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk format: int32 type: integer pdName: - description: 'pdName is unique name of the PD resource in - GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: boolean required: - pdName type: object gitRepo: - description: 'gitRepo represents a git repository at a particular - revision. DEPRECATED: GitRepo is deprecated. To provision - a container with a git repo, mount an EmptyDir into an InitContainer - that clones the repo using git, then mount the EmptyDir into - the Pod''s container.' + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. properties: directory: - description: directory is the target directory name. Must - not contain or start with '..'. If '.' is supplied, the - volume directory will be the git repository. Otherwise, - if specified, the volume will contain the git repository - in the subdirectory with the given name. + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. type: string repository: description: repository is the URL @@ -5214,51 +6550,58 @@ spec: - repository type: object glusterfs: - description: 'glusterfs represents a Glusterfs mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md' + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md properties: endpoints: - description: 'endpoints is the endpoint name that details - Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string path: - description: 'path is the Glusterfs volume path. More info: - https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string readOnly: - description: 'readOnly here will force the Glusterfs volume - to be mounted with read-only permissions. Defaults to - false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: boolean required: - endpoints - path type: object hostPath: - description: 'hostPath represents a pre-existing file or directory - on the host machine that is directly exposed to the container. - This is generally used for system agents or other privileged - things that are allowed to see the host machine. Most containers - will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - --- TODO(jonesdl) We need to restrict who can use host directory - mounts and who can/can not mount host directories as read/write.' + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath properties: path: - description: 'path of the directory on the host. If the - path is a symlink, it will follow the link to the real - path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string type: - description: 'type for HostPath Volume Defaults to "" More - info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string required: - path type: object iscsi: - description: 'iscsi represents an ISCSI Disk resource that is - attached to a kubelet''s host machine and then exposed to - the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md properties: chapAuthDiscovery: description: chapAuthDiscovery defines whether support iSCSI @@ -5269,55 +6612,57 @@ spec: Session CHAP authentication type: boolean fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi type: string initiatorName: - description: initiatorName is the custom iSCSI Initiator - Name. If initiatorName is specified with iscsiInterface - simultaneously, new iSCSI interface : will be created for the connection. + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. type: string iqn: description: iqn is the target iSCSI Qualified Name. type: string iscsiInterface: - description: iscsiInterface is the interface Name that uses - an iSCSI transport. Defaults to 'default' (tcp). + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). type: string lun: description: lun represents iSCSI Target Lun number. format: int32 type: integer portals: - description: portals is the iSCSI Target Portal List. The - portal is either an IP or ip_addr:port if the port is - other than default (typically TCP ports 860 and 3260). + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). items: type: string type: array readOnly: - description: readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. type: boolean secretRef: description: secretRef is the CHAP Secret for iSCSI target and initiator authentication properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic targetPortal: - description: targetPortal is iSCSI Target Portal. The Portal - is either an IP or ip_addr:port if the port is other than - default (typically TCP ports 860 and 3260). + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). type: string required: - iqn @@ -5325,43 +6670,51 @@ spec: - targetPortal type: object name: - description: 'name of the volume. Must be a DNS_LABEL and unique - within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string nfs: - description: 'nfs represents an NFS mount on the host that shares - a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs properties: path: - description: 'path that is exported by the NFS server. More - info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string readOnly: - description: 'readOnly here will force the NFS export to - be mounted with read-only permissions. Defaults to false. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: boolean server: - description: 'server is the hostname or IP address of the - NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string required: - path - server type: object persistentVolumeClaim: - description: 'persistentVolumeClaimVolumeSource represents a - reference to a PersistentVolumeClaim in the same namespace. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims properties: claimName: - description: 'claimName is the name of a PersistentVolumeClaim - in the same namespace as the pod using this volume. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims type: string readOnly: - description: readOnly Will force the ReadOnly setting in - VolumeMounts. Default false. + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. type: boolean required: - claimName @@ -5371,10 +6724,10 @@ spec: persistent disk attached and mounted on kubelets host machine properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string pdID: description: pdID is the ID that identifies Photon Controller @@ -5388,14 +6741,15 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fSType represents the filesystem type to mount - Must be a filesystem type supported by the host operating - system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean volumeID: description: volumeID uniquely identifies a Portworx volume @@ -5408,14 +6762,13 @@ spec: configmaps, and downward API properties: defaultMode: - description: defaultMode are the mode bits used to set permissions - on created files by default. Must be an octal value between - 0000 and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires decimal - values for mode bits. Directories within the path are - not affected by this setting. This might be in conflict - with other options that affect the file mode, like fsGroup, - and the result can be other mode bits set. + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer sources: @@ -5429,17 +6782,14 @@ spec: data to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced ConfigMap - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the ConfigMap, the volume - setup will error unless it is marked optional. - Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -5448,25 +6798,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -5474,16 +6820,16 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic downwardAPI: description: downwardAPI information about the downwardAPI data to project @@ -5513,18 +6859,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to - set permissions on this file, must be - an octal value between 0000 and 0777 or - a decimal value between 0 and 511. YAML - accepts both octal and decimal values, - JSON requires decimal values for mode - bits. If not specified, the volume defaultMode - will be used. This might be in conflict - with other options that affect the file - mode, like fsGroup, and the result can - be other mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -5536,10 +6879,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the - container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu - and requests.memory) are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required @@ -5561,6 +6903,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -5571,17 +6914,14 @@ spec: to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced Secret - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the Secret, the volume setup - will error unless it is marked optional. Paths - must be relative and may not contain the '..' - path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -5590,25 +6930,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -5616,44 +6952,41 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional field specify whether the Secret or its key must be defined type: boolean type: object + x-kubernetes-map-type: atomic serviceAccountToken: description: serviceAccountToken is information about the serviceAccountToken data to project properties: audience: - description: audience is the intended audience - of the token. A recipient of a token must identify - itself with an identifier specified in the audience - of the token, and otherwise should reject the - token. The audience defaults to the identifier - of the apiserver. + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. type: string expirationSeconds: - description: expirationSeconds is the requested - duration of validity of the service account - token. As the token approaches expiration, the - kubelet volume plugin will proactively rotate - the service account token. The kubelet will - start trying to rotate the token if the token - is older than 80 percent of its time to live - or if the token is older than 24 hours.Defaults - to 1 hour and must be at least 10 minutes. + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. format: int64 type: integer path: - description: path is the path relative to the - mount point of the file to project the token - into. + description: |- + path is the path relative to the mount point of the file to project the + token into. type: string required: - path @@ -5666,28 +6999,30 @@ spec: that shares a pod's lifetime properties: group: - description: group to map volume access to Default is no - group + description: |- + group to map volume access to + Default is no group type: string readOnly: - description: readOnly here will force the Quobyte volume - to be mounted with read-only permissions. Defaults to - false. + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. type: boolean registry: - description: registry represents a single or multiple Quobyte - Registry services specified as a string as host:port pair - (multiple entries are separated with commas) which acts - as the central registry for volumes + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes type: string tenant: - description: tenant owning the given Quobyte volume in the - Backend Used with dynamically provisioned Quobyte volumes, - value is set by the plugin + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin type: string user: - description: user to map volume access to Defaults to serivceaccount - user + description: |- + user to map volume access to + Defaults to serivceaccount user type: string volume: description: volume is a string that references an already @@ -5698,53 +7033,66 @@ spec: - volume type: object rbd: - description: 'rbd represents a Rados Block Device mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md' + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd type: string image: - description: 'image is the rados image name. More info: - https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string keyring: - description: 'keyring is the path to key ring for RBDUser. - Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string monitors: - description: 'monitors is a collection of Ceph monitors. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it items: type: string type: array pool: - description: 'pool is the rados pool name. Default is rbd. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: boolean secretRef: - description: 'secretRef is name of the authentication secret - for RBDUser. If provided overrides keyring. Default is - nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is the rados user name. Default is admin. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string required: - image @@ -5755,9 +7103,11 @@ spec: attached and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Default is "xfs". + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". type: string gateway: description: gateway is the host address of the ScaleIO @@ -5768,26 +7118,29 @@ spec: Protection Domain for the configured storage. type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef references to the secret for ScaleIO - user and other sensitive information. If this is not provided, - Login operation will fail. + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic sslEnabled: description: sslEnabled Flag enable/disable SSL communication with Gateway, default false type: boolean storageMode: - description: storageMode indicates whether the storage for - a volume should be ThickProvisioned or ThinProvisioned. + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. type: string storagePool: @@ -5799,9 +7152,9 @@ spec: configured in ScaleIO. type: string volumeName: - description: volumeName is the name of a volume already - created in the ScaleIO system that is associated with - this volume source. + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. type: string required: - gateway @@ -5809,31 +7162,30 @@ spec: - system type: object secret: - description: 'secret represents a secret that should populate - this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret properties: defaultMode: - description: 'defaultMode is Optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items If unspecified, each key-value pair in - the Data field of the referenced Secret will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the Secret, the volume setup will error unless it is marked - optional. Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -5841,22 +7193,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -5868,8 +7219,9 @@ spec: its keys must be defined type: boolean secretName: - description: 'secretName is the name of the secret in the - pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret type: string type: object storageos: @@ -5877,39 +7229,41 @@ spec: and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef specifies the secret to use for obtaining - the StorageOS API credentials. If not specified, default - values will be attempted. + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeName: - description: volumeName is the human-readable name of the - StorageOS volume. Volume names are only unique within - a namespace. + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. type: string volumeNamespace: - description: volumeNamespace specifies the scope of the - volume within StorageOS. If no namespace is specified - then the Pod's namespace will be used. This allows the - Kubernetes name scoping to be mirrored within StorageOS - for tighter integration. Set VolumeName to any name to - override the default behaviour. Set to "default" if you - are not using namespaces within StorageOS. Namespaces - that do not pre-exist within StorageOS will be created. + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. type: string type: object vsphereVolume: @@ -5917,10 +7271,10 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fsType is filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string storagePolicyID: description: storagePolicyID is the storage Policy Based @@ -5952,45 +7306,35 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -6005,10 +7349,6 @@ spec: type: string type: description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -6030,9 +7370,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/deploy/ydb-operator/crds/storagemonitoring.yaml b/deploy/ydb-operator/crds/storagemonitoring.yaml index 4d37c632..2e39eb99 100644 --- a/deploy/ydb-operator/crds/storagemonitoring.yaml +++ b/deploy/ydb-operator/crds/storagemonitoring.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.16.5 name: storagemonitorings.ydb.tech spec: group: ydb.tech @@ -30,14 +28,19 @@ spec: description: StorageMonitoring is the Schema for the storagemonitorings API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -72,45 +75,35 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -125,10 +118,6 @@ spec: type: string type: description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -150,9 +139,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/deploy/ydb-operator/crds/storagenodeset.yaml b/deploy/ydb-operator/crds/storagenodeset.yaml index ecdc1d7d..cf3ea5ee 100644 --- a/deploy/ydb-operator/crds/storagenodeset.yaml +++ b/deploy/ydb-operator/crds/storagenodeset.yaml @@ -1,11 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.16.5 name: storagenodesets.ydb.tech spec: group: ydb.tech @@ -30,14 +28,19 @@ spec: description: StorageNodeSet declares StatefulSet parameters properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -56,6 +59,12 @@ spec: description: (Optional) Additional custom resource labels that are added to all resources type: object + additionalPodLabels: + additionalProperties: + type: string + description: (Optional) Additional custom resource labels that are + added to Pods + type: object affinity: description: (Optional) If specified, the pod's scheduling constraints properties: @@ -64,22 +73,20 @@ spec: pod. properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node matches - the corresponding matchExpressions; the node(s) with the - highest sum are the most preferred. + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. items: - description: An empty preferred scheduling term matches - all objects with implicit weight 0 (i.e. it's a no-op). - A null preferred scheduling term matches no objects (i.e. - is also a no-op). + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). properties: preference: description: A node selector term, associated with the @@ -89,30 +96,26 @@ spec: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -125,30 +128,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -158,6 +157,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. @@ -169,50 +169,46 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to an update), the system may or may not try to - eventually evict the pod from its node. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. properties: nodeSelectorTerms: description: Required. A list of node selector terms. The terms are ORed. items: - description: A null or empty node selector term matches - no objects. The requirements of them are ANDed. The - TopologySelectorTerm type implements a subset of the - NodeSelectorTerm. + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. properties: matchExpressions: description: A list of node selector requirements by node's labels. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -225,30 +221,26 @@ spec: description: A list of node selector requirements by node's fields. items: - description: A node selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. properties: key: description: The label key that the selector applies to. type: string operator: - description: Represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists, DoesNotExist. Gt, and - Lt. + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. type: string values: - description: An array of string values. If - the operator is In or NotIn, the values - array must be non-empty. If the operator - is Exists or DoesNotExist, the values array - must be empty. If the operator is Gt or - Lt, the values array must have a single - element, which will be interpreted as an - integer. This array is replaced during a - strategic merge patch. + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. items: type: string type: array @@ -258,26 +250,27 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the affinity expressions specified by - this field, but it may choose a node that violates one or - more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -296,28 +289,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -330,50 +319,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -386,39 +369,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -427,23 +408,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the affinity requirements specified by this - field are not met at scheduling time, the pod will not be - scheduled onto the node. If the affinity requirements specified - by this field cease to be met at some point during pod execution - (e.g. due to a pod label update), the system may or may - not try to eventually evict the pod from its node. When - there are multiple elements, the lists of nodes corresponding - to each podAffinityTerm are intersected, i.e. all terms - must be satisfied. + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -453,26 +433,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -484,46 +463,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -535,31 +512,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -573,16 +547,15 @@ spec: other pod(s)). properties: preferredDuringSchedulingIgnoredDuringExecution: - description: The scheduler will prefer to schedule pods to - nodes that satisfy the anti-affinity expressions specified - by this field, but it may choose a node that violates one - or more of the expressions. The node that is most preferred - is the one with the greatest sum of weights, i.e. for each - node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, - etc.), compute a sum by iterating through the elements of - this field and adding "weight" to the sum if the node has - pods which matches the corresponding podAffinityTerm; the + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred. items: description: The weights of all of the matched WeightedPodAffinityTerm @@ -601,28 +574,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -635,50 +604,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied - to the union of the namespaces selected by this - field and the ones listed in the namespaces field. - null selector and null or empty namespaces list - means "this pod's namespace". An empty selector - ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -691,39 +654,37 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list - of namespace names that the term applies to. The - term is applied to the union of the namespaces - listed in this field and the ones selected by - namespaceSelector. null or empty namespaces list - and null namespaceSelector means "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods - matching the labelSelector in the specified namespaces, - where co-located is defined as running on a node - whose value of the label with key topologyKey - matches that of any node on which any of the selected - pods is running. Empty topologyKey is not allowed. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. type: string required: - topologyKey type: object weight: - description: weight associated with matching the corresponding - podAffinityTerm, in the range 1-100. + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. format: int32 type: integer required: @@ -732,23 +693,22 @@ spec: type: object type: array requiredDuringSchedulingIgnoredDuringExecution: - description: If the anti-affinity requirements specified by - this field are not met at scheduling time, the pod will - not be scheduled onto the node. If the anti-affinity requirements - specified by this field cease to be met at some point during - pod execution (e.g. due to a pod label update), the system - may or may not try to eventually evict the pod from its - node. When there are multiple elements, the lists of nodes - corresponding to each podAffinityTerm are intersected, i.e. - all terms must be satisfied. + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. items: - description: Defines a set of pods (namely those matching - the labelSelector relative to the given namespace(s)) - that this pod should be co-located (affinity) or not co-located - (anti-affinity) with, where co-located is defined as running - on a node whose value of the label with key - matches that of any node on which a pod of the set of - pods is running + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running properties: labelSelector: description: A label query over a set of resources, @@ -758,26 +718,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -789,46 +748,44 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: - description: A label query over the set of namespaces - that the term applies to. The term is applied to the - union of the namespaces selected by this field and - the ones listed in the namespaces field. null selector - and null or empty namespaces list means "this pod's - namespace". An empty selector ({}) matches all namespaces. + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -840,31 +797,28 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: - description: namespaces specifies a static list of namespace - names that the term applies to. The term is applied - to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. null or - empty namespaces list and null namespaceSelector means - "this pod's namespace". + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". items: type: string type: array topologyKey: - description: This pod should be co-located (affinity) - or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where - co-located is defined as running on a node whose value - of the label with key topologyKey matches that of - any node on which any of the selected pods is running. + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. Empty topologyKey is not allowed. type: string required: @@ -874,8 +828,9 @@ spec: type: object type: object caBundle: - description: User-defined root certificate authority that is added - to system trust store of Storage pods on startup. + description: |- + User-defined root certificate authority that is added to system trust + store of Storage pods on startup. type: string configuration: description: YDB configuration in YAML format. Will be applied on @@ -884,32 +839,33 @@ spec: dataStore: description: (Optional) Where cluster data should be kept items: - description: PersistentVolumeClaimSpec describes the common attributes - of storage devices and allows a Source for provider-specific attributes + description: |- + PersistentVolumeClaimSpec describes the common attributes of storage devices + and allows a Source for provider-specific attributes properties: accessModes: - description: 'accessModes contains the desired access modes - the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify either: + description: |- + dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the provisioner - or an external controller can support the specified data source, - it will create a new volume based on the contents of the specified - data source. When the AnyVolumeDataSource feature gate is - enabled, dataSource contents will be copied to dataSourceRef, - and dataSourceRef contents will be copied to dataSource when - dataSourceRef.namespace is not specified. If the namespace - is specified, then dataSourceRef will not be copied to dataSource.' + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource being - referenced. If APIGroup is not specified, the specified - Kind must be in the core API group. For any other third-party - types, APIGroup is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being referenced @@ -921,38 +877,38 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object from which - to populate the volume with data, if a non-empty volume is - desired. This may be any object from a non-empty API group - (non core object) or a PersistentVolumeClaim object. When - this field is specified, volume binding will only succeed - if the type of the specified object matches some installed - volume populator or dynamic provisioner. This field will replace - the functionality of the dataSource field and as such if both - fields are non-empty, they must have the same value. For backwards - compatibility, when namespace isn''t specified in dataSourceRef, - both fields (dataSource and dataSourceRef) will be set to - the same value automatically if one of them is empty and the - other is non-empty. When namespace is specified in dataSourceRef, - dataSource isn''t set to the same value and must be empty. - There are three important differences between dataSource and - dataSourceRef: * While dataSource only allows two specific - types of objects, dataSourceRef allows any non-core object, - as well as PersistentVolumeClaim objects. * While dataSource - ignores disallowed values (dropping them), dataSourceRef preserves - all values, and generates an error if a disallowed value is specified. - * While dataSource only allows local objects, dataSourceRef - allows objects in any namespaces. (Beta) Using this field - requires the AnyVolumeDataSource feature gate to be enabled. - (Alpha) Using the namespace field of dataSourceRef requires - the CrossNamespaceVolumeDataSource feature gate to be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource being - referenced. If APIGroup is not specified, the specified - Kind must be in the core API group. For any other third-party - types, APIGroup is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being referenced @@ -961,38 +917,39 @@ spec: description: Name is the name of resource being referenced type: string namespace: - description: Namespace is the namespace of resource being - referenced Note that when a namespace is specified, a - gateway.networking.k8s.io/ReferenceGrant object is required - in the referent namespace to allow that namespace's owner - to accept the reference. See the ReferenceGrant documentation - for details. (Alpha) This field requires the CrossNamespaceVolumeDataSource - feature gate to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources the - volume should have. If RecoverVolumeExpansionFailure feature - is enabled users are allowed to specify resource requirements - that are lower than previous value but must still be higher - than capacity recorded in the status field of the claim. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -1009,8 +966,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -1019,11 +977,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -1034,25 +992,25 @@ spec: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists or - DoesNotExist, the values array must be empty. This - array is replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -1064,21 +1022,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is - "key", the operator is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the StorageClass - required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume is required - by the claim. Value of Filesystem is implied when not included - in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference to the PersistentVolume @@ -1088,14 +1047,17 @@ spec: type: array domain: default: Root - description: '(Optional) Name of the root storage domain Default: - root' + description: |- + (Optional) Name of the root storage domain + Default: root maxLength: 63 pattern: '[a-zA-Z0-9]([-_a-zA-Z0-9]*[a-zA-Z0-9])?' type: string erasure: default: block-4-2 - description: Data storage topology mode For details, see https://ydb.tech/docs/en/cluster/topology + description: |- + Data storage topology mode + For details, see https://ydb.tech/docs/en/cluster/topology FIXME mirror-3-dc is only supported with external configuration enum: - mirror-3-dc @@ -1103,64 +1065,68 @@ spec: - none type: string hostNetwork: - description: '(Optional) Whether host network should be enabled. Default: - false' + description: |- + (Optional) Whether host network should be enabled. + Default: false type: boolean image: description: (Optional) Container image information properties: name: - description: 'Container image with supported YDB version. This - defaults to the version pinned to the operator and requires - a full container and tag/sha name. For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22' + description: |- + Container image with supported YDB version. + This defaults to the version pinned to the operator and requires a full container and tag/sha name. + For example: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.2.22 type: string pullPolicy: - description: '(Optional) PullPolicy for the image, which defaults - to IfNotPresent. Default: IfNotPresent' + description: |- + (Optional) PullPolicy for the image, which defaults to IfNotPresent. + Default: IfNotPresent type: string pullSecret: - description: (Optional) Secret name containing the dockerconfig - to use for a registry that requires authentication. The secret + description: |- + (Optional) Secret name containing the dockerconfig to use for a registry that requires authentication. The secret must be configured first by the user. type: string type: object initContainers: - description: '(Optional) List of initialization containers belonging - to the pod. Init containers are executed in order prior to containers - being started. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/' + description: |- + (Optional) List of initialization containers belonging to the pod. + Init containers are executed in order prior to containers being started. + More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ items: description: A single application container that you want to run within a pod. properties: args: - description: 'Arguments to the entrypoint. The container image''s - CMD is used if this is not provided. Variable references $(VAR_NAME) - are expanded using the container''s environment. If a variable - cannot be resolved, the reference in the input string will - be unchanged. Double $$ are reduced to a single $, which allows - for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will - produce the string literal "$(VAR_NAME)". Escaped references - will never be expanded, regardless of whether the variable - exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Arguments to the entrypoint. + The container image's CMD is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array command: - description: 'Entrypoint array. Not executed within a shell. - The container image''s ENTRYPOINT is used if this is not provided. - Variable references $(VAR_NAME) are expanded using the container''s - environment. If a variable cannot be resolved, the reference - in the input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) syntax: - i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". - Escaped references will never be expanded, regardless of whether - the variable exists or not. Cannot be updated. More info: - https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell' + description: |- + Entrypoint array. Not executed within a shell. + The container image's ENTRYPOINT is used if this is not provided. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell items: type: string type: array env: - description: List of environment variables to set in the container. + description: |- + List of environment variables to set in the container. Cannot be updated. items: description: EnvVar represents an environment variable present @@ -1171,16 +1137,16 @@ spec: a C_IDENTIFIER. type: string value: - description: 'Variable references $(VAR_NAME) are expanded - using the previously defined environment variables in - the container and any service environment variables. - If a variable cannot be resolved, the reference in the - input string will be unchanged. Double $$ are reduced - to a single $, which allows for escaping the $(VAR_NAME) - syntax: i.e. "$$(VAR_NAME)" will produce the string - literal "$(VAR_NAME)". Escaped references will never - be expanded, regardless of whether the variable exists - or not. Defaults to "".' + description: |- + Variable references $(VAR_NAME) are expanded + using the previously defined environment variables in the container and + any service environment variables. If a variable cannot be resolved, + the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. + "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". + Escaped references will never be expanded, regardless of whether the variable + exists or not. + Defaults to "". type: string valueFrom: description: Source for the environment variable's value. @@ -1193,10 +1159,9 @@ spec: description: The key to select. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap or @@ -1205,12 +1170,11 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: - description: 'Selects a field of the pod: supports - metadata.name, metadata.namespace, `metadata.labels['''']`, - `metadata.annotations['''']`, spec.nodeName, - spec.serviceAccountName, status.hostIP, status.podIP, - status.podIPs.' + description: |- + Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['']`, `metadata.annotations['']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs. properties: apiVersion: description: Version of the schema the FieldPath @@ -1223,12 +1187,11 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, limits.ephemeral-storage, requests.cpu, - requests.memory and requests.ephemeral-storage) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -1248,6 +1211,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -1257,10 +1221,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its @@ -1269,19 +1232,20 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name type: object type: array envFrom: - description: List of sources to populate environment variables - in the container. The keys defined within a source must be - a C_IDENTIFIER. All invalid keys will be reported as an event - when the container is starting. When a key exists in multiple - sources, the value associated with the last source will take - precedence. Values defined by an Env with a duplicate key - will take precedence. Cannot be updated. + description: |- + List of sources to populate environment variables in the container. + The keys defined within a source must be a C_IDENTIFIER. All invalid keys + will be reported as an event when the container is starting. When a key exists in multiple + sources, the value associated with the last source will take precedence. + Values defined by an Env with a duplicate key will take precedence. + Cannot be updated. items: description: EnvFromSource represents the source of a set of ConfigMaps @@ -1290,15 +1254,16 @@ spec: description: The ConfigMap to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the ConfigMap must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -1307,51 +1272,54 @@ spec: description: The Secret to select from properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: - description: 'Container image name. More info: https://kubernetes.io/docs/concepts/containers/images - This field is optional to allow higher level config management - to default or override container images in workload controllers - like Deployments and StatefulSets.' + description: |- + Container image name. + More info: https://kubernetes.io/docs/concepts/containers/images + This field is optional to allow higher level config management to default or override + container images in workload controllers like Deployments and StatefulSets. type: string imagePullPolicy: - description: 'Image pull policy. One of Always, Never, IfNotPresent. - Defaults to Always if :latest tag is specified, or IfNotPresent - otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images' + description: |- + Image pull policy. + One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/containers/images#updating-images type: string lifecycle: - description: Actions that the management system should take - in response to container lifecycle events. Cannot be updated. + description: |- + Actions that the management system should take in response to container lifecycle events. + Cannot be updated. properties: postStart: - description: 'PostStart is called immediately after a container - is created. If the handler fails, the container is terminated - and restarted according to its restart policy. Other management - of the container blocks until the hook completes. More - info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PostStart is called immediately after a container is created. If the handler fails, + the container is terminated and restarted according to its restart policy. + Other management of the container blocks until the hook completes. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1360,9 +1328,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1372,7 +1340,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1389,22 +1359,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1414,40 +1386,37 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object type: object preStop: - description: 'PreStop is called immediately before a container - is terminated due to an API request or management event - such as liveness/startup probe failure, preemption, resource - contention, etc. The handler is not called if the container - crashes or exits. The Pod''s termination grace period - countdown begins before the PreStop hook is executed. - Regardless of the outcome of the handler, the container - will eventually terminate within the Pod''s termination - grace period (unless delayed by finalizers). Other management - of the container blocks until the hook completes or until - the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks' + description: |- + PreStop is called immediately before a container is terminated due to an + API request or management event such as liveness/startup probe failure, + preemption, resource contention, etc. The handler is not called if the + container crashes or exits. The Pod's termination grace period countdown begins before the + PreStop hook is executed. Regardless of the outcome of the handler, the + container will eventually terminate within the Pod's termination grace + period (unless delayed by finalizers). Other management of the container blocks until the hook completes + or until the termination grace period is reached. + More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for - the command is root ('/') in the container's - filesystem. The command is simply exec'd, it is - not run inside a shell, so traditional shell instructions - ('|', etc) won't work. To use a shell, you need - to explicitly call out to that shell. Exit status - of 0 is treated as live/healthy and non-zero is - unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array @@ -1456,9 +1425,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to - the pod IP. You probably want to set "Host" in - httpHeaders instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. @@ -1468,7 +1437,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1485,22 +1456,24 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the - host. Defaults to HTTP. + description: |- + Scheme to use for connecting to the host. + Defaults to HTTP. type: string required: - port type: object tcpSocket: - description: Deprecated. TCPSocket is NOT supported - as a LifecycleHandler and kept for the backward compatibility. - There are no validation of this field and lifecycle - hooks will fail in runtime when tcp handler is specified. + description: |- + Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept + for the backward compatibility. There are no validation of this field and + lifecycle hooks will fail in runtime when tcp handler is specified. properties: host: description: 'Optional: Host name to connect to, @@ -1510,9 +1483,10 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access - on the container. Number must be in the range - 1 to 65535. Name must be an IANA_SVC_NAME. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. + Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port @@ -1520,36 +1494,36 @@ spec: type: object type: object livenessProbe: - description: 'Periodic probe of container liveness. Container - will be restarted if the probe fails. Cannot be updated. More - info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container liveness. + Container will be restarted if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1557,10 +1531,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1569,9 +1545,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1581,7 +1557,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1598,33 +1576,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1639,78 +1619,82 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object name: - description: Name of the container specified as a DNS_LABEL. + description: |- + Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. type: string ports: - description: List of ports to expose from the container. Not - specifying a port here DOES NOT prevent that port from being - exposed. Any port which is listening on the default "0.0.0.0" - address inside a container will be accessible from the network. - Modifying this array with strategic merge patch may corrupt - the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. + description: |- + List of ports to expose from the container. Not specifying a port here + DOES NOT prevent that port from being exposed. Any port which is + listening on the default "0.0.0.0" address inside a container will be + accessible from the network. + Modifying this array with strategic merge patch may corrupt the data. + For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated. items: description: ContainerPort represents a network port in a single container. properties: containerPort: - description: Number of port to expose on the pod's IP - address. This must be a valid port number, 0 < x < 65536. + description: |- + Number of port to expose on the pod's IP address. + This must be a valid port number, 0 < x < 65536. format: int32 type: integer hostIP: description: What host IP to bind the external port to. type: string hostPort: - description: Number of port to expose on the host. If - specified, this must be a valid port number, 0 < x < - 65536. If HostNetwork is specified, this must match - ContainerPort. Most containers do not need this. + description: |- + Number of port to expose on the host. + If specified, this must be a valid port number, 0 < x < 65536. + If HostNetwork is specified, this must match ContainerPort. + Most containers do not need this. format: int32 type: integer name: - description: If specified, this must be an IANA_SVC_NAME - and unique within the pod. Each named port in a pod - must have a unique name. Name for the port that can - be referred to by services. + description: |- + If specified, this must be an IANA_SVC_NAME and unique within the pod. Each + named port in a pod must have a unique name. Name for the port that can be + referred to by services. type: string protocol: default: TCP - description: Protocol for port. Must be UDP, TCP, or SCTP. + description: |- + Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP". type: string required: @@ -1722,36 +1706,36 @@ spec: - protocol x-kubernetes-list-type: map readinessProbe: - description: 'Periodic probe of container service readiness. - Container will be removed from service endpoints if the probe - fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -1759,10 +1743,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -1771,9 +1757,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -1783,7 +1769,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -1800,33 +1788,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -1841,53 +1831,58 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object resources: - description: 'Compute Resources required by this container. - Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Compute Resources required by this container. + Cannot be updated. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ properties: claims: - description: "Claims lists the names of resources, defined - in spec.resourceClaims, that are used by this container. - \n This is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry - in pod.spec.resourceClaims of the Pod where this - field is used. It makes that resource available + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available inside a container. type: string required: @@ -1904,8 +1899,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -1914,33 +1910,34 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object securityContext: - description: 'SecurityContext defines the security options the - container should be run with. If set, the fields of SecurityContext - override the equivalent fields of PodSecurityContext. More - info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/' + description: |- + SecurityContext defines the security options the container should be run with. + If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. + More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ properties: allowPrivilegeEscalation: - description: 'AllowPrivilegeEscalation controls whether - a process can gain more privileges than its parent process. - This bool directly controls if the no_new_privs flag will - be set on the container process. AllowPrivilegeEscalation - is true always when the container is: 1) run as Privileged - 2) has CAP_SYS_ADMIN Note that this field cannot be set - when spec.os.name is windows.' + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. type: boolean capabilities: - description: The capabilities to add/drop when running containers. - Defaults to the default set of capabilities granted by - the container runtime. Note that this field cannot be - set when spec.os.name is windows. + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. properties: add: description: Added capabilities @@ -1958,60 +1955,60 @@ spec: type: array type: object privileged: - description: Run container in privileged mode. Processes - in privileged containers are essentially equivalent to - root on the host. Defaults to false. Note that this field - cannot be set when spec.os.name is windows. + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. type: boolean procMount: - description: procMount denotes the type of proc mount to - use for the containers. The default is DefaultProcMount - which uses the container runtime defaults for readonly - paths and masked paths. This requires the ProcMountType - feature flag to be enabled. Note that this field cannot - be set when spec.os.name is windows. + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. type: string readOnlyRootFilesystem: - description: Whether this container has a read-only root - filesystem. Default is false. Note that this field cannot - be set when spec.os.name is windows. + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. type: boolean runAsGroup: - description: The GID to run the entrypoint of the container - process. Uses runtime default if unset. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer runAsNonRoot: - description: Indicates that the container must run as a - non-root user. If true, the Kubelet will validate the - image at runtime to ensure that it does not run as UID - 0 (root) and fail to start the container if it does. If - unset or false, no such validation will be performed. - May also be set in PodSecurityContext. If set in both - SecurityContext and PodSecurityContext, the value specified - in SecurityContext takes precedence. + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: boolean runAsUser: - description: The UID to run the entrypoint of the container - process. Defaults to user specified in image metadata - if unspecified. May also be set in PodSecurityContext. If - set in both SecurityContext and PodSecurityContext, the - value specified in SecurityContext takes precedence. Note - that this field cannot be set when spec.os.name is windows. + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. format: int64 type: integer seLinuxOptions: - description: The SELinux context to be applied to the container. - If unspecified, the container runtime will allocate a - random SELinux context for each container. May also be - set in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. Note that this field cannot be set when - spec.os.name is windows. + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. properties: level: description: Level is SELinux level label that applies @@ -2031,108 +2028,101 @@ spec: type: string type: object seccompProfile: - description: The seccomp options to use by this container. - If seccomp options are provided at both the pod & container - level, the container options override the pod options. - Note that this field cannot be set when spec.os.name is - windows. + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. properties: localhostProfile: - description: localhostProfile indicates a profile defined - in a file on the node should be used. The profile - must be preconfigured on the node to work. Must be - a descending path, relative to the kubelet's configured - seccomp profile location. Must only be set if type - is "Localhost". + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". type: string type: - description: "type indicates which kind of seccomp profile - will be applied. Valid options are: \n Localhost - - a profile defined in a file on the node should be - used. RuntimeDefault - the container runtime default - profile should be used. Unconfined - no profile should - be applied." + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. type: string required: - type type: object windowsOptions: - description: The Windows specific settings applied to all - containers. If unspecified, the options from the PodSecurityContext - will be used. If set in both SecurityContext and PodSecurityContext, - the value specified in SecurityContext takes precedence. - Note that this field cannot be set when spec.os.name is - linux. + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. properties: gmsaCredentialSpec: - description: GMSACredentialSpec is where the GMSA admission - webhook (https://github.com/kubernetes-sigs/windows-gmsa) - inlines the contents of the GMSA credential spec named - by the GMSACredentialSpecName field. + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. type: string gmsaCredentialSpecName: description: GMSACredentialSpecName is the name of the GMSA credential spec to use. type: string hostProcess: - description: HostProcess determines if a container should - be run as a 'Host Process' container. This field is - alpha-level and will only be honored by components - that enable the WindowsHostProcessContainers feature - flag. Setting this field without the feature flag - will result in errors when validating the Pod. All - of a Pod's containers must have the same effective - HostProcess value (it is not allowed to have a mix - of HostProcess containers and non-HostProcess containers). In - addition, if HostProcess is true then HostNetwork - must also be set to true. + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. type: boolean runAsUserName: - description: The UserName in Windows to run the entrypoint - of the container process. Defaults to the user specified - in image metadata if unspecified. May also be set - in PodSecurityContext. If set in both SecurityContext - and PodSecurityContext, the value specified in SecurityContext - takes precedence. + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. type: string type: object type: object startupProbe: - description: 'StartupProbe indicates that the Pod has successfully - initialized. If specified, no other probes are executed until - this completes successfully. If this probe fails, the Pod - will be restarted, just as if the livenessProbe failed. This - can be used to provide different probe parameters at the beginning - of a Pod''s lifecycle, when it might take a long time to load - data or warm a cache, than during steady-state operation. - This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + StartupProbe indicates that the Pod has successfully initialized. + If specified, no other probes are executed until this completes successfully. + If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. + This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, + when it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes properties: exec: description: Exec specifies the action to take. properties: command: - description: Command is the command line to execute - inside the container, the working directory for the - command is root ('/') in the container's filesystem. - The command is simply exec'd, it is not run inside - a shell, so traditional shell instructions ('|', etc) - won't work. To use a shell, you need to explicitly - call out to that shell. Exit status of 0 is treated - as live/healthy and non-zero is unhealthy. + description: |- + Command is the command line to execute inside the container, the working directory for the + command is root ('/') in the container's filesystem. The command is simply exec'd, it is + not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use + a shell, you need to explicitly call out to that shell. + Exit status of 0 is treated as live/healthy and non-zero is unhealthy. items: type: string type: array type: object failureThreshold: - description: Minimum consecutive failures for the probe - to be considered failed after having succeeded. Defaults - to 3. Minimum value is 1. + description: |- + Minimum consecutive failures for the probe to be considered failed after having succeeded. + Defaults to 3. Minimum value is 1. format: int32 type: integer grpc: - description: GRPC specifies an action involving a GRPC port. - This is a beta field and requires enabling GRPCContainerProbe - feature gate. + description: |- + GRPC specifies an action involving a GRPC port. + This is a beta field and requires enabling GRPCContainerProbe feature gate. properties: port: description: Port number of the gRPC service. Number @@ -2140,10 +2130,12 @@ spec: format: int32 type: integer service: - description: "Service is the name of the service to - place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - \n If this is not specified, the default behavior - is defined by gRPC." + default: "" + description: |- + Service is the name of the service to place in the gRPC HealthCheckRequest + (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). + + If this is not specified, the default behavior is defined by gRPC. type: string required: - port @@ -2152,9 +2144,9 @@ spec: description: HTTPGet specifies the http request to perform. properties: host: - description: Host name to connect to, defaults to the - pod IP. You probably want to set "Host" in httpHeaders - instead. + description: |- + Host name to connect to, defaults to the pod IP. You probably want to set + "Host" in httpHeaders instead. type: string httpHeaders: description: Custom headers to set in the request. HTTP @@ -2164,7 +2156,9 @@ spec: to be used in HTTP probes properties: name: - description: The header field name + description: |- + The header field name. + This will be canonicalized upon output, so case-variant names will be understood as the same header. type: string value: description: The header field value @@ -2181,33 +2175,35 @@ spec: anyOf: - type: integer - type: string - description: Name or number of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Name or number of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true scheme: - description: Scheme to use for connecting to the host. + description: |- + Scheme to use for connecting to the host. Defaults to HTTP. type: string required: - port type: object initialDelaySeconds: - description: 'Number of seconds after the container has - started before liveness probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after the container has started before liveness probes are initiated. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer periodSeconds: - description: How often (in seconds) to perform the probe. + description: |- + How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: - description: Minimum consecutive successes for the probe - to be considered successful after having failed. Defaults - to 1. Must be 1 for liveness and startup. Minimum value - is 1. + description: |- + Minimum consecutive successes for the probe to be considered successful after having failed. + Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. format: int32 type: integer tcpSocket: @@ -2222,77 +2218,76 @@ spec: anyOf: - type: integer - type: string - description: Number or name of the port to access on - the container. Number must be in the range 1 to 65535. + description: |- + Number or name of the port to access on the container. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. x-kubernetes-int-or-string: true required: - port type: object terminationGracePeriodSeconds: - description: Optional duration in seconds the pod needs - to terminate gracefully upon probe failure. The grace - period is the duration in seconds after the processes - running in the pod are sent a termination signal and the - time when the processes are forcibly halted with a kill - signal. Set this value longer than the expected cleanup - time for your process. If this value is nil, the pod's - terminationGracePeriodSeconds will be used. Otherwise, - this value overrides the value provided by the pod spec. - Value must be non-negative integer. The value zero indicates - stop immediately via the kill signal (no opportunity to - shut down). This is a beta field and requires enabling - ProbeTerminationGracePeriod feature gate. Minimum value - is 1. spec.terminationGracePeriodSeconds is used if unset. + description: |- + Optional duration in seconds the pod needs to terminate gracefully upon probe failure. + The grace period is the duration in seconds after the processes running in the pod are sent + a termination signal and the time when the processes are forcibly halted with a kill signal. + Set this value longer than the expected cleanup time for your process. + If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this + value overrides the value provided by the pod spec. + Value must be non-negative integer. The value zero indicates stop immediately via + the kill signal (no opportunity to shut down). + This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. + Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. format: int64 type: integer timeoutSeconds: - description: 'Number of seconds after which the probe times - out. Defaults to 1 second. Minimum value is 1. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + description: |- + Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes format: int32 type: integer type: object stdin: - description: Whether this container should allocate a buffer - for stdin in the container runtime. If this is not set, reads - from stdin in the container will always result in EOF. Default - is false. + description: |- + Whether this container should allocate a buffer for stdin in the container runtime. If this + is not set, reads from stdin in the container will always result in EOF. + Default is false. type: boolean stdinOnce: - description: Whether the container runtime should close the - stdin channel after it has been opened by a single attach. - When stdin is true the stdin stream will remain open across - multiple attach sessions. If stdinOnce is set to true, stdin - is opened on container start, is empty until the first client - attaches to stdin, and then remains open and accepts data - until the client disconnects, at which time stdin is closed - and remains closed until the container is restarted. If this - flag is false, a container processes that reads from stdin - will never receive an EOF. Default is false + description: |- + Whether the container runtime should close the stdin channel after it has been opened by + a single attach. When stdin is true the stdin stream will remain open across multiple attach + sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the + first client attaches to stdin, and then remains open and accepts data until the client disconnects, + at which time stdin is closed and remains closed until the container is restarted. If this + flag is false, a container processes that reads from stdin will never receive an EOF. + Default is false type: boolean terminationMessagePath: - description: 'Optional: Path at which the file to which the - container''s termination message will be written is mounted - into the container''s filesystem. Message written is intended - to be brief final status, such as an assertion failure message. - Will be truncated by the node if greater than 4096 bytes. - The total message length across all containers will be limited - to 12kb. Defaults to /dev/termination-log. Cannot be updated.' + description: |- + Optional: Path at which the file to which the container's termination message + will be written is mounted into the container's filesystem. + Message written is intended to be brief final status, such as an assertion failure message. + Will be truncated by the node if greater than 4096 bytes. The total message length across + all containers will be limited to 12kb. + Defaults to /dev/termination-log. + Cannot be updated. type: string terminationMessagePolicy: - description: Indicate how the termination message should be - populated. File will use the contents of terminationMessagePath - to populate the container status message on both success and - failure. FallbackToLogsOnError will use the last chunk of - container log output if the termination message file is empty - and the container exited with an error. The log output is - limited to 2048 bytes or 80 lines, whichever is smaller. Defaults - to File. Cannot be updated. + description: |- + Indicate how the termination message should be populated. File will use the contents of + terminationMessagePath to populate the container status message on both success and failure. + FallbackToLogsOnError will use the last chunk of container log output if the termination + message file is empty and the container exited with an error. + The log output is limited to 2048 bytes or 80 lines, whichever is smaller. + Defaults to File. + Cannot be updated. type: string tty: - description: Whether this container should allocate a TTY for - itself, also requires 'stdin' to be true. Default is false. + description: |- + Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. + Default is false. type: boolean volumeDevices: description: volumeDevices is the list of block devices to be @@ -2315,40 +2310,44 @@ spec: type: object type: array volumeMounts: - description: Pod volumes to mount into the container's filesystem. + description: |- + Pod volumes to mount into the container's filesystem. Cannot be updated. items: description: VolumeMount describes a mounting of a Volume within a container. properties: mountPath: - description: Path within the container at which the volume - should be mounted. Must not contain ':'. + description: |- + Path within the container at which the volume should be mounted. Must + not contain ':'. type: string mountPropagation: - description: mountPropagation determines how mounts are - propagated from the host to container and the other - way around. When not set, MountPropagationNone is used. + description: |- + mountPropagation determines how mounts are propagated from the host + to container and the other way around. + When not set, MountPropagationNone is used. This field is beta in 1.10. type: string name: description: This must match the Name of a Volume. type: string readOnly: - description: Mounted read-only if true, read-write otherwise - (false or unspecified). Defaults to false. + description: |- + Mounted read-only if true, read-write otherwise (false or unspecified). + Defaults to false. type: boolean subPath: - description: Path within the volume from which the container's - volume should be mounted. Defaults to "" (volume's root). + description: |- + Path within the volume from which the container's volume should be mounted. + Defaults to "" (volume's root). type: string subPathExpr: - description: Expanded path within the volume from which - the container's volume should be mounted. Behaves similarly - to SubPath but environment variable references $(VAR_NAME) - are expanded using the container's environment. Defaults - to "" (volume's root). SubPathExpr and SubPath are mutually - exclusive. + description: |- + Expanded path within the volume from which the container's volume should be mounted. + Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. + Defaults to "" (volume's root). + SubPathExpr and SubPath are mutually exclusive. type: string required: - mountPath @@ -2356,17 +2355,20 @@ spec: type: object type: array workingDir: - description: Container's working directory. If not specified, - the container runtime's default will be used, which might - be configured in the container image. Cannot be updated. + description: |- + Container's working directory. + If not specified, the container runtime's default will be used, which + might be configured in the container image. + Cannot be updated. type: string required: - name type: object type: array monitoring: - description: '(Optional) Monitoring sets configuration options for - YDB observability Default: ""' + description: |- + (Optional) Monitoring sets configuration options for YDB observability + Default: "" properties: enabled: type: boolean @@ -2377,10 +2379,10 @@ spec: description: RelabelConfig allows dynamic rewriting of the label set, being applied to sample before ingestion. items: - description: 'RelabelConfig allows dynamic rewriting of the - label set, being applied to samples before ingestion. It defines - ``-section of Prometheus configuration. - More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs' + description: |- + RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. + It defines ``-section of Prometheus configuration. + More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs properties: action: description: Action to perform based on regex matching. @@ -2396,26 +2398,26 @@ spec: value is matched. Default is '(.*)' type: string replacement: - description: Replacement value against which a regex replace - is performed if the regular expression matches. Regex - capture groups are available. Default is '$1' + description: |- + Replacement value against which a regex replace is performed if the + regular expression matches. Regex capture groups are available. Default is '$1' type: string separator: description: Separator placed between concatenated source label values. default is ';'. type: string sourceLabels: - description: The source labels select values from existing - labels. Their content is concatenated using the configured - separator and matched against the configured regular expression + description: |- + The source labels select values from existing labels. Their content is concatenated + using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions. items: type: string type: array targetLabel: - description: Label to which the resulting value is written - in a replace action. It is mandatory for replace actions. - Regex capture groups are available. + description: |- + Label to which the resulting value is written in a replace action. + It is mandatory for replace actions. Regex capture groups are available. type: string type: object type: array @@ -2425,106 +2427,56 @@ spec: nodeSelector: additionalProperties: type: string - description: '(Optional) NodeSelector is a selector which must be - true for the pod to fit on a node. Selector which must match a node''s - labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/' + description: |- + (Optional) NodeSelector is a selector which must be true for the pod to fit on a node. + Selector which must match a node's labels for the pod to be scheduled on that node. + More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ type: object nodes: description: Number of nodes (pods) format: int32 type: integer - operatorConnection: - description: '(Optional) Operator connection settings Default: (not - specified)' - properties: - accessToken: - properties: - secretKeyRef: - description: SecretKeySelector selects a key of a Secret. - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the Secret or its key must - be defined - type: boolean - required: - - key - type: object - required: - - secretKeyRef - type: object - staticCredentials: - properties: - password: - properties: - secretKeyRef: - description: SecretKeySelector selects a key of a Secret. - properties: - key: - description: The key of the secret to select from. Must - be a valid secret key. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' - type: string - optional: - description: Specify whether the Secret or its key - must be defined - type: boolean - required: - - key - type: object - required: - - secretKeyRef - type: object - username: - type: string - required: - - username - type: object - type: object operatorSync: default: true - description: Enables or disables operator's reconcile loop. `false` - means all the Pods are running, but the reconcile is effectively - turned off. `true` means the default state of the system, all Pods - running, operator reacts to specification change of this Storage - resource. + description: |- + Enables or disables operator's reconcile loop. + `false` means all the Pods are running, but the reconcile is effectively turned off. + `true` means the default state of the system, all Pods running, operator reacts + to specification change of this Storage resource. type: boolean pause: default: false - description: The state of the Storage processes. `true` means all - the Storage Pods are being killed, but the Storage resource is persisted. + description: |- + The state of the Storage processes. + `true` means all the Storage Pods are being killed, but the Storage resource is persisted. `false` means the default state of the system, all Pods running. type: boolean priorityClassName: description: (Optional) If specified, the pod's priorityClassName. type: string resources: - description: '(Optional) Container resource limits. Any container - limits can be specified. Default: (not specified)' + description: |- + (Optional) Container resource limits. Any container limits + can be specified. + Default: (not specified) properties: claims: - description: "Claims lists the names of resources, defined in - spec.resourceClaims, that are used by this container. \n This - is an alpha field and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name of one entry in pod.spec.resourceClaims - of the Pod where this field is used. It makes that resource - available inside a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -2540,8 +2492,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount of compute resources - allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -2550,28 +2503,204 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object secrets: - description: 'Secret names that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/secrets//`' + description: |- + Secret names that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/secrets//` items: - description: LocalObjectReference contains enough information to - let you locate the referenced object inside the same namespace. + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic type: array + securityContext: + description: |- + SecurityContext holds security configuration that will be applied to a container. + Some fields are present in both SecurityContext and PodSecurityContext. When both + are set, the values in SecurityContext take precedence. + properties: + allowPrivilegeEscalation: + description: |- + AllowPrivilegeEscalation controls whether a process can gain more + privileges than its parent process. This bool directly controls if + the no_new_privs flag will be set on the container process. + AllowPrivilegeEscalation is true always when the container is: + 1) run as Privileged + 2) has CAP_SYS_ADMIN + Note that this field cannot be set when spec.os.name is windows. + type: boolean + capabilities: + description: |- + The capabilities to add/drop when running containers. + Defaults to the default set of capabilities granted by the container runtime. + Note that this field cannot be set when spec.os.name is windows. + properties: + add: + description: Added capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + drop: + description: Removed capabilities + items: + description: Capability represent POSIX capabilities type + type: string + type: array + type: object + privileged: + description: |- + Run container in privileged mode. + Processes in privileged containers are essentially equivalent to root on the host. + Defaults to false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + procMount: + description: |- + procMount denotes the type of proc mount to use for the containers. + The default is DefaultProcMount which uses the container runtime defaults for + readonly paths and masked paths. + This requires the ProcMountType feature flag to be enabled. + Note that this field cannot be set when spec.os.name is windows. + type: string + readOnlyRootFilesystem: + description: |- + Whether this container has a read-only root filesystem. + Default is false. + Note that this field cannot be set when spec.os.name is windows. + type: boolean + runAsGroup: + description: |- + The GID to run the entrypoint of the container process. + Uses runtime default if unset. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + runAsNonRoot: + description: |- + Indicates that the container must run as a non-root user. + If true, the Kubelet will validate the image at runtime to ensure that it + does not run as UID 0 (root) and fail to start the container if it does. + If unset or false, no such validation will be performed. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: boolean + runAsUser: + description: |- + The UID to run the entrypoint of the container process. + Defaults to user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + format: int64 + type: integer + seLinuxOptions: + description: |- + The SELinux context to be applied to the container. + If unspecified, the container runtime will allocate a random SELinux context for each + container. May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is windows. + properties: + level: + description: Level is SELinux level label that applies to + the container. + type: string + role: + description: Role is a SELinux role label that applies to + the container. + type: string + type: + description: Type is a SELinux type label that applies to + the container. + type: string + user: + description: User is a SELinux user label that applies to + the container. + type: string + type: object + seccompProfile: + description: |- + The seccomp options to use by this container. If seccomp options are + provided at both the pod & container level, the container options + override the pod options. + Note that this field cannot be set when spec.os.name is windows. + properties: + localhostProfile: + description: |- + localhostProfile indicates a profile defined in a file on the node should be used. + The profile must be preconfigured on the node to work. + Must be a descending path, relative to the kubelet's configured seccomp profile location. + Must only be set if type is "Localhost". + type: string + type: + description: |- + type indicates which kind of seccomp profile will be applied. + Valid options are: + + Localhost - a profile defined in a file on the node should be used. + RuntimeDefault - the container runtime default profile should be used. + Unconfined - no profile should be applied. + type: string + required: + - type + type: object + windowsOptions: + description: |- + The Windows specific settings applied to all containers. + If unspecified, the options from the PodSecurityContext will be used. + If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. + Note that this field cannot be set when spec.os.name is linux. + properties: + gmsaCredentialSpec: + description: |- + GMSACredentialSpec is where the GMSA admission webhook + (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the + GMSA credential spec named by the GMSACredentialSpecName field. + type: string + gmsaCredentialSpecName: + description: GMSACredentialSpecName is the name of the GMSA + credential spec to use. + type: string + hostProcess: + description: |- + HostProcess determines if a container should be run as a 'Host Process' container. + This field is alpha-level and will only be honored by components that enable the + WindowsHostProcessContainers feature flag. Setting this field without the feature + flag will result in errors when validating the Pod. All of a Pod's containers must + have the same effective HostProcess value (it is not allowed to have a mix of HostProcess + containers and non-HostProcess containers). In addition, if HostProcess is true + then HostNetwork must also be set to true. + type: boolean + runAsUserName: + description: |- + The UserName in Windows to run the entrypoint of the container process. + Defaults to the user specified in image metadata if unspecified. + May also be set in PodSecurityContext. If set in both SecurityContext and + PodSecurityContext, the value specified in SecurityContext takes precedence. + type: string + type: object + type: object service: - description: '(Optional) Storage services parameter overrides Default: - (not specified)' + description: |- + (Optional) Storage services parameter overrides + Default: (not specified) properties: grpc: properties: @@ -2585,11 +2714,28 @@ spec: type: object externalHost: type: string + externalPort: + format: int32 + type: integer + ipDiscovery: + properties: + enabled: + type: boolean + ipFamily: + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). + type: string + targetNameOverride: + type: string + required: + - enabled + type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -2606,9 +2752,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2617,6 +2763,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -2625,9 +2772,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2636,6 +2783,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -2646,9 +2794,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2657,6 +2805,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -2673,9 +2822,9 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: @@ -2692,9 +2841,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2703,6 +2852,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic certificate: description: SecretKeySelector selects a key of a Secret. properties: @@ -2711,9 +2861,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2722,6 +2872,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic enabled: type: boolean key: @@ -2732,9 +2883,9 @@ spec: be a valid secret key. type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: Specify whether the Secret or its key @@ -2743,6 +2894,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic required: - enabled type: object @@ -2759,15 +2911,82 @@ spec: type: object ipFamilies: items: - description: IPFamily represents the IP Family (IPv4 or - IPv6). This type is used to express the family of an IP - expressed by a type (e.g. service.spec.ipFamilies). + description: |- + IPFamily represents the IP Family (IPv4 or IPv6). This type is used + to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies). type: string type: array ipFamilyPolicy: description: IPFamilyPolicy represents the dual-stack-ness requested or required by a Service type: string + tls: + properties: + CA: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + certificate: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + enabled: + type: boolean + key: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + optional: + description: Specify whether the Secret or its key + must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + required: + - enabled + type: object type: object type: object storageRef: @@ -2784,81 +3003,86 @@ spec: required: - name type: object + terminationGracePeriodSeconds: + description: (Optional) If specified, the pod's terminationGracePeriodSeconds. + format: int64 + type: integer tolerations: description: (Optional) If specified, the pod's tolerations. items: - description: The pod this Toleration is attached to tolerates any - taint that matches the triple using the matching - operator . + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . properties: effect: - description: Effect indicates the taint effect to match. Empty - means match all taint effects. When specified, allowed values - are NoSchedule, PreferNoSchedule and NoExecute. + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. type: string key: - description: Key is the taint key that the toleration applies - to. Empty means match all taint keys. If the key is empty, - operator must be Exists; this combination means to match all - values and all keys. + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. type: string operator: - description: Operator represents a key's relationship to the - value. Valid operators are Exists and Equal. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod - can tolerate all taints of a particular category. + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. type: string tolerationSeconds: - description: TolerationSeconds represents the period of time - the toleration (which must be of effect NoExecute, otherwise - this field is ignored) tolerates the taint. By default, it - is not set, which means tolerate the taint forever (do not - evict). Zero and negative values will be treated as 0 (evict - immediately) by the system. + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. format: int64 type: integer value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. type: string type: object type: array topologySpreadConstraints: - description: (Optional) If specified, the pod's topologySpreadConstraints. + description: |- + (Optional) If specified, the pod's topologySpreadConstraints. All topologySpreadConstraints are ANDed. items: description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. properties: labelSelector: - description: LabelSelector is used to find matching pods. Pods - that match this label selector are counted to determine the - number of pods in their corresponding topology domain. + description: |- + LabelSelector is used to find matching pods. + Pods that match this label selector are counted to determine the number of pods + in their corresponding topology domain. properties: matchExpressions: description: matchExpressions is a list of label selector requirements. The requirements are ANDed. items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists or - DoesNotExist, the values array must be empty. This - array is replaced during a strategic merge patch. + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. items: type: string type: array @@ -2870,121 +3094,125 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is - "key", the operator is "In", and the values array contains - only "value". The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic matchLabelKeys: - description: MatchLabelKeys is a set of pod label keys to select - the pods over which spreading will be calculated. The keys - are used to lookup values from the incoming pod labels, those - key-value labels are ANDed with labelSelector to select the - group of existing pods over which spreading will be calculated - for the incoming pod. Keys that don't exist in the incoming - pod labels will be ignored. A null or empty list means only - match against labelSelector. + description: |- + MatchLabelKeys is a set of pod label keys to select the pods over which + spreading will be calculated. The keys are used to lookup values from the + incoming pod labels, those key-value labels are ANDed with labelSelector + to select the group of existing pods over which spreading will be calculated + for the incoming pod. Keys that don't exist in the incoming pod labels will + be ignored. A null or empty list means only match against labelSelector. items: type: string type: array x-kubernetes-list-type: atomic maxSkew: - description: 'MaxSkew describes the degree to which pods may - be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, - it is the maximum permitted difference between the number - of matching pods in the target topology and the global minimum. - The global minimum is the minimum number of matching pods - in an eligible domain or zero if the number of eligible domains - is less than MinDomains. For example, in a 3-zone cluster, - MaxSkew is set to 1, and pods with the same labelSelector - spread as 2/2/1: In this case, the global minimum is 1. | - zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew - is 1, incoming pod can only be scheduled to zone3 to become - 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) - on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming - pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, - it is used to give higher precedence to topologies that satisfy - it. It''s a required field. Default value is 1 and 0 is not - allowed.' + description: |- + MaxSkew describes the degree to which pods may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of matching pods in the target topology and the global minimum. + The global minimum is the minimum number of matching pods in an eligible domain + or zero if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 2/2/1: + In this case, the global minimum is 1. + | zone1 | zone2 | zone3 | + | P P | P P | P | + - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; + scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) + violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto any zone. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's a required field. Default value is 1 and 0 is not allowed. format: int32 type: integer minDomains: - description: "MinDomains indicates a minimum number of eligible - domains. When the number of eligible domains with matching - topology keys is less than minDomains, Pod Topology Spread - treats \"global minimum\" as 0, and then the calculation of - Skew is performed. And when the number of eligible domains - with matching topology keys equals or greater than minDomains, - this value has no effect on scheduling. As a result, when - the number of eligible domains is less than minDomains, scheduler - won't schedule more than maxSkew Pods to those domains. If - value is nil, the constraint behaves as if MinDomains is equal - to 1. Valid values are integers greater than 0. When value - is not nil, WhenUnsatisfiable must be DoNotSchedule. \n For - example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains - is set to 5 and pods with the same labelSelector spread as - 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | - The number of domains is less than 5(MinDomains), so \"global - minimum\" is treated as 0. In this situation, new pod with - the same labelSelector cannot be scheduled, because computed - skew will be 3(3 - 0) if new Pod is scheduled to any of the - three zones, it will violate MaxSkew. \n This is a beta field - and requires the MinDomainsInPodTopologySpread feature gate - to be enabled (enabled by default)." + description: |- + MinDomains indicates a minimum number of eligible domains. + When the number of eligible domains with matching topology keys is less than minDomains, + Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. + And when the number of eligible domains with matching topology keys equals or greater than minDomains, + this value has no effect on scheduling. + As a result, when the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to those domains. + If value is nil, the constraint behaves as if MinDomains is equal to 1. + Valid values are integers greater than 0. + When value is not nil, WhenUnsatisfiable must be DoNotSchedule. + + For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same + labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | + | P P | P P | P P | + The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. + In this situation, new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, + it will violate MaxSkew. + + This is a beta field and requires the MinDomainsInPodTopologySpread feature gate to be enabled (enabled by default). format: int32 type: integer nodeAffinityPolicy: - description: "NodeAffinityPolicy indicates how we will treat - Pod's nodeAffinity/nodeSelector when calculating pod topology - spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector - are included in the calculations. - Ignore: nodeAffinity/nodeSelector - are ignored. All nodes are included in the calculations. \n - If this value is nil, the behavior is equivalent to the Honor - policy. This is a beta-level feature default enabled by the - NodeInclusionPolicyInPodTopologySpread feature flag." + description: |- + NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector + when calculating pod topology spread skew. Options are: + - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. + - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. + + If this value is nil, the behavior is equivalent to the Honor policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string nodeTaintsPolicy: - description: "NodeTaintsPolicy indicates how we will treat node - taints when calculating pod topology spread skew. Options - are: - Honor: nodes without taints, along with tainted nodes - for which the incoming pod has a toleration, are included. + description: |- + NodeTaintsPolicy indicates how we will treat node taints when calculating + pod topology spread skew. Options are: + - Honor: nodes without taints, along with tainted nodes for which the incoming pod + has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - \n If this value is nil, the behavior is equivalent to the - Ignore policy. This is a beta-level feature default enabled - by the NodeInclusionPolicyInPodTopologySpread feature flag." + + If this value is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag. type: string topologyKey: - description: TopologyKey is the key of node labels. Nodes that - have a label with this key and identical values are considered - to be in the same topology. We consider each - as a "bucket", and try to put balanced number of pods into - each bucket. We define a domain as a particular instance of - a topology. Also, we define an eligible domain as a domain - whose nodes meet the requirements of nodeAffinityPolicy and - nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", - each Node is a domain of that topology. And, if TopologyKey - is "topology.kubernetes.io/zone", each zone is a domain of - that topology. It's a required field. + description: |- + TopologyKey is the key of node labels. Nodes that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of pods into each bucket. + We define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose nodes meet the requirements of + nodeAffinityPolicy and nodeTaintsPolicy. + e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. + And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. + It's a required field. type: string whenUnsatisfiable: - description: 'WhenUnsatisfiable indicates how to deal with a - pod if it doesn''t satisfy the spread constraint. - DoNotSchedule - (default) tells the scheduler not to schedule it. - ScheduleAnyway - tells the scheduler to schedule the pod in any location, but - giving higher precedence to topologies that would help reduce - the skew. A constraint is considered "Unsatisfiable" for - an incoming pod if and only if every possible node assignment - for that pod would violate "MaxSkew" on some topology. For - example, in a 3-zone cluster, MaxSkew is set to 1, and pods - with the same labelSelector spread as 3/1/1: | zone1 | zone2 - | zone3 | | P P P | P | P | If WhenUnsatisfiable is - set to DoNotSchedule, incoming pod can only be scheduled to - zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on - zone2(zone3) satisfies MaxSkew(1). In other words, the cluster - can still be imbalanced, but scheduler won''t make it *more* - imbalanced. It''s a required field.' + description: |- + WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the pod in any location, + but giving higher precedence to topologies that would help reduce the + skew. + A constraint is considered "Unsatisfiable" for an incoming pod + if and only if every possible node assignment for that pod would violate + "MaxSkew" on some topology. + For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same + labelSelector spread as 3/1/1: + | zone1 | zone2 | zone3 | + | P P P | P | P | + If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled + to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies + MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler + won't make it *more* imbalanced. + It's a required field. type: string required: - maxSkew @@ -2997,46 +3225,49 @@ spec: - whenUnsatisfiable x-kubernetes-list-type: map version: - description: '(Optional) YDBVersion sets the explicit version of the - YDB image Default: ""' + description: |- + (Optional) YDBVersion sets the explicit version of the YDB image + Default: "" type: string volumes: - description: 'Additional volumes that will be mounted into the well-known - directory of every storage pod. Directory: `/opt/ydb/volumes/`. - Only `hostPath` volume type is supported for now.' + description: |- + Additional volumes that will be mounted into the well-known directory of + every storage pod. Directory: `/opt/ydb/volumes/`. + Only `hostPath` volume type is supported for now. items: description: Volume represents a named volume in a pod that may be accessed by any container in the pod. properties: awsElasticBlockStore: - description: 'awsElasticBlockStore represents an AWS Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + awsElasticBlockStore represents an AWS Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty).' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). format: int32 type: integer readOnly: - description: 'readOnly value true will force the readOnly - setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + readOnly value true will force the readOnly setting in VolumeMounts. + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: boolean volumeID: - description: 'volumeID is unique ID of the persistent disk - resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore' + description: |- + volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). + More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore type: string required: - volumeID @@ -3058,10 +3289,10 @@ spec: storage type: string fsType: - description: fsType is Filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is Filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string kind: description: 'kind expected values are Shared: multiple @@ -3070,8 +3301,9 @@ spec: disk (only in managed availability set). defaults to shared' type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean required: - diskName @@ -3082,8 +3314,9 @@ spec: on the host and bind mount to the pod. properties: readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretName: description: secretName is the name of secret that contains @@ -3101,8 +3334,9 @@ spec: shares a pod's lifetime properties: monitors: - description: 'monitors is Required: Monitors is a collection - of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + monitors is Required: Monitors is a collection of Ceph monitors + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it items: type: string type: array @@ -3111,59 +3345,70 @@ spec: rather than the full Ceph tree, default is /' type: string readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: boolean secretFile: - description: 'secretFile is Optional: SecretFile is the - path to key ring for User, default is /etc/ceph/user.secret - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string secretRef: - description: 'secretRef is Optional: SecretRef is reference - to the authentication secret for User, default is empty. - More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is optional: User is the rados user name, - default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' + description: |- + user is optional: User is the rados user name, default is admin + More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it type: string required: - monitors type: object cinder: - description: 'cinder represents a cinder volume attached and - mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + cinder represents a cinder volume attached and mounted on kubelets host machine. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Examples: "ext4", "xfs", "ntfs". Implicitly inferred to - be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string readOnly: - description: 'readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: boolean secretRef: - description: 'secretRef is optional: points to a secret - object containing parameters used to connect to OpenStack.' + description: |- + secretRef is optional: points to a secret object containing parameters used to connect + to OpenStack. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeID: - description: 'volumeID used to identify the volume in cinder. - More info: https://examples.k8s.io/mysql-cinder-pd/README.md' + description: |- + volumeID used to identify the volume in cinder. + More info: https://examples.k8s.io/mysql-cinder-pd/README.md type: string required: - volumeID @@ -3173,27 +3418,25 @@ spec: this volume properties: defaultMode: - description: 'defaultMode is optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items if unspecified, each key-value pair in - the Data field of the referenced ConfigMap will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the ConfigMap, the volume setup will error unless it is - marked optional. Paths must be relative and may not contain - the '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -3201,22 +3444,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -3224,54 +3466,58 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic csi: description: csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature). properties: driver: - description: driver is the name of the CSI driver that handles - this volume. Consult with your admin for the correct name - as registered in the cluster. + description: |- + driver is the name of the CSI driver that handles this volume. + Consult with your admin for the correct name as registered in the cluster. type: string fsType: - description: fsType to mount. Ex. "ext4", "xfs", "ntfs". - If not provided, the empty value is passed to the associated - CSI driver which will determine the default filesystem - to apply. + description: |- + fsType to mount. Ex. "ext4", "xfs", "ntfs". + If not provided, the empty value is passed to the associated CSI driver + which will determine the default filesystem to apply. type: string nodePublishSecretRef: - description: nodePublishSecretRef is a reference to the - secret object containing sensitive information to pass - to the CSI driver to complete the CSI NodePublishVolume - and NodeUnpublishVolume calls. This field is optional, - and may be empty if no secret is required. If the secret - object contains more than one secret, all secret references - are passed. + description: |- + nodePublishSecretRef is a reference to the secret object containing + sensitive information to pass to the CSI driver to complete the CSI + NodePublishVolume and NodeUnpublishVolume calls. + This field is optional, and may be empty if no secret is required. If the + secret object contains more than one secret, all secret references are passed. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic readOnly: - description: readOnly specifies a read-only configuration - for the volume. Defaults to false (read/write). + description: |- + readOnly specifies a read-only configuration for the volume. + Defaults to false (read/write). type: boolean volumeAttributes: additionalProperties: type: string - description: volumeAttributes stores driver-specific properties - that are passed to the CSI driver. Consult your driver's - documentation for supported values. + description: |- + volumeAttributes stores driver-specific properties that are passed to the CSI + driver. Consult your driver's documentation for supported values. type: object required: - driver @@ -3281,16 +3527,15 @@ spec: that should populate this volume properties: defaultMode: - description: 'Optional: mode bits to use on created files - by default. Must be a Optional: mode bits used to set - permissions on created files by default. Must be an octal - value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + Optional: mode bits to use on created files by default. Must be a + Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: @@ -3315,16 +3560,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to set permissions - on this file, must be an octal value between 0000 - and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires - decimal values for mode bits. If not specified, - the volume defaultMode will be used. This might - be in conflict with other options that affect the - file mode, like fsGroup, and the result can be other - mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -3335,10 +3579,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the container: - only resources limits and requests (limits.cpu, - limits.memory, requests.cpu and requests.memory) - are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required for volumes, @@ -3358,113 +3601,125 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object type: array type: object emptyDir: - description: 'emptyDir represents a temporary directory that - shares a pod''s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + emptyDir represents a temporary directory that shares a pod's lifetime. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir properties: medium: - description: 'medium represents what type of storage medium - should back this directory. The default is "" which means - to use the node''s default medium. Must be an empty string - (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' + description: |- + medium represents what type of storage medium should back this directory. + The default is "" which means to use the node's default medium. + Must be an empty string (default) or Memory. + More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir type: string sizeLimit: anyOf: - type: integer - type: string - description: 'sizeLimit is the total amount of local storage - required for this EmptyDir volume. The size limit is also - applicable for memory medium. The maximum usage on memory - medium EmptyDir would be the minimum value between the - SizeLimit specified here and the sum of memory limits - of all containers in a pod. The default is nil which means - that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir' + description: |- + sizeLimit is the total amount of local storage required for this EmptyDir volume. + The size limit is also applicable for memory medium. + The maximum usage on memory medium EmptyDir would be the minimum value between + the SizeLimit specified here and the sum of memory limits of all containers in a pod. + The default is nil which means that the limit is undefined. + More info: http://kubernetes.io/docs/user-guide/volumes#emptydir pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true type: object ephemeral: - description: "ephemeral represents a volume that is handled - by a cluster storage driver. The volume's lifecycle is tied - to the pod that defines it - it will be created before the - pod starts, and deleted when the pod is removed. \n Use this - if: a) the volume is only needed while the pod runs, b) features - of normal volumes like restoring from snapshot or capacity - \ tracking are needed, c) the storage driver is specified - through a storage class, and d) the storage driver supports - dynamic volume provisioning through a PersistentVolumeClaim - (see EphemeralVolumeSource for more information on the - connection between this volume type and PersistentVolumeClaim). - \n Use PersistentVolumeClaim or one of the vendor-specific + description: |- + ephemeral represents a volume that is handled by a cluster storage driver. + The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, + and deleted when the pod is removed. + + Use this if: + a) the volume is only needed while the pod runs, + b) features of normal volumes like restoring from snapshot or capacity + tracking are needed, + c) the storage driver is specified through a storage class, and + d) the storage driver supports dynamic volume provisioning through + a PersistentVolumeClaim (see EphemeralVolumeSource for more + information on the connection between this volume type + and PersistentVolumeClaim). + + Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle - of an individual pod. \n Use CSI for light-weight local ephemeral - volumes if the CSI driver is meant to be used that way - see - the documentation of the driver for more information. \n A - pod can use both types of ephemeral volumes and persistent - volumes at the same time." + of an individual pod. + + Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to + be used that way - see the documentation of the driver for + more information. + + A pod can use both types of ephemeral volumes and + persistent volumes at the same time. properties: volumeClaimTemplate: - description: "Will be used to create a stand-alone PVC to - provision the volume. The pod in which this EphemeralVolumeSource - is embedded will be the owner of the PVC, i.e. the PVC - will be deleted together with the pod. The name of the - PVC will be `-` where `` is the name from the `PodSpec.Volumes` array entry. - Pod validation will reject the pod if the concatenated - name is not valid for a PVC (for example, too long). \n - An existing PVC with that name that is not owned by the - pod will *not* be used for the pod to avoid using an unrelated + description: |- + Will be used to create a stand-alone PVC to provision the volume. + The pod in which this EphemeralVolumeSource is embedded will be the + owner of the PVC, i.e. the PVC will be deleted together with the + pod. The name of the PVC will be `-` where + `` is the name from the `PodSpec.Volumes` array + entry. Pod validation will reject the pod if the concatenated name + is not valid for a PVC (for example, too long). + + An existing PVC with that name that is not owned by the pod + will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until - the unrelated PVC is removed. If such a pre-created PVC - is meant to be used by the pod, the PVC has to updated - with an owner reference to the pod once the pod exists. - Normally this should not be necessary, but it may be useful - when manually reconstructing a broken cluster. \n This - field is read-only and no changes will be made by Kubernetes - to the PVC after it has been created. \n Required, must - not be nil." + the unrelated PVC is removed. If such a pre-created PVC is + meant to be used by the pod, the PVC has to updated with an + owner reference to the pod once the pod exists. Normally + this should not be necessary, but it may be useful when + manually reconstructing a broken cluster. + + This field is read-only and no changes will be made by Kubernetes + to the PVC after it has been created. + + Required, must not be nil. properties: metadata: - description: May contain labels and annotations that - will be copied into the PVC when creating it. No other - fields are allowed and will be rejected during validation. + description: |- + May contain labels and annotations that will be copied into the PVC + when creating it. No other fields are allowed and will be rejected during + validation. type: object spec: - description: The specification for the PersistentVolumeClaim. - The entire content is copied unchanged into the PVC - that gets created from this template. The same fields - as in a PersistentVolumeClaim are also valid here. + description: |- + The specification for the PersistentVolumeClaim. The entire content is + copied unchanged into the PVC that gets created from this + template. The same fields as in a PersistentVolumeClaim + are also valid here. properties: accessModes: - description: 'accessModes contains the desired access - modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1' + description: |- + accessModes contains the desired access modes the volume should have. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 items: type: string type: array dataSource: - description: 'dataSource field can be used to specify - either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) - * An existing PVC (PersistentVolumeClaim) If the - provisioner or an external controller can support - the specified data source, it will create a new - volume based on the contents of the specified - data source. When the AnyVolumeDataSource feature - gate is enabled, dataSource contents will be copied - to dataSourceRef, and dataSourceRef contents will - be copied to dataSource when dataSourceRef.namespace - is not specified. If the namespace is specified, - then dataSourceRef will not be copied to dataSource.' + description: |- + dataSource field can be used to specify either: + * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) + * An existing PVC (PersistentVolumeClaim) + If the provisioner or an external controller can support the specified data source, + it will create a new volume based on the contents of the specified data source. + When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, + and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. + If the namespace is specified, then dataSourceRef will not be copied to dataSource. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -3478,46 +3733,38 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: - description: 'dataSourceRef specifies the object - from which to populate the volume with data, if - a non-empty volume is desired. This may be any - object from a non-empty API group (non core object) - or a PersistentVolumeClaim object. When this field - is specified, volume binding will only succeed - if the type of the specified object matches some - installed volume populator or dynamic provisioner. - This field will replace the functionality of the - dataSource field and as such if both fields are - non-empty, they must have the same value. For - backwards compatibility, when namespace isn''t - specified in dataSourceRef, both fields (dataSource - and dataSourceRef) will be set to the same value - automatically if one of them is empty and the - other is non-empty. When namespace is specified - in dataSourceRef, dataSource isn''t set to the - same value and must be empty. There are three - important differences between dataSource and dataSourceRef: - * While dataSource only allows two specific types - of objects, dataSourceRef allows any non-core - object, as well as PersistentVolumeClaim objects. - * While dataSource ignores disallowed values (dropping - them), dataSourceRef preserves all values, and - generates an error if a disallowed value is specified. - * While dataSource only allows local objects, - dataSourceRef allows objects in any namespaces. - (Beta) Using this field requires the AnyVolumeDataSource - feature gate to be enabled. (Alpha) Using the - namespace field of dataSourceRef requires the - CrossNamespaceVolumeDataSource feature gate to - be enabled.' + description: |- + dataSourceRef specifies the object from which to populate the volume with data, if a non-empty + volume is desired. This may be any object from a non-empty API group (non + core object) or a PersistentVolumeClaim object. + When this field is specified, volume binding will only succeed if the type of + the specified object matches some installed volume populator or dynamic + provisioner. + This field will replace the functionality of the dataSource field and as such + if both fields are non-empty, they must have the same value. For backwards + compatibility, when namespace isn't specified in dataSourceRef, + both fields (dataSource and dataSourceRef) will be set to the same + value automatically if one of them is empty and the other is non-empty. + When namespace is specified in dataSourceRef, + dataSource isn't set to the same value and must be empty. + There are three important differences between dataSource and dataSourceRef: + * While dataSource only allows two specific types of objects, dataSourceRef + allows any non-core object, as well as PersistentVolumeClaim objects. + * While dataSource ignores disallowed values (dropping them), dataSourceRef + preserves all values, and generates an error if a disallowed value is + specified. + * While dataSource only allows local objects, dataSourceRef allows objects + in any namespaces. + (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled. properties: apiGroup: - description: APIGroup is the group for the resource - being referenced. If APIGroup is not specified, - the specified Kind must be in the core API - group. For any other third-party types, APIGroup - is required. + description: |- + APIGroup is the group for the resource being referenced. + If APIGroup is not specified, the specified Kind must be in the core API group. + For any other third-party types, APIGroup is required. type: string kind: description: Kind is the type of resource being @@ -3528,44 +3775,41 @@ spec: referenced type: string namespace: - description: Namespace is the namespace of resource - being referenced Note that when a namespace - is specified, a gateway.networking.k8s.io/ReferenceGrant - object is required in the referent namespace - to allow that namespace's owner to accept - the reference. See the ReferenceGrant documentation - for details. (Alpha) This field requires the - CrossNamespaceVolumeDataSource feature gate - to be enabled. + description: |- + Namespace is the namespace of resource being referenced + Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. + (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled. type: string required: - kind - name type: object resources: - description: 'resources represents the minimum resources - the volume should have. If RecoverVolumeExpansionFailure - feature is enabled users are allowed to specify - resource requirements that are lower than previous - value but must still be higher than capacity recorded - in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources' + description: |- + resources represents the minimum resources the volume should have. + If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements + that are lower than previous value but must still be higher than capacity recorded in the + status field of the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources properties: claims: - description: "Claims lists the names of resources, - defined in spec.resourceClaims, that are used - by this container. \n This is an alpha field - and requires enabling the DynamicResourceAllocation - feature gate. \n This field is immutable." + description: |- + Claims lists the names of resources, defined in spec.resourceClaims, + that are used by this container. + + This is an alpha field and requires enabling the + DynamicResourceAllocation feature gate. + + This field is immutable. It can only be set for containers. items: description: ResourceClaim references one entry in PodSpec.ResourceClaims. properties: name: - description: Name must match the name - of one entry in pod.spec.resourceClaims - of the Pod where this field is used. - It makes that resource available inside - a container. + description: |- + Name must match the name of one entry in pod.spec.resourceClaims of + the Pod where this field is used. It makes that resource available + inside a container. type: string required: - name @@ -3581,8 +3825,9 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Limits describes the maximum amount - of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Limits describes the maximum amount of compute resources allowed. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object requests: additionalProperties: @@ -3591,12 +3836,11 @@ spec: - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - description: 'Requests describes the minimum - amount of compute resources required. If Requests - is omitted for a container, it defaults to - Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: - https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + description: |- + Requests describes the minimum amount of compute resources required. + If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, + otherwise to an implementation-defined value. + More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object selector: @@ -3608,28 +3852,24 @@ spec: selector requirements. The requirements are ANDed. items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. properties: key: description: key is the label key that the selector applies to. type: string operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic merge patch. items: type: string @@ -3642,23 +3882,22 @@ spec: matchLabels: additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: - description: 'storageClassName is the name of the - StorageClass required by the claim. More info: - https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1' + description: |- + storageClassName is the name of the StorageClass required by the claim. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 type: string volumeMode: - description: volumeMode defines what type of volume - is required by the claim. Value of Filesystem - is implied when not included in claim spec. + description: |- + volumeMode defines what type of volume is required by the claim. + Value of Filesystem is implied when not included in claim spec. type: string volumeName: description: volumeName is the binding reference @@ -3675,19 +3914,19 @@ spec: pod. properties: fsType: - description: 'fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. TODO: how do we prevent errors in the - filesystem from compromising the machine' + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string lun: description: 'lun is Optional: FC target lun number' format: int32 type: integer readOnly: - description: 'readOnly is Optional: Defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean targetWWNs: description: 'targetWWNs is Optional: FC target worldwide @@ -3696,26 +3935,27 @@ spec: type: string type: array wwids: - description: 'wwids Optional: FC volume world wide identifiers - (wwids) Either wwids or combination of targetWWNs and - lun must be set, but not both simultaneously.' + description: |- + wwids Optional: FC volume world wide identifiers (wwids) + Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. items: type: string type: array type: object flexVolume: - description: flexVolume represents a generic volume resource - that is provisioned/attached using an exec based plugin. + description: |- + flexVolume represents a generic volume resource that is + provisioned/attached using an exec based plugin. properties: driver: description: driver is the name of the driver to use for this volume. type: string fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". The default filesystem depends - on FlexVolume script. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. type: string options: additionalProperties: @@ -3724,22 +3964,25 @@ spec: command options if any.' type: object readOnly: - description: 'readOnly is Optional: defaults to false (read/write). - ReadOnly here will force the ReadOnly setting in VolumeMounts.' + description: |- + readOnly is Optional: defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: 'secretRef is Optional: secretRef is reference - to the secret object containing sensitive information - to pass to the plugin scripts. This may be empty if no - secret object is specified. If the secret object contains - more than one secret, all secrets are passed to the plugin - scripts.' + description: |- + secretRef is Optional: secretRef is reference to the secret object containing + sensitive information to pass to the plugin scripts. This may be + empty if no secret object is specified. If the secret object + contains more than one secret, all secrets are passed to the plugin + scripts. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic required: - driver type: object @@ -3749,9 +3992,9 @@ spec: service being running properties: datasetName: - description: datasetName is Name of the dataset stored as - metadata -> name on the dataset for Flocker should be - considered as deprecated + description: |- + datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker + should be considered as deprecated type: string datasetUUID: description: datasetUUID is the UUID of the dataset. This @@ -3759,52 +4002,54 @@ spec: type: string type: object gcePersistentDisk: - description: 'gcePersistentDisk represents a GCE Disk resource - that is attached to a kubelet''s host machine and then exposed - to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + gcePersistentDisk represents a GCE Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk properties: fsType: - description: 'fsType is filesystem type of the volume that - you want to mount. Tip: Ensure that the filesystem type - is supported by the host operating system. Examples: "ext4", - "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + description: |- + fsType is filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk - TODO: how do we prevent errors in the filesystem from - compromising the machine' type: string partition: - description: 'partition is the partition in the volume that - you want to mount. If omitted, the default is to mount - by volume name. Examples: For volume /dev/sda1, you specify - the partition as "1". Similarly, the volume partition - for /dev/sda is "0" (or you can leave the property empty). - More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + partition is the partition in the volume that you want to mount. + If omitted, the default is to mount by volume name. + Examples: For volume /dev/sda1, you specify the partition as "1". + Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk format: int32 type: integer pdName: - description: 'pdName is unique name of the PD resource in - GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk type: boolean required: - pdName type: object gitRepo: - description: 'gitRepo represents a git repository at a particular - revision. DEPRECATED: GitRepo is deprecated. To provision - a container with a git repo, mount an EmptyDir into an InitContainer - that clones the repo using git, then mount the EmptyDir into - the Pod''s container.' + description: |- + gitRepo represents a git repository at a particular revision. + DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an + EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir + into the Pod's container. properties: directory: - description: directory is the target directory name. Must - not contain or start with '..'. If '.' is supplied, the - volume directory will be the git repository. Otherwise, - if specified, the volume will contain the git repository - in the subdirectory with the given name. + description: |- + directory is the target directory name. + Must not contain or start with '..'. If '.' is supplied, the volume directory will be the + git repository. Otherwise, if specified, the volume will contain the git repository in + the subdirectory with the given name. type: string repository: description: repository is the URL @@ -3817,51 +4062,58 @@ spec: - repository type: object glusterfs: - description: 'glusterfs represents a Glusterfs mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md' + description: |- + glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/glusterfs/README.md properties: endpoints: - description: 'endpoints is the endpoint name that details - Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + endpoints is the endpoint name that details Glusterfs topology. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string path: - description: 'path is the Glusterfs volume path. More info: - https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + path is the Glusterfs volume path. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: string readOnly: - description: 'readOnly here will force the Glusterfs volume - to be mounted with read-only permissions. Defaults to - false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod' + description: |- + readOnly here will force the Glusterfs volume to be mounted with read-only permissions. + Defaults to false. + More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod type: boolean required: - endpoints - path type: object hostPath: - description: 'hostPath represents a pre-existing file or directory - on the host machine that is directly exposed to the container. - This is generally used for system agents or other privileged - things that are allowed to see the host machine. Most containers - will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath - --- TODO(jonesdl) We need to restrict who can use host directory - mounts and who can/can not mount host directories as read/write.' + description: |- + hostPath represents a pre-existing file or directory on the host + machine that is directly exposed to the container. This is generally + used for system agents or other privileged things that are allowed + to see the host machine. Most containers will NOT need this. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath properties: path: - description: 'path of the directory on the host. If the - path is a symlink, it will follow the link to the real - path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + path of the directory on the host. + If the path is a symlink, it will follow the link to the real path. + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string type: - description: 'type for HostPath Volume Defaults to "" More - info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath' + description: |- + type for HostPath Volume + Defaults to "" + More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath type: string required: - path type: object iscsi: - description: 'iscsi represents an ISCSI Disk resource that is - attached to a kubelet''s host machine and then exposed to - the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md' + description: |- + iscsi represents an ISCSI Disk resource that is attached to a + kubelet's host machine and then exposed to the pod. + More info: https://examples.k8s.io/volumes/iscsi/README.md properties: chapAuthDiscovery: description: chapAuthDiscovery defines whether support iSCSI @@ -3872,55 +4124,57 @@ spec: Session CHAP authentication type: boolean fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi type: string initiatorName: - description: initiatorName is the custom iSCSI Initiator - Name. If initiatorName is specified with iscsiInterface - simultaneously, new iSCSI interface : will be created for the connection. + description: |- + initiatorName is the custom iSCSI Initiator Name. + If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface + : will be created for the connection. type: string iqn: description: iqn is the target iSCSI Qualified Name. type: string iscsiInterface: - description: iscsiInterface is the interface Name that uses - an iSCSI transport. Defaults to 'default' (tcp). + description: |- + iscsiInterface is the interface Name that uses an iSCSI transport. + Defaults to 'default' (tcp). type: string lun: description: lun represents iSCSI Target Lun number. format: int32 type: integer portals: - description: portals is the iSCSI Target Portal List. The - portal is either an IP or ip_addr:port if the port is - other than default (typically TCP ports 860 and 3260). + description: |- + portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). items: type: string type: array readOnly: - description: readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. type: boolean secretRef: description: secretRef is the CHAP Secret for iSCSI target and initiator authentication properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic targetPortal: - description: targetPortal is iSCSI Target Portal. The Portal - is either an IP or ip_addr:port if the port is other than - default (typically TCP ports 860 and 3260). + description: |- + targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port + is other than default (typically TCP ports 860 and 3260). type: string required: - iqn @@ -3928,43 +4182,51 @@ spec: - targetPortal type: object name: - description: 'name of the volume. Must be a DNS_LABEL and unique - within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + name of the volume. + Must be a DNS_LABEL and unique within the pod. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string nfs: - description: 'nfs represents an NFS mount on the host that shares - a pod''s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + nfs represents an NFS mount on the host that shares a pod's lifetime + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs properties: path: - description: 'path that is exported by the NFS server. More - info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + path that is exported by the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string readOnly: - description: 'readOnly here will force the NFS export to - be mounted with read-only permissions. Defaults to false. - More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + readOnly here will force the NFS export to be mounted with read-only permissions. + Defaults to false. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: boolean server: - description: 'server is the hostname or IP address of the - NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs' + description: |- + server is the hostname or IP address of the NFS server. + More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs type: string required: - path - server type: object persistentVolumeClaim: - description: 'persistentVolumeClaimVolumeSource represents a - reference to a PersistentVolumeClaim in the same namespace. - More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + persistentVolumeClaimVolumeSource represents a reference to a + PersistentVolumeClaim in the same namespace. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims properties: claimName: - description: 'claimName is the name of a PersistentVolumeClaim - in the same namespace as the pod using this volume. More - info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims' + description: |- + claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. + More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims type: string readOnly: - description: readOnly Will force the ReadOnly setting in - VolumeMounts. Default false. + description: |- + readOnly Will force the ReadOnly setting in VolumeMounts. + Default false. type: boolean required: - claimName @@ -3974,10 +4236,10 @@ spec: persistent disk attached and mounted on kubelets host machine properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string pdID: description: pdID is the ID that identifies Photon Controller @@ -3991,14 +4253,15 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fSType represents the filesystem type to mount - Must be a filesystem type supported by the host operating - system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fSType represents the filesystem type to mount + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean volumeID: description: volumeID uniquely identifies a Portworx volume @@ -4011,14 +4274,13 @@ spec: configmaps, and downward API properties: defaultMode: - description: defaultMode are the mode bits used to set permissions - on created files by default. Must be an octal value between - 0000 and 0777 or a decimal value between 0 and 511. YAML - accepts both octal and decimal values, JSON requires decimal - values for mode bits. Directories within the path are - not affected by this setting. This might be in conflict - with other options that affect the file mode, like fsGroup, - and the result can be other mode bits set. + description: |- + defaultMode are the mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer sources: @@ -4032,17 +4294,14 @@ spec: data to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced ConfigMap - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the ConfigMap, the volume - setup will error unless it is marked optional. - Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + ConfigMap will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the ConfigMap, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -4051,25 +4310,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4077,16 +4332,16 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional specify whether the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic downwardAPI: description: downwardAPI information about the downwardAPI data to project @@ -4116,18 +4371,15 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: - description: 'Optional: mode bits used to - set permissions on this file, must be - an octal value between 0000 and 0777 or - a decimal value between 0 and 511. YAML - accepts both octal and decimal values, - JSON requires decimal values for mode - bits. If not specified, the volume defaultMode - will be used. This might be in conflict - with other options that affect the file - mode, like fsGroup, and the result can - be other mode bits set.' + description: |- + Optional: mode bits used to set permissions on this file, must be an octal value + between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: @@ -4139,10 +4391,9 @@ spec: with ''..''' type: string resourceFieldRef: - description: 'Selects a resource of the - container: only resources limits and requests - (limits.cpu, limits.memory, requests.cpu - and requests.memory) are currently supported.' + description: |- + Selects a resource of the container: only resources limits and requests + (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. properties: containerName: description: 'Container name: required @@ -4164,6 +4415,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -4174,17 +4426,14 @@ spec: to project properties: items: - description: items if unspecified, each key-value - pair in the Data field of the referenced Secret - will be projected into the volume as a file - whose name is the key and content is the value. - If specified, the listed keys will be projected - into the specified paths, and unlisted keys - will not be present. If a key is specified which - is not present in the Secret, the volume setup - will error unless it is marked optional. Paths - must be relative and may not contain the '..' - path or start with '..'. + description: |- + items if unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. @@ -4193,25 +4442,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits - used to set permissions on this file. - Must be an octal value between 0000 and - 0777 or a decimal value between 0 and - 511. YAML accepts both octal and decimal - values, JSON requires decimal values for - mode bits. If not specified, the volume - defaultMode will be used. This might be - in conflict with other options that affect - the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of - the file to map the key to. May not be - an absolute path. May not contain the - path element '..'. May not start with - the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4219,44 +4464,41 @@ spec: type: object type: array name: - description: 'Name of the referent. More info: - https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, - uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string optional: description: optional field specify whether the Secret or its key must be defined type: boolean type: object + x-kubernetes-map-type: atomic serviceAccountToken: description: serviceAccountToken is information about the serviceAccountToken data to project properties: audience: - description: audience is the intended audience - of the token. A recipient of a token must identify - itself with an identifier specified in the audience - of the token, and otherwise should reject the - token. The audience defaults to the identifier - of the apiserver. + description: |- + audience is the intended audience of the token. A recipient of a token + must identify itself with an identifier specified in the audience of the + token, and otherwise should reject the token. The audience defaults to the + identifier of the apiserver. type: string expirationSeconds: - description: expirationSeconds is the requested - duration of validity of the service account - token. As the token approaches expiration, the - kubelet volume plugin will proactively rotate - the service account token. The kubelet will - start trying to rotate the token if the token - is older than 80 percent of its time to live - or if the token is older than 24 hours.Defaults - to 1 hour and must be at least 10 minutes. + description: |- + expirationSeconds is the requested duration of validity of the service + account token. As the token approaches expiration, the kubelet volume + plugin will proactively rotate the service account token. The kubelet will + start trying to rotate the token if the token is older than 80 percent of + its time to live or if the token is older than 24 hours.Defaults to 1 hour + and must be at least 10 minutes. format: int64 type: integer path: - description: path is the path relative to the - mount point of the file to project the token - into. + description: |- + path is the path relative to the mount point of the file to project the + token into. type: string required: - path @@ -4269,28 +4511,30 @@ spec: that shares a pod's lifetime properties: group: - description: group to map volume access to Default is no - group + description: |- + group to map volume access to + Default is no group type: string readOnly: - description: readOnly here will force the Quobyte volume - to be mounted with read-only permissions. Defaults to - false. + description: |- + readOnly here will force the Quobyte volume to be mounted with read-only permissions. + Defaults to false. type: boolean registry: - description: registry represents a single or multiple Quobyte - Registry services specified as a string as host:port pair - (multiple entries are separated with commas) which acts - as the central registry for volumes + description: |- + registry represents a single or multiple Quobyte Registry services + specified as a string as host:port pair (multiple entries are separated with commas) + which acts as the central registry for volumes type: string tenant: - description: tenant owning the given Quobyte volume in the - Backend Used with dynamically provisioned Quobyte volumes, - value is set by the plugin + description: |- + tenant owning the given Quobyte volume in the Backend + Used with dynamically provisioned Quobyte volumes, value is set by the plugin type: string user: - description: user to map volume access to Defaults to serivceaccount - user + description: |- + user to map volume access to + Defaults to serivceaccount user type: string volume: description: volume is a string that references an already @@ -4301,53 +4545,66 @@ spec: - volume type: object rbd: - description: 'rbd represents a Rados Block Device mount on the - host that shares a pod''s lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md' + description: |- + rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. + More info: https://examples.k8s.io/volumes/rbd/README.md properties: fsType: - description: 'fsType is the filesystem type of the volume - that you want to mount. Tip: Ensure that the filesystem - type is supported by the host operating system. Examples: - "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd - TODO: how do we prevent errors in the filesystem from - compromising the machine' + description: |- + fsType is the filesystem type of the volume that you want to mount. + Tip: Ensure that the filesystem type is supported by the host operating system. + Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd type: string image: - description: 'image is the rados image name. More info: - https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + image is the rados image name. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string keyring: - description: 'keyring is the path to key ring for RBDUser. - Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + keyring is the path to key ring for RBDUser. + Default is /etc/ceph/keyring. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string monitors: - description: 'monitors is a collection of Ceph monitors. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + monitors is a collection of Ceph monitors. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it items: type: string type: array pool: - description: 'pool is the rados pool name. Default is rbd. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + pool is the rados pool name. + Default is rbd. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string readOnly: - description: 'readOnly here will force the ReadOnly setting - in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + readOnly here will force the ReadOnly setting in VolumeMounts. + Defaults to false. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: boolean secretRef: - description: 'secretRef is name of the authentication secret - for RBDUser. If provided overrides keyring. Default is - nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + secretRef is name of the authentication secret for RBDUser. If provided + overrides keyring. + Default is nil. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic user: - description: 'user is the rados user name. Default is admin. - More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' + description: |- + user is the rados user name. + Default is admin. + More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it type: string required: - image @@ -4358,9 +4615,11 @@ spec: attached and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Default is "xfs". + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". + Default is "xfs". type: string gateway: description: gateway is the host address of the ScaleIO @@ -4371,26 +4630,29 @@ spec: Protection Domain for the configured storage. type: string readOnly: - description: readOnly Defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly Defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef references to the secret for ScaleIO - user and other sensitive information. If this is not provided, - Login operation will fail. + description: |- + secretRef references to the secret for ScaleIO user and other + sensitive information. If this is not provided, Login operation will fail. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic sslEnabled: description: sslEnabled Flag enable/disable SSL communication with Gateway, default false type: boolean storageMode: - description: storageMode indicates whether the storage for - a volume should be ThickProvisioned or ThinProvisioned. + description: |- + storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned. type: string storagePool: @@ -4402,9 +4664,9 @@ spec: configured in ScaleIO. type: string volumeName: - description: volumeName is the name of a volume already - created in the ScaleIO system that is associated with - this volume source. + description: |- + volumeName is the name of a volume already created in the ScaleIO system + that is associated with this volume source. type: string required: - gateway @@ -4412,31 +4674,30 @@ spec: - system type: object secret: - description: 'secret represents a secret that should populate - this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secret represents a secret that should populate this volume. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret properties: defaultMode: - description: 'defaultMode is Optional: mode bits used to - set permissions on created files by default. Must be an - octal value between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. Defaults to - 0644. Directories within the path are not affected by - this setting. This might be in conflict with other options - that affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + defaultMode is Optional: mode bits used to set permissions on created files by default. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values + for mode bits. Defaults to 0644. + Directories within the path are not affected by this setting. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer items: - description: items If unspecified, each key-value pair in - the Data field of the referenced Secret will be projected - into the volume as a file whose name is the key and content - is the value. If specified, the listed keys will be projected - into the specified paths, and unlisted keys will not be - present. If a key is specified which is not present in - the Secret, the volume setup will error unless it is marked - optional. Paths must be relative and may not contain the - '..' path or start with '..'. + description: |- + items If unspecified, each key-value pair in the Data field of the referenced + Secret will be projected into the volume as a file whose name is the + key and content is the value. If specified, the listed keys will be + projected into the specified paths, and unlisted keys will not be + present. If a key is specified which is not present in the Secret, + the volume setup will error unless it is marked optional. Paths must be + relative and may not contain the '..' path or start with '..'. items: description: Maps a string key to a path within a volume. properties: @@ -4444,22 +4705,21 @@ spec: description: key is the key to project. type: string mode: - description: 'mode is Optional: mode bits used to - set permissions on this file. Must be an octal value - between 0000 and 0777 or a decimal value between - 0 and 511. YAML accepts both octal and decimal values, - JSON requires decimal values for mode bits. If not - specified, the volume defaultMode will be used. - This might be in conflict with other options that - affect the file mode, like fsGroup, and the result - can be other mode bits set.' + description: |- + mode is Optional: mode bits used to set permissions on this file. + Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. + YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. + If not specified, the volume defaultMode will be used. + This might be in conflict with other options that affect the file + mode, like fsGroup, and the result can be other mode bits set. format: int32 type: integer path: - description: path is the relative path of the file - to map the key to. May not be an absolute path. - May not contain the path element '..'. May not start - with the string '..'. + description: |- + path is the relative path of the file to map the key to. + May not be an absolute path. + May not contain the path element '..'. + May not start with the string '..'. type: string required: - key @@ -4471,8 +4731,9 @@ spec: its keys must be defined type: boolean secretName: - description: 'secretName is the name of the secret in the - pod''s namespace to use. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret' + description: |- + secretName is the name of the secret in the pod's namespace to use. + More info: https://kubernetes.io/docs/concepts/storage/volumes#secret type: string type: object storageos: @@ -4480,39 +4741,41 @@ spec: and mounted on Kubernetes nodes. properties: fsType: - description: fsType is the filesystem type to mount. Must - be a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is the filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string readOnly: - description: readOnly defaults to false (read/write). ReadOnly - here will force the ReadOnly setting in VolumeMounts. + description: |- + readOnly defaults to false (read/write). ReadOnly here will force + the ReadOnly setting in VolumeMounts. type: boolean secretRef: - description: secretRef specifies the secret to use for obtaining - the StorageOS API credentials. If not specified, default - values will be attempted. + description: |- + secretRef specifies the secret to use for obtaining the StorageOS API + credentials. If not specified, default values will be attempted. properties: name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string type: object + x-kubernetes-map-type: atomic volumeName: - description: volumeName is the human-readable name of the - StorageOS volume. Volume names are only unique within - a namespace. + description: |- + volumeName is the human-readable name of the StorageOS volume. Volume + names are only unique within a namespace. type: string volumeNamespace: - description: volumeNamespace specifies the scope of the - volume within StorageOS. If no namespace is specified - then the Pod's namespace will be used. This allows the - Kubernetes name scoping to be mirrored within StorageOS - for tighter integration. Set VolumeName to any name to - override the default behaviour. Set to "default" if you - are not using namespaces within StorageOS. Namespaces - that do not pre-exist within StorageOS will be created. + description: |- + volumeNamespace specifies the scope of the volume within StorageOS. If no + namespace is specified then the Pod's namespace will be used. This allows the + Kubernetes name scoping to be mirrored within StorageOS for tighter integration. + Set VolumeName to any name to override the default behaviour. + Set to "default" if you are not using namespaces within StorageOS. + Namespaces that do not pre-exist within StorageOS will be created. type: string type: object vsphereVolume: @@ -4520,10 +4783,10 @@ spec: and mounted on kubelets host machine properties: fsType: - description: fsType is filesystem type to mount. Must be - a filesystem type supported by the host operating system. - Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" - if unspecified. + description: |- + fsType is filesystem type to mount. + Must be a filesystem type supported by the host operating system. + Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. type: string storagePolicyID: description: storagePolicyID is the storage Policy Based @@ -4556,45 +4819,35 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. maxLength: 32768 type: string observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. format: int64 minimum: 0 type: integer reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. This field may not be empty. maxLength: 1024 minLength: 1 @@ -4609,10 +4862,6 @@ spec: type: string type: description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -4624,9 +4873,6 @@ spec: - type type: object type: array - observedStorageGeneration: - format: int64 - type: integer state: type: string required: @@ -4637,9 +4883,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/deploy/ydb-operator/templates/deployment.yaml b/deploy/ydb-operator/templates/deployment.yaml index 7cd7c85c..5574e797 100644 --- a/deploy/ydb-operator/templates/deployment.yaml +++ b/deploy/ydb-operator/templates/deployment.yaml @@ -14,11 +14,27 @@ spec: metadata: labels: {{- include "ydb.selectorLabels" . | nindent 8 }} + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 -}} {{- end }} + {{ with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{ end }} + {{ with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.extraInitContainers }} + initContainers: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - args: - --health-probe-bind-address=:8081 @@ -30,6 +46,10 @@ spec: {{- if .Values.metrics.enabled }} - --with-service-monitors=true {{- end }} + {{- if .Values.mgmtCluster.enabled }} + - --mgmt-cluster-name={{- .Values.mgmtCluster.name }} + - --mgmt-cluster-kubeconfig=/mgmt-cluster/kubeconfig + {{- end }} command: - /manager image: {{ default "cr.yandex/yc/ydb-kubernetes-operator" .Values.image.repository }}: @@ -60,17 +80,31 @@ spec: {{- toYaml .Values.resources | nindent 12 }} securityContext: allowPrivilegeEscalation: false + {{- if or .Values.webhook.enabled .Values.mgmtCluster.enabled }} {{- if .Values.webhook.enabled }} volumeMounts: - mountPath: /tmp/k8s-webhook-server/serving-certs name: webhook-tls {{- end }} + {{- if .Values.mgmtCluster.enabled }} + - mountPath: /mgmt-cluster + name: mgmt-cluster-kubeconfig + {{- end }} + {{- with .Values.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- end }} + {{- with .Values.extraEnvs }} + env: + {{ toYaml . | nindent 12 }} + {{- end }} securityContext: runAsNonRoot: true serviceAccountName: {{ include "ydb.fullname" . }} terminationGracePeriodSeconds: 10 - {{- if .Values.webhook.enabled }} + {{- if or .Values.webhook.enabled .Values.mgmtCluster.enabled .Values.extraVolumes }} volumes: + {{- if .Values.webhook.enabled }} - name: webhook-tls secret: secretName: {{ include "ydb.fullname" . }}-webhook @@ -83,6 +117,15 @@ spec: - key: key path: tls.key {{- end }} + {{- end }} + {{- if .Values.mgmtCluster.enabled }} + - name: mgmt-cluster-kubeconfig + secret: + secretName: {{ .Values.mgmtCluster.kubeconfig }} + {{- end }} + {{- with .Values.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} {{- if .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }} diff --git a/deploy/ydb-operator/templates/rbac-operator.yaml b/deploy/ydb-operator/templates/rbac-operator.yaml index 99313d1f..84937fcb 100644 --- a/deploy/ydb-operator/templates/rbac-operator.yaml +++ b/deploy/ydb-operator/templates/rbac-operator.yaml @@ -77,19 +77,26 @@ rules: - patch - delete - apiGroups: - - "" + - batch resources: - - pods + - jobs verbs: + - create + - delete - get - list + - patch + - update - watch - apiGroups: - "" resources: - - pods/exec + - pods + - pods/log verbs: - - create + - get + - list + - watch - apiGroups: - apps resources: @@ -179,7 +186,9 @@ rules: - ydb.tech resources: - databasenodesets + - remotedatabasenodesets - storagenodesets + - remotestoragenodesets verbs: - create - delete @@ -192,14 +201,18 @@ rules: - ydb.tech resources: - databasenodesets/finalizers + - remotedatabasenodesets/finalizers - storagenodesets/finalizers + - remotestoragenodesets/finalizers verbs: - update - apiGroups: - ydb.tech resources: - databasenodesets/status + - remotedatabasenodesets/status - storagenodesets/status + - remotestoragenodesets/status verbs: - get - patch diff --git a/deploy/ydb-operator/values.yaml b/deploy/ydb-operator/values.yaml index 97ed8b5c..dd0fc717 100644 --- a/deploy/ydb-operator/values.yaml +++ b/deploy/ydb-operator/values.yaml @@ -18,6 +18,9 @@ image: imagePullSecrets: [] nodeSelector: {} +podAnnotations: {} +affinity: {} +tolerations: [] nameOverride: "" fullnameOverride: "" @@ -47,6 +50,14 @@ metrics: ## enabled: false +mgmtCluster: + ## Watch resources from mgmtCluster + ## + enabled: false + name: "" + ## Define existing kubeconfig Secret name in current namespace + kubeconfig: "remote-kubeconfig" + webhook: enabled: true @@ -108,3 +119,8 @@ webhook: # issuerRef: # name: "issuer" # kind: "ClusterIssuer" + +extraVolumes: [] +extraVolumeMounts: [] +extraInitContainers: [] +extraEnvs: [] diff --git a/docs/README.md b/docs/README.md index 2091a780..2415570d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,16 +1,8 @@ This document attempts to be some sort of a table of contents: -## Operator release flow -See [here](./release-flow.md). +## Working on a feature -## Writing and running tests - -See [here](./tests.md). - -## Storage - -#### [Storage state machine schema](./storage-state-machine-schema.md) - -This describes which states the Storage object has and in what order they are -traversed. +- don't forget to use `changie` to generate a changelog entry, whenever you complete a feature +- see [here](./tests.md) to learn how to run tests +- see [here](./tests.md) to learn how to release a new version diff --git a/docs/release-flow.md b/docs/release-flow.md index c3381069..e796f9da 100644 --- a/docs/release-flow.md +++ b/docs/release-flow.md @@ -2,34 +2,15 @@ #### How and when the operator version is changed -The single source of truth is the version number in -[Chart.yaml](https://github.com/ydb-platform/ydb-kubernetes-operator/blob/master/deploy/ydb-operator/Chart.yaml#L18) -file. - -It is incremented according to semver practices. Essentially, it is incremented every -time any change is made into either chart or the operator code. - -For the contrast, changing some details of Github workflows or rewriting the docs -does not initiate a new release. - -#### What the CI does - -When you increment the version in `Chart.yaml` and your PR is merged into master, tag -is automatically extracted from the Chart like this: - -``` -"version: 0.4.22" -> "0.4.22" -``` - -If the version is new (no previous commit was tagged with this version), then: - -- this merge commit gets tagged with version extracted from `Chart.yaml`; -- new docker image is built and uploaded to `cr.yandex/yc/ydb-kubernetes-operator`; -- new chart version is uploaded to https://charts.ydb.tech. - -#### What if I forget to bump up the chart version? - -Then these changes won't get automatically tagged, new version won't be built and -uploaded and you most likely will notice it immediately when you'll want to use an -updated version. Then you make another PR with a chart version bump and get your -changes rebuilt. +The single source of truth is the changelog. + +Currently, version is updated when a developer decides to release a new version by manually invoking +`create-release-pr` workflow in Github Actions: + +- invoke `create-release-pr` workflow +- `changie` tool automatically bumps the version and generates an updated CHANGELOG.md +- if a generated `CHANGELOG.md` looks okay, just merge it +- the `upload-artifacts` workflow will: + - substitute the latest version in `Chart.yaml` + - build artifacts (docker image and helm chart) and upload them to all configured registries + - create a new Github release diff --git a/docs/storage-state-machine-schema.drawio.png b/docs/storage-state-machine-schema.drawio.png deleted file mode 100644 index bb43a557..00000000 Binary files a/docs/storage-state-machine-schema.drawio.png and /dev/null differ diff --git a/docs/storage-state-machine-schema.md b/docs/storage-state-machine-schema.md deleted file mode 100644 index be702d8e..00000000 --- a/docs/storage-state-machine-schema.md +++ /dev/null @@ -1,3 +0,0 @@ -## Storage state machine schema - -![Image of a storage state machine](./storage-state-machine-schema.drawio.png) diff --git a/docs/tests.md b/docs/tests.md index ada6229c..8cbd46bd 100644 --- a/docs/tests.md +++ b/docs/tests.md @@ -43,7 +43,7 @@ containers on a single machine. This allows for full-blown smoke tests - apply t `Storage` manifests, wait until the `Pod`s become available, run `SELECT 1` inside one of those pods to check that YDB is actually up and running! -E2E tests are located in [e2e](../e2e) folder. +E2E tests are located in [tests/e2e](../tests/e2e) folder. ## Running tests @@ -81,21 +81,21 @@ kind delete cluster --name=local-kind kind create cluster \ --image=kindest/node:v1.21.14@sha256:9d9eb5fb26b4fbc0c6d95fa8c790414f9750dd583f5d7cee45d92e8c26670aa1 \ --name=local-kind \ - --config=./e2e/kind-cluster-config.yaml \ + --config=./tests/cfg/kind-cluster-config.yaml \ --wait 5m # Switch your local kubeconfig to the newly created cluster: kubectl config use-context kind-local-kind # Within tests, the following two images are used: -# cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 +# cr.yandex/crptqonuodf51kdj7a7d/ydb: # kind/ydb-operator:current # You have to download the ydb image and build the operator image yourself. Then, explicitly -# upload them into the kind cluster. Refer to `./github/e2e.yaml` github workflow which essentially +# upload them into the kind cluster. Refer to `./github/workflows/run-tests.yaml` github workflow which essentially # does the same thing. kind --name local-kind load docker-image kind/ydb-operator:current -kind --name local-kind load docker-image ydb:22.4.44 +kind --name local-kind load docker-image ydb: # Run all tests with disabled concurrency, because there is only one cluster to run tests against go test -p 1 -v ./... diff --git a/e2e/kind-cluster-config.yaml b/e2e/kind-cluster-config.yaml deleted file mode 100644 index be227cf7..00000000 --- a/e2e/kind-cluster-config.yaml +++ /dev/null @@ -1,32 +0,0 @@ -kind: Cluster -apiVersion: kind.x-k8s.io/v1alpha4 -containerdConfigPatches: -- |- - [plugins."io.containerd.grpc.v1.cri".containerd] - snapshotter = "native" -nodes: -- role: control-plane -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true -- role: worker - labels: - worker: true diff --git a/e2e/tests/data/storage-block-4-2-config.yaml b/e2e/tests/data/storage-block-4-2-config.yaml deleted file mode 100644 index 8e9f81cf..00000000 --- a/e2e/tests/data/storage-block-4-2-config.yaml +++ /dev/null @@ -1,103 +0,0 @@ -static_erasure: block-4-2 -host_configs: - - drive: - - path: SectorMap:1:1 - type: SSD - host_config_id: 1 -domains_config: - domain: - - name: Root - storage_pool_types: - - kind: ssd - pool_config: - box_id: 1 - erasure_species: block-4-2 - kind: ssd - pdisk_filter: - - property: - - type: SSD - vdisk_kind: Default - state_storage: - - ring: - node: [1, 2, 3, 4, 5, 6, 7, 8] - nto_select: 5 - ssid: 1 -table_service_config: - sql_version: 1 -actor_system_config: - executor: - - name: System - threads: 1 - type: BASIC - - name: User - threads: 1 - type: BASIC - - name: Batch - threads: 1 - type: BASIC - - name: IO - threads: 1 - time_per_mailbox_micro_secs: 100 - type: IO - - name: IC - spin_threshold: 10 - threads: 4 - time_per_mailbox_micro_secs: 100 - type: BASIC - scheduler: - progress_threshold: 10000 - resolution: 256 - spin_threshold: 0 -blob_storage_config: - service_set: - groups: - - erasure_species: block-4-2 - rings: - - fail_domains: - - vdisk_locations: - - node_id: storage-0 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-1 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-2 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-3 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-4 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-5 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-6 - pdisk_category: SSD - path: SectorMap:1:1 - - vdisk_locations: - - node_id: storage-7 - pdisk_category: SSD - path: SectorMap:1:1 -channel_profile_config: - profile: - - channel: - - erasure_species: block-4-2 - pdisk_category: 1 - storage_pool_kind: ssd - - erasure_species: block-4-2 - pdisk_category: 1 - storage_pool_kind: ssd - - erasure_species: block-4-2 - pdisk_category: 1 - storage_pool_kind: ssd - profile_id: 0 -grpc_config: - port: 2135 diff --git a/e2e/tests/smoke_test.go b/e2e/tests/smoke_test.go deleted file mode 100644 index d647b6e3..00000000 --- a/e2e/tests/smoke_test.go +++ /dev/null @@ -1,573 +0,0 @@ -package tests - -import ( - "context" - "fmt" - "os" - "os/exec" - "path/filepath" - "regexp" - "strconv" - "strings" - "time" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - v1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "sigs.k8s.io/controller-runtime/pkg/client" - - v1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects" - . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" -) - -const ( - Timeout = time.Second * 600 - Interval = time.Second * 5 -) - -var HostPathDirectoryType corev1.HostPathType = "Directory" - -func podIsReady(conditions []corev1.PodCondition) bool { - for _, condition := range conditions { - if condition.Type == testobjects.ReadyStatus && condition.Status == "True" { - return true - } - } - return false -} - -func execInPod(namespace string, name string, cmd []string) (string, error) { - args := []string{ - "-n", - namespace, - "exec", - name, - "--", - } - args = append(args, cmd...) - result := exec.Command("kubectl", args...) - stdout, err := result.Output() - return string(stdout), err -} - -func bringYdbCliToPod(namespace string, name string, ydbHome string) error { - args := []string{ - "-n", - namespace, - "cp", - fmt.Sprintf("%v/ydb/bin/ydb", os.ExpandEnv("$HOME")), - fmt.Sprintf("%v:%v/ydb", name, ydbHome), - } - result := exec.Command("kubectl", args...) - _, err := result.Output() - return err -} - -func installOperatorWithHelm(namespace string) bool { - args := []string{ - "-n", - namespace, - "install", - "--wait", - "ydb-operator", - filepath.Join("..", "..", "deploy", "ydb-operator"), - "-f", - filepath.Join("..", "operator-values.yaml"), - } - result := exec.Command("helm", args...) - stdout, err := result.Output() - if err != nil { - return false - } - - return strings.Contains(string(stdout), "deployed") -} - -func uninstallOperatorWithHelm(namespace string) bool { - args := []string{ - "-n", - namespace, - "uninstall", - "--wait", - "ydb-operator", - } - result := exec.Command("helm", args...) - stdout, err := result.Output() - if err != nil { - return false - } - - return strings.Contains(string(stdout), "uninstalled") -} - -func waitUntilStorageReady(ctx context.Context, storageName, storageNamespace string) { - storage := v1alpha1.Storage{} - Eventually(func(g Gomega) bool { - g.Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: storageName, - Namespace: storageNamespace, - }, &storage)).Should(Succeed()) - - return meta.IsStatusConditionPresentAndEqual( - storage.Status.Conditions, - StorageInitializedCondition, - metav1.ConditionTrue, - ) && storage.Status.State == testobjects.ReadyStatus - }, Timeout, Interval).Should(BeTrue()) -} - -func waitUntilDatabaseReady(ctx context.Context, databaseName, databaseNamespace string) { - database := v1alpha1.Database{} - Eventually(func(g Gomega) bool { - g.Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: databaseName, - Namespace: databaseNamespace, - }, &database)).Should(Succeed()) - - return meta.IsStatusConditionPresentAndEqual( - database.Status.Conditions, - DatabaseTenantInitializedCondition, - metav1.ConditionTrue, - ) && database.Status.State == testobjects.ReadyStatus - }, Timeout, Interval).Should(BeTrue()) -} - -func checkPodsRunningAndReady(ctx context.Context, podLabelKey, podLabelValue string, nPods int32) { - Eventually(func(g Gomega) bool { - pods := corev1.PodList{} - g.Expect(k8sClient.List(ctx, &pods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - podLabelKey: podLabelValue, - })).Should(Succeed()) - g.Expect(len(pods.Items)).Should(BeEquivalentTo(nPods)) - for _, pod := range pods.Items { - g.Expect(pod.Status.Phase).To(BeEquivalentTo("Running")) - g.Expect(podIsReady(pod.Status.Conditions)).To(BeTrue()) - } - return true - }, Timeout, Interval).Should(BeTrue()) -} - -var _ = Describe("Operator smoke test", func() { - var ctx context.Context - var namespace corev1.Namespace - - var storageSample *v1alpha1.Storage - var databaseSample *v1alpha1.Database - - BeforeEach(func() { - storageSample = testobjects.DefaultStorage(filepath.Join(".", "data", "storage-block-4-2-config.yaml")) - databaseSample = testobjects.DefaultDatabase() - - ctx = context.Background() - namespace = corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: testobjects.YdbNamespace, - }, - } - Expect(k8sClient.Create(ctx, &namespace)).Should(Succeed()) - Eventually(func(g Gomega) bool { - namespaceList := corev1.NamespaceList{} - g.Expect(k8sClient.List(ctx, &namespaceList)).Should(Succeed()) - for _, namespace := range namespaceList.Items { - if namespace.GetName() == testobjects.YdbNamespace { - return true - } - } - return false - }, Timeout, Interval).Should(BeTrue()) - Expect(installOperatorWithHelm(testobjects.YdbNamespace)).Should(BeTrue()) - }) - - It("general smoke pipeline, create storage + database", func() { - By("issuing create commands...") - Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) - }() - Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) - }() - - By("waiting until Storage is ready...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - - By("waiting until database is ready...") - waitUntilDatabaseReady(ctx, databaseSample.Name, testobjects.YdbNamespace) - - By("checking that all the database pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) - - databasePods := corev1.PodList{} - err := k8sClient.List(ctx, &databasePods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - "ydb-cluster": "kind-database", - }) - Expect(err).To(BeNil()) - firstDBPod := databasePods.Items[0].Name - - Expect(bringYdbCliToPod(testobjects.YdbNamespace, firstDBPod, testobjects.YdbHome)).To(Succeed()) - - Eventually(func(g Gomega) { - out, err := execInPod(testobjects.YdbNamespace, firstDBPod, []string{ - fmt.Sprintf("%v/ydb", testobjects.YdbHome), - "-d", - "/" + testobjects.DefaultDomain, - "-e", - "grpc://localhost:2135", - "yql", - "-s", - "select 1", - }) - - g.Expect(err).To(BeNil()) - - // `yql` gives output in the following format: - // ┌─────────┐ - // | column0 | - // ├─────────┤ - // | 1 | - // └─────────┘ - g.Expect(strings.ReplaceAll(out, "\n", "")). - To(MatchRegexp(".*column0.*1.*")) - }) - }) - - It("pause and un-pause Storage, should destroy and bring up Pods", func() { - By("issuing create commands...") - Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) - }() - - By("waiting until Storage is ready...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - - By("setting storage pause to Paused...") - storage := v1alpha1.Storage{} - Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: storageSample.Name, - Namespace: testobjects.YdbNamespace, - }, &storage)).Should(Succeed()) - - storage.Spec.Pause = true - Expect(k8sClient.Update(ctx, &storage)).Should(Succeed()) - - By("expecting all Pods to die...") - storagePods := corev1.PodList{} - Eventually(func(g Gomega) bool { - g.Expect(k8sClient.List(ctx, &storagePods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - "ydb-cluster": "kind-storage", - })).Should(Succeed()) - - return len(storagePods.Items) == 0 - }, Timeout, Interval).Should(BeTrue()) - - By("setting storage pause back to Running...") - storage = v1alpha1.Storage{} - Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: storageSample.Name, - Namespace: testobjects.YdbNamespace, - }, &storage)).Should(Succeed()) - - storage.Spec.Pause = false - Expect(k8sClient.Update(ctx, &storage)).Should(Succeed()) - - By("expecting storage to become ready again...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - }) - - It("freeze + delete StatefulSet + un-freeze Storage", func() { - By("issuing create commands...") - Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) - }() - - By("waiting until Storage is ready...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - - By("setting storage operatorSync to false...") - storage := v1alpha1.Storage{} - Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: storageSample.Name, - Namespace: testobjects.YdbNamespace, - }, &storage)).Should(Succeed()) - - storage.Spec.OperatorSync = false - Expect(k8sClient.Update(ctx, &storage)).Should(Succeed()) - - By("expecting all Pods to stay alive for a while...") - Consistently(func(g Gomega) bool { - storagePods := corev1.PodList{} - g.Expect(k8sClient.List(ctx, &storagePods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - "ydb-cluster": "kind-storage", - })).Should(Succeed()) - - return len(storagePods.Items) == int(storageSample.Spec.Nodes) - }, 20*time.Second, Interval).Should(BeTrue()) - - By("deleting a StatefulSet...") - statefulSet := v1.StatefulSet{} - Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: storageSample.Name, - Namespace: testobjects.YdbNamespace, - }, &statefulSet)).Should(Succeed()) - Expect(k8sClient.Delete(ctx, &statefulSet)).Should(Succeed()) - - By("storage pods must all go down...") - Eventually(func(g Gomega) bool { - storagePods := corev1.PodList{} - g.Expect(k8sClient.List(ctx, &storagePods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - "ydb-cluster": "kind-storage", - })).Should(Succeed()) - - return len(storagePods.Items) == 0 - }, Timeout, Interval).Should(BeTrue()) - By("... and then storage pods must not restart for a while...") - Consistently(func(g Gomega) bool { - storagePods := corev1.PodList{} - g.Expect(k8sClient.List(ctx, &storagePods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - "ydb-cluster": "kind-storage", - })).Should(Succeed()) - - return len(storagePods.Items) == 0 - }, 20*time.Second, Interval).Should(BeTrue()) - - By("setting storage freeze back to Running...") - storage = v1alpha1.Storage{} - Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: storageSample.Name, - Namespace: testobjects.YdbNamespace, - }, &storage)).Should(Succeed()) - - storage.Spec.OperatorSync = true - Expect(k8sClient.Update(ctx, &storage)).Should(Succeed()) - - By("expecting storage to become ready again...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - - By("database can be healthily created after Frozen storage...") - Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) - }() - By("waiting until database is ready...") - waitUntilDatabaseReady(ctx, databaseSample.Name, testobjects.YdbNamespace) - By("checking that all the database pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) - }) - - It("create storage and database with nodeSets", func() { - By("issuing create commands...") - storageSample = testobjects.DefaultStorage(filepath.Join(".", "data", "storage-block-4-2-config-nodeSets.yaml")) - databaseSample = testobjects.DefaultDatabase() - testNodeSetName := "nodeset" - for idx := 1; idx <= 2; idx++ { - storageSample.Spec.NodeSets = append(storageSample.Spec.NodeSets, v1alpha1.StorageNodeSetSpecInline{ - Name: testNodeSetName + "-" + strconv.Itoa(idx), - StorageNodeSpec: v1alpha1.StorageNodeSpec{ - Nodes: 4, - }, - }) - databaseSample.Spec.NodeSets = append(databaseSample.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ - Name: testNodeSetName + "-" + strconv.Itoa(idx), - DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ - Nodes: 4, - }, - }) - } - Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) - }() - Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) - }() - - By("waiting until Storage is ready...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - - By("waiting until database is ready...") - waitUntilDatabaseReady(ctx, databaseSample.Name, testobjects.YdbNamespace) - - By("checking that all the database pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) - - By("delete nodeSetSpec inline to check inheritance...") - database := v1alpha1.Database{} - Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: databaseSample.Name, - Namespace: testobjects.YdbNamespace, - }, &database)).Should(Succeed()) - database.Spec.Nodes = 4 - database.Spec.NodeSets = []v1alpha1.DatabaseNodeSetSpecInline{ - { - Name: testNodeSetName + "-" + strconv.Itoa(1), - DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ - Nodes: 4, - }, - }, - } - Expect(k8sClient.Update(ctx, &database)).Should(Succeed()) - - By("check that ObservedDatabaseGeneration changed...") - Eventually(func(g Gomega) bool { - database := v1alpha1.Database{} - g.Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: databaseSample.Name, - Namespace: testobjects.YdbNamespace, - }, &database)).Should(Succeed()) - - databaseNodeSetList := v1alpha1.DatabaseNodeSetList{} - g.Expect(k8sClient.List(ctx, &databaseNodeSetList, - client.InNamespace(testobjects.YdbNamespace), - )).Should(Succeed()) - for _, databaseNodeSet := range databaseNodeSetList.Items { - if database.GetGeneration() != databaseNodeSet.Status.ObservedDatabaseGeneration { - return false - } - } - return true - }, Timeout, Interval).Should(BeTrue()) - - By("expecting databaseNodeSet pods deletion...") - Eventually(func(g Gomega) bool { - database := v1alpha1.Database{} - g.Expect(k8sClient.Get(ctx, types.NamespacedName{ - Name: databaseSample.Name, - Namespace: testobjects.YdbNamespace, - }, &database)).Should(Succeed()) - - databasePods := corev1.PodList{} - g.Expect(k8sClient.List(ctx, &databasePods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ - "ydb-cluster": "kind-database", - })).Should(Succeed()) - return len(databasePods.Items) == int(database.Spec.Nodes) - }, Timeout, Interval).Should(BeTrue()) - - By("execute simple query inside ydb database pod...") - databasePods := corev1.PodList{} - err := k8sClient.List(ctx, &databasePods, - client.InNamespace(testobjects.YdbNamespace), - client.MatchingLabels{ - "ydb-cluster": "kind-database", - }) - Expect(err).To(BeNil()) - firstDBPod := databasePods.Items[0].Name - - Expect(bringYdbCliToPod(testobjects.YdbNamespace, firstDBPod, testobjects.YdbHome)).To(Succeed()) - - Eventually(func(g Gomega) { - out, err := execInPod(testobjects.YdbNamespace, firstDBPod, []string{ - fmt.Sprintf("%v/ydb", testobjects.YdbHome), - "-d", - "/" + testobjects.DefaultDomain, - "-e", - "grpc://localhost:2135", - "yql", - "-s", - "select 1", - }) - - g.Expect(err).To(BeNil()) - - // `yql` gives output in the following format: - // ┌─────────┐ - // | column0 | - // ├─────────┤ - // | 1 | - // └─────────┘ - g.Expect(strings.ReplaceAll(out, "\n", "")). - To(MatchRegexp(".*column0.*1.*")) - }) - }) - - It("operatorConnection check, create storage with default staticCredentials", func() { - By("issuing create commands...") - storageSample = testobjects.DefaultStorage(filepath.Join(".", "data", "storage-block-4-2-config-staticCreds.yaml")) - storageSample.Spec.OperatorConnection = &v1alpha1.ConnectionOptions{ - StaticCredentials: &v1alpha1.StaticCredentialsAuth{ - Username: "root", - }, - } - Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) - }() - - By("waiting until Storage is ready...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("checking that all the storage pods are running and ready...") - checkPodsRunningAndReady(ctx, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) - }) - - It("storage.State goes Pending -> Preparing -> Provisioning -> Initializing -> Ready", func() { - Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) - defer func() { - Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) - }() - - By("waiting until Storage is ready...") - waitUntilStorageReady(ctx, storageSample.Name, testobjects.YdbNamespace) - - By("tracking storage state changes...") - events, err := clientset.CoreV1().Events(testobjects.YdbNamespace).List(context.Background(), - metav1.ListOptions{TypeMeta: metav1.TypeMeta{Kind: "Storage"}}) - Expect(err).ToNot(HaveOccurred()) - - allowedChanges := map[ClusterState]ClusterState{ - StoragePending: StoragePreparing, - StoragePreparing: StorageProvisioning, - StorageProvisioning: StorageInitializing, - StorageInitializing: StorageReady, - } - - re := regexp.MustCompile(`Storage moved from ([a-zA-Z]+) to ([a-zA-Z]+)`) - for _, event := range events.Items { - if event.Reason == "StatusChanged" { - match := re.FindStringSubmatch(event.Message) - Expect(allowedChanges[ClusterState(match[1])]).To(BeEquivalentTo(ClusterState(match[2]))) - } - } - }) - - AfterEach(func() { - Expect(uninstallOperatorWithHelm(testobjects.YdbNamespace)).Should(BeTrue()) - Expect(k8sClient.Delete(ctx, &namespace)).Should(Succeed()) - Eventually(func(g Gomega) bool { - namespaceList := corev1.NamespaceList{} - g.Expect(k8sClient.List(ctx, &namespaceList)).Should(Succeed()) - for _, namespace := range namespaceList.Items { - if namespace.GetName() == testobjects.YdbNamespace { - return false - } - } - return true - }, Timeout, Interval).Should(BeTrue()) - }) -}) diff --git a/go.mod b/go.mod index 66173cf1..f0297899 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,25 @@ module github.com/ydb-platform/ydb-kubernetes-operator -go 1.19 +go 1.20 require ( github.com/banzaicloud/k8s-objectmatcher v1.7.0 github.com/go-logr/logr v1.2.4 - github.com/google/go-cmp v0.5.9 + github.com/golang-jwt/jwt/v4 v4.5.1 + github.com/google/go-cmp v0.6.0 github.com/onsi/ginkgo/v2 v2.9.4 github.com/onsi/gomega v1.27.6 github.com/pkg/errors v0.9.1 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.50.0 - github.com/ydb-platform/ydb-go-genproto v0.0.0-20230801151335-81e01be38941 - github.com/ydb-platform/ydb-go-sdk/v3 v3.53.0 - google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + github.com/ydb-platform/ydb-go-genproto v0.0.0-20240528144234-5d5a685e41f7 + github.com/ydb-platform/ydb-go-sdk/v3 v3.74.2 + google.golang.org/grpc v1.57.1 + google.golang.org/protobuf v1.33.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.26.1 - k8s.io/apimachinery v0.26.1 - k8s.io/client-go v0.26.1 - k8s.io/kubectl v0.26.1 + k8s.io/api v0.26.15 + k8s.io/apimachinery v0.26.15 + k8s.io/client-go v0.26.15 + k8s.io/kubectl v0.26.15 k8s.io/utils v0.0.0-20230115233650-391b47cb4029 sigs.k8s.io/controller-runtime v0.14.1 ) @@ -38,9 +39,8 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.4.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 // indirect @@ -63,21 +63,21 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/oauth2 v0.4.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/net v0.33.0 // indirect + golang.org/x/oauth2 v0.7.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.9.1 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/apiextensions-apiserver v0.26.1 // indirect - k8s.io/component-base v0.26.1 // indirect + k8s.io/apiextensions-apiserver v0.26.15 // indirect + k8s.io/component-base v0.26.15 // indirect k8s.io/klog/v2 v2.90.0 // indirect k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index d51cc5f9..a863f035 100644 --- a/go.sum +++ b/go.sum @@ -173,8 +173,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ= -github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -182,7 +182,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -199,8 +198,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= @@ -212,8 +211,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -348,6 +347,7 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/rekby/fixenv v0.6.1 h1:jUFiSPpajT4WY2cYuc++7Y1zWrnCxnovGCIX72PZniM= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -394,10 +394,10 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/ydb-platform/ydb-go-genproto v0.0.0-20230801151335-81e01be38941 h1:QXgmY0vkYtOoGEXnTjWkyxhOkIzCosMrnoDyYjrv71Q= -github.com/ydb-platform/ydb-go-genproto v0.0.0-20230801151335-81e01be38941/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= -github.com/ydb-platform/ydb-go-sdk/v3 v3.53.0 h1:fnObls3EJwvjH1L9QHAipazN26Hp924rzeMRv9iu788= -github.com/ydb-platform/ydb-go-sdk/v3 v3.53.0/go.mod h1:YBBMbkISt0UKjrO5JQYjM7xkOBbHoNXKJskiHhpETxQ= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20240528144234-5d5a685e41f7 h1:nL8XwD6fSst7xFUirkaWJmE7kM0CdWRYgu6+YQer1d4= +github.com/ydb-platform/ydb-go-genproto v0.0.0-20240528144234-5d5a685e41f7/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= +github.com/ydb-platform/ydb-go-sdk/v3 v3.74.2 h1:aciEkENbBcpRVGwU9+EPyC/cdXqiGU9cqc75LN7wxfY= +github.com/ydb-platform/ydb-go-sdk/v3 v3.74.2/go.mod h1:ZXl2InwGFiZKojWCsj6tW/SGFbch7zaehQWX5CjXMEI= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -412,6 +412,7 @@ go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -437,7 +438,6 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -463,14 +463,14 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= +golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= +golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -478,8 +478,8 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -505,11 +505,11 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -517,8 +517,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -541,8 +541,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -562,8 +562,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -574,8 +574,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= +google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -590,8 +590,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -625,23 +625,23 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA= -k8s.io/api v0.26.1 h1:f+SWYiPd/GsiWwVRz+NbFyCgvv75Pk9NK6dlkZgpCRQ= -k8s.io/api v0.26.1/go.mod h1:xd/GBNgR0f707+ATNyPmQ1oyKSgndzXij81FzWGsejg= +k8s.io/api v0.26.15 h1:tjMERUjIwkq+2UtPZL5ZbSsLkpxUv4gXWZfV5lQl+Og= +k8s.io/api v0.26.15/go.mod h1:CtWOrFl8VLCTLolRlhbBxo4fy83tjCLEtYa5pMubIe0= k8s.io/apiextensions-apiserver v0.18.3/go.mod h1:TMsNGs7DYpMXd+8MOCX8KzPOCx8fnZMoIGB24m03+JE= -k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI= -k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM= +k8s.io/apiextensions-apiserver v0.26.15 h1:QePn6+5mihx8sXQLaOXzvF4XPv2RGGj8Pv+O4P75GPU= +k8s.io/apiextensions-apiserver v0.26.15/go.mod h1:PbhgN0XidyF+9vCTUmNgVFK0MMEYqlHLZ4AJeBfiNMo= k8s.io/apimachinery v0.18.3/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= k8s.io/apimachinery v0.19.2/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= -k8s.io/apimachinery v0.26.1 h1:8EZ/eGJL+hY/MYCNwhmDzVqq2lPl3N3Bo8rvweJwXUQ= -k8s.io/apimachinery v0.26.1/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74= +k8s.io/apimachinery v0.26.15 h1:GPxeERYBSqSZlj3xIkX4L6mBjzZ9q8JPnJ+Vj15qe+g= +k8s.io/apimachinery v0.26.15/go.mod h1:O/uIhIOWuy6ndHqQ6qbkjD7OgeMhVtlk8+Z66ZcmJQc= k8s.io/apiserver v0.18.3/go.mod h1:tHQRmthRPLUtwqsOnJJMoI8SW3lnoReZeE861lH8vUw= k8s.io/client-go v0.18.3/go.mod h1:4a/dpQEvzAhT1BbuWW09qvIaGw6Gbu1gZYiQZIi1DMw= -k8s.io/client-go v0.26.1 h1:87CXzYJnAMGaa/IDDfRdhTzxk/wzGZ+/HUQpqgVSZXU= -k8s.io/client-go v0.26.1/go.mod h1:IWNSglg+rQ3OcvDkhY6+QLeasV4OYHDjdqeWkDQZwGE= +k8s.io/client-go v0.26.15 h1:A2Yav2v+VZQfpEsf5ESFp2Lqq5XACKBDrwkG+jEtOg0= +k8s.io/client-go v0.26.15/go.mod h1:KJs7snLEyKPlypqTQG/ngcaqE6h3/6qTvVHDViRL+iI= k8s.io/code-generator v0.18.3/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= k8s.io/component-base v0.18.3/go.mod h1:bp5GzGR0aGkYEfTj+eTY0AN/vXTgkJdQXjNTTVUaa3k= -k8s.io/component-base v0.26.1 h1:4ahudpeQXHZL5kko+iDHqLj/FSGAEUnSVO0EBbgDd+4= -k8s.io/component-base v0.26.1/go.mod h1:VHrLR0b58oC035w6YQiBSbtsf0ThuSwXP+p5dD/kAWU= +k8s.io/component-base v0.26.15 h1:32XJyv5fo/lbDZhYU1HyISXTgdSUkbW5cO4DhfR6Y/8= +k8s.io/component-base v0.26.15/go.mod h1:9V+nBzUtTNtRuYfYmQQEhuKrjhL80i2l6F2H2qUsHAI= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= @@ -656,8 +656,8 @@ k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a h1:s6zvHjyDQX1NtVT88pvw2tddqhqY0Bz0Gbnn+yctsFU= k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0= -k8s.io/kubectl v0.26.1 h1:K8A0Jjlwg8GqrxOXxAbjY5xtmXYeYjLU96cHp2WMQ7s= -k8s.io/kubectl v0.26.1/go.mod h1:miYFVzldVbdIiXMrHZYmL/EDWwJKM+F0sSsdxsATFPo= +k8s.io/kubectl v0.26.15 h1:Q118/ZVWmUYEm6Iod8MKuxQFwTBBopBogGq5tkudvhg= +k8s.io/kubectl v0.26.15/go.mod h1:JgN3H70qdFjI/93T91gVOAsSExxNmccoCQLDNX//aYw= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20230115233650-391b47cb4029 h1:L8zDtT4jrxj+TaQYD0k8KNlr556WaVQylDXswKmX+dE= k8s.io/utils v0.0.0-20230115233650-391b47cb4029/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= diff --git a/internal/annotations/annotations.go b/internal/annotations/annotations.go index 3adbc580..5fa06070 100644 --- a/internal/annotations/annotations.go +++ b/internal/annotations/annotations.go @@ -1,31 +1,26 @@ package annotations -import "strings" +const ( + PrimaryResourceStorageAnnotation = "ydb.tech/primary-resource-storage" + PrimaryResourceDatabaseAnnotation = "ydb.tech/primary-resource-database" + RemoteResourceVersionAnnotation = "ydb.tech/remote-resource-version" + ConfigurationChecksum = "ydb.tech/configuration-checksum" + StorageFinalizerKey = "ydb.tech/storage-finalizer" + RemoteFinalizerKey = "ydb.tech/remote-finalizer" + LastAppliedAnnotation = "ydb.tech/last-applied" +) -func GetYdbTechAnnotations(annotations map[string]string) map[string]string { - result := make(map[string]string) - for key, value := range annotations { - if strings.HasPrefix(key, "ydb.tech/") { - result[key] = value - } - } - return result +func CompareLastAppliedAnnotation(map1, map2 map[string]string) bool { + value1 := getLastAppliedAnnotation(map1) + value2 := getLastAppliedAnnotation(map2) + return value1 == value2 } -func CompareMaps(map1, map2 map[string]string) bool { - if len(map1) != len(map2) { - return false - } - for key1, value1 := range map1 { - if value2, ok := map2[key1]; !ok || value2 != value1 { - return false +func getLastAppliedAnnotation(annotations map[string]string) string { + for key, value := range annotations { + if key == LastAppliedAnnotation { + return value } } - return true -} - -func CompareYdbTechAnnotations(map1, map2 map[string]string) bool { - map1 = GetYdbTechAnnotations(map1) - map2 = GetYdbTechAnnotations(map2) - return CompareMaps(map1, map2) + return "" } diff --git a/internal/cms/dynconfig.go b/internal/cms/dynconfig.go new file mode 100644 index 00000000..5f4f8711 --- /dev/null +++ b/internal/cms/dynconfig.go @@ -0,0 +1,113 @@ +package cms + +import ( + "context" + "fmt" + "time" + + "github.com/ydb-platform/ydb-go-genproto/draft/Ydb_DynamicConfig_V1" + "github.com/ydb-platform/ydb-go-genproto/draft/protos/Ydb_DynamicConfig" + "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Operations" + "github.com/ydb-platform/ydb-go-sdk/v3" + "google.golang.org/protobuf/types/known/durationpb" + "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/connection" +) + +const ( + GetConfigTimeoutSeconds = 10 + ReplaceConfigTimeoutSeconds = 30 +) + +type Config struct { + StorageEndpoint string + Domain string + Config string + Version uint64 + DryRun bool + AllowUnknownFields bool +} + +func (c *Config) GetConfig( + ctx context.Context, + opts ...ydb.Option, +) (*Ydb_DynamicConfig.GetConfigResponse, error) { + logger := log.FromContext(ctx) + + endpoint := fmt.Sprintf("%s/%s", c.StorageEndpoint, c.Domain) + conn, err := connection.Open(ctx, endpoint, ydb.MergeOptions(opts...)) + if err != nil { + return nil, fmt.Errorf("error connecting to YDB: %w", err) + } + defer func() { + connection.Close(ctx, conn) + }() + + cmsCtx, cmsCtxCancel := context.WithTimeout(ctx, GetConfigTimeoutSeconds*time.Second) + defer cmsCtxCancel() + client := Ydb_DynamicConfig_V1.NewDynamicConfigServiceClient(ydb.GRPCConn(conn)) + request := c.makeGetConfigRequest() + + logger.Info("CMS GetConfig request", "endpoint", endpoint, "request", request) + return client.GetConfig(cmsCtx, request) +} + +func (c *Config) ProcessConfigResponse(ctx context.Context, response *Ydb_DynamicConfig.GetConfigResponse) error { + logger := log.FromContext(ctx) + logger.Info("CMS GetConfig response", "response", response) + + configResult := &Ydb_DynamicConfig.GetConfigResult{} + err := response.GetOperation().GetResult().UnmarshalTo(configResult) + if err != nil { + return err + } + + c.Config = configResult.GetConfig() + c.Version = configResult.GetIdentity().GetVersion() + return nil +} + +func (c *Config) ReplaceConfig( + ctx context.Context, + opts ...ydb.Option, +) (*Ydb_DynamicConfig.ReplaceConfigResponse, error) { + logger := log.FromContext(ctx) + + endpoint := fmt.Sprintf("%s/%s", c.StorageEndpoint, c.Domain) + conn, err := connection.Open(ctx, endpoint, ydb.MergeOptions(opts...)) + if err != nil { + return nil, fmt.Errorf("error connecting to YDB: %w", err) + } + defer func() { + connection.Close(ctx, conn) + }() + + cmsCtx, cmsCtxCancel := context.WithTimeout(ctx, ReplaceConfigTimeoutSeconds*time.Second) + defer cmsCtxCancel() + client := Ydb_DynamicConfig_V1.NewDynamicConfigServiceClient(ydb.GRPCConn(conn)) + request := &Ydb_DynamicConfig.ReplaceConfigRequest{ + Config: c.Config, + DryRun: c.DryRun, + AllowUnknownFields: c.AllowUnknownFields, + } + + logger.Info("CMS ReplaceConfig request", "endpoint", endpoint, "request", request) + return client.ReplaceConfig(cmsCtx, request) +} + +func (c *Config) CheckReplaceConfigResponse(ctx context.Context, response *Ydb_DynamicConfig.ReplaceConfigResponse) (bool, string, error) { + logger := log.FromContext(ctx) + + logger.Info("CMS ReplaceConfig response", "response", response) + return CheckOperationStatus(response.GetOperation()) +} + +func (c *Config) makeGetConfigRequest() *Ydb_DynamicConfig.GetConfigRequest { + request := &Ydb_DynamicConfig.GetConfigRequest{} + request.OperationParams = &Ydb_Operations.OperationParams{ + OperationTimeout: &durationpb.Duration{Seconds: GetConfigTimeoutSeconds}, + } + + return request +} diff --git a/internal/cms/operation.go b/internal/cms/operation.go new file mode 100644 index 00000000..7f023c47 --- /dev/null +++ b/internal/cms/operation.go @@ -0,0 +1,72 @@ +package cms + +import ( + "context" + "fmt" + "time" + + "github.com/ydb-platform/ydb-go-genproto/Ydb_Operation_V1" + "github.com/ydb-platform/ydb-go-genproto/protos/Ydb" + "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Operations" + "github.com/ydb-platform/ydb-go-sdk/v3" + "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/connection" +) + +const ( + GetOperationTimeoutSeconds = 10 +) + +type Operation struct { + StorageEndpoint string + Domain string + ID string +} + +func (op *Operation) GetOperation( + ctx context.Context, + opts ...ydb.Option, +) (*Ydb_Operations.GetOperationResponse, error) { + logger := log.FromContext(ctx) + + endpoint := fmt.Sprintf("%s/%s", op.StorageEndpoint, op.Domain) + conn, err := connection.Open(ctx, endpoint, ydb.MergeOptions(opts...)) + if err != nil { + return nil, fmt.Errorf("error connecting to YDB: %w", err) + } + defer func() { + connection.Close(ctx, conn) + }() + + cmsCtx, cmsCtxCancel := context.WithTimeout(ctx, GetOperationTimeoutSeconds*time.Second) + defer cmsCtxCancel() + client := Ydb_Operation_V1.NewOperationServiceClient(ydb.GRPCConn(conn)) + request := &Ydb_Operations.GetOperationRequest{Id: op.ID} + + logger.Info("CMS GetOperation request", "endpoint", endpoint, "request", request) + return client.GetOperation(cmsCtx, request) +} + +func (op *Operation) CheckGetOperationResponse(ctx context.Context, response *Ydb_Operations.GetOperationResponse) (bool, string, error) { + logger := log.FromContext(ctx) + + logger.Info("CMS GetOperation response", "response", response) + return CheckOperationStatus(response.GetOperation()) +} + +func CheckOperationStatus(operation *Ydb_Operations.Operation) (bool, string, error) { + if operation == nil { + return false, "", ErrEmptyReplyFromStorage + } + + if !operation.GetReady() { + return false, operation.Id, nil + } + + if operation.Status == Ydb.StatusIds_ALREADY_EXISTS || operation.Status == Ydb.StatusIds_SUCCESS { + return true, operation.Id, nil + } + + return true, operation.Id, fmt.Errorf("YDB response error: %v %v", operation.Status, operation.Issues) +} diff --git a/internal/cms/tenant.go b/internal/cms/tenant.go index abeb89a9..f403e944 100644 --- a/internal/cms/tenant.go +++ b/internal/cms/tenant.go @@ -4,62 +4,60 @@ import ( "context" "errors" "fmt" + "time" "github.com/ydb-platform/ydb-go-genproto/Ydb_Cms_V1" - "github.com/ydb-platform/ydb-go-genproto/protos/Ydb" "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Cms" - "github.com/ydb-platform/ydb-go-sdk/v3" - ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" + ydb "github.com/ydb-platform/ydb-go-sdk/v3" "sigs.k8s.io/controller-runtime/pkg/log" ydbv1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" "github.com/ydb-platform/ydb-kubernetes-operator/internal/connection" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +const ( + CreateDatabaseTimeoutSeconds = 10 ) var ErrEmptyReplyFromStorage = errors.New("empty reply from storage") type Tenant struct { StorageEndpoint string + Domain string Path string StorageUnits []ydbv1alpha1.StorageUnit Shared bool SharedDatabasePath string } -func (t *Tenant) Create(ctx context.Context, database *resources.DatabaseBuilder, creds ydbCredentials.Credentials) error { +func (t *Tenant) CreateDatabase( + ctx context.Context, + opts ...ydb.Option, +) (*Ydb_Cms.CreateDatabaseResponse, error) { logger := log.FromContext(ctx) - createDatabaseURL := fmt.Sprintf( - "%s/%s", - t.StorageEndpoint, - database.Spec.Domain, - ) - db, err := connection.Open(ctx, - createDatabaseURL, - ydb.WithCredentials(creds), - ) + endpoint := fmt.Sprintf("%s/%s", t.StorageEndpoint, t.Domain) + conn, err := connection.Open(ctx, endpoint, opts...) if err != nil { - logger.Error(err, "Error connecting to YDB storage") - return err + return nil, fmt.Errorf("error connecting to YDB: %w", err) } defer func() { - connection.Close(ctx, db) + connection.Close(ctx, conn) }() - client := Ydb_Cms_V1.NewCmsServiceClient(ydb.GRPCConn(db)) - logger.Info(fmt.Sprintf("creating tenant, url: %s", createDatabaseURL)) + cmsCtx, cmsCtxCancel := context.WithTimeout(ctx, CreateDatabaseTimeoutSeconds*time.Second) + defer cmsCtxCancel() + client := Ydb_Cms_V1.NewCmsServiceClient(ydb.GRPCConn(conn)) request := t.makeCreateDatabaseRequest() - logger.Info(fmt.Sprintf("creating tenant, request: %s", request)) - response, err := client.CreateDatabase(ctx, request) - if err != nil { - return err - } - if _, err := processDatabaseCreationResponse(response); err != nil { - return err - } - logger.Info(fmt.Sprintf("creating tenant, response: %s", response)) - return nil + logger.Info("CMS CreateDatabase request", "endpoint", endpoint, "request", request) + return client.CreateDatabase(cmsCtx, request) +} + +func (t *Tenant) CheckCreateDatabaseResponse(ctx context.Context, response *Ydb_Cms.CreateDatabaseResponse) (bool, string, error) { + logger := log.FromContext(ctx) + + logger.Info("CMS CreateDatabase response", "response", response) + return CheckOperationStatus(response.GetOperation()) } func (t *Tenant) makeCreateDatabaseRequest() *Ydb_Cms.CreateDatabaseRequest { @@ -94,18 +92,3 @@ func (t *Tenant) makeCreateDatabaseRequest() *Ydb_Cms.CreateDatabaseRequest { } return request } - -func processDatabaseCreationResponse(response *Ydb_Cms.CreateDatabaseResponse) (bool, error) { - if response.Operation == nil { - return false, ErrEmptyReplyFromStorage - } - - if response.Operation.Status == Ydb.StatusIds_ALREADY_EXISTS || response.Operation.Status == Ydb.StatusIds_SUCCESS { - return true, nil - } - if response.Operation.Status == Ydb.StatusIds_STATUS_CODE_UNSPECIFIED && len(response.Operation.Issues) == 0 { - return true, nil - } - - return false, fmt.Errorf("YDB response error: %v %v", response.Operation.Status, response.Operation.Issues) -} diff --git a/internal/configuration/schema/configuration.go b/internal/configuration/schema/configuration.go index b446a099..086c2d16 100644 --- a/internal/configuration/schema/configuration.go +++ b/internal/configuration/schema/configuration.go @@ -1,6 +1,26 @@ package schema +type DynConfig struct { + Metadata *Metadata `yaml:"metadata"` + Config map[string]interface{} `yaml:"config"` + AllowedLabels map[string]interface{} `yaml:"allowed_labels"` + SelectorConfig []SelectorConfig `yaml:"selector_config"` +} type Configuration struct { - Hosts []Host `yaml:"hosts"` - KeyConfig *KeyConfig `yaml:"key_config,omitempty"` + DomainsConfig *DomainsConfig `yaml:"domains_config"` + Hosts []Host `yaml:"hosts,omitempty"` + KeyConfig *KeyConfig `yaml:"key_config,omitempty"` +} + +type Metadata struct { + Kind string `yaml:"kind"` + Cluster string `yaml:"cluster"` + Version uint64 `yaml:"version"` + ID uint64 `yaml:"id,omitempty"` +} + +type SelectorConfig struct { + Description string `yaml:"description"` + Selector map[string]interface{} `yaml:"selector"` + Config map[string]interface{} `yaml:"config"` } diff --git a/internal/configuration/schema/domains.go b/internal/configuration/schema/domains.go new file mode 100644 index 00000000..8362f8a2 --- /dev/null +++ b/internal/configuration/schema/domains.go @@ -0,0 +1,9 @@ +package schema + +type DomainsConfig struct { + SecurityConfig *SecurityConfig `yaml:"security_config,omitempty"` +} + +type SecurityConfig struct { + EnforceUserTokenRequirement *bool `yaml:"enforce_user_token_requirement,omitempty"` +} diff --git a/internal/configuration/schema/host.go b/internal/configuration/schema/host.go index 6c0454ed..69cb8277 100644 --- a/internal/configuration/schema/host.go +++ b/internal/configuration/schema/host.go @@ -1,12 +1,12 @@ package schema type Host struct { - Address string `yaml:"address"` + Address string `yaml:"address,omitempty"` Host string `yaml:"host"` HostConfigID int `yaml:"host_config_id"` NodeID int `yaml:"node_id"` - Port int `yaml:"port"` - WalleLocation WalleLocation `yaml:"walle_location"` + Port int `yaml:"port,omitempty"` + WalleLocation WalleLocation `yaml:"walle_location,omitempty"` } type WalleLocation struct { diff --git a/internal/configuration/schema/schema_test.go b/internal/configuration/schema/schema_test.go new file mode 100644 index 00000000..e8221bf6 --- /dev/null +++ b/internal/configuration/schema/schema_test.go @@ -0,0 +1,264 @@ +package schema_test + +import ( + "fmt" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/configuration/schema" +) + +//nolint:all +var configurationExample = ` +--- +domains_config: + domain: + - name: Root + storage_pool_types: + - kind: ssd + pool_config: + box_id: 1 + erasure_species: block-4-2 + kind: ssd + pdisk_filter: + - property: + - type: SSD + vdisk_kind: Default + state_storage: + - ring: + node: [1, 2, 3, 4, 5, 6, 7, 8] + nto_select: 5 + ssid: 1 +hosts: +- host: storage-0 + walle_location: {body: 0, data_center: 'dcExample', rack: '0'} + node_id: 1 + host_config_id: 1 +- host: storage-1 + walle_location: {body: 1, data_center: 'dcExample', rack: '1'} + node_id: 2 + host_config_id: 1 +- host: storage-2 + walle_location: {body: 2, data_center: 'dcExample', rack: '2'} + node_id: 3 + host_config_id: 1 +- host: storage-3 + walle_location: {body: 3, data_center: 'dcExample', rack: '3'} + node_id: 4 + host_config_id: 1 +- host: storage-4 + walle_location: {body: 4, data_center: 'dcExample', rack: '4'} + node_id: 5 + host_config_id: 1 +- host: storage-5 + walle_location: {body: 5, data_center: 'dcExample', rack: '5'} + node_id: 6 + host_config_id: 1 +- host: storage-6 + walle_location: {body: 6, data_center: 'dcExample', rack: '6'} + node_id: 7 + host_config_id: 1 +- host: storage-7 + walle_location: {body: 7, data_center: 'dcExample', rack: '7'} + node_id: 8 + host_config_id: 1 +key_config: + keys: + - container_path: "/opt/ydb/secrets/database_encryption/key" + id: "1" + version: 1 +` + +//nolint:all +var dynconfigExample = ` +--- +metadata: + kind: MainConfig + version: 0 + cluster: "unknown" + # comment1 +config: + yaml_config_enabled: true + static_erasure: block-4-2 + host_configs: + - drive: + - path: SectorMap:1:1 + type: SSD + host_config_id: 1 + domains_config: + domain: + - name: Root + storage_pool_types: + - kind: ssd + pool_config: + box_id: 1 + erasure_species: block-4-2 + kind: ssd + pdisk_filter: + - property: + - type: SSD + vdisk_kind: Default + state_storage: + - ring: + node: [1, 2, 3, 4, 5, 6, 7, 8] + nto_select: 5 + ssid: 1 + table_service_config: + sql_version: 1 + actor_system_config: + executor: + - name: System + threads: 1 + type: BASIC + - name: User + threads: 1 + type: BASIC + - name: Batch + threads: 1 + type: BASIC + - name: IO + threads: 1 + time_per_mailbox_micro_secs: 100 + type: IO + - name: IC + spin_threshold: 10 + threads: 4 + time_per_mailbox_micro_secs: 100 + type: BASIC + scheduler: + progress_threshold: 10000 + resolution: 256 + spin_threshold: 0 + blob_storage_config: + service_set: + groups: + - erasure_species: block-4-2 + rings: + - fail_domains: + - vdisk_locations: + - node_id: storage-0 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-1 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-2 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-3 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-4 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-5 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-6 + pdisk_category: SSD + path: SectorMap:1:1 + - vdisk_locations: + - node_id: storage-7 + pdisk_category: SSD + path: SectorMap:1:1 + channel_profile_config: + profile: + - channel: + - erasure_species: block-4-2 + pdisk_category: 1 + storage_pool_kind: ssd + - erasure_species: block-4-2 + pdisk_category: 1 + storage_pool_kind: ssd + - erasure_species: block-4-2 + pdisk_category: 1 + storage_pool_kind: ssd + profile_id: 0 + grpc_config: + port: 2135 +selector_config: +- description: actor system config for dynnodes + selector: + node_type: slot + config: + actor_system_config: + cpu_count: 10 + node_type: COMPUTE + use_auto_config: true +allowed_labels: + node_id: + type: string + host: + type: string + tenant: + type: string +` + +func TestSchema(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Shema suite") +} + +var _ = Describe("Testing schema", func() { + It("Parse dynconfig", func() { + success, dynconfig, err := v1alpha1.ParseDynConfig(dynconfigExample) + Expect(success).Should(BeTrue()) + Expect(err).ShouldNot(HaveOccurred()) + Expect(*dynconfig.Metadata).Should(BeEquivalentTo(schema.Metadata{ + Kind: "MainConfig", + Version: 0, + Cluster: "unknown", + })) + Expect(dynconfig.AllowedLabels).ShouldNot(BeNil()) + Expect(dynconfig.SelectorConfig).ShouldNot(BeNil()) + Expect(dynconfig.Config["yaml_config_enabled"]).Should(BeTrue()) + }) + + It("Try parse static config as dynconfig", func() { + success, _, err := v1alpha1.ParseDynConfig(configurationExample) + Expect(success).ShouldNot(BeTrue()) + Expect(err).Should(HaveOccurred()) + }) + + It("Parse configuration with static config", func() { + yamlConfig, err := v1alpha1.ParseConfiguration(configurationExample) + Expect(err).ShouldNot(HaveOccurred()) + hosts := []schema.Host{} + for i := 0; i < 8; i++ { + hosts = append(hosts, schema.Host{ + Host: fmt.Sprintf("storage-%d", i), + NodeID: i + 1, + HostConfigID: 1, + WalleLocation: schema.WalleLocation{ + Body: i, + DataCenter: "dcExample", + Rack: fmt.Sprint(i), + }, + }) + } + Expect(yamlConfig.Hosts).Should(BeEquivalentTo(hosts)) + Expect(*yamlConfig.KeyConfig).Should(BeEquivalentTo(schema.KeyConfig{ + Keys: []schema.Key{ + { + ContainerPath: "/opt/ydb/secrets/database_encryption/key", + ID: "1", + Version: 1, + }, + }, + })) + }) + + It("Parse configuration with dynamic config", func() { + _, err := v1alpha1.ParseConfiguration(dynconfigExample) + Expect(err).ShouldNot(HaveOccurred()) + }) +}) diff --git a/internal/connection/connection.go b/internal/connection/connection.go index f228835a..d7240ea2 100644 --- a/internal/connection/connection.go +++ b/internal/connection/connection.go @@ -4,10 +4,11 @@ import ( "context" "crypto/tls" "crypto/x509" + "errors" "fmt" "time" - "github.com/ydb-platform/ydb-go-sdk/v3" + ydb "github.com/ydb-platform/ydb-go-sdk/v3" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" @@ -15,7 +16,7 @@ import ( ) func Open(ctx context.Context, endpoint string, opts ...ydb.Option) (*ydb.Driver, error) { - ctx, cancel := context.WithTimeout(ctx, time.Second) + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() db, err := ydb.Open( @@ -41,14 +42,26 @@ func Close(ctx context.Context, db *ydb.Driver) { } } -func LoadTLSCredentials(secure bool) grpc.DialOption { - if secure { - certPool, _ := x509.SystemCertPool() - tlsConfig := &tls.Config{ - MinVersion: tls.VersionTLS12, - RootCAs: certPool, +func LoadTLSCredentials(secure bool, caBundle []byte) (grpc.DialOption, error) { + if !secure { + return grpc.WithTransportCredentials(insecure.NewCredentials()), nil + } + var certPool *x509.CertPool + if len(caBundle) > 0 { + certPool = x509.NewCertPool() + if ok := certPool.AppendCertsFromPEM(caBundle); !ok { + return nil, errors.New("failed to parse CA bundle") + } + } else { + var err error + certPool, err = x509.SystemCertPool() + if err != nil { + return nil, fmt.Errorf("failed to get system cert pool, error: %w", err) } - return grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)) } - return grpc.WithTransportCredentials(insecure.NewCredentials()) + tlsConfig := &tls.Config{ + MinVersion: tls.VersionTLS12, + RootCAs: certPool, + } + return grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)), nil } diff --git a/internal/controllers/constants/constants.go b/internal/controllers/constants/constants.go index 52289f4c..ed995638 100644 --- a/internal/controllers/constants/constants.go +++ b/internal/controllers/constants/constants.go @@ -2,15 +2,45 @@ package constants import "time" -type ClusterState string +type ( + ClusterState string + RemoteResourceState string +) const ( - StoragePausedCondition = "StoragePaused" - StorageInitializedCondition = "StorageReady" - StorageNodeSetReadyCondition = "StorageNodeSetReady" - DatabasePausedCondition = "DatabasePaused" - DatabaseTenantInitializedCondition = "TenantInitialized" - DatabaseNodeSetReadyCondition = "DatabaseNodeSetReady" + StorageKind = "Storage" + StorageNodeSetKind = "StorageNodeSet" + RemoteStorageNodeSetKind = "RemoteStorageNodeSet" + DatabaseKind = "Database" + DatabaseNodeSetKind = "DatabaseNodeSet" + RemoteDatabaseNodeSetKind = "RemoteDatabaseNodeSet" + + // For backward compatibility + OldStorageInitializedCondition = "StorageReady" + OldDatabaseInitializedCondition = "TenantInitialized" + + StoragePreparedCondition = "StoragePrepared" + StorageInitializedCondition = "StorageInitialized" + StorageProvisionedCondition = "StorageProvisioned" + StoragePausedCondition = "StoragePaused" + StorageReadyCondition = "StorageReady" + + DatabasePreparedCondition = "DatabasePrepared" + DatabaseInitializedCondition = "DatabaseInitialized" + DatabaseProvisionedCondition = "DatabaseProvisioned" + DatabasePausedCondition = "DatabasePaused" + DatabaseReadyCondition = "DatabaseReady" + + NodeSetPreparedCondition = "NodeSetPrepared" + NodeSetProvisionedCondition = "NodeSetProvisioned" + NodeSetReadyCondition = "NodeSetReady" + NodeSetPausedCondition = "NodeSetPaused" + + CreateDatabaseOperationCondition = "CreateDatabaseOperation" + ReplaceConfigOperationCondition = "ReplaceConfigOperation" + + ConfigurationSyncedCondition = "ConfigurationSynced" + RemoteResourceSyncedCondition = "ResourceSynced" Stop = true Continue = false @@ -18,19 +48,24 @@ const ( ReasonInProgress = "InProgress" ReasonNotRequired = "NotRequired" ReasonCompleted = "Completed" + ReasonFailed = "Failed" - DefaultRequeueDelay = 10 * time.Second - StatusUpdateRequeueDelay = 1 * time.Second - SelfCheckRequeueDelay = 30 * time.Second - StorageInitializationRequeueDelay = 5 * time.Second + DefaultRequeueDelay = 10 * time.Second + StatusUpdateRequeueDelay = 1 * time.Second + ReplaceConfigOperationRequeueDelay = 15 * time.Second + SelfCheckRequeueDelay = 30 * time.Second + StorageInitializationRequeueDelay = 30 * time.Second + DatabaseInitializationRequeueDelay = 30 * time.Second DatabasePending ClusterState = "Pending" + DatabasePreparing ClusterState = "Preparing" DatabaseProvisioning ClusterState = "Provisioning" DatabaseInitializing ClusterState = "Initializing" DatabaseReady ClusterState = "Ready" DatabasePaused ClusterState = "Paused" DatabaseNodeSetPending ClusterState = "Pending" + DatabaseNodeSetPreparing ClusterState = "Preparing" DatabaseNodeSetProvisioning ClusterState = "Provisioning" DatabaseNodeSetReady ClusterState = "Ready" DatabaseNodeSetPaused ClusterState = "Paused" @@ -43,13 +78,19 @@ const ( StoragePaused ClusterState = "Paused" StorageNodeSetPending ClusterState = "Pending" + StorageNodeSetPreparing ClusterState = "Preparing" StorageNodeSetProvisioning ClusterState = "Provisioning" StorageNodeSetReady ClusterState = "Ready" StorageNodeSetPaused ClusterState = "Paused" - TenantCreationRequeueDelay = 30 * time.Second + ResourceSyncPending RemoteResourceState = "Pending" + ResourceSyncSuccess RemoteResourceState = "Synced" + StorageAwaitRequeueDelay = 30 * time.Second SharedDatabaseAwaitRequeueDelay = 30 * time.Second - OwnerControllerKey = ".metadata.controller" + OwnerControllerField = ".metadata.controller" + DatabaseRefField = ".spec.databaseRef.name" + StorageRefField = ".spec.storageRef.name" + SecretField = ".spec.secrets" ) diff --git a/internal/controllers/database/controller.go b/internal/controllers/database/controller.go index 092d2ab1..71fa7f18 100644 --- a/internal/controllers/database/controller.go +++ b/internal/controllers/database/controller.go @@ -6,20 +6,24 @@ import ( "github.com/go-logr/logr" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" - ydbv1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) // Reconciler reconciles a Database object @@ -34,6 +38,9 @@ type Reconciler struct { //+kubebuilder:rbac:groups=ydb.tech,resources=databases,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=ydb.tech,resources=databases/status,verbs=get;update;patch //+kubebuilder:rbac:groups=ydb.tech,resources=databases/finalizers,verbs=update +//+kubebuilder:rbac:groups=ydb.tech,resources=remotedatabasenodesets,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=ydb.tech,resources=remotedatabasenodesets/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=ydb.tech,resources=remotedatabasenodesets/finalizers,verbs=update //+kubebuilder:rbac:groups=ydb.tech,resources=databasenodesets,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=ydb.tech,resources=databasenodesets/status,verbs=get;update;patch //+kubebuilder:rbac:groups=ydb.tech,resources=databasenodesets/finalizers,verbs=update @@ -53,58 +60,62 @@ type Reconciler struct { func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { r.Log = log.FromContext(ctx) - database := &ydbv1alpha1.Database{} - err := r.Get(ctx, req.NamespacedName, database) + resource := &v1alpha1.Database{} + err := r.Get(ctx, req.NamespacedName, resource) if err != nil { - if errors.IsNotFound(err) { - r.Log.Info("database resources not found") + if apierrors.IsNotFound(err) { + r.Log.Info("Database resource not found") return ctrl.Result{Requeue: false}, nil } r.Log.Error(err, "unexpected Get error") return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - result, err := r.Sync(ctx, database) + + result, err := r.Sync(ctx, resource) if err != nil { r.Log.Error(err, "unexpected Sync error") } - return result, err -} -func ignoreDeletionPredicate() predicate.Predicate { - return predicate.Funcs{ - UpdateFunc: func(e event.UpdateEvent) bool { - generationChanged := e.ObjectOld.GetGeneration() != e.ObjectNew.GetGeneration() - annotationsChanged := !annotations.CompareYdbTechAnnotations(e.ObjectOld.GetAnnotations(), e.ObjectNew.GetAnnotations()) - _, isService := e.ObjectOld.(*corev1.Service) - - return generationChanged || annotationsChanged || isService - }, - DeleteFunc: func(e event.DeleteEvent) bool { - // Evaluates to false if the object has been confirmed deleted. - return !e.DeleteStateUnknown - }, - } + return result, err } -// SetupWithManager sets up the controller with the Manager. -func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { - controller := ctrl.NewControllerManagedBy(mgr).For(&ydbv1alpha1.Database{}) +// Create FieldIndexer to usage for List requests in Reconcile +func createFieldIndexers(mgr ctrl.Manager) error { + if err := mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.RemoteDatabaseNodeSet{}, + OwnerControllerField, + func(obj client.Object) []string { + // grab the RemoteDatabaseNodeSet object, extract the owner... + remoteDatabaseNodeSet := obj.(*v1alpha1.RemoteDatabaseNodeSet) + owner := metav1.GetControllerOf(remoteDatabaseNodeSet) + if owner == nil { + return nil + } + // ...make sure it's a Database... + if owner.APIVersion != v1alpha1.GroupVersion.String() || owner.Kind != DatabaseKind { + return nil + } - r.Recorder = mgr.GetEventRecorderFor("Database") + // ...and if so, return it + return []string{owner.Name} + }); err != nil { + return err + } if err := mgr.GetFieldIndexer().IndexField( context.Background(), - &ydbv1alpha1.DatabaseNodeSet{}, - OwnerControllerKey, + &v1alpha1.DatabaseNodeSet{}, + OwnerControllerField, func(obj client.Object) []string { // grab the DatabaseNodeSet object, extract the owner... - databaseNodeSet := obj.(*ydbv1alpha1.DatabaseNodeSet) + databaseNodeSet := obj.(*v1alpha1.DatabaseNodeSet) owner := metav1.GetControllerOf(databaseNodeSet) if owner == nil { return nil } // ...make sure it's a Database... - if owner.APIVersion != ydbv1alpha1.GroupVersion.String() || owner.Kind != "Database" { + if owner.APIVersion != v1alpha1.GroupVersion.String() || owner.Kind != DatabaseKind { return nil } @@ -114,11 +125,84 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { return err } + return mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.Database{}, + SecretField, + func(obj client.Object) []string { + secrets := []string{} + // grab the Database object, extract secrets from spec... + database := obj.(*v1alpha1.Database) + + // ...append declared Secret to index... + for _, secret := range database.Spec.Secrets { + secrets = append(secrets, secret.Name) + } + + // ...and if so, return it + return secrets + }) +} + +// SetupWithManager sets up the controller with the Manager. +func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { + r.Recorder = mgr.GetEventRecorderFor(DatabaseKind) + controller := ctrl.NewControllerManagedBy(mgr) + if err := createFieldIndexers(mgr); err != nil { + r.Log.Error(err, "unexpected FieldIndexer error") + return err + } + return controller. - Owns(&ydbv1alpha1.DatabaseNodeSet{}). - Owns(&corev1.Service{}). - Owns(&appsv1.StatefulSet{}). - Owns(&corev1.ConfigMap{}). - WithEventFilter(ignoreDeletionPredicate()). + For(&v1alpha1.Database{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Owns(&v1alpha1.RemoteDatabaseNodeSet{}, + builder.WithPredicates(resources.LastAppliedAnnotationPredicate()), // TODO: YDBOPS-9194 + ). + Owns(&v1alpha1.DatabaseNodeSet{}, + builder.WithPredicates(resources.LastAppliedAnnotationPredicate()), // TODO: YDBOPS-9194 + ). + Owns(&appsv1.StatefulSet{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Owns(&corev1.ConfigMap{}, + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Owns(&corev1.Service{}, + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &corev1.Secret{}}, + handler.EnqueueRequestsFromMapFunc(r.findDatabasesForSecret), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + WithEventFilter(resources.IsDatabaseCreatePredicate()). + WithEventFilter(resources.IgnoreDeleteStateUnknownPredicate()). Complete(r) } + +// Find all Databases which using Secret and make request for Reconcile +func (r *Reconciler) findDatabasesForSecret(secret client.Object) []reconcile.Request { + attachedDatabases := &v1alpha1.DatabaseList{} + err := r.List( + context.Background(), + attachedDatabases, + client.InNamespace(secret.GetNamespace()), + client.MatchingFields{SecretField: secret.GetName()}, + ) + if err != nil { + return []reconcile.Request{} + } + + requests := make([]reconcile.Request, len(attachedDatabases.Items)) + for i, item := range attachedDatabases.Items { + requests[i] = reconcile.Request{ + NamespacedName: types.NamespacedName{ + Name: item.GetName(), + Namespace: item.GetNamespace(), + }, + } + } + return requests +} diff --git a/internal/controllers/database/controller_test.go b/internal/controllers/database/controller_test.go new file mode 100644 index 00000000..a36e0694 --- /dev/null +++ b/internal/controllers/database/controller_test.go @@ -0,0 +1,420 @@ +package database_test + +import ( + "context" + "errors" + "fmt" + "path/filepath" + "reflect" + "strings" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" +) + +var ( + k8sClient client.Client + ctx context.Context + env *envtest.Environment +) + +func TestAPIs(t *testing.T) { + RegisterFailHandler(Fail) + + env = test.SetupK8STestManager(&ctx, &k8sClient, func(mgr *manager.Manager) []test.Reconciler { + return []test.Reconciler{ + &storage.Reconciler{ + Client: k8sClient, + Scheme: (*mgr).GetScheme(), + }, + &database.Reconciler{ + Client: k8sClient, + Scheme: (*mgr).GetScheme(), + }, + } + }) + + RunSpecs(t, "Database controller medium tests suite") +} + +var _ = Describe("Database controller medium tests", func() { + var namespace corev1.Namespace + var storageSample v1alpha1.Storage + var databaseSample v1alpha1.Database + + BeforeEach(func() { + namespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + Expect(k8sClient.Create(ctx, &namespace)).Should(Succeed()) + storageSample = *testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) + Expect(k8sClient.Create(ctx, &storageSample)).Should(Succeed()) + + By("checking that Storage created on local cluster...") + foundStorage := v1alpha1.Storage{} + Eventually(func() bool { + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + return foundStorage.Status.State == StorageInitializing + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("set condition Initialized to Storage...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + meta.SetStatusCondition(&foundStorage.Status.Conditions, metav1.Condition{ + Type: StorageInitializedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + }) + return k8sClient.Status().Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + + AfterEach(func() { + Expect(k8sClient.Delete(ctx, &databaseSample)).Should(Succeed()) + Expect(k8sClient.Delete(ctx, &storageSample)).Should(Succeed()) + Expect(k8sClient.Delete(ctx, &namespace)).Should(Succeed()) + test.DeleteAllObjects(env, k8sClient, &namespace) + }) + + It("Checking field propagation to objects", func() { + By("Check that Shared Database was created...") + databaseSample = *testobjects.DefaultDatabase() + databaseSample.Spec.SharedResources = &v1alpha1.DatabaseResources{ + StorageUnits: []v1alpha1.StorageUnit{ + { + UnitKind: "ssd", + Count: 1, + }, + }, + } + Expect(k8sClient.Create(ctx, &databaseSample)).Should(Succeed()) + + By("Check that StatefulSet was created...") + databaseStatefulSet := appsv1.StatefulSet{} + foundStatefulSets := appsv1.StatefulSetList{} + Eventually(func() error { + err := k8sClient.List(ctx, &foundStatefulSets, client.InNamespace( + testobjects.YdbNamespace)) + if err != nil { + return err + } + for idx, statefulSet := range foundStatefulSets.Items { + if statefulSet.Name == testobjects.DatabaseName { + databaseStatefulSet = foundStatefulSets.Items[idx] + return nil + } + } + return errors.New("failed to find StatefulSet") + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("Check that args `--label` propagated to pods...", func() { + podContainerArgs := databaseStatefulSet.Spec.Template.Spec.Containers[0].Args + var labelArgKey string + var labelArgValue string + for idx, arg := range podContainerArgs { + if arg == "--label" { + labelArgKey = strings.Split(podContainerArgs[idx+1], "=")[0] + labelArgValue = strings.Split(podContainerArgs[idx+1], "=")[1] + if labelArgKey == v1alpha1.LabelDeploymentKey { + Expect(labelArgValue).Should(BeEquivalentTo(v1alpha1.LabelDeploymentValueKubernetes)) + } + if labelArgKey == v1alpha1.LabelSharedDatabaseKey { + Expect(labelArgValue).Should(BeEquivalentTo(v1alpha1.LabelSharedDatabaseValueTrue)) + } + } + } + }) + + By("Check encryption for Database...") + foundDatabase := v1alpha1.Database{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundDatabase)) + + By("Update Database and enable encryption...") + foundDatabase.Spec.Encryption = &v1alpha1.EncryptionConfig{Enabled: true} + Expect(k8sClient.Update(ctx, &foundDatabase)).Should(Succeed()) + + By("Check that encryption secret was created...") + encryptionSecret := corev1.Secret{} + Eventually(func() error { + return k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &encryptionSecret) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + encryptionData := encryptionSecret.Data + + By("Check that arg `--key-file` was added to StatefulSet...") + databaseStatefulSet = appsv1.StatefulSet{} + Eventually(func() error { + Expect(k8sClient.List(ctx, + &foundStatefulSets, + client.InNamespace(testobjects.YdbNamespace), + )).ShouldNot(HaveOccurred()) + for idx, statefulSet := range foundStatefulSets.Items { + if statefulSet.Name == testobjects.DatabaseName { + databaseStatefulSet = foundStatefulSets.Items[idx] + break + } + } + podContainerArgs := databaseStatefulSet.Spec.Template.Spec.Containers[0].Args + encryptionKeyConfigPath := fmt.Sprintf("%s/%s", v1alpha1.ConfigDir, v1alpha1.DatabaseEncryptionKeyConfigFile) + for idx, arg := range podContainerArgs { + if arg == "--key-file" { + if podContainerArgs[idx+1] == encryptionKeyConfigPath { + return nil + } + return fmt.Errorf( + "Found arg `--key-file=%s` for encryption does not match with expected path: %s", + podContainerArgs[idx+1], + encryptionKeyConfigPath, + ) + } + } + return errors.New("Failed to find arg `--key-file` for encryption in StatefulSet") + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("Update Database encryption pin...") + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundDatabase)) + pin := "Ignore" + foundDatabase.Spec.Encryption = &v1alpha1.EncryptionConfig{ + Enabled: true, + Pin: &pin, + } + Expect(k8sClient.Update(ctx, &foundDatabase)).Should(Succeed()) + + By("Check that Secret for encryption was not changed...") + Consistently(func(g Gomega) bool { + g.Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &encryptionSecret)) + return reflect.DeepEqual(encryptionData, encryptionSecret.Data) + }, test.Timeout, test.Interval).Should(BeTrue()) + }) + + It("Check iPDiscovery flag works", func() { + getDBSts := func(generation int64) appsv1.StatefulSet { + sts := appsv1.StatefulSet{} + + Eventually( + func() error { + objectKey := types.NamespacedName{ + Name: testobjects.DatabaseName, + Namespace: testobjects.YdbNamespace, + } + err := k8sClient.Get(ctx, objectKey, &sts) + if err != nil { + return err + } + + if sts.Generation <= generation { + return fmt.Errorf("sts is too old (generation=%d)", sts.Generation) + } + return nil + }, + ).WithTimeout(test.Timeout).WithPolling(test.Interval).Should(Succeed()) + + return sts + } + getDB := func() v1alpha1.Database { + found := v1alpha1.Database{} + Eventually(func() error { + return k8sClient.Get(ctx, + types.NamespacedName{ + Name: testobjects.DatabaseName, + Namespace: testobjects.YdbNamespace, + }, + &found, + ) + }, test.Timeout, test.Interval).Should(Succeed()) + return found + } + + By("Create test database") + db := *testobjects.DefaultDatabase() + Expect(k8sClient.Create(ctx, &db)).Should(Succeed()) + + By("Check container args") + sts := getDBSts(0) + args := sts.Spec.Template.Spec.Containers[0].Args + + Expect(args).To(ContainElements([]string{"--grpc-public-host"})) + Expect(args).ToNot(ContainElements([]string{"--grpc-public-address-v6", "--grpc-public-address-v4", "--grpc-public-target-name-override"})) + + By("Enabling ip discovery using ipv6") + db = getDB() + db.Spec.Service.GRPC.IPDiscovery = &v1alpha1.IPDiscovery{ + Enabled: true, + IPFamily: corev1.IPv6Protocol, + } + + Expect(k8sClient.Update(ctx, &db)).Should(Succeed()) + + By("Check container args") + sts = getDBSts(sts.Generation) + args = sts.Spec.Template.Spec.Containers[0].Args + + Expect(args).To(ContainElements([]string{"--grpc-public-address-v6"})) + Expect(args).ToNot(ContainElements([]string{"--grpc-public-target-name-override"})) + + db = getDB() + + By("Enabling ip discovery using ipv4 and target name override") + db.Spec.Service.GRPC.IPDiscovery = &v1alpha1.IPDiscovery{ + Enabled: true, + IPFamily: corev1.IPv4Protocol, + TargetNameOverride: "a.b.c.d", + } + + Expect(k8sClient.Update(ctx, &db)).Should(Succeed()) + + By("Check container args") + + sts = getDBSts(sts.Generation) + args = sts.Spec.Template.Spec.Containers[0].Args + + Expect(args).To(ContainElements([]string{"--grpc-public-address-v4", "--grpc-public-target-name-override"})) + }) + + checkContainerArg := func(expectedArgKey, expectedArgValue string) error { + foundStatefulSet := appsv1.StatefulSet{} + Eventually(func() error { + return k8sClient.Get(ctx, + types.NamespacedName{ + Name: testobjects.DatabaseName, + Namespace: testobjects.YdbNamespace, + }, + &foundStatefulSet, + ) + }, test.Timeout, test.Interval).Should(Succeed()) + podContainerArgs := foundStatefulSet.Spec.Template.Spec.Containers[0].Args + for idx, argKey := range podContainerArgs { + if argKey == expectedArgKey { + if podContainerArgs[idx+1] != expectedArgValue { + return fmt.Errorf( + "Found arg `%s` value %s does not match with expected: %s", + expectedArgKey, + podContainerArgs[idx+1], + expectedArgValue, + ) + } + } + } + return nil + } + + It("Check externalPort GRPC Service field propagation", func() { + By("Create test database") + databaseSample = *testobjects.DefaultDatabase() + databaseSample.Spec.Service.GRPC.ExternalHost = fmt.Sprintf("%s.%s", testobjects.YdbNamespace, "k8s.external.net") + Expect(k8sClient.Create(ctx, &databaseSample)).Should(Succeed()) + + By("Check that args `--grpc-public-host` and `--grpc-public-port` propagated to StatefulSet pods...") + Eventually( + checkContainerArg("--grpc-public-host", fmt.Sprintf("%s.%s", "$(POD_NAME)", databaseSample.Spec.Service.GRPC.ExternalHost)), + test.Timeout, + test.Interval).ShouldNot(HaveOccurred()) + + Eventually( + checkContainerArg("--grpc-public-port", fmt.Sprintf("%d", v1alpha1.GRPCPort)), + test.Timeout, + test.Interval).ShouldNot(HaveOccurred()) + + externalPort := int32(30001) + By("Update externalHost and externalPort for Database GRPC Service...", func() { + database := v1alpha1.Database{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: testobjects.DatabaseName, + Namespace: testobjects.YdbNamespace, + }, &database)) + database.Spec.Service.GRPC.ExternalPort = externalPort + Expect(k8sClient.Update(ctx, &database)).Should(Succeed()) + }) + + By("Check that type was updated for Database GRPC Service to NodePort...") + Eventually(func() error { + databaseGRPCService := corev1.Service{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: fmt.Sprintf(resources.GRPCServiceNameFormat, databaseSample.Name), + Namespace: testobjects.YdbNamespace, + }, &databaseGRPCService)) + if databaseGRPCService.Spec.Type != corev1.ServiceTypeNodePort { + return fmt.Errorf( + "Found GRPC Service .spec.type %s does not match with expected: %s", + databaseGRPCService.Spec.Type, + corev1.ServiceTypeNodePort, + ) + } + for _, port := range databaseGRPCService.Spec.Ports { + if port.NodePort != externalPort { + return fmt.Errorf( + "Found GRPC Service NodePort value %d does not match with expected: %s", + port.NodePort, + fmt.Sprintf("%d", externalPort), + ) + } + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("Check that args `--grpc-public-port` was updated in StatefulSet...") + Eventually( + checkContainerArg("--grpc-public-port", fmt.Sprintf("%d", externalPort)), + test.Timeout, + test.Interval).ShouldNot(HaveOccurred()) + }) + + It("Checking args propagation from annotation to StatefulSet", func() { + By("Check that Database with annotations was created...") + databaseSample = *testobjects.DefaultDatabase() + databaseSample.Annotations = map[string]string{ + v1alpha1.AnnotationGRPCPublicHost: fmt.Sprintf("%s.%s", testobjects.YdbNamespace, "k8s.external.net"), + v1alpha1.AnnotationGRPCPublicPort: fmt.Sprintf("%d", 30001), + } + Expect(k8sClient.Create(ctx, &databaseSample)).Should(Succeed()) + + By("Check that args `--grpc-public-host` propagated to StatefulSet pods...") + Eventually( + checkContainerArg("--grpc-public-host", fmt.Sprintf("%s.%s.%s", "$(POD_NAME)", testobjects.YdbNamespace, "k8s.external.net")), + test.Timeout, + test.Interval).ShouldNot(HaveOccurred()) + + By("Check that args `--grpc-public-port` propagated to StatefulSet pods...") + Eventually( + checkContainerArg("--grpc-public-port", fmt.Sprintf("%d", 30001)), + test.Timeout, + test.Interval).ShouldNot(HaveOccurred()) + }) +}) diff --git a/internal/controllers/database/init.go b/internal/controllers/database/init.go index ab2cd0a7..1a2770be 100644 --- a/internal/controllers/database/init.go +++ b/internal/controllers/database/init.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" + ydb "github.com/ydb-platform/ydb-go-sdk/v3" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -18,58 +18,38 @@ import ( "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) -func (r *Reconciler) processSkipInitPipeline( +func (r *Reconciler) setInitPipelineStatus( ctx context.Context, database *resources.DatabaseBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step processSkipInitPipeline") - r.Log.Info("Database initialization disabled (with annotation), proceed with caution") - - r.Recorder.Event( - database, - corev1.EventTypeWarning, - "SkippingInit", - "Skipping database creation due to skip annotation present, be careful!", - ) - - return r.setInitDatabaseCompleted( - ctx, - database, - "Database creation not performed because initialization is skipped", - ) -} - -func (r *Reconciler) setInitialStatus( - ctx context.Context, - database *resources.DatabaseBuilder, -) (bool, ctrl.Result, error) { - r.Log.Info("running step setInitialStatus") - - if value, ok := database.Annotations[v1alpha1.AnnotationSkipInitialization]; ok && value == v1alpha1.AnnotationValueTrue { - if meta.FindStatusCondition(database.Status.Conditions, DatabaseTenantInitializedCondition) == nil || - meta.IsStatusConditionFalse(database.Status.Conditions, DatabaseTenantInitializedCondition) { - return r.processSkipInitPipeline(ctx, database) - } - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil - } - - changed := false - if meta.FindStatusCondition(database.Status.Conditions, DatabaseTenantInitializedCondition) == nil { + if database.Status.State == DatabasePreparing { meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ - Type: DatabaseTenantInitializedCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Tenant creation in progress", + Type: DatabaseInitializedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Database has not been initialized yet", }) - changed = true - } - if database.Status.State == DatabasePending { database.Status.State = DatabaseInitializing - changed = true + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + + // This block is special internal logic that skips all Database initialization. + if value, ok := database.Annotations[v1alpha1.AnnotationSkipInitialization]; ok && value == v1alpha1.AnnotationValueTrue { + r.Log.Info("Database initialization disabled (with annotation), proceed with caution") + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "SkippingInit", + "Skipping initialization due to skip annotation present, be careful!", + ) + return r.setInitDatabaseCompleted(ctx, database, "Database initialization not performed because initialization is skipped") } - if changed { - return r.setState(ctx, database) + + if meta.IsStatusConditionTrue(database.Status.Conditions, OldDatabaseInitializedCondition) { + return r.setInitDatabaseCompleted(ctx, database, "Database initialized successfully") } + return Continue, ctrl.Result{Requeue: false}, nil } @@ -79,23 +59,114 @@ func (r *Reconciler) setInitDatabaseCompleted( message string, ) (bool, ctrl.Result, error) { meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ - Type: DatabaseTenantInitializedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: message, + Type: DatabaseInitializedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + Message: message, }) - - database.Status.State = DatabaseReady - return r.setState(ctx, database) + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: CreateDatabaseOperationCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + Message: "Tenant creation operation is completed", + }) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) } -func (r *Reconciler) handleTenantCreation( +func (r *Reconciler) checkCreateDatabaseOperation( ctx context.Context, database *resources.DatabaseBuilder, - creds ydbCredentials.Credentials, + tenant *cms.Tenant, + ydbOptions ydb.Option, ) (bool, ctrl.Result, error) { - r.Log.Info("running step handleTenantCreation") + condition := meta.FindStatusCondition(database.Status.Conditions, CreateDatabaseOperationCondition) + if len(condition.Message) == 0 { + // Something is wrong with the condition where we save operation id + // retry create tenant + errMessage := fmt.Sprintf("Something is wrong with the condition, retry creating tenant %s", tenant.Path) + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "InitializingFailed", + errMessage, + ) + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: CreateDatabaseOperationCondition, + Status: metav1.ConditionFalse, + Reason: ReasonFailed, + ObservedGeneration: database.Generation, + Message: errMessage, + }) + return r.updateStatus(ctx, database, DatabaseInitializationRequeueDelay) + } + operation := &cms.Operation{ + StorageEndpoint: tenant.StorageEndpoint, + Domain: tenant.Domain, + ID: condition.Message, + } + response, err := operation.GetOperation(ctx, ydbOptions) + if err != nil { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "InitializingFailed", + fmt.Sprintf("Failed to check creation operation, operationID %s: %s", operation.ID, err), + ) + return Stop, ctrl.Result{RequeueAfter: DatabaseInitializationRequeueDelay}, err + } + + finished, operationID, err := operation.CheckGetOperationResponse(ctx, response) + if err != nil { + errMessage := fmt.Sprintf("Error creating tenant %s: %s", tenant.Path, err) + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "InitializingFailed", + errMessage, + ) + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: CreateDatabaseOperationCondition, + Status: metav1.ConditionFalse, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + Message: errMessage, + }) + return r.updateStatus(ctx, database, DatabaseInitializationRequeueDelay) + } + + if !finished { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + string(DatabaseInitializing), + fmt.Sprintf("Tenant creation operation is not completed, operationID: %s", operationID), + ) + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: CreateDatabaseOperationCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: operationID, + }) + return r.updateStatus(ctx, database, DatabaseInitializationRequeueDelay) + } + + r.Recorder.Event( + database, + corev1.EventTypeNormal, + string(DatabaseInitializing), + fmt.Sprintf("Tenant %s created", tenant.Path), + ) + return r.setInitDatabaseCompleted(ctx, database, "Database initialized successfully") +} + +func (r *Reconciler) initializeTenant( + ctx context.Context, + database *resources.DatabaseBuilder, +) (bool, ctrl.Result, error) { path := database.GetDatabasePath() var storageUnits []v1alpha1.StorageUnit var shared bool @@ -141,16 +212,15 @@ func (r *Reconciler) handleTenantCreation( return Stop, ctrl.Result{RequeueAfter: SharedDatabaseAwaitRequeueDelay}, err } - if sharedDatabaseCr.Status.State != "Ready" { + if !meta.IsStatusConditionTrue(sharedDatabaseCr.Status.Conditions, DatabaseProvisionedCondition) { r.Recorder.Event( database, corev1.EventTypeWarning, "Pending", fmt.Sprintf( - "Referenced shared Database (%s, %s) in a bad state: %s != Ready", + "Referenced shared Database (%s, %s) is not Provisioned", database.Spec.ServerlessResources.SharedDatabaseRef.Name, database.Spec.ServerlessResources.SharedDatabaseRef.Namespace, - sharedDatabaseCr.Status.State, ), ) return Stop, ctrl.Result{RequeueAfter: SharedDatabaseAwaitRequeueDelay}, err @@ -167,15 +237,42 @@ func (r *Reconciler) handleTenantCreation( return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, ErrIncorrectDatabaseResourcesConfiguration } - tenant := cms.Tenant{ + tenant := &cms.Tenant{ StorageEndpoint: database.Spec.StorageEndpoint, + Domain: database.Spec.Domain, Path: path, StorageUnits: storageUnits, Shared: shared, SharedDatabasePath: sharedDatabasePath, } - err := tenant.Create(ctx, database, creds) + creds, err := resources.GetYDBCredentials(ctx, database.Storage, r.Config) + if err != nil { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB credentials: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + tlsOptions, err := resources.GetYDBTLSOption(ctx, database.Storage, r.Config) + if err != nil { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB TLS options: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + ydbOpts := ydb.MergeOptions(ydb.WithCredentials(creds), tlsOptions) + + if meta.IsStatusConditionPresentAndEqual(database.Status.Conditions, CreateDatabaseOperationCondition, metav1.ConditionUnknown) { + return r.checkCreateDatabaseOperation(ctx, database, tenant, ydbOpts) + } + + response, err := tenant.CreateDatabase(ctx, ydbOpts) if err != nil { r.Recorder.Event( database, @@ -183,7 +280,35 @@ func (r *Reconciler) handleTenantCreation( "InitializingFailed", fmt.Sprintf("Error creating tenant %s: %s", tenant.Path, err), ) - return Stop, ctrl.Result{RequeueAfter: TenantCreationRequeueDelay}, err + return Stop, ctrl.Result{RequeueAfter: DatabaseInitializationRequeueDelay}, err + } + + finished, operationID, err := tenant.CheckCreateDatabaseResponse(ctx, response) + if err != nil { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "InitializingFailed", + fmt.Sprintf("Error checking operation for tenant %s: %s", tenant.Path, err), + ) + return Stop, ctrl.Result{RequeueAfter: DatabaseInitializationRequeueDelay}, err + } + + if !finished { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + string(DatabaseInitializing), + fmt.Sprintf("Tenant creation operation in progress, operationID: %s", operationID), + ) + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: CreateDatabaseOperationCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: operationID, + }) + return r.updateStatus(ctx, database, DatabaseInitializationRequeueDelay) } r.Recorder.Event( database, @@ -192,16 +317,5 @@ func (r *Reconciler) handleTenantCreation( fmt.Sprintf("Tenant %s created", tenant.Path), ) - r.Recorder.Event( - database, - corev1.EventTypeNormal, - "DatabaseReady", - "Database is initialized", - ) - - return r.setInitDatabaseCompleted( - ctx, - database, - "Database initialization is completed", - ) + return r.setInitDatabaseCompleted(ctx, database, "Database initialized successfully") } diff --git a/internal/controllers/database/sync.go b/internal/controllers/database/sync.go index f76d0aee..095f2b51 100644 --- a/internal/controllers/database/sync.go +++ b/internal/controllers/database/sync.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" "reflect" + "time" - ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -19,9 +19,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/connection" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck - "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) @@ -34,17 +32,8 @@ func (r *Reconciler) Sync(ctx context.Context, ydbCr *v1alpha1.Database) (ctrl.R var err error database := resources.NewDatabase(ydbCr) - stop, result, err = database.SetStatusOnFirstReconcile() - if stop { - return result, err - } - stop, result = r.checkDatabaseFrozen(&database) - if stop { - return result, nil - } - - stop, result, err = r.handlePauseResume(ctx, &database) + stop, result, err = r.setInitialStatus(ctx, &database) if stop { return result, err } @@ -59,20 +48,78 @@ func (r *Reconciler) Sync(ctx context.Context, ydbCr *v1alpha1.Database) (ctrl.R return result, err } - stop, result, err = r.syncNodeSetSpecInline(ctx, &database) + if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabaseInitializedCondition) { + return r.handleTenantCreation(ctx, &database) + } + + if database.Spec.NodeSets != nil { + stop, result, err = r.waitForNodeSetsToProvisioned(ctx, &database) + if stop { + return result, err + } + } else { + stop, result, err = r.waitForStatefulSetToScale(ctx, &database) + if stop { + return result, err + } + } + + stop, result, err = r.handlePauseResume(ctx, &database) if stop { return result, err } - if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabaseTenantInitializedCondition) { - return r.handleFirstStart(ctx, &database) + return ctrl.Result{}, nil +} + +func (r *Reconciler) setInitialStatus( + ctx context.Context, + database *resources.DatabaseBuilder, +) (bool, ctrl.Result, error) { + r.Log.Info("running step setInitialStatus") + if database.Status.Conditions == nil { + database.Status.Conditions = []metav1.Condition{} + + if database.Spec.Pause { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePausedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Transitioning to state Paused", + }) + } else { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseReadyCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Transitioning to state Ready", + }) + } + + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) } - return ctrl.Result{}, nil + r.Log.Info("complete step setInitialStatus") + return Continue, ctrl.Result{}, nil } func (r *Reconciler) waitForClusterResources(ctx context.Context, database *resources.DatabaseBuilder) (bool, ctrl.Result, error) { r.Log.Info("running step waitForClusterResources") + + if database.Status.State == DatabasePending { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePreparedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Waiting for sync resources", + }) + database.Status.State = DatabasePreparing + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + storage := &v1alpha1.Storage{} err := r.Get(ctx, types.NamespacedName{ Name: database.Spec.StorageClusterRef.Name, @@ -97,7 +144,7 @@ func (r *Reconciler) waitForClusterResources(ctx context.Context, database *reso corev1.EventTypeWarning, "Pending", fmt.Sprintf( - "Failed to get Database (%s, %s) resource, error: %s", + "Failed to get Storage (%s, %s) resource, error: %s", database.Spec.StorageClusterRef.Name, database.Spec.StorageClusterRef.Namespace, err, @@ -106,85 +153,134 @@ func (r *Reconciler) waitForClusterResources(ctx context.Context, database *reso return Stop, ctrl.Result{RequeueAfter: StorageAwaitRequeueDelay}, err } - if storage.Status.State != DatabaseReady { + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StorageInitializedCondition) { r.Recorder.Event( database, corev1.EventTypeWarning, "Pending", fmt.Sprintf( - "Referenced storage cluster (%s, %s) in a bad state: %s != Ready", + "Referenced storage cluster (%s, %s) is not initialized", database.Spec.StorageClusterRef.Name, database.Spec.StorageClusterRef.Namespace, - storage.Status.State, ), ) - return Stop, ctrl.Result{RequeueAfter: StorageAwaitRequeueDelay}, err + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: fmt.Sprintf( + "Referenced storage cluster (%s, %s) is not initialized", + database.Spec.StorageClusterRef.Name, + database.Spec.StorageClusterRef.Namespace, + ), + }) + return r.updateStatus(ctx, database, StorageAwaitRequeueDelay) } database.Storage = storage + r.Log.Info("complete step waitForClusterResources") return Continue, ctrl.Result{Requeue: false}, nil } -func (r *Reconciler) waitForDatabaseNodeSetsToReady( +func (r *Reconciler) waitForNodeSetsToProvisioned( ctx context.Context, database *resources.DatabaseBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step waitForDatabaseNodeSetToReady for Database") + r.Log.Info("running step waitForNodeSetsToProvisioned") - if database.Status.State == DatabasePending { - r.Recorder.Event( - database, - corev1.EventTypeNormal, - string(DatabaseProvisioning), - fmt.Sprintf("Starting to track readiness of running nodeSets objects, expected: %d", len(database.Spec.NodeSets)), - ) + if database.Status.State == DatabaseInitializing { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseProvisionedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Waiting for NodeSet resources to be Provisioned", + }) database.Status.State = DatabaseProvisioning - return r.setState(ctx, database) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) } for _, nodeSetSpec := range database.Spec.NodeSets { - foundDatabaseNodeSet := v1alpha1.DatabaseNodeSet{} - databaseNodeSetName := database.Name + "-" + nodeSetSpec.Name - err := r.Get(ctx, types.NamespacedName{ - Name: databaseNodeSetName, + var nodeSetObject client.Object + var nodeSetKind string + var nodeSetConditions []metav1.Condition + if nodeSetSpec.Remote != nil { + nodeSetObject = &v1alpha1.RemoteDatabaseNodeSet{} + nodeSetKind = RemoteDatabaseNodeSetKind + } else { + nodeSetObject = &v1alpha1.DatabaseNodeSet{} + nodeSetKind = DatabaseNodeSetKind + } + + nodeSetName := database.Name + "-" + nodeSetSpec.Name + if err := r.Get(ctx, types.NamespacedName{ + Name: nodeSetName, Namespace: database.Namespace, - }, &foundDatabaseNodeSet) - if err != nil { + }, nodeSetObject); err != nil { if apierrors.IsNotFound(err) { r.Recorder.Event( database, corev1.EventTypeWarning, "ProvisioningFailed", - fmt.Sprintf("DatabaseNodeSet with name %s was not found: %s", databaseNodeSetName, err), + fmt.Sprintf("%s with name %s was not found: %s", nodeSetKind, nodeSetName, err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil } r.Recorder.Event( database, corev1.EventTypeWarning, "ProvisioningFailed", - fmt.Sprintf("Failed to get DatabaseNodeSet: %s", err), + fmt.Sprintf("Failed to get %s with name %s: %s", nodeSetKind, nodeSetName, err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - if foundDatabaseNodeSet.Status.State != DatabaseNodeSetReady { - eventMessage := fmt.Sprintf("Waiting %s state for DatabaseNodeSet object %s, current: %s", - string(DatabaseReady), - foundDatabaseNodeSet.Name, - foundDatabaseNodeSet.Status.State, - ) + if nodeSetSpec.Remote != nil { + nodeSetConditions = nodeSetObject.(*v1alpha1.RemoteDatabaseNodeSet).Status.Conditions + } else { + nodeSetConditions = nodeSetObject.(*v1alpha1.DatabaseNodeSet).Status.Conditions + } + + condition := meta.FindStatusCondition(nodeSetConditions, NodeSetProvisionedCondition) + if condition == nil || condition.ObservedGeneration != nodeSetObject.GetGeneration() || condition.Status != metav1.ConditionTrue { r.Recorder.Event( database, corev1.EventTypeNormal, string(DatabaseProvisioning), - eventMessage, + fmt.Sprintf( + "Waiting %s with name %s for condition NodeSetProvisioned to be True", + nodeSetKind, + nodeSetName, + ), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseProvisionedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: fmt.Sprintf( + "Waiting %s with name %s for condition NodeSetProvisioned to be True", + nodeSetKind, + nodeSetName, + ), + }) + return r.updateStatus(ctx, database, DefaultRequeueDelay) } } + if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabaseProvisionedCondition) { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseProvisionedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + Message: fmt.Sprintf("Successfully scaled to desired number of nodes: %d", database.Spec.Nodes), + }) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step waitForNodeSetsToProvisioned") return Continue, ctrl.Result{Requeue: false}, nil } @@ -192,28 +288,29 @@ func (r *Reconciler) waitForStatefulSetToScale( ctx context.Context, database *resources.DatabaseBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step waitForStatefulSetToScale for Database") + r.Log.Info("running step waitForStatefulSetToScale") - if database.Status.State == DatabasePending { - r.Recorder.Event( - database, - corev1.EventTypeNormal, - string(DatabaseProvisioning), - fmt.Sprintf("Starting to track number of running database pods, expected: %d", database.Spec.Nodes), - ) + if database.Status.State == DatabaseInitializing { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseProvisionedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: fmt.Sprintf("Waiting for scale to desired number of nodes: %d", database.Spec.Nodes), + }) database.Status.State = DatabaseProvisioning - return r.setState(ctx, database) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) } if database.Spec.ServerlessResources != nil { return Continue, ctrl.Result{Requeue: false}, nil } - found := &appsv1.StatefulSet{} + foundStatefulSet := &appsv1.StatefulSet{} err := r.Get(ctx, types.NamespacedName{ Name: database.Name, Namespace: database.Namespace, - }, found) + }, foundStatefulSet) if err != nil { if apierrors.IsNotFound(err) { r.Recorder.Event( @@ -227,63 +324,55 @@ func (r *Reconciler) waitForStatefulSetToScale( r.Recorder.Event( database, corev1.EventTypeWarning, - "ProvisioningFailed", - fmt.Sprintf("Failed to get StatefulSets: %s", err), - ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - - podLabels := labels.Common(database.Name, make(map[string]string)) - podLabels.Merge(map[string]string{ - labels.ComponentKey: labels.DynamicComponent, - }) - - matchingLabels := client.MatchingLabels{} - for k, v := range podLabels { - matchingLabels[k] = v - } - - podList := &corev1.PodList{} - opts := []client.ListOption{ - client.InNamespace(database.Namespace), - matchingLabels, - } - - err = r.List(ctx, podList, opts...) - if err != nil { - r.Recorder.Event( - database, - corev1.EventTypeWarning, - "ProvisioningFailed", - fmt.Sprintf("Failed to list cluster pods: %s", err), + "ControllerError", + fmt.Sprintf("Failed to get StatefulSet: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - runningPods := 0 - for _, e := range podList.Items { - if e.Status.Phase == "Running" { - runningPods++ - } - } - - if runningPods != int(database.Spec.Nodes) { + if foundStatefulSet.Status.ReadyReplicas != database.Spec.Nodes { r.Recorder.Event( database, corev1.EventTypeNormal, string(DatabaseProvisioning), - fmt.Sprintf("Waiting for number of running dynamic pods to match expected: %d != %d", runningPods, database.Spec.Nodes), + fmt.Sprintf("Waiting for number of running pods to match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, database.Spec.Nodes), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseProvisionedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: fmt.Sprintf("Number of running nodes does not match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, database.Spec.Nodes), + }) + return r.updateStatus(ctx, database, DefaultRequeueDelay) + } + + if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabaseProvisionedCondition) { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseProvisionedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + Message: fmt.Sprintf("Successfully scaled to desired number of nodes: %d", database.Spec.Nodes), + }) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) } + r.Log.Info("complete step waitForStatefulSetToScale") return Continue, ctrl.Result{Requeue: false}, nil } func shouldIgnoreDatabaseChange(database *resources.DatabaseBuilder) resources.IgnoreChangesFunction { return func(oldObj, newObj runtime.Object) bool { - if _, ok := newObj.(*appsv1.StatefulSet); ok { - if database.Spec.Pause && *oldObj.(*appsv1.StatefulSet).Spec.Replicas == 0 { + if statefulSet, ok := oldObj.(*appsv1.StatefulSet); ok { + if database.Spec.Pause && *statefulSet.Spec.Replicas == 0 { + return true + } + } + + if sec, ok := oldObj.(*corev1.Secret); ok { + // Do not update already existing secret data for encryption + if (len(sec.StringData) > 0) || (len(sec.Data) > 0) { return true } } @@ -297,6 +386,17 @@ func (r *Reconciler) handleResourcesSync( ) (bool, ctrl.Result, error) { r.Log.Info("running step handleResourcesSync") + if !database.Spec.OperatorSync { + r.Log.Info("`operatorSync: false` is set, no further steps will be run") + r.Recorder.Event( + database, + corev1.EventTypeNormal, + string(DatabasePreparing), + fmt.Sprintf("Found .spec.operatorSync set to %t, skip further steps", database.Spec.OperatorSync), + ) + return Stop, ctrl.Result{}, nil + } + for _, builder := range database.GetResourceBuilders(r.Config) { newResource := builder.Placeholder(database) @@ -341,7 +441,14 @@ func (r *Reconciler) handleResourcesSync( "ProvisioningFailed", eventMessage+fmt.Sprintf(", failed to sync, error: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Failed to sync resources", + }) + return r.updateStatus(ctx, database, DefaultRequeueDelay) } else if result == controllerutil.OperationResultCreated || result == controllerutil.OperationResultUpdated { r.Recorder.Event( database, @@ -352,22 +459,67 @@ func (r *Reconciler) handleResourcesSync( } } - r.Log.Info("resource sync complete") + if err := r.syncNodeSetSpecInline(ctx, database); err != nil { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + Message: "Failed to sync NodeSet resources", + }) + return r.updateStatus(ctx, database, DefaultRequeueDelay) + } + + if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabasePreparedCondition) { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePreparedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + Message: "Successfully synced resources", + }) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step handleResourcesSync") return Continue, ctrl.Result{Requeue: false}, nil } -func (r *Reconciler) setState( +func (r *Reconciler) updateStatus( ctx context.Context, database *resources.DatabaseBuilder, + requeueAfter time.Duration, ) (bool, ctrl.Result, error) { + r.Log.Info("running updateStatus handler") + + if meta.IsStatusConditionFalse(database.Status.Conditions, DatabasePreparedCondition) || + meta.IsStatusConditionFalse(database.Status.Conditions, DatabaseInitializedCondition) || + meta.IsStatusConditionFalse(database.Status.Conditions, DatabaseProvisionedCondition) { + if database.Spec.Pause { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + }) + } else { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: database.Generation, + }) + } + } + databaseCr := &v1alpha1.Database{} - err := r.Get(ctx, client.ObjectKey{ + err := r.Get(ctx, types.NamespacedName{ Namespace: database.Namespace, Name: database.Name, }, databaseCr) if err != nil { r.Recorder.Event( - databaseCr, + database, corev1.EventTypeWarning, "ControllerError", "Failed fetching CR before status update", @@ -375,100 +527,42 @@ func (r *Reconciler) setState( return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } + oldStatus := databaseCr.Status.State databaseCr.Status.State = database.Status.State databaseCr.Status.Conditions = database.Status.Conditions - err = r.Status().Update(ctx, databaseCr) if err != nil { r.Recorder.Event( - databaseCr, + database, corev1.EventTypeWarning, "ControllerError", fmt.Sprintf("failed setting status: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil -} - -func (r *Reconciler) getYDBCredentials( - ctx context.Context, - database *resources.DatabaseBuilder, -) (ydbCredentials.Credentials, ctrl.Result, error) { - r.Log.Info("running step getYDBCredentials") - - if auth := database.Storage.Spec.OperatorConnection; auth != nil { - switch { - case auth.AccessToken != nil: - token, err := r.getSecretKey( - ctx, - database.Storage.Namespace, - auth.AccessToken.SecretKeyRef, - ) - if err != nil { - return nil, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - return ydbCredentials.NewAccessTokenCredentials(token), ctrl.Result{Requeue: false}, nil - case auth.StaticCredentials != nil: - username := auth.StaticCredentials.Username - password := v1alpha1.DefaultRootPassword - if auth.StaticCredentials.Password != nil { - var err error - password, err = r.getSecretKey( - ctx, - database.Storage.Namespace, - auth.StaticCredentials.Password.SecretKeyRef, - ) - if err != nil { - return nil, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - } - endpoint := database.Storage.GetStorageEndpoint() - secure := connection.LoadTLSCredentials(database.Storage.IsStorageEndpointSecure()) - return ydbCredentials.NewStaticCredentials(username, password, endpoint, secure), ctrl.Result{Requeue: false}, nil - } - } - return ydbCredentials.NewAnonymousCredentials(), ctrl.Result{Requeue: false}, nil -} - -func (r *Reconciler) getSecretKey( - ctx context.Context, - namespace string, - secretKeyRef *corev1.SecretKeySelector, -) (string, error) { - secret := &corev1.Secret{} - err := r.Get(ctx, types.NamespacedName{ - Name: secretKeyRef.Name, - Namespace: namespace, - }, secret) - if err != nil { - return "", err - } - secretVal, exist := secret.Data[secretKeyRef.Key] - if !exist { - return "", fmt.Errorf( - "key %s does not exist in secretData %s", - secretKeyRef.Key, - secretKeyRef.Name, + if oldStatus != database.Status.State { + r.Recorder.Event( + database, + corev1.EventTypeNormal, + "StatusChanged", + fmt.Sprintf("Database moved from %s to %s", oldStatus, databaseCr.Status.State), ) } - return string(secretVal), nil + + r.Log.Info("complete updateStatus handler") + return Stop, ctrl.Result{RequeueAfter: requeueAfter}, nil } func (r *Reconciler) syncNodeSetSpecInline( ctx context.Context, database *resources.DatabaseBuilder, -) (bool, ctrl.Result, error) { - r.Log.Info("running step syncNodeSetSpecInline") - +) error { databaseNodeSets := &v1alpha1.DatabaseNodeSetList{} - matchingFields := client.MatchingFields{ - OwnerControllerKey: database.Name, - } if err := r.List(ctx, databaseNodeSets, client.InNamespace(database.Namespace), - matchingFields, + client.MatchingFields{ + OwnerControllerField: database.Name, + }, ); err != nil { r.Recorder.Event( database, @@ -476,17 +570,19 @@ func (r *Reconciler) syncNodeSetSpecInline( "ProvisioningFailed", fmt.Sprintf("Failed to list DatabaseNodeSets: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + return err } for _, databaseNodeSet := range databaseNodeSets.Items { databaseNodeSet := databaseNodeSet.DeepCopy() isFoundDatabaseNodeSetSpecInline := false for _, nodeSetSpecInline := range database.Spec.NodeSets { - databaseNodeSetName := database.Name + "-" + nodeSetSpecInline.Name - if databaseNodeSet.Name == databaseNodeSetName { - isFoundDatabaseNodeSetSpecInline = true - break + if nodeSetSpecInline.Remote == nil { + nodeSetName := database.Name + "-" + nodeSetSpecInline.Name + if databaseNodeSet.Name == nodeSetName { + isFoundDatabaseNodeSetSpecInline = true + break + } } } if !isFoundDatabaseNodeSetSpecInline { @@ -497,109 +593,169 @@ func (r *Reconciler) syncNodeSetSpecInline( "ProvisioningFailed", fmt.Sprintf("Failed to delete DatabaseNodeSet: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + return err } r.Recorder.Event( database, corev1.EventTypeNormal, "Syncing", fmt.Sprintf("Resource: %s, Namespace: %s, Name: %s, deleted", - reflect.TypeOf(databaseNodeSet), + DatabaseNodeSetKind, databaseNodeSet.Namespace, databaseNodeSet.Name), ) } + } + + remoteDatabaseNodeSets := &v1alpha1.RemoteDatabaseNodeSetList{} + if err := r.List(ctx, remoteDatabaseNodeSets, + client.InNamespace(database.Namespace), + client.MatchingFields{ + OwnerControllerField: database.Name, + }, + ); err != nil { + r.Recorder.Event( + database, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Failed to list RemoteDatabaseNodeSets: %s", err), + ) + return err + } + + for _, remoteDatabaseNodeSet := range remoteDatabaseNodeSets.Items { + remoteDatabaseNodeSet := remoteDatabaseNodeSet.DeepCopy() + isFoundRemoteDatabaseNodeSetSpecInline := false + for _, nodeSetSpecInline := range database.Spec.NodeSets { + if nodeSetSpecInline.Remote != nil { + nodeSetName := database.Name + "-" + nodeSetSpecInline.Name + if remoteDatabaseNodeSet.Name == nodeSetName { + isFoundRemoteDatabaseNodeSetSpecInline = true + break + } + } + } - oldGeneration := databaseNodeSet.Status.ObservedDatabaseGeneration - if oldGeneration != database.Generation { - databaseNodeSet.Status.ObservedDatabaseGeneration = database.Generation - if err := r.Status().Update(ctx, databaseNodeSet); err != nil { + if !isFoundRemoteDatabaseNodeSetSpecInline { + if err := r.Delete(ctx, remoteDatabaseNodeSet); err != nil { r.Recorder.Event( - databaseNodeSet, + database, corev1.EventTypeWarning, - "ControllerError", - fmt.Sprintf("Failed setting status: %s", err), + "ProvisioningFailed", + fmt.Sprintf("Failed to delete RemoteDatabaseNodeSet: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + return err } r.Recorder.Event( - databaseNodeSet, + database, corev1.EventTypeNormal, - "StatusChanged", - fmt.Sprintf("DatabaseNodeSet updated observedStorageGeneration from %d to %d", oldGeneration, database.Generation), + "Syncing", + fmt.Sprintf("Resource: %s, Namespace: %s, Name: %s, deleted", + RemoteDatabaseNodeSetKind, + remoteDatabaseNodeSet.Namespace, + remoteDatabaseNodeSet.Name), ) } } - r.Log.Info("syncNodeSetSpecInline complete") - return Continue, ctrl.Result{Requeue: false}, nil + return nil } func (r *Reconciler) handlePauseResume( ctx context.Context, database *resources.DatabaseBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step handlePauseResume for Database") + r.Log.Info("running step handlePauseResume") + + if database.Status.State == DatabaseProvisioning { + if database.Spec.Pause { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + }) + database.Status.State = DatabasePaused + } else { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + }) + database.Status.State = DatabaseReady + } + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + if database.Status.State == DatabaseReady && database.Spec.Pause { r.Log.Info("`pause: true` was noticed, moving Database to state `Paused`") meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ - Type: DatabasePausedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: "State Database set to Paused", + Type: DatabaseReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: database.Generation, + Message: "Transitioning to state Paused", }) database.Status.State = DatabasePaused - return r.setState(ctx, database) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) } if database.Status.State == DatabasePaused && !database.Spec.Pause { r.Log.Info("`pause: false` was noticed, moving Database to state `Ready`") - meta.RemoveStatusCondition(&database.Status.Conditions, DatabasePausedCondition) + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: database.Generation, + Message: "Transitioning to state Ready", + }) database.Status.State = DatabaseReady - return r.setState(ctx, database) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + + if database.Spec.Pause { + if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabasePausedCondition) { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabasePausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + }) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } + } else { + if !meta.IsStatusConditionTrue(database.Status.Conditions, DatabaseReadyCondition) { + meta.SetStatusCondition(&database.Status.Conditions, metav1.Condition{ + Type: DatabaseReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: database.Generation, + }) + return r.updateStatus(ctx, database, StatusUpdateRequeueDelay) + } } + r.Log.Info("complete step handlePauseResume") return Continue, ctrl.Result{}, nil } -func (r *Reconciler) handleFirstStart( +func (r *Reconciler) handleTenantCreation( ctx context.Context, database *resources.DatabaseBuilder, ) (ctrl.Result, error) { - stop, result, err := r.setInitialStatus(ctx, database) + r.Log.Info("running step handleTenantCreation") + + stop, result, err := r.setInitPipelineStatus(ctx, database) if stop { return result, err } - if database.Spec.NodeSets != nil { - stop, result, err = r.waitForDatabaseNodeSetsToReady(ctx, database) - if stop { - return result, err - } - } else { - stop, result, err = r.waitForStatefulSetToScale(ctx, database) - if stop { - return result, err - } - } - - auth, result, err := r.getYDBCredentials(ctx, database) - if auth == nil { + stop, result, err = r.initializeTenant(ctx, database) + if stop { return result, err } - _, result, err = r.handleTenantCreation(ctx, database, auth) - return result, err -} - -func (r *Reconciler) checkDatabaseFrozen( - database *resources.DatabaseBuilder, -) (bool, ctrl.Result) { - r.Log.Info("running step checkStorageFrozen for Database") - if !database.Spec.OperatorSync { - r.Log.Info("`operatorSync: false` is set, no further steps will be run") - return Stop, ctrl.Result{} - } - - return Continue, ctrl.Result{} + r.Log.Info("complete step handleTenantCreation") + return ctrl.Result{}, nil } diff --git a/internal/controllers/databasenodeset/controller.go b/internal/controllers/databasenodeset/controller.go index 9e6858c4..36219778 100644 --- a/internal/controllers/databasenodeset/controller.go +++ b/internal/controllers/databasenodeset/controller.go @@ -5,23 +5,22 @@ import ( "github.com/go-logr/logr" appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) -// Reconciler reconciles a Storage object +// Reconciler reconciles a DatabaseNodeSet object type Reconciler struct { client.Client Recorder record.EventRecorder @@ -37,24 +36,23 @@ type Reconciler struct { //+kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=apps,resources=statefulsets/status,verbs=get;update;patch //+kubebuilder:rbac:groups=apps,resources=statefulsets/finalizers,verbs=get;list;watch -//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=core,resources=configmaps/status,verbs=get;update;patch // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - logger := log.FromContext(ctx) + r.Log = log.FromContext(ctx) - crDatabaseNodeSet := &api.DatabaseNodeSet{} + crDatabaseNodeSet := &v1alpha1.DatabaseNodeSet{} err := r.Get(ctx, req.NamespacedName, crDatabaseNodeSet) if err != nil { - if errors.IsNotFound(err) { - logger.Info("DatabaseNodeSet has been deleted") + if apierrors.IsNotFound(err) { + r.Log.Info("DatabaseNodeSet resource not found") return ctrl.Result{Requeue: false}, nil } - logger.Error(err, "unable to get DatabaseNodeSet") + r.Log.Error(err, "unable to get DatabaseNodeSet") return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } + result, err := r.Sync(ctx, crDatabaseNodeSet) if err != nil { r.Log.Error(err, "unexpected Sync error") @@ -63,29 +61,19 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu return result, err } -func ignoreDeletionPredicate() predicate.Predicate { - return predicate.Funcs{ - UpdateFunc: func(e event.UpdateEvent) bool { - generationChanged := e.ObjectOld.GetGeneration() != e.ObjectNew.GetGeneration() - annotationsChanged := !annotations.CompareYdbTechAnnotations(e.ObjectOld.GetAnnotations(), e.ObjectNew.GetAnnotations()) - - return generationChanged || annotationsChanged - }, - DeleteFunc: func(e event.DeleteEvent) bool { - // Evaluates to false if the object has been confirmed deleted. - return !e.DeleteStateUnknown - }, - } -} - // SetupWithManager sets up the controller with the Manager. func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { - controller := ctrl.NewControllerManagedBy(mgr).For(&api.DatabaseNodeSet{}) - r.Recorder = mgr.GetEventRecorderFor("DatabaseNodeSet") + r.Recorder = mgr.GetEventRecorderFor(DatabaseNodeSetKind) + controller := ctrl.NewControllerManagedBy(mgr) return controller. - Owns(&appsv1.StatefulSet{}). - Owns(&corev1.ConfigMap{}). - WithEventFilter(ignoreDeletionPredicate()). + For(&v1alpha1.DatabaseNodeSet{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Owns(&appsv1.StatefulSet{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + WithEventFilter(resources.IsDatabaseNodeSetCreatePredicate()). + WithEventFilter(resources.IgnoreDeleteStateUnknownPredicate()). Complete(r) } diff --git a/internal/controllers/databasenodeset/controller_test.go b/internal/controllers/databasenodeset/controller_test.go new file mode 100644 index 00000000..26f7aeb7 --- /dev/null +++ b/internal/controllers/databasenodeset/controller_test.go @@ -0,0 +1,258 @@ +package databasenodeset_test + +import ( + "context" + "path/filepath" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/databasenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" +) + +const ( + testDatabaseLabel = "database-label" + testNodeSetName = "nodeset" + testNodeSetLabel = "nodeset-label" +) + +var ( + k8sClient client.Client + ctx context.Context +) + +func TestAPIs(t *testing.T) { + RegisterFailHandler(Fail) + + test.SetupK8STestManager(&ctx, &k8sClient, func(mgr *manager.Manager) []test.Reconciler { + return []test.Reconciler{ + &storage.Reconciler{ + Client: k8sClient, + Scheme: (*mgr).GetScheme(), + }, + &database.Reconciler{ + Client: k8sClient, + Scheme: (*mgr).GetScheme(), + }, + &databasenodeset.Reconciler{ + Client: k8sClient, + Scheme: (*mgr).GetScheme(), + }, + } + }) + + RunSpecs(t, "DatabaseNodeSet controller medium tests suite") +} + +var _ = Describe("DatabaseNodeSet controller medium tests", func() { + var namespace corev1.Namespace + var storageSample v1alpha1.Storage + var databaseSample v1alpha1.Database + + BeforeEach(func() { + namespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + Expect(k8sClient.Create(ctx, &namespace)).Should(Succeed()) + + storageSample = *testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) + Expect(k8sClient.Create(ctx, &storageSample)).Should(Succeed()) + + By("checking that Storage created on local cluster...") + foundStorage := v1alpha1.Storage{} + Eventually(func() bool { + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + return foundStorage.Status.State == StorageInitializing + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("set condition Initialized to Storage...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + meta.SetStatusCondition(&foundStorage.Status.Conditions, metav1.Condition{ + Type: StorageInitializedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + }) + return k8sClient.Status().Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + databaseSample = *testobjects.DefaultDatabase() + databaseSample.Spec.NodeSets = append(databaseSample.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ + Name: testNodeSetName, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }) + + By("issuing create Database commands...") + Expect(k8sClient.Create(ctx, &databaseSample)).Should(Succeed()) + By("checking that Database created on local cluster...") + foundDatabase := v1alpha1.Database{} + Eventually(func() bool { + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundDatabase)) + return foundDatabase.Status.State == DatabaseInitializing + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that DatabaseNodeSet created on local cluster...") + Eventually(func() error { + foundDatabaseNodeSet := &v1alpha1.DatabaseNodeSet{} + return k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName, + Namespace: testobjects.YdbNamespace, + }, foundDatabaseNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + + AfterEach(func() { + Expect(k8sClient.Delete(ctx, &databaseSample)).Should(Succeed()) + Expect(k8sClient.Delete(ctx, &storageSample)).Should(Succeed()) + Expect(k8sClient.Delete(ctx, &namespace)).Should(Succeed()) + }) + + It("Check labels and annotations propagation to NodeSet", func() { + // Test update inline nodeSetSpec in Database object + testNodeSetName := "nodeset" + By("checking that Database updated on local cluster...") + Eventually(func() error { + foundDatabase := &v1alpha1.Database{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, foundDatabase)) + + foundDatabase.Labels = map[string]string{ + testDatabaseLabel: "true", + } + + foundDatabase.Annotations = map[string]string{ + v1alpha1.AnnotationUpdateStrategyOnDelete: "true", + } + + foundDatabase.Spec.NodeSets = append(foundDatabase.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ + Name: testNodeSetName + "-labeled", + Labels: map[string]string{ + testNodeSetLabel: "true", + }, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }) + + foundDatabase.Spec.NodeSets = append(foundDatabase.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ + Name: testNodeSetName + "-annotated", + Annotations: map[string]string{ + v1alpha1.AnnotationDataCenter: "envtest", + }, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }) + + return k8sClient.Update(ctx, foundDatabase) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + // check that DatabaseNodeSets was created + databaseNodeSets := v1alpha1.DatabaseNodeSetList{} + Eventually(func() bool { + Expect(k8sClient.List(ctx, &databaseNodeSets, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + foundDatabaseNodeSet := make(map[string]bool) + for _, databaseNodeSet := range databaseNodeSets.Items { + if databaseNodeSet.Name == testobjects.DatabaseName+"-"+testNodeSetName+"-labeled" { + foundDatabaseNodeSet["labeled"] = true + break + } + } + for _, databaseNodeSet := range databaseNodeSets.Items { + if databaseNodeSet.Name == testobjects.DatabaseName+"-"+testNodeSetName+"-annotated" { + foundDatabaseNodeSet["annotated"] = true + break + } + } + + return foundDatabaseNodeSet["labeled"] && foundDatabaseNodeSet["annotated"] + }, test.Timeout, test.Interval).Should(BeTrue()) + + // check that StatefulSets was created + databaseStatefulSets := appsv1.StatefulSetList{} + Eventually(func() bool { + Expect(k8sClient.List(ctx, &databaseStatefulSets, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + foundStatefulSet := make(map[string]bool) + for _, statefulSet := range databaseStatefulSets.Items { + if statefulSet.Name == testobjects.DatabaseName+"-"+testNodeSetName+"-labeled" { + foundStatefulSet["labeled"] = true + break + } + } + + for _, statefulSet := range databaseStatefulSets.Items { + if statefulSet.Name == testobjects.DatabaseName+"-"+testNodeSetName+"-annotated" { + foundStatefulSet["annotated"] = true + break + } + } + + return foundStatefulSet["labeled"] && foundStatefulSet["annotated"] + }, test.Timeout, test.Interval).Should(BeTrue()) + + // check that DatabaseNodeSet was labeled + labeledDatabaseNodeSet := v1alpha1.DatabaseNodeSet{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-labeled", + Namespace: testobjects.YdbNamespace, + }, &labeledDatabaseNodeSet)).Should(Succeed()) + Expect(labeledDatabaseNodeSet.Labels[testNodeSetLabel]).Should(Equal("true")) + + // check that DatabaseNodeSet was annotated and args was appended to pods + annotatedDatabaseNodeSet := v1alpha1.DatabaseNodeSet{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-annotated", + Namespace: testobjects.YdbNamespace, + }, &annotatedDatabaseNodeSet)).Should(Succeed()) + Expect(annotatedDatabaseNodeSet.Annotations[v1alpha1.AnnotationUpdateStrategyOnDelete]).Should(Equal("true")) + Expect(annotatedDatabaseNodeSet.Annotations[v1alpha1.AnnotationDataCenter]).Should(Equal("envtest")) + + annotatedDatabaseStatefulSet := appsv1.StatefulSet{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-annotated", + Namespace: testobjects.YdbNamespace, + }, &annotatedDatabaseStatefulSet)).Should(Succeed()) + Expect(annotatedDatabaseStatefulSet.Spec.UpdateStrategy.Type).Should(Equal(appsv1.OnDeleteStatefulSetStrategyType)) + var dataCenterArgExist bool + for _, item := range annotatedDatabaseStatefulSet.Spec.Template.Spec.Containers[0].Args { + if item == "--data-center" { + dataCenterArgExist = true + } + } + Expect(dataCenterArgExist).Should(BeTrue()) + }) +}) diff --git a/internal/controllers/databasenodeset/sync.go b/internal/controllers/databasenodeset/sync.go index 1e17c3a7..34f2147a 100644 --- a/internal/controllers/databasenodeset/sync.go +++ b/internal/controllers/databasenodeset/sync.go @@ -4,50 +4,46 @@ import ( "context" "fmt" "reflect" + "time" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - ydbv1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) -func (r *Reconciler) Sync(ctx context.Context, crDatabaseNodeSet *ydbv1alpha1.DatabaseNodeSet) (ctrl.Result, error) { +func (r *Reconciler) Sync(ctx context.Context, crDatabaseNodeSet *v1alpha1.DatabaseNodeSet) (ctrl.Result, error) { var stop bool var result ctrl.Result var err error databaseNodeSet := resources.NewDatabaseNodeSet(crDatabaseNodeSet) - stop, result, err = databaseNodeSet.SetStatusOnFirstReconcile() - if stop { - return result, err - } - stop, result = r.checkDatabaseNodeSetFrozen(&databaseNodeSet) + stop, result, err = r.setInitialStatus(ctx, &databaseNodeSet) if stop { - return result, nil + return result, err } - stop, result, err = r.handlePauseResume(ctx, &databaseNodeSet) + stop, result, err = r.handleResourcesSync(ctx, &databaseNodeSet) if stop { return result, err } - stop, result, err = r.handleResourcesSync(ctx, &databaseNodeSet) + stop, result, err = r.waitForStatefulSetToScale(ctx, &databaseNodeSet) if stop { return result, err } - stop, result, err = r.waitForStatefulSetToScale(ctx, &databaseNodeSet) + stop, result, err = r.handlePauseResume(ctx, &databaseNodeSet) if stop { return result, err } @@ -55,12 +51,69 @@ func (r *Reconciler) Sync(ctx context.Context, crDatabaseNodeSet *ydbv1alpha1.Da return ctrl.Result{}, nil } +func (r *Reconciler) setInitialStatus( + ctx context.Context, + databaseNodeSet *resources.DatabaseNodeSetResource, +) (bool, ctrl.Result, error) { + r.Log.Info("running step setInitialStatus") + + if databaseNodeSet.Status.Conditions == nil { + databaseNodeSet.Status.Conditions = []metav1.Condition{} + + if databaseNodeSet.Spec.Pause { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Transitioning to state Paused", + }) + } else { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Transitioning to state Ready", + }) + } + + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step setInitialStatus") + return Continue, ctrl.Result{}, nil +} + func (r *Reconciler) handleResourcesSync( ctx context.Context, databaseNodeSet *resources.DatabaseNodeSetResource, ) (bool, ctrl.Result, error) { r.Log.Info("running step handleResourcesSync") + if !databaseNodeSet.Spec.OperatorSync { + r.Log.Info("`operatorSync: false` is set, no further steps will be run") + r.Recorder.Event( + databaseNodeSet, + corev1.EventTypeNormal, + string(DatabaseNodeSetPreparing), + fmt.Sprintf("Found .spec.operatorSync set to %t, skip further steps", databaseNodeSet.Spec.OperatorSync), + ) + return Stop, ctrl.Result{Requeue: false}, nil + } + + if databaseNodeSet.Status.State == DatabaseNodeSetPending { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPreparedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Waiting for sync resources", + }) + databaseNodeSet.Status.State = DatabaseNodeSetPreparing + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) + } + for _, builder := range databaseNodeSet.GetResourceBuilders(r.Config) { newResource := builder.Placeholder(databaseNodeSet) @@ -104,130 +157,147 @@ func (r *Reconciler) handleResourcesSync( "ProvisioningFailed", eventMessage+fmt.Sprintf(", failed to sync, error: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Failed to sync resources", + }) + return r.updateStatus(ctx, databaseNodeSet, DefaultRequeueDelay) } else if result == controllerutil.OperationResultCreated || result == controllerutil.OperationResultUpdated { r.Recorder.Event( databaseNodeSet, corev1.EventTypeNormal, - string(DatabaseNodeSetProvisioning), + string(DatabaseNodeSetPreparing), eventMessage+fmt.Sprintf(", changed, result: %s", result), ) } } - r.Log.Info("resource sync complete") - return Continue, ctrl.Result{Requeue: false}, nil + + if !meta.IsStatusConditionTrue(databaseNodeSet.Status.Conditions, NodeSetPreparedCondition) { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPreparedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Successfully synced resources", + }) + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step handleResourcesSync") + return Continue, ctrl.Result{}, nil } func (r *Reconciler) waitForStatefulSetToScale( ctx context.Context, databaseNodeSet *resources.DatabaseNodeSetResource, ) (bool, ctrl.Result, error) { - r.Log.Info("running step waitForStatefulSetToScale for DatabaseNodeSet") + r.Log.Info("running step waitForStatefulSetToScale") - if databaseNodeSet.Status.State == DatabaseNodeSetPending { - r.Recorder.Event( - databaseNodeSet, - corev1.EventTypeNormal, - string(DatabaseNodeSetProvisioning), - fmt.Sprintf("Starting to track number of running databaseNodeSet pods, expected: %d", databaseNodeSet.Spec.Nodes), - ) + if databaseNodeSet.Status.State == DatabaseNodeSetPreparing { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetProvisionedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: databaseNodeSet.Generation, + Message: fmt.Sprintf("Waiting for scale to desired nodes: %d", databaseNodeSet.Spec.Nodes), + }) databaseNodeSet.Status.State = DatabaseNodeSetProvisioning - return r.setState(ctx, databaseNodeSet) + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) } - found := &appsv1.StatefulSet{} + foundStatefulSet := &appsv1.StatefulSet{} err := r.Get(ctx, types.NamespacedName{ Name: databaseNodeSet.Name, Namespace: databaseNodeSet.Namespace, - }, found) + }, foundStatefulSet) if err != nil { - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { r.Recorder.Event( databaseNodeSet, corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to found StatefulSet: %s", err), + "ProvisioningFailed", + fmt.Sprintf("StatefulSet with name %s was not found: %s", databaseNodeSet.Name, err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil } r.Recorder.Event( databaseNodeSet, corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to get StatefulSets: %s", err), - ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - - matchingLabels := client.MatchingLabels{} - for k, v := range databaseNodeSet.Labels { - matchingLabels[k] = v - } - - podList := &corev1.PodList{} - opts := []client.ListOption{ - client.InNamespace(databaseNodeSet.Namespace), - matchingLabels, - } - if err = r.List(ctx, podList, opts...); err != nil { - r.Recorder.Event( - databaseNodeSet, - corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to list databaseNodeSet pods: %s", err), + "ControllerError", + fmt.Sprintf("Failed to get StatefulSet: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - runningPods := 0 - for _, e := range podList.Items { - if e.Status.Phase == "Running" { - runningPods++ - } - } - - if runningPods != int(databaseNodeSet.Spec.Nodes) { + if foundStatefulSet.Status.ReadyReplicas != databaseNodeSet.Spec.Nodes { r.Recorder.Event( databaseNodeSet, corev1.EventTypeNormal, string(DatabaseNodeSetProvisioning), - fmt.Sprintf("Waiting for number of running databaseNodeSet pods to match expected: %d != %d", runningPods, databaseNodeSet.Spec.Nodes)) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil - } - - if databaseNodeSet.Spec.Pause { + fmt.Sprintf("Waiting for number of running nodes to match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, databaseNodeSet.Spec.Nodes), + ) meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ - Type: DatabasePausedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: "Scaled DatabaseNodeSet to 0 successfully", + Type: NodeSetProvisionedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: databaseNodeSet.Generation, + Message: fmt.Sprintf("Number of running nodes does not match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, databaseNodeSet.Spec.Nodes), }) - databaseNodeSet.Status.State = DatabaseNodeSetPaused - } else { + return r.updateStatus(ctx, databaseNodeSet, DefaultRequeueDelay) + } + + if !meta.IsStatusConditionTrue(databaseNodeSet.Status.Conditions, NodeSetProvisionedCondition) { meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ - Type: DatabaseNodeSetReadyCondition, - Status: "True", - Reason: ReasonCompleted, - Message: fmt.Sprintf("Scaled DatabaseNodeSet to %d successfully", databaseNodeSet.Spec.Nodes), + Type: NodeSetProvisionedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: databaseNodeSet.Generation, + Message: fmt.Sprintf("Successfully scaled to desired number of nodes: %d", databaseNodeSet.Spec.Nodes), }) - databaseNodeSet.Status.State = DatabaseNodeSetReady + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) } - return r.setState(ctx, databaseNodeSet) + r.Log.Info("complete step waitForStatefulSetToScale") + return Continue, ctrl.Result{Requeue: false}, nil } -func (r *Reconciler) setState( +func (r *Reconciler) updateStatus( ctx context.Context, databaseNodeSet *resources.DatabaseNodeSetResource, + requeueAfter time.Duration, ) (bool, ctrl.Result, error) { - crdatabaseNodeSet := &ydbv1alpha1.DatabaseNodeSet{} - err := r.Get(ctx, client.ObjectKey{ + r.Log.Info("running updateStatus handler") + + if meta.IsStatusConditionFalse(databaseNodeSet.Status.Conditions, NodeSetPreparedCondition) || + meta.IsStatusConditionFalse(databaseNodeSet.Status.Conditions, NodeSetProvisionedCondition) { + if databaseNodeSet.Spec.Pause { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionFalse, + ObservedGeneration: databaseNodeSet.Generation, + Reason: ReasonInProgress, + }) + } else { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionFalse, + ObservedGeneration: databaseNodeSet.Generation, + Reason: ReasonInProgress, + }) + } + } + + crDatabaseNodeSet := &v1alpha1.DatabaseNodeSet{} + err := r.Get(ctx, types.NamespacedName{ Namespace: databaseNodeSet.Namespace, Name: databaseNodeSet.Name, - }, crdatabaseNodeSet) + }, crDatabaseNodeSet) if err != nil { r.Recorder.Event( - crdatabaseNodeSet, + databaseNodeSet, corev1.EventTypeWarning, "ControllerError", "Failed fetching CR before status update", @@ -235,29 +305,29 @@ func (r *Reconciler) setState( return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - oldStatus := crdatabaseNodeSet.Status.State - crdatabaseNodeSet.Status.State = databaseNodeSet.Status.State - crdatabaseNodeSet.Status.Conditions = databaseNodeSet.Status.Conditions - - err = r.Status().Update(ctx, crdatabaseNodeSet) - if err != nil { + oldStatus := crDatabaseNodeSet.Status.State + crDatabaseNodeSet.Status.State = databaseNodeSet.Status.State + crDatabaseNodeSet.Status.Conditions = databaseNodeSet.Status.Conditions + if err = r.Status().Update(ctx, crDatabaseNodeSet); err != nil { r.Recorder.Event( - crdatabaseNodeSet, + databaseNodeSet, corev1.EventTypeWarning, "ControllerError", fmt.Sprintf("Failed setting status: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } else if oldStatus != databaseNodeSet.Status.State { + } + if oldStatus != databaseNodeSet.Status.State { r.Recorder.Event( - crdatabaseNodeSet, + databaseNodeSet, corev1.EventTypeNormal, "StatusChanged", fmt.Sprintf("DatabaseNodeSet moved from %s to %s", oldStatus, databaseNodeSet.Status.State), ) } - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil + r.Log.Info("complete updateStatus handler") + return Stop, ctrl.Result{RequeueAfter: requeueAfter}, nil } func shouldIgnoreDatabaseNodeSetChange(databaseNodeSet *resources.DatabaseNodeSetResource) resources.IgnoreChangesFunction { @@ -275,44 +345,77 @@ func (r *Reconciler) handlePauseResume( ctx context.Context, databaseNodeSet *resources.DatabaseNodeSetResource, ) (bool, ctrl.Result, error) { - r.Log.Info("running step handlePauseResume for Database") - if databaseNodeSet.Status.State == DatabaseReady && databaseNodeSet.Spec.Pause { + r.Log.Info("running step handlePauseResume") + + if databaseNodeSet.Status.State == DatabaseNodeSetProvisioning { + if databaseNodeSet.Spec.Pause { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: databaseNodeSet.Generation, + }) + databaseNodeSet.Status.State = DatabaseNodeSetPaused + } else { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: databaseNodeSet.Generation, + }) + databaseNodeSet.Status.State = DatabaseNodeSetReady + } + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) + } + + if databaseNodeSet.Status.State == DatabaseNodeSetReady && databaseNodeSet.Spec.Pause { r.Log.Info("`pause: true` was noticed, moving DatabaseNodeSet to state `Paused`") - meta.RemoveStatusCondition(&databaseNodeSet.Status.Conditions, DatabaseNodeSetReadyCondition) meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ - Type: DatabasePausedCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Transitioning DatabaseNodeSet to Paused state", + Type: NodeSetReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Transitioning to state Paused", }) databaseNodeSet.Status.State = DatabaseNodeSetPaused - return r.setState(ctx, databaseNodeSet) + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) } if databaseNodeSet.Status.State == DatabaseNodeSetPaused && !databaseNodeSet.Spec.Pause { r.Log.Info("`pause: false` was noticed, moving DatabaseNodeSet to state `Ready`") - meta.RemoveStatusCondition(&databaseNodeSet.Status.Conditions, DatabasePausedCondition) meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ - Type: DatabaseNodeSetReadyCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Recovering DatabaseNodeSet from Paused state", + Type: NodeSetPausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: databaseNodeSet.Generation, + Message: "Transitioning to state Ready", }) databaseNodeSet.Status.State = DatabaseNodeSetReady - return r.setState(ctx, databaseNodeSet) + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) } - return Continue, ctrl.Result{}, nil -} - -func (r *Reconciler) checkDatabaseNodeSetFrozen( - databaseNodeSet *resources.DatabaseNodeSetResource, -) (bool, ctrl.Result) { - r.Log.Info("running step checkStorageFrozen for DatabaseNodeSet parent object") - if !databaseNodeSet.Spec.OperatorSync { - r.Log.Info("`operatorSync: false` is set, no further steps will be run") - return Stop, ctrl.Result{} + if databaseNodeSet.Spec.Pause { + if !meta.IsStatusConditionTrue(databaseNodeSet.Status.Conditions, NodeSetPausedCondition) { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: databaseNodeSet.Generation, + }) + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) + } + } else { + if !meta.IsStatusConditionTrue(databaseNodeSet.Status.Conditions, NodeSetReadyCondition) { + meta.SetStatusCondition(&databaseNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: databaseNodeSet.Generation, + }) + return r.updateStatus(ctx, databaseNodeSet, StatusUpdateRequeueDelay) + } } - return Continue, ctrl.Result{} + r.Log.Info("complete step handlePauseResume") + return Continue, ctrl.Result{}, nil } diff --git a/internal/controllers/monitoring/monitoring_test.go b/internal/controllers/monitoring/monitoring_test.go index edc049e0..be2651e0 100644 --- a/internal/controllers/monitoring/monitoring_test.go +++ b/internal/controllers/monitoring/monitoring_test.go @@ -16,11 +16,11 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/monitoring" "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" ) var ( @@ -119,7 +119,7 @@ func createMockDBAndSvc() { func createMockStorageAndSvc() { GinkgoHelper() - stor := testobjects.DefaultStorage(filepath.Join("..", "..", "..", "e2e", "tests", "data", "storage-block-4-2-config.yaml")) + stor := testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) Expect(k8sClient.Create(ctx, stor)).Should(Succeed()) stor.Status.State = StorageReady diff --git a/internal/controllers/remotedatabasenodeset/controller.go b/internal/controllers/remotedatabasenodeset/controller.go new file mode 100644 index 00000000..ae0d662c --- /dev/null +++ b/internal/controllers/remotedatabasenodeset/controller.go @@ -0,0 +1,252 @@ +package remotedatabasenodeset + +import ( + "context" + + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/record" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/cluster" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + ydblabels "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +// Reconciler reconciles a RemoteDatabaseNodeSet object +type Reconciler struct { + Client client.Client + RemoteClient client.Client + Recorder record.EventRecorder + RemoteRecorder record.EventRecorder + Log logr.Logger + Scheme *runtime.Scheme +} + +//+kubebuilder:rbac:groups=ydb.tech,resources=remotedatabasenodesets,verbs=get;list;watch;update +//+kubebuilder:rbac:groups=ydb.tech,resources=remotedatabasenodesets/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=ydb.tech,resources=remotedatabasenodesets/finalizers,verbs=update +//+kubebuilder:rbac:groups=ydb.tech,resources=databasenodesets,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=ydb.tech,resources=databasenodesets/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=ydb.tech,resources=databasenodesets/finalizers,verbs=update +//+kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=core,resources=services/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=core,resources=services/finalizers,verbs=get;list;watch +//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=core,resources=configmaps/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=core,resources=secrets/status,verbs=get;update;patch + +func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + r.Log = log.FromContext(ctx) + + remoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + if err := r.RemoteClient.Get(ctx, req.NamespacedName, remoteDatabaseNodeSet); err != nil { + if apierrors.IsNotFound(err) { + r.Log.Info("RemoteDatabaseNodeSet resource not found on remote cluster") + return ctrl.Result{Requeue: false}, nil + } + r.Log.Error(err, "unable to get RemoteDatabaseNodeSet on remote cluster") + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + } + + //nolint:nestif + // examine DeletionTimestamp to determine if object is under deletion + if remoteDatabaseNodeSet.ObjectMeta.DeletionTimestamp.IsZero() { + // The object is not being deleted, so if it does not have our finalizer, + // then lets add the finalizer and update the object. This is equivalent + // to registering our finalizer. + if !controllerutil.ContainsFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey) { + controllerutil.AddFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey) + if err := r.RemoteClient.Update(ctx, remoteDatabaseNodeSet); err != nil { + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + } else { + // The object is being deleted + if controllerutil.ContainsFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey) { + // our finalizer is present, so lets handle any external dependency + if err := r.deleteExternalResources(ctx, remoteDatabaseNodeSet); err != nil { + // if fail to delete the external dependency here, return with error + // so that it can be retried. + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + // remove our finalizer from the list and update it. + controllerutil.RemoveFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey) + if err := r.RemoteClient.Update(ctx, remoteDatabaseNodeSet); err != nil { + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + + // Stop reconciliation as the item is being deleted + return ctrl.Result{Requeue: false}, nil + } + + result, err := r.Sync(ctx, remoteDatabaseNodeSet) + if err != nil { + r.Log.Error(err, "unexpected Sync error") + } + + return result, err +} + +// SetupWithManager sets up the controller with the Manager. +func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, remoteCluster *cluster.Cluster) error { + cluster := *remoteCluster + + r.Recorder = mgr.GetEventRecorderFor(RemoteDatabaseNodeSetKind) + r.RemoteRecorder = cluster.GetEventRecorderFor(RemoteDatabaseNodeSetKind) + r.RemoteClient = cluster.GetClient() + + annotationFilter := func(mapObj client.Object) []reconcile.Request { + requests := make([]reconcile.Request, 0) + + annotations := mapObj.GetAnnotations() + primaryResourceName, exist := annotations[ydbannotations.PrimaryResourceDatabaseAnnotation] + if exist { + databaseNodeSets := &v1alpha1.DatabaseNodeSetList{} + if err := r.Client.List( + context.Background(), + databaseNodeSets, + client.InNamespace(mapObj.GetNamespace()), + client.MatchingFields{ + DatabaseRefField: primaryResourceName, + }, + ); err != nil { + return requests + } + for _, databaseNodeSet := range databaseNodeSets.Items { + requests = append(requests, reconcile.Request{ + NamespacedName: types.NamespacedName{ + Namespace: databaseNodeSet.GetNamespace(), + Name: databaseNodeSet.GetName(), + }, + }) + } + } + return requests + } + + isNodeSetFromMgmt, err := buildLocalSelector() + if err != nil { + return err + } + + if err := mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.DatabaseNodeSet{}, + DatabaseRefField, + func(obj client.Object) []string { + databaseNodeSet := obj.(*v1alpha1.DatabaseNodeSet) + return []string{databaseNodeSet.Spec.DatabaseRef.Name} + }); err != nil { + return err + } + + return ctrl.NewControllerManagedBy(mgr). + Named(RemoteDatabaseNodeSetKind). + Watches( + source.NewKindWithCache(&v1alpha1.RemoteDatabaseNodeSet{}, cluster.GetCache()), + &handler.EnqueueRequestForObject{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &v1alpha1.DatabaseNodeSet{}}, + &handler.EnqueueRequestForObject{}, + builder.WithPredicates(resources.LabelExistsPredicate(isNodeSetFromMgmt)), + ). + Watches( + &source.Kind{Type: &corev1.Service{}}, + handler.EnqueueRequestsFromMapFunc(annotationFilter), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &corev1.ConfigMap{}}, + handler.EnqueueRequestsFromMapFunc(annotationFilter), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &corev1.Secret{}}, + handler.EnqueueRequestsFromMapFunc(annotationFilter), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + WithEventFilter(resources.IsRemoteDatabaseNodeSetCreatePredicate()). + WithEventFilter(resources.IgnoreDeleteStateUnknownPredicate()). + Complete(r) +} + +func buildLocalSelector() (labels.Selector, error) { + labelRequirements := []labels.Requirement{} + localClusterRequirement, err := labels.NewRequirement( + ydblabels.RemoteClusterKey, + selection.Exists, + []string{}, + ) + if err != nil { + return nil, err + } + labelRequirements = append(labelRequirements, *localClusterRequirement) + return labels.NewSelector().Add(labelRequirements...), nil +} + +func BuildRemoteSelector(remoteCluster string) (labels.Selector, error) { + labelRequirements := []labels.Requirement{} + remoteClusterRequirement, err := labels.NewRequirement( + ydblabels.RemoteClusterKey, + selection.Equals, + []string{remoteCluster}, + ) + if err != nil { + return nil, err + } + labelRequirements = append(labelRequirements, *remoteClusterRequirement) + return labels.NewSelector().Add(labelRequirements...), nil +} + +func (r *Reconciler) deleteExternalResources( + ctx context.Context, + crRemoteDatabaseNodeSet *v1alpha1.RemoteDatabaseNodeSet, +) error { + databaseNodeSet := &v1alpha1.DatabaseNodeSet{} + if err := r.Client.Get(ctx, types.NamespacedName{ + Name: crRemoteDatabaseNodeSet.Name, + Namespace: crRemoteDatabaseNodeSet.Namespace, + }, databaseNodeSet); err != nil { + if apierrors.IsNotFound(err) { + r.Log.Info("DatabaseNodeSet not found") + } else { + r.Log.Error(err, "unable to get DatabaseNodeSet") + return err + } + } else { + if err := r.Client.Delete(ctx, databaseNodeSet); err != nil { + r.Log.Error(err, "unable to delete DatabaseNodeSet") + return err + } + } + + remoteDatabaseNodeSet := resources.NewRemoteDatabaseNodeSet(crRemoteDatabaseNodeSet) + if _, _, err := r.removeUnusedRemoteObjects(ctx, &remoteDatabaseNodeSet, []client.Object{}); err != nil { + r.Log.Error(err, "unable to delete unused remote resources") + return err + } + + return nil +} diff --git a/internal/controllers/remotedatabasenodeset/controller_test.go b/internal/controllers/remotedatabasenodeset/controller_test.go new file mode 100644 index 00000000..d0335e93 --- /dev/null +++ b/internal/controllers/remotedatabasenodeset/controller_test.go @@ -0,0 +1,891 @@ +package remotedatabasenodeset_test + +import ( + "context" + "fmt" + "path/filepath" + "reflect" + "strings" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/kubectl/pkg/scheme" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/cluster" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/databasenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/remotedatabasenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/remotestoragenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storagenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" +) + +const ( + testRemoteCluster = "remote-cluster" + testNodeSetName = "nodeset" + testSecretName = "remote-secret" +) + +var ( + localClient client.Client + remoteClient client.Client + localEnv *envtest.Environment + remoteEnv *envtest.Environment + ctx context.Context + cancel context.CancelFunc +) + +func TestRemoteDatabaseNodeSetApis(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "RemoteDatabaseNodeSet controller tests") +} + +var _ = BeforeSuite(func() { + By("bootstrapping test environment") + + ctx, cancel = context.WithCancel(context.TODO()) + + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) + + localEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{ + filepath.Join("..", "..", "..", "deploy", "ydb-operator", "crds"), + }, + ErrorIfCRDPathMissing: true, + } + remoteEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{ + filepath.Join("..", "..", "..", "deploy", "ydb-operator", "crds"), + }, + ErrorIfCRDPathMissing: true, + } + + err := v1alpha1.AddToScheme(scheme.Scheme) + Expect(err).ShouldNot(HaveOccurred()) + + localCfg, err := localEnv.Start() + Expect(err).ToNot(HaveOccurred()) + Expect(localCfg).ToNot(BeNil()) + + remoteCfg, err := remoteEnv.Start() + Expect(err).ToNot(HaveOccurred()) + Expect(remoteCfg).ToNot(BeNil()) + + // +kubebuilder:scaffold:scheme + + localManager, err := ctrl.NewManager(localCfg, ctrl.Options{ + MetricsBindAddress: "0", + Scheme: scheme.Scheme, + }) + Expect(err).ShouldNot(HaveOccurred()) + + //+kubebuilder:scaffold:scheme + + remoteManager, err := ctrl.NewManager(remoteCfg, ctrl.Options{ + MetricsBindAddress: "0", + Scheme: scheme.Scheme, + }) + Expect(err).ShouldNot(HaveOccurred()) + + databaseSelector, err := remotedatabasenodeset.BuildRemoteSelector(testRemoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + remoteCluster, err := cluster.New(localCfg, func(o *cluster.Options) { + o.Scheme = scheme.Scheme + o.NewCache = cache.BuilderWithOptions(cache.Options{ + SelectorsByObject: cache.SelectorsByObject{ + &v1alpha1.RemoteDatabaseNodeSet{}: {Label: databaseSelector}, + }, + }) + }) + Expect(err).ShouldNot(HaveOccurred()) + + err = remoteManager.Add(remoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&storage.Reconciler{ + Client: localManager.GetClient(), + Scheme: localManager.GetScheme(), + Config: localManager.GetConfig(), + }).SetupWithManager(localManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&database.Reconciler{ + Client: localManager.GetClient(), + Scheme: localManager.GetScheme(), + Config: localManager.GetConfig(), + }).SetupWithManager(localManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&databasenodeset.Reconciler{ + Client: localManager.GetClient(), + Scheme: localManager.GetScheme(), + Config: localManager.GetConfig(), + }).SetupWithManager(localManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&storagenodeset.Reconciler{ + Client: remoteManager.GetClient(), + Scheme: remoteManager.GetScheme(), + Config: remoteManager.GetConfig(), + }).SetupWithManager(remoteManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&databasenodeset.Reconciler{ + Client: remoteManager.GetClient(), + Scheme: remoteManager.GetScheme(), + Config: remoteManager.GetConfig(), + }).SetupWithManager(remoteManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&remotestoragenodeset.Reconciler{ + Client: remoteManager.GetClient(), + Scheme: remoteManager.GetScheme(), + }).SetupWithManager(remoteManager, &remoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&remotedatabasenodeset.Reconciler{ + Client: remoteManager.GetClient(), + Scheme: remoteManager.GetScheme(), + }).SetupWithManager(remoteManager, &remoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + go func() { + defer GinkgoRecover() + err = localManager.Start(ctx) + Expect(err).ShouldNot(HaveOccurred()) + }() + + go func() { + defer GinkgoRecover() + err = remoteManager.Start(ctx) + Expect(err).ShouldNot(HaveOccurred()) + }() + + localClient = localManager.GetClient() + Expect(localClient).ToNot(BeNil()) + remoteClient = remoteManager.GetClient() + Expect(remoteClient).ToNot(BeNil()) +}) + +var _ = AfterSuite(func() { + By("tearing down the test environment") + cancel() + err := localEnv.Stop() + Expect(err).ToNot(HaveOccurred()) + err = remoteEnv.Stop() + Expect(err).ToNot(HaveOccurred()) +}) + +var _ = Describe("RemoteDatabaseNodeSet controller tests", func() { + var localNamespace corev1.Namespace + var remoteNamespace corev1.Namespace + var storageSample *v1alpha1.Storage + var databaseSample *v1alpha1.Database + + BeforeEach(func() { + storageSample = testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) + databaseSample = testobjects.DefaultDatabase() + databaseSample.Spec.NodeSets = append(databaseSample.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ + Name: testNodeSetName + "-local", + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }) + databaseSample.Spec.NodeSets = append(databaseSample.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ + Name: testNodeSetName + "-remote", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }) + databaseSample.Spec.NodeSets = append(databaseSample.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{ + Name: testNodeSetName + "-remote-dedicated", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }) + + By("issuing create Namespace commands...") + localNamespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + remoteNamespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + Expect(localClient.Create(ctx, &localNamespace)).Should(Succeed()) + Expect(remoteClient.Create(ctx, &remoteNamespace)).Should(Succeed()) + + By("issuing create Storage commands...") + Expect(localClient.Create(ctx, storageSample)).Should(Succeed()) + By("checking that Storage created on local cluster...") + foundStorage := v1alpha1.Storage{} + Eventually(func() bool { + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + return foundStorage.Status.State == StorageInitializing + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("set condition Initialized to Storage...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + meta.SetStatusCondition(&foundStorage.Status.Conditions, metav1.Condition{ + Type: StorageInitializedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + }) + return localClient.Status().Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("issuing create Database commands...") + Expect(localClient.Create(ctx, databaseSample)).Should(Succeed()) + By("checking that Database created on local cluster...") + foundDatabase := v1alpha1.Database{} + Eventually(func() bool { + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundDatabase)) + return foundDatabase.Status.State == DatabaseInitializing + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that DatabaseNodeSet created on local cluster...") + Eventually(func() error { + foundDatabaseNodeSet := &v1alpha1.DatabaseNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-local", + Namespace: testobjects.YdbNamespace, + }, foundDatabaseNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that RemoteDatabaseNodeSet created on local cluster...") + Eventually(func() error { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that dedicated RemoteDatabaseNodeSet created on local cluster...") + Eventually(func() error { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that DatabaseNodeSet created on remote cluster...") + Eventually(func() bool { + foundDatabaseNodeSetOnRemote := v1alpha1.DatabaseNodeSetList{} + + Expect(remoteClient.List(ctx, &foundDatabaseNodeSetOnRemote, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + + for _, nodeset := range foundDatabaseNodeSetOnRemote.Items { + if nodeset.Name == databaseSample.Name+"-"+testNodeSetName+"-remote" { + return true + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that dedicated DatabaseNodeSet created on remote cluster...") + Eventually(func() bool { + foundDatabaseNodeSetOnRemote := v1alpha1.DatabaseNodeSetList{} + + Expect(remoteClient.List(ctx, &foundDatabaseNodeSetOnRemote, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + + for _, nodeset := range foundDatabaseNodeSetOnRemote.Items { + if nodeset.Name == databaseSample.Name+"-"+testNodeSetName+"-remote-dedicated" { + return true + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + }) + + AfterEach(func() { + Expect(localClient.Delete(ctx, databaseSample)).Should(Succeed()) + Expect(localClient.Delete(ctx, storageSample)).Should(Succeed()) + test.DeleteAllObjects(localEnv, localClient, &localNamespace) + test.DeleteAllObjects(remoteEnv, remoteClient, &localNamespace) + }) + + When("Created RemoteDatabaseNodeSet in k8s-mgmt-cluster", func() { + It("Should receive status from k8s-data-cluster", func() { + By("checking that dedicated DatabaseNodeSet status updated on remote cluster...") + Eventually(func() bool { + foundDatabaseNodeSetOnRemote := v1alpha1.DatabaseNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, &foundDatabaseNodeSetOnRemote)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundDatabaseNodeSetOnRemote.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that dedicated RemoteDatabaseNodeSet status updated on local cluster...") + Eventually(func() bool { + foundRemoteDatabaseNodeSet := v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, &foundRemoteDatabaseNodeSet)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundRemoteDatabaseNodeSet.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that DatabaseNodeSet status updated on remote cluster...") + Eventually(func() bool { + foundDatabaseNodeSetOnRemote := v1alpha1.DatabaseNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundDatabaseNodeSetOnRemote)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundDatabaseNodeSetOnRemote.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteDatabaseNodeSet status updated on local cluster...") + Eventually(func() bool { + foundRemoteDatabaseNodeSet := v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundRemoteDatabaseNodeSet)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundRemoteDatabaseNodeSet.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + }) + }) + + When("Created RemoteDatabaseNodeSet with Secrets in k8s-mgmt-cluster", func() { + It("Should sync Secrets into k8s-data-cluster", func() { + By("create simple Secret in remote namespace") + simpleSecret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, + StringData: map[string]string{ + "message": "Hello from k8s-mgmt-cluster", + }, + } + Expect(localClient.Create(ctx, simpleSecret)) + + By("checking that Storage updated on local cluster...") + Eventually(func() error { + foundStorage := &v1alpha1.Storage{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, foundStorage)) + + foundStorage.Spec.NodeSets = append(foundStorage.Spec.NodeSets, v1alpha1.StorageNodeSetSpecInline{ + Name: testNodeSetName + "-remote", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + StorageNodeSpec: v1alpha1.StorageNodeSpec{ + Nodes: 1, + }, + }) + + foundStorage.Spec.Secrets = append( + foundStorage.Spec.Secrets, + &corev1.LocalObjectReference{ + Name: testSecretName, + }, + ) + return localClient.Update(ctx, foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that RemoteStorageNodeSet created on local cluster...") + Eventually(func() error { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that StorageNodeSet created on remote cluster...") + Eventually(func() bool { + foundStorageNodeSetOnRemote := v1alpha1.StorageNodeSetList{} + + Expect(remoteClient.List(ctx, &foundStorageNodeSetOnRemote, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + + for _, nodeset := range foundStorageNodeSetOnRemote.Items { + if nodeset.Name == storageSample.Name+"-"+testNodeSetName+"-remote" { + return true + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that Database updated on local cluster...") + Eventually(func() error { + foundDatabase := &v1alpha1.Database{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, foundDatabase)) + + foundDatabase.Spec.Secrets = append( + foundDatabase.Spec.Secrets, + &corev1.LocalObjectReference{ + Name: testSecretName, + }, + ) + return localClient.Update(ctx, foundDatabase) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that Secrets are synced...") + Eventually(func() error { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet)).Should(Succeed()) + + localSecret := &corev1.Secret{} + err := localClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, localSecret) + if err != nil { + return err + } + + remoteSecret := &corev1.Secret{} + err = remoteClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, remoteSecret) + if err != nil { + return err + } + + primaryResourceStorage, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceStorageAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceStorageAnnotation, remoteSecret.Name) + } + if primaryResourceStorage != foundRemoteStorageNodeSet.Spec.StorageRef.Name { + return fmt.Errorf("primaryResourceName %s does not equal storageRef name %s", primaryResourceStorage, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name) + } + + primaryResourceDatabase, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceDatabaseAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceDatabaseAnnotation, remoteSecret.Name) + } + if primaryResourceDatabase != foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name { + return fmt.Errorf("primaryResourceName %s does not equal databaseRef name %s", primaryResourceDatabase, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name) + } + + remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name) + } + if localSecret.GetResourceVersion() != remoteRV { + return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV) + } + + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("delete RemoteDatabaseNodeSet on local cluster...") + Eventually(func() error { + foundDatabase := v1alpha1.Database{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundDatabase)).Should(Succeed()) + foundDatabase.Spec.NodeSets = []v1alpha1.DatabaseNodeSetSpecInline{ + { + Name: testNodeSetName + "-local", + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 2, + }, + }, + { + Name: testNodeSetName + "-remote-dedicated", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }, + } + return localClient.Update(ctx, &foundDatabase) + }, test.Timeout, test.Interval).Should(Succeed()) + + By("delete RemoteStorageNodeSet on local cluster...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)).Should(Succeed()) + foundStorage.Spec.NodeSets = []v1alpha1.StorageNodeSetSpecInline{} + return localClient.Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).Should(Succeed()) + + By("checking that Secrets are synced after RemoteStorageNodeSet and RemoteDatabaseNodeSet delete...") + Eventually(func() error { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet)).Should(Succeed()) + + localSecret := &corev1.Secret{} + err := localClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, localSecret) + if err != nil { + return err + } + + remoteSecret := &corev1.Secret{} + err = remoteClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, remoteSecret) + if err != nil { + return err + } + + _, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceStorageAnnotation] + if exist { + return fmt.Errorf("annotation %s still exist on remoteSecret %s", ydbannotations.PrimaryResourceStorageAnnotation, remoteSecret.Name) + } + + primaryResourceDatabase, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceDatabaseAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceDatabaseAnnotation, remoteSecret.Name) + } + if primaryResourceDatabase != foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name { + return fmt.Errorf("primaryResourceName %s does not equal databaseRef name %s", primaryResourceDatabase, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name) + } + + remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name) + } + if localSecret.GetResourceVersion() != remoteRV { + return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV) + } + + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("update Secret in remote namespace") + Eventually(func() error { + localSecret := &corev1.Secret{} + err := localClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, localSecret) + if err != nil { + return err + } + localSecret.StringData = map[string]string{ + "message": "Updated message from k8s-mgmt-cluster", + } + return localClient.Update(ctx, localSecret) + }, test.Timeout, test.Interval).Should(Succeed()) + + By("checking that Secrets are synced after update...") + Eventually(func() error { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet)).Should(Succeed()) + + localSecret := &corev1.Secret{} + err := localClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, localSecret) + if err != nil { + return err + } + + remoteSecret := &corev1.Secret{} + err = remoteClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, remoteSecret) + if err != nil { + return err + } + + primaryResourceDatabase, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceDatabaseAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceDatabaseAnnotation, remoteSecret.Name) + } + if primaryResourceDatabase != foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name { + return fmt.Errorf("primaryResourceName %s does not equal databaseRef name %s", primaryResourceDatabase, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name) + } + + remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name) + } + if localSecret.GetResourceVersion() != remoteRV { + return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV) + } + + if !reflect.DeepEqual(localSecret.StringData, remoteSecret.StringData) { + return fmt.Errorf("localSecret StringData %s does not equal with remoteSecret %s", localSecret.StringData, remoteSecret.StringData) + } + + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + }) + + When("Created RemoteDatabaseNodeSet with Services in k8s-mgmt-cluster", func() { + It("Should sync Services into k8s-data-cluster", func() { + By("checking that Services are synced...") + Eventually(func() error { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet)).Should(Succeed()) + + foundServices := corev1.ServiceList{} + Expect(localClient.List(ctx, &foundServices, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + for _, localService := range foundServices.Items { + if !strings.HasPrefix(localService.Name, databaseSample.Name) { + continue + } + remoteService := &corev1.Service{} + err := remoteClient.Get(ctx, types.NamespacedName{ + Name: localService.Name, + Namespace: localService.Namespace, + }, remoteService) + if err != nil { + return err + } + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that dedicated RemoteDatabaseNodeSet RemoteStatus are updated...") + Eventually(func() bool { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet)).Should(Succeed()) + + foundConfigMap := corev1.ConfigMap{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundConfigMap)).Should(Succeed()) + + for idx := range foundRemoteDatabaseNodeSet.Status.RemoteResources { + remoteResource := foundRemoteDatabaseNodeSet.Status.RemoteResources[idx] + if resources.EqualRemoteResourceWithObject( + &remoteResource, + foundConfigMap.DeepCopy(), + ) { + if meta.IsStatusConditionPresentAndEqual( + remoteResource.Conditions, + RemoteResourceSyncedCondition, + metav1.ConditionTrue, + ) { + return true + } + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteDatabaseNodeSet RemoteStatus are updated...") + Eventually(func() bool { + foundRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteDatabaseNodeSet)).Should(Succeed()) + + foundConfigMap := corev1.ConfigMap{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundConfigMap)).Should(Succeed()) + + for idx := range foundRemoteDatabaseNodeSet.Status.RemoteResources { + remoteResource := foundRemoteDatabaseNodeSet.Status.RemoteResources[idx] + if resources.EqualRemoteResourceWithObject( + &remoteResource, + foundConfigMap.DeepCopy(), + ) { + if meta.IsStatusConditionPresentAndEqual( + remoteResource.Conditions, + RemoteResourceSyncedCondition, + metav1.ConditionTrue, + ) { + return true + } + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + }) + }) + + When("Delete RemoteDatabaseNodeSet in k8s-mgmt-cluster", func() { + It("Should delete resources in k8s-data-cluster", func() { + By("delete RemoteDatabaseNodeSet on local cluster...") + Eventually(func() error { + foundDatabase := v1alpha1.Database{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundDatabase)).Should(Succeed()) + foundDatabase.Spec.NodeSets = []v1alpha1.DatabaseNodeSetSpecInline{ + { + Name: testNodeSetName + "-local", + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 2, + }, + }, + { + Name: testNodeSetName + "-remote-dedicated", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ + Nodes: 1, + }, + }, + } + return localClient.Update(ctx, &foundDatabase) + }, test.Timeout, test.Interval).Should(Succeed()) + + By("checking that DatabaseNodeSet deleted from remote cluster...") + Eventually(func() bool { + foundDatabaseNodeSetOnRemote := v1alpha1.DatabaseNodeSet{} + + err := remoteClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundDatabaseNodeSetOnRemote) + + return apierrors.IsNotFound(err) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteDatabaseNodeSet deleted from local cluster...") + Eventually(func() bool { + foundRemoteDatabaseNodeSet := v1alpha1.RemoteDatabaseNodeSet{} + + err := localClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundRemoteDatabaseNodeSet) + + return apierrors.IsNotFound(err) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that Services for dedicated DatabaseNodeSet exisiting in remote cluster...") + Eventually(func() error { + foundDedicatedDatabaseNodeSetOnRemote := &v1alpha1.DatabaseNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name + "-" + testNodeSetName + "-remote-dedicated", + Namespace: testobjects.YdbNamespace, + }, foundDedicatedDatabaseNodeSetOnRemote)).Should(Succeed()) + + databaseServices := corev1.ServiceList{} + Expect(localClient.List(ctx, &databaseServices, + client.InNamespace(testobjects.YdbNamespace), + )).Should(Succeed()) + for _, databaseService := range databaseServices.Items { + remoteService := &corev1.Service{} + if !strings.HasPrefix(databaseService.GetName(), databaseSample.Name) { + continue + } + if err := remoteClient.Get(ctx, types.NamespacedName{ + Name: databaseService.GetName(), + Namespace: databaseService.GetNamespace(), + }, remoteService); err != nil { + return err + } + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + }) +}) diff --git a/internal/controllers/remotedatabasenodeset/remote_objects.go b/internal/controllers/remotedatabasenodeset/remote_objects.go new file mode 100644 index 00000000..8b1305d5 --- /dev/null +++ b/internal/controllers/remotedatabasenodeset/remote_objects.go @@ -0,0 +1,421 @@ +package remotedatabasenodeset + +import ( + "context" + "fmt" + "time" + + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + ydblabels "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +func (r *Reconciler) initRemoteObjectsStatus( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, + remoteObjects []client.Object, +) (bool, ctrl.Result, error) { + r.Log.Info("running step initRemoteObjectsStatus") + + for _, remoteObj := range remoteObjects { + existInStatus := false + for idx := range remoteDatabaseNodeSet.Status.RemoteResources { + if resources.EqualRemoteResourceWithObject( + &remoteDatabaseNodeSet.Status.RemoteResources[idx], + remoteObj, + ) { + existInStatus = true + break + } + } + if !existInStatus { + remoteDatabaseNodeSet.CreateRemoteResourceStatus(remoteObj) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, StatusUpdateRequeueDelay) + } + } + + r.Log.Info("complete step initRemoteObjectsStatus") + return Continue, ctrl.Result{}, nil +} + +func (r *Reconciler) syncRemoteObjects( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, + remoteObjects []client.Object, +) (bool, ctrl.Result, error) { + r.Log.Info("running step syncRemoteObjects") + + for _, remoteObj := range remoteObjects { + remoteObjName := remoteObj.GetName() + remoteObjKind := remoteObj.GetObjectKind().GroupVersionKind().Kind + var remoteResource *v1alpha1.RemoteResource + for idx := range remoteDatabaseNodeSet.Status.RemoteResources { + if resources.EqualRemoteResourceWithObject(&remoteDatabaseNodeSet.Status.RemoteResources[idx], remoteObj) { + remoteResource = &remoteDatabaseNodeSet.Status.RemoteResources[idx] + break + } + } + + // Get object to sync from remote cluster + remoteGetErr := r.RemoteClient.Get(ctx, types.NamespacedName{ + Name: remoteObj.GetName(), + Namespace: remoteObj.GetNamespace(), + }, remoteObj) + // Resource not found on remote cluster or internal kubernetes error + if remoteGetErr != nil { + if apierrors.IsNotFound(remoteGetErr) { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Resource %s with name %s was not found on remote cluster: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Resource %s with name %s was not found: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + } else { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get resource %s with name %s on remote cluster: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get resource %s with name %s: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + } + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, remoteGetErr + } + + // Check object existence in local cluster + remoteObjRV := remoteObj.GetResourceVersion() + localObj := resources.CreateResource(remoteObj) + getErr := r.Client.Get(ctx, types.NamespacedName{ + Name: localObj.GetName(), + Namespace: localObj.GetNamespace(), + }, localObj) + + // Handler for kubernetes internal error + if getErr != nil && !apierrors.IsNotFound(getErr) { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get resource %s with name %s: %s", remoteObjKind, remoteObjName, getErr), + ) + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, DefaultRequeueDelay) + } + + // Try to create non-existing remote object in local cluster + if apierrors.IsNotFound(getErr) { + createErr := r.Client.Create(ctx, localObj) + if createErr != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to create resource %s with name %s: %s", remoteObjKind, remoteObjName, getErr), + ) + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, DefaultRequeueDelay) + } + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync CREATE resource %s with name %s", remoteObjKind, remoteObjName), + ) + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionTrue, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, StatusUpdateRequeueDelay) + } + + // Get patch diff between remote object and existing object + remoteDatabaseNodeSet.SetPrimaryResourceAnnotations(remoteObj) + patchResult, patchErr := resources.GetPatchResult(localObj, remoteObj) + if patchErr != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get diff for remote resource %s with name %s: %s", remoteObjKind, remoteObjName, patchErr), + ) + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, DefaultRequeueDelay) + } + + // Try to update existing object in local cluster by rawPatch + if !patchResult.IsEmpty() { + updateErr := r.Client.Patch(ctx, localObj, client.RawPatch(types.StrategicMergePatchType, patchResult.Patch)) + if updateErr != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update resource %s with name %s: %v", remoteObjKind, remoteObjName, updateErr), + ) + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, DefaultRequeueDelay) + } + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync UPDATE resource %s with name %s resourceVersion %s", remoteObjKind, remoteObjName, remoteObj.GetResourceVersion()), + ) + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionTrue, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, StatusUpdateRequeueDelay) + } + + if !meta.IsStatusConditionTrue(remoteResource.Conditions, RemoteResourceSyncedCondition) { + remoteDatabaseNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionTrue, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, StatusUpdateRequeueDelay) + } + } + + r.Log.Info("complete step syncRemoteObjects") + return Continue, ctrl.Result{}, nil +} + +func (r *Reconciler) removeUnusedRemoteObjects( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, + remoteObjects []client.Object, +) (bool, ctrl.Result, error) { + r.Log.Info("running step removeUnusedRemoteResources") + + // We should check every remote resource to need existence in cluster + // Get processed remote resources from object Status + candidatesToDelete := []v1alpha1.RemoteResource{} + for idx := range remoteDatabaseNodeSet.Status.RemoteResources { + // Remove remote resource from candidates to delete if it declared + // to using in current RemoteDatabaseNodeSet spec + existInSpec := false + for _, remoteObj := range remoteObjects { + if resources.EqualRemoteResourceWithObject( + &remoteDatabaseNodeSet.Status.RemoteResources[idx], + remoteObj, + ) { + existInSpec = true + break + } + } + if !existInSpec { + candidatesToDelete = append(candidatesToDelete, remoteDatabaseNodeSet.Status.RemoteResources[idx]) + } + } + + if len(candidatesToDelete) == 0 { + r.Log.Info("complete step removeUnusedRemoteObjects") + return Continue, ctrl.Result{}, nil + } + + existInDatabase := false + anotherDatabaseNodeSets, err := r.getAnotherDatabaseNodeSets(ctx, remoteDatabaseNodeSet) + if err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to check remote resource usage in another: %v", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + if len(anotherDatabaseNodeSets) > 0 { + existInDatabase = true + } + + // Check RemoteResource usage in DatabaseNodeSet + for _, remoteResource := range candidatesToDelete { + remoteObj, err := resources.ConvertRemoteResourceToObject(remoteResource, remoteDatabaseNodeSet.Namespace) + if err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to convert RemoteResource %s with name %s to object: %v", remoteResource.Kind, remoteResource.Name, err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + localObj := resources.CreateResource(remoteObj) + if err := r.Client.Get(ctx, types.NamespacedName{ + Name: localObj.GetName(), + Namespace: localObj.GetNamespace(), + }, localObj); err != nil { + if apierrors.IsNotFound(err) { + continue + } + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get RemoteResource %s with name %s as object: %v", remoteResource.Kind, remoteResource.Name, err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + // Remove annotation if no one another DatabaseNodeSet + if !existInDatabase { + // Try to update existing object in local cluster by rawPatch + patch := []byte(fmt.Sprintf(`{"metadata": {"annotations": {"%s": null}}}`, ydbannotations.PrimaryResourceStorageAnnotation)) + updateErr := r.Client.Patch(ctx, localObj, client.RawPatch(types.StrategicMergePatchType, patch)) + if updateErr != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update resource %s with name %s: %s", remoteResource.Kind, remoteResource.Name, err), + ) + } else { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync UPDATE resource %s with name %s unset primaryResource annotation", remoteResource.Kind, remoteResource.Name), + ) + } + } + + // Delete resource if annotation `ydb.tech/primary-resource-storage` does not exist + _, existInStorage := localObj.GetAnnotations()[ydbannotations.PrimaryResourceStorageAnnotation] + if !existInStorage { + // Try to delete unused resource from local cluster + deleteErr := r.Client.Delete(ctx, localObj) + if deleteErr != nil { + if !apierrors.IsNotFound(deleteErr) { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to delete resource %s with name %s: %s", remoteResource.Kind, remoteResource.Name, err), + ) + } + } else { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync DELETE resource %s with name %s", remoteResource.Kind, remoteResource.Name), + ) + } + } + remoteDatabaseNodeSet.RemoveRemoteResourceStatus(remoteObj) + } + + return r.updateStatusRemoteObjects(ctx, remoteDatabaseNodeSet, StatusUpdateRequeueDelay) +} + +func (r *Reconciler) updateStatusRemoteObjects( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, + requeueAfter time.Duration, +) (bool, ctrl.Result, error) { + crRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + getErr := r.RemoteClient.Get(ctx, types.NamespacedName{ + Name: remoteDatabaseNodeSet.Name, + Namespace: remoteDatabaseNodeSet.Namespace, + }, crRemoteDatabaseNodeSet) + if getErr != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed fetching CR before status update for remote resources on remote cluster: %v", getErr), + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed fetching CR before status update for remote resources: %v", getErr), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, getErr + } + + crRemoteDatabaseNodeSet.Status.RemoteResources = append([]v1alpha1.RemoteResource{}, remoteDatabaseNodeSet.Status.RemoteResources...) + updateErr := r.RemoteClient.Status().Update(ctx, crRemoteDatabaseNodeSet) + if updateErr != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status for remote resources on remote cluster: %s", updateErr), + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status for remote resources: %s", updateErr), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, updateErr + } + + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status for remote resources updated on remote cluster", + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status for remote resources updated", + ) + + return Stop, ctrl.Result{RequeueAfter: requeueAfter}, nil +} + +func (r *Reconciler) getAnotherDatabaseNodeSets( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, +) ([]v1alpha1.DatabaseNodeSet, error) { + // Create label requirement that label `ydb.tech/database-nodeset` which not equal + // to current DatabaseNodeSet object for exclude current nodeSet from List result + labelRequirement, err := labels.NewRequirement( + ydblabels.DatabaseNodeSetComponent, + selection.NotEquals, + []string{remoteDatabaseNodeSet.Labels[ydblabels.DatabaseNodeSetComponent]}, + ) + if err != nil { + return nil, err + } + + // Search another DatabaseNodeSets in current namespace with the same DatabaseRef + // but exclude current nodeSet from result + databaseNodeSets := v1alpha1.DatabaseNodeSetList{} + if err := r.Client.List( + ctx, + &databaseNodeSets, + client.InNamespace(remoteDatabaseNodeSet.Namespace), + client.MatchingLabelsSelector{ + Selector: labels.NewSelector().Add(*labelRequirement), + }, + client.MatchingFields{ + DatabaseRefField: remoteDatabaseNodeSet.Spec.DatabaseRef.Name, + }, + ); err != nil { + return nil, err + } + + return databaseNodeSets.Items, nil +} diff --git a/internal/controllers/remotedatabasenodeset/sync.go b/internal/controllers/remotedatabasenodeset/sync.go new file mode 100644 index 00000000..c0cabc22 --- /dev/null +++ b/internal/controllers/remotedatabasenodeset/sync.go @@ -0,0 +1,184 @@ +package remotedatabasenodeset + +import ( + "context" + "fmt" + "reflect" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +func (r *Reconciler) Sync(ctx context.Context, crRemoteDatabaseNodeSet *v1alpha1.RemoteDatabaseNodeSet) (ctrl.Result, error) { + var stop bool + var result ctrl.Result + var err error + + remoteDatabaseNodeSet := resources.NewRemoteDatabaseNodeSet(crRemoteDatabaseNodeSet) + remoteObjects := remoteDatabaseNodeSet.GetRemoteObjects(r.Scheme) + + stop, result, err = r.initRemoteObjectsStatus(ctx, &remoteDatabaseNodeSet, remoteObjects) + if stop { + return result, err + } + + stop, result, err = r.syncRemoteObjects(ctx, &remoteDatabaseNodeSet, remoteObjects) + if stop { + return result, err + } + + stop, result, err = r.handleResourcesSync(ctx, &remoteDatabaseNodeSet) + if stop { + return result, err + } + + stop, result, err = r.removeUnusedRemoteObjects(ctx, &remoteDatabaseNodeSet, remoteObjects) + if stop { + return result, err + } + + stop, result, err = r.updateRemoteStatus(ctx, &remoteDatabaseNodeSet) + if stop { + return result, err + } + + return ctrl.Result{}, nil +} + +func (r *Reconciler) handleResourcesSync( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, +) (bool, ctrl.Result, error) { + r.Log.Info("running step handleResourcesSync") + + for _, builder := range remoteDatabaseNodeSet.GetResourceBuilders() { + newResource := builder.Placeholder(remoteDatabaseNodeSet) + + result, err := resources.CreateOrUpdateOrMaybeIgnore(ctx, r.Client, newResource, func() error { + err := builder.Build(newResource) + if err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Failed building resources: %s", err), + ) + return err + } + remoteDatabaseNodeSet.SetPrimaryResourceAnnotations(newResource) + + return nil + }, func(oldObj, newObj runtime.Object) bool { + return false + }) + + eventMessage := fmt.Sprintf( + "Resource: %s, Namespace: %s, Name: %s", + reflect.TypeOf(newResource), + newResource.GetNamespace(), + newResource.GetName(), + ) + if err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + eventMessage+fmt.Sprintf(", failed to sync, error: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } else if result == controllerutil.OperationResultCreated || result == controllerutil.OperationResultUpdated { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "Provisioning", + eventMessage+fmt.Sprintf(", changed, result: %s", result), + ) + } + } + + r.Log.Info("complete step handleResourcesSync") + return Continue, ctrl.Result{}, nil +} + +func (r *Reconciler) updateRemoteStatus( + ctx context.Context, + remoteDatabaseNodeSet *resources.RemoteDatabaseNodeSetResource, +) (bool, ctrl.Result, error) { + r.Log.Info("running step updateRemoteStatus") + + crDatabaseNodeSet := &v1alpha1.DatabaseNodeSet{} + if err := r.Client.Get(ctx, types.NamespacedName{ + Name: remoteDatabaseNodeSet.Name, + Namespace: remoteDatabaseNodeSet.Namespace, + }, crDatabaseNodeSet); err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + "Failed fetching DatabaseNodeSet before status update", + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + crRemoteDatabaseNodeSet := &v1alpha1.RemoteDatabaseNodeSet{} + if err := r.RemoteClient.Get(ctx, types.NamespacedName{ + Name: remoteDatabaseNodeSet.Name, + Namespace: remoteDatabaseNodeSet.Namespace, + }, crRemoteDatabaseNodeSet); err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + "Failed fetching RemoteDatabaseNodeSet on remote cluster before status update", + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + "Failed fetching RemoteDatabaseNodeSet before status update", + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + crRemoteDatabaseNodeSet.Status.State = crDatabaseNodeSet.Status.State + crRemoteDatabaseNodeSet.Status.Conditions = crDatabaseNodeSet.Status.Conditions + if err := r.RemoteClient.Status().Update(ctx, crRemoteDatabaseNodeSet); err != nil { + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status on remote cluster: %s", err), + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status: %s", err), + ) + + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + r.Recorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status updated on remote cluster", + ) + r.RemoteRecorder.Event( + remoteDatabaseNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status updated", + ) + + r.Log.Info("complete step updateRemoteStatus") + return Continue, ctrl.Result{}, nil +} diff --git a/internal/controllers/remotestoragenodeset/controller.go b/internal/controllers/remotestoragenodeset/controller.go new file mode 100644 index 00000000..91ce95ea --- /dev/null +++ b/internal/controllers/remotestoragenodeset/controller.go @@ -0,0 +1,252 @@ +package remotestoragenodeset + +import ( + "context" + + "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/record" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/cluster" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + ydblabels "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +// Reconciler reconciles a RemoteStorageNodeSet object +type Reconciler struct { + Client client.Client + RemoteClient client.Client + Recorder record.EventRecorder + RemoteRecorder record.EventRecorder + Log logr.Logger + Scheme *runtime.Scheme +} + +//+kubebuilder:rbac:groups=ydb.tech,resources=remotestoragenodesets,verbs=get;list;watch;update +//+kubebuilder:rbac:groups=ydb.tech,resources=remotestoragenodesets/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=ydb.tech,resources=remotestoragenodesets/finalizers,verbs=update +//+kubebuilder:rbac:groups=ydb.tech,resources=storagenodesets,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=ydb.tech,resources=storagenodesets/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=ydb.tech,resources=storagenodesets/finalizers,verbs=update +//+kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=core,resources=services/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=core,resources=services/finalizers,verbs=get;list;watch +//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=core,resources=configmaps/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=core,resources=secrets/status,verbs=get;update;patch + +func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + r.Log = log.FromContext(ctx) + + remoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + if err := r.RemoteClient.Get(ctx, req.NamespacedName, remoteStorageNodeSet); err != nil { + if apierrors.IsNotFound(err) { + r.Log.Info("RemoteStorageNodeSet resource not found on remote cluster") + return ctrl.Result{Requeue: false}, nil + } + r.Log.Error(err, "unable to get RemoteStorageNodeSet on remote cluster") + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + } + + //nolint:nestif + // examine DeletionTimestamp to determine if object is under deletion + if remoteStorageNodeSet.ObjectMeta.DeletionTimestamp.IsZero() { + // The object is not being deleted, so if it does not have our finalizer, + // then lets add the finalizer and update the object. This is equivalent + // to registering our finalizer. + if !controllerutil.ContainsFinalizer(remoteStorageNodeSet, ydbannotations.RemoteFinalizerKey) { + controllerutil.AddFinalizer(remoteStorageNodeSet, ydbannotations.RemoteFinalizerKey) + if err := r.RemoteClient.Update(ctx, remoteStorageNodeSet); err != nil { + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + } else { + // The object is being deleted + if controllerutil.ContainsFinalizer(remoteStorageNodeSet, ydbannotations.RemoteFinalizerKey) { + // our finalizer is present, so lets handle any external dependency + if err := r.deleteExternalResources(ctx, remoteStorageNodeSet); err != nil { + // if fail to delete the external dependency here, return with error + // so that it can be retried. + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + // remove our finalizer from the list and update it. + controllerutil.RemoveFinalizer(remoteStorageNodeSet, ydbannotations.RemoteFinalizerKey) + if err := r.RemoteClient.Update(ctx, remoteStorageNodeSet); err != nil { + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + + // Stop reconciliation as the item is being deleted + return ctrl.Result{Requeue: false}, nil + } + + result, err := r.Sync(ctx, remoteStorageNodeSet) + if err != nil { + r.Log.Error(err, "unexpected Sync error") + } + + return result, err +} + +// SetupWithManager sets up the controller with the Manager. +func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, remoteCluster *cluster.Cluster) error { + cluster := *remoteCluster + + r.Recorder = mgr.GetEventRecorderFor(RemoteStorageNodeSetKind) + r.RemoteRecorder = cluster.GetEventRecorderFor(RemoteStorageNodeSetKind) + r.RemoteClient = cluster.GetClient() + + annotationFilter := func(mapObj client.Object) []reconcile.Request { + requests := make([]reconcile.Request, 0) + + annotations := mapObj.GetAnnotations() + primaryResourceName, exist := annotations[ydbannotations.PrimaryResourceStorageAnnotation] + if exist { + storageNodeSets := &v1alpha1.StorageNodeSetList{} + if err := r.Client.List( + context.Background(), + storageNodeSets, + client.InNamespace(mapObj.GetNamespace()), + client.MatchingFields{ + StorageRefField: primaryResourceName, + }, + ); err != nil { + return requests + } + for _, storageNodeSet := range storageNodeSets.Items { + requests = append(requests, reconcile.Request{ + NamespacedName: types.NamespacedName{ + Namespace: storageNodeSet.GetNamespace(), + Name: storageNodeSet.GetName(), + }, + }) + } + } + return requests + } + + isNodeSetFromMgmt, err := buildLocalSelector() + if err != nil { + return err + } + + if err := mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.StorageNodeSet{}, + StorageRefField, + func(obj client.Object) []string { + storageNodeSet := obj.(*v1alpha1.StorageNodeSet) + return []string{storageNodeSet.Spec.StorageRef.Name} + }); err != nil { + return err + } + + return ctrl.NewControllerManagedBy(mgr). + Named(RemoteStorageNodeSetKind). + Watches( + source.NewKindWithCache(&v1alpha1.RemoteStorageNodeSet{}, cluster.GetCache()), + &handler.EnqueueRequestForObject{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &v1alpha1.StorageNodeSet{}}, + &handler.EnqueueRequestForObject{}, + builder.WithPredicates(resources.LabelExistsPredicate(isNodeSetFromMgmt)), + ). + Watches( + &source.Kind{Type: &corev1.Service{}}, + handler.EnqueueRequestsFromMapFunc(annotationFilter), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &corev1.ConfigMap{}}, + handler.EnqueueRequestsFromMapFunc(annotationFilter), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &corev1.Secret{}}, + handler.EnqueueRequestsFromMapFunc(annotationFilter), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + WithEventFilter(resources.IsRemoteStorageNodeSetCreatePredicate()). + WithEventFilter(resources.IgnoreDeleteStateUnknownPredicate()). + Complete(r) +} + +func buildLocalSelector() (labels.Selector, error) { + labelRequirements := []labels.Requirement{} + localClusterRequirement, err := labels.NewRequirement( + ydblabels.RemoteClusterKey, + selection.Exists, + []string{}, + ) + if err != nil { + return nil, err + } + labelRequirements = append(labelRequirements, *localClusterRequirement) + return labels.NewSelector().Add(labelRequirements...), nil +} + +func BuildRemoteSelector(remoteCluster string) (labels.Selector, error) { + labelRequirements := []labels.Requirement{} + remoteClusterRequirement, err := labels.NewRequirement( + ydblabels.RemoteClusterKey, + selection.Equals, + []string{remoteCluster}, + ) + if err != nil { + return nil, err + } + labelRequirements = append(labelRequirements, *remoteClusterRequirement) + return labels.NewSelector().Add(labelRequirements...), nil +} + +func (r *Reconciler) deleteExternalResources( + ctx context.Context, + crRemoteStorageNodeSet *v1alpha1.RemoteStorageNodeSet, +) error { + storageNodeSet := &v1alpha1.StorageNodeSet{} + if err := r.Client.Get(ctx, types.NamespacedName{ + Name: crRemoteStorageNodeSet.Name, + Namespace: crRemoteStorageNodeSet.Namespace, + }, storageNodeSet); err != nil { + if apierrors.IsNotFound(err) { + r.Log.Info("StorageNodeSet not found") + } else { + r.Log.Error(err, "unable to get StorageNodeSet") + return err + } + } else { + if err := r.Client.Delete(ctx, storageNodeSet); err != nil { + r.Log.Error(err, "unable to delete StorageNodeSet") + return err + } + } + + remoteStorageNodeSet := resources.NewRemoteStorageNodeSet(crRemoteStorageNodeSet) + if _, _, err := r.removeUnusedRemoteObjects(ctx, &remoteStorageNodeSet, []client.Object{}); err != nil { + r.Log.Error(err, "unable to delete unused remote resources") + return err + } + + return nil +} diff --git a/internal/controllers/remotestoragenodeset/controller_test.go b/internal/controllers/remotestoragenodeset/controller_test.go new file mode 100644 index 00000000..a1a20613 --- /dev/null +++ b/internal/controllers/remotestoragenodeset/controller_test.go @@ -0,0 +1,633 @@ +package remotestoragenodeset_test + +import ( + "context" + "fmt" + "path/filepath" + "reflect" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/kubectl/pkg/scheme" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/cluster" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/remotestoragenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storagenodeset" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" +) + +const ( + testRemoteCluster = "remote-cluster" + testSecretName = "remote-secret" + testNodeSetName = "nodeset" +) + +var ( + localClient client.Client + remoteClient client.Client + localEnv *envtest.Environment + remoteEnv *envtest.Environment + ctx context.Context + cancel context.CancelFunc +) + +func TestRemoteStorageNodeSetApis(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "RemoteStorageNodeSet controller tests") +} + +var _ = BeforeSuite(func() { + By("bootstrapping test environment") + + ctx, cancel = context.WithCancel(context.TODO()) + + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) + + localEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{ + filepath.Join("..", "..", "..", "deploy", "ydb-operator", "crds"), + }, + ErrorIfCRDPathMissing: true, + } + remoteEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{ + filepath.Join("..", "..", "..", "deploy", "ydb-operator", "crds"), + }, + ErrorIfCRDPathMissing: true, + } + + err := v1alpha1.AddToScheme(scheme.Scheme) + Expect(err).ToNot(HaveOccurred()) + // +kubebuilder:scaffold:scheme + + localCfg, err := localEnv.Start() + Expect(err).ToNot(HaveOccurred()) + Expect(localCfg).ToNot(BeNil()) + + remoteCfg, err := remoteEnv.Start() + Expect(err).ToNot(HaveOccurred()) + Expect(remoteCfg).ToNot(BeNil()) + + localManager, err := ctrl.NewManager(localCfg, ctrl.Options{ + MetricsBindAddress: "0", + Scheme: scheme.Scheme, + }) + Expect(err).ShouldNot(HaveOccurred()) + + remoteManager, err := ctrl.NewManager(remoteCfg, ctrl.Options{ + MetricsBindAddress: "0", + Scheme: scheme.Scheme, + }) + Expect(err).ShouldNot(HaveOccurred()) + + storageSelector, err := remotestoragenodeset.BuildRemoteSelector(testRemoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + remoteCluster, err := cluster.New(localCfg, func(o *cluster.Options) { + o.Scheme = scheme.Scheme + o.NewCache = cache.BuilderWithOptions(cache.Options{ + SelectorsByObject: cache.SelectorsByObject{ + &v1alpha1.RemoteStorageNodeSet{}: {Label: storageSelector}, + }, + }) + }) + Expect(err).ShouldNot(HaveOccurred()) + + err = remoteManager.Add(remoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&storage.Reconciler{ + Client: localManager.GetClient(), + Scheme: localManager.GetScheme(), + Config: localManager.GetConfig(), + }).SetupWithManager(localManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&storagenodeset.Reconciler{ + Client: localManager.GetClient(), + Scheme: localManager.GetScheme(), + Config: localManager.GetConfig(), + }).SetupWithManager(localManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&storagenodeset.Reconciler{ + Client: remoteManager.GetClient(), + Scheme: remoteManager.GetScheme(), + Config: remoteManager.GetConfig(), + }).SetupWithManager(remoteManager) + Expect(err).ShouldNot(HaveOccurred()) + + err = (&remotestoragenodeset.Reconciler{ + Client: remoteManager.GetClient(), + Scheme: remoteManager.GetScheme(), + }).SetupWithManager(remoteManager, &remoteCluster) + Expect(err).ShouldNot(HaveOccurred()) + + go func() { + defer GinkgoRecover() + err = localManager.Start(ctx) + Expect(err).ShouldNot(HaveOccurred()) + }() + + go func() { + defer GinkgoRecover() + err = remoteManager.Start(ctx) + Expect(err).ShouldNot(HaveOccurred()) + }() + + localClient = localManager.GetClient() + Expect(localClient).ToNot(BeNil()) + remoteClient = remoteManager.GetClient() + Expect(remoteClient).ToNot(BeNil()) +}) + +var _ = AfterSuite(func() { + By("tearing down the test environment") + cancel() + err := localEnv.Stop() + Expect(err).ToNot(HaveOccurred()) + err = remoteEnv.Stop() + Expect(err).ToNot(HaveOccurred()) +}) + +var _ = Describe("RemoteStorageNodeSet controller tests", func() { + var localNamespace corev1.Namespace + var remoteNamespace corev1.Namespace + var storageSample *v1alpha1.Storage + + BeforeEach(func() { + storageSample = testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) + storageSample.Spec.NodeSets = append(storageSample.Spec.NodeSets, v1alpha1.StorageNodeSetSpecInline{ + Name: testNodeSetName + "-local", + StorageNodeSpec: v1alpha1.StorageNodeSpec{ + Nodes: 1, + }, + }) + storageSample.Spec.NodeSets = append(storageSample.Spec.NodeSets, v1alpha1.StorageNodeSetSpecInline{ + Name: testNodeSetName + "-remote-static", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + StorageNodeSpec: v1alpha1.StorageNodeSpec{ + Nodes: 1, + }, + }) + storageSample.Spec.NodeSets = append(storageSample.Spec.NodeSets, v1alpha1.StorageNodeSetSpecInline{ + Name: testNodeSetName + "-remote", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + StorageNodeSpec: v1alpha1.StorageNodeSpec{ + Nodes: 1, + }, + }) + + By("issuing create Namespace commands...") + localNamespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + remoteNamespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + Expect(localClient.Create(ctx, &localNamespace)).Should(Succeed()) + Expect(remoteClient.Create(ctx, &remoteNamespace)).Should(Succeed()) + + By("issuing create Storage commands...") + Expect(localClient.Create(ctx, storageSample)).Should(Succeed()) + + By("checking that Storage created on local cluster...") + Eventually(func() bool { + foundStorage := v1alpha1.Storage{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + return foundStorage.Status.State == StorageInitializing + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that StorageNodeSet created on local cluster...") + Eventually(func() error { + foundStorageNodeSet := &v1alpha1.StorageNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-local", + Namespace: testobjects.YdbNamespace, + }, foundStorageNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that RemoteStorageNodeSet created on local cluster...") + Eventually(func() error { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that static RemoteStorageNodeSet created on local cluster...") + Eventually(func() error { + foundStaticRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + return localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, foundStaticRemoteStorageNodeSet) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that StorageNodeSet created on remote cluster...") + Eventually(func() error { + foundStorageNodeSetOnRemote := &v1alpha1.StorageNodeSet{} + return remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundStorageNodeSetOnRemote) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that static StorageNodeSet created on remote cluster...") + Eventually(func() error { + foundStaticStorageNodeSetOnRemote := &v1alpha1.StorageNodeSet{} + return remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, foundStaticStorageNodeSetOnRemote) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + + AfterEach(func() { + Expect(localClient.Delete(ctx, storageSample)).Should(Succeed()) + test.DeleteAllObjects(localEnv, localClient, &localNamespace) + test.DeleteAllObjects(remoteEnv, remoteClient, &localNamespace) + }) + + When("Created RemoteStorageNodeSet in k8s-mgmt-cluster", func() { + It("Should receive status from k8s-data-cluster", func() { + By("checking that static StorageNodeSet status updated on remote cluster...") + Eventually(func() bool { + foundStaticRemoteStorageNodeSetOnRemote := v1alpha1.StorageNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, &foundStaticRemoteStorageNodeSetOnRemote)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundStaticRemoteStorageNodeSetOnRemote.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that static RemoteStorageNodeSet status updated on local cluster...") + Eventually(func() bool { + foundStaticRemoteStorageNodeSet := v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, &foundStaticRemoteStorageNodeSet)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundStaticRemoteStorageNodeSet.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that StorageNodeSet status updated on remote cluster...") + Eventually(func() bool { + foundRemoteStorageNodeSetOnRemote := v1alpha1.StorageNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundRemoteStorageNodeSetOnRemote)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundRemoteStorageNodeSetOnRemote.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteStorageNodeSet status updated on local cluster...") + Eventually(func() bool { + foundRemoteStorageNodeSet := v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundRemoteStorageNodeSet)).Should(Succeed()) + + return meta.IsStatusConditionPresentAndEqual( + foundRemoteStorageNodeSet.Status.Conditions, + NodeSetPreparedCondition, + metav1.ConditionTrue, + ) + }, test.Timeout, test.Interval).Should(BeTrue()) + }) + }) + When("Created RemoteStorageNodeSet with Secrets in k8s-mgmt-cluster", func() { + It("Should sync Secrets into k8s-data-cluster", func() { + By("create simple Secret in Storage namespace") + simpleSecret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, + StringData: map[string]string{ + "message": "Hello from k8s-mgmt-cluster", + }, + } + Expect(localClient.Create(ctx, simpleSecret)) + + By("checking that Storage updated on local cluster...") + Eventually(func() error { + foundStorage := &v1alpha1.Storage{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, foundStorage)) + + foundStorage.Spec.Secrets = append( + foundStorage.Spec.Secrets, + &corev1.LocalObjectReference{ + Name: testSecretName, + }, + ) + return localClient.Update(ctx, foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that Secrets are synced...") + Eventually(func() error { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + localSecret := &corev1.Secret{} + err := localClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, localSecret) + if err != nil { + return err + } + + remoteSecret := &corev1.Secret{} + err = remoteClient.Get(ctx, types.NamespacedName{ + Name: testSecretName, + Namespace: testobjects.YdbNamespace, + }, remoteSecret) + if err != nil { + return err + } + + primaryResourceName, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceStorageAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceStorageAnnotation, remoteSecret.Name) + } + if primaryResourceName != foundRemoteStorageNodeSet.Spec.StorageRef.Name { + return fmt.Errorf("primaryResourceName %s does not equal storageRef name %s", primaryResourceName, foundRemoteStorageNodeSet.Spec.StorageRef.Name) + } + + remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation] + if !exist { + return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name) + } + if localSecret.GetResourceVersion() != remoteRV { + return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV) + } + + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + }) + When("Created RemoteStorageNodeSet with Services in k8s-mgmt-cluster", func() { + It("Should sync Services into k8s-data-cluster", func() { + By("checking that Services are synced...") + Eventually(func() error { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + foundServices := corev1.ServiceList{} + Expect(localClient.List(ctx, &foundServices, client.InNamespace( + testobjects.YdbNamespace, + ))).Should(Succeed()) + for _, localService := range foundServices.Items { + remoteService := &corev1.Service{} + err := remoteClient.Get(ctx, types.NamespacedName{ + Name: localService.Name, + Namespace: localService.Namespace, + }, remoteService) + if err != nil { + return err + } + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("checking that static RemoteStorageNodeSet RemoteResource status are updated...") + Eventually(func() bool { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + foundConfigMap := corev1.ConfigMap{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundConfigMap)).Should(Succeed()) + + for idx := range foundRemoteStorageNodeSet.Status.RemoteResources { + remoteResource := foundRemoteStorageNodeSet.Status.RemoteResources[idx] + if resources.EqualRemoteResourceWithObject( + &remoteResource, + foundConfigMap.DeepCopy(), + ) { + if meta.IsStatusConditionPresentAndEqual( + remoteResource.Conditions, + RemoteResourceSyncedCondition, + metav1.ConditionTrue, + ) { + return true + } + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that static RemoteStorageNodeSet status are synced...") + Eventually(func() bool { + foundStorageNodeSet := &v1alpha1.StorageNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, foundStorageNodeSet)).Should(Succeed()) + + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + if foundStorageNodeSet.Status.State != foundRemoteStorageNodeSet.Status.State { + return false + } + return reflect.DeepEqual(foundStorageNodeSet.Status.Conditions, foundRemoteStorageNodeSet.Status.Conditions) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteStorageNodeSet RemoteResource status are updated...") + Eventually(func() bool { + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + foundConfigMap := corev1.ConfigMap{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundConfigMap)).Should(Succeed()) + + for idx := range foundRemoteStorageNodeSet.Status.RemoteResources { + remoteResource := foundRemoteStorageNodeSet.Status.RemoteResources[idx] + if resources.EqualRemoteResourceWithObject( + &remoteResource, + foundConfigMap.DeepCopy(), + ) { + if meta.IsStatusConditionPresentAndEqual( + remoteResource.Conditions, + RemoteResourceSyncedCondition, + metav1.ConditionTrue, + ) { + return true + } + } + } + return false + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteStorageNodeSet status are synced...") + Eventually(func() bool { + foundStorageNodeSet := &v1alpha1.StorageNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundStorageNodeSet)).Should(Succeed()) + + foundRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, foundRemoteStorageNodeSet)).Should(Succeed()) + + if foundStorageNodeSet.Status.State != foundRemoteStorageNodeSet.Status.State { + return false + } + return reflect.DeepEqual(foundStorageNodeSet.Status.Conditions, foundRemoteStorageNodeSet.Status.Conditions) + }, test.Timeout, test.Interval).Should(BeTrue()) + }) + }) + When("Delete Storage with RemoteStorageNodeSet in k8s-mgmt-cluster", func() { + It("Should delete all resources in k8s-data-cluster", func() { + By("delete RemoteStorageNodeSet on local cluster...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)).Should(Succeed()) + foundStorage.Spec.NodeSets = []v1alpha1.StorageNodeSetSpecInline{ + { + Name: testNodeSetName + "-local", + StorageNodeSpec: v1alpha1.StorageNodeSpec{ + Nodes: 2, + }, + }, + { + Name: testNodeSetName + "-remote-static", + Remote: &v1alpha1.RemoteSpec{ + Cluster: testRemoteCluster, + }, + StorageNodeSpec: v1alpha1.StorageNodeSpec{ + Nodes: 1, + }, + }, + } + return localClient.Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).Should(Succeed()) + + By("checking that StorageNodeSet deleted from remote cluster...") + Eventually(func() bool { + foundStorageNodeSetOnRemote := v1alpha1.StorageNodeSet{} + + err := remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundStorageNodeSetOnRemote) + + return apierrors.IsNotFound(err) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that RemoteStorageNodeSet deleted from local cluster...") + Eventually(func() bool { + foundRemoteStorageNodeSet := v1alpha1.RemoteStorageNodeSet{} + + err := localClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote", + Namespace: testobjects.YdbNamespace, + }, &foundRemoteStorageNodeSet) + + return apierrors.IsNotFound(err) + }, test.Timeout, test.Interval).Should(BeTrue()) + + By("checking that Services for static RemoteStorageNodeSet exisiting in remote cluster...") + Eventually(func() error { + foundStaticStorageNodeSetOnRemote := &v1alpha1.StorageNodeSet{} + Expect(remoteClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name + "-" + testNodeSetName + "-remote-static", + Namespace: testobjects.YdbNamespace, + }, foundStaticStorageNodeSetOnRemote)).Should(Succeed()) + + storageServices := corev1.ServiceList{} + Expect(localClient.List(ctx, &storageServices, + client.InNamespace(testobjects.YdbNamespace), + )).Should(Succeed()) + for _, storageService := range storageServices.Items { + remoteService := &corev1.Service{} + if err := remoteClient.Get(ctx, types.NamespacedName{ + Name: storageService.GetName(), + Namespace: storageService.GetNamespace(), + }, remoteService); err != nil { + return err + } + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + }) +}) diff --git a/internal/controllers/remotestoragenodeset/remote_objects.go b/internal/controllers/remotestoragenodeset/remote_objects.go new file mode 100644 index 00000000..4f8c670f --- /dev/null +++ b/internal/controllers/remotestoragenodeset/remote_objects.go @@ -0,0 +1,420 @@ +package remotestoragenodeset + +import ( + "context" + "fmt" + "time" + + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + ydblabels "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +func (r *Reconciler) initRemoteObjectsStatus( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, + remoteObjects []client.Object, +) (bool, ctrl.Result, error) { + r.Log.Info("running step initRemoteObjectsStatus") + + for _, remoteObj := range remoteObjects { + existInStatus := false + for idx := range remoteStorageNodeSet.Status.RemoteResources { + if resources.EqualRemoteResourceWithObject( + &remoteStorageNodeSet.Status.RemoteResources[idx], + remoteObj, + ) { + existInStatus = true + break + } + } + if !existInStatus { + remoteStorageNodeSet.CreateRemoteResourceStatus(remoteObj) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, StatusUpdateRequeueDelay) + } + } + + r.Log.Info("complete step initRemoteObjectsStatus") + return Continue, ctrl.Result{}, nil +} + +func (r *Reconciler) syncRemoteObjects( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, + remoteObjects []client.Object, +) (bool, ctrl.Result, error) { + r.Log.Info("running step syncRemoteObjects") + + for _, remoteObj := range remoteObjects { + remoteObjName := remoteObj.GetName() + remoteObjKind := remoteObj.GetObjectKind().GroupVersionKind().Kind + var remoteResource *v1alpha1.RemoteResource + for idx := range remoteStorageNodeSet.Status.RemoteResources { + if resources.EqualRemoteResourceWithObject(&remoteStorageNodeSet.Status.RemoteResources[idx], remoteObj) { + remoteResource = &remoteStorageNodeSet.Status.RemoteResources[idx] + break + } + } + + // Get object to sync from remote cluster + remoteGetErr := r.RemoteClient.Get(ctx, types.NamespacedName{ + Name: remoteObj.GetName(), + Namespace: remoteObj.GetNamespace(), + }, remoteObj) + // Resource not found on remote cluster or internal kubernetes error + if remoteGetErr != nil { + if apierrors.IsNotFound(remoteGetErr) { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Resource %s with name %s was not found on remote cluster: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Resource %s with name %s was not found: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + } else { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get resource %s with name %s on remote cluster: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get resource %s with name %s: %s", remoteObjKind, remoteObjName, remoteGetErr), + ) + } + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, remoteGetErr + } + + // Check object existence in local cluster + remoteObjRV := remoteObj.GetResourceVersion() + localObj := resources.CreateResource(remoteObj) + getErr := r.Client.Get(ctx, types.NamespacedName{ + Name: localObj.GetName(), + Namespace: localObj.GetNamespace(), + }, localObj) + + // Handler for kubernetes internal error + if getErr != nil && !apierrors.IsNotFound(getErr) { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get resource %s with name %s: %s", remoteObjKind, remoteObjName, getErr), + ) + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, DefaultRequeueDelay) + } + + // Try to create non-existing remote object in local cluster + if apierrors.IsNotFound(getErr) { + createErr := r.Client.Create(ctx, localObj) + if createErr != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to create resource %s with name %s: %s", remoteObjKind, remoteObjName, getErr), + ) + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, DefaultRequeueDelay) + } + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync CREATE resource %s with name %s", remoteObjKind, remoteObjName), + ) + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionTrue, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, StatusUpdateRequeueDelay) + } + + // Get patch diff between remote object and existing object + remoteStorageNodeSet.SetPrimaryResourceAnnotations(remoteObj) + patchResult, patchErr := resources.GetPatchResult(localObj, remoteObj) + if patchErr != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get diff for remote resource %s with name %s: %s", remoteObjKind, remoteObjName, patchErr), + ) + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, DefaultRequeueDelay) + } + + // Try to update existing object in local cluster by rawPatch + if !patchResult.IsEmpty() { + updateErr := r.Client.Patch(ctx, localObj, client.RawPatch(types.StrategicMergePatchType, patchResult.Patch)) + if updateErr != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update resource %s with name %s: %v", remoteObjKind, remoteObjName, updateErr), + ) + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionFalse, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, DefaultRequeueDelay) + } + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync UPDATE resource %s with name %s resourceVersion %s", remoteObjKind, remoteObjName, remoteObjRV), + ) + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionTrue, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, StatusUpdateRequeueDelay) + } + + if !meta.IsStatusConditionTrue(remoteResource.Conditions, RemoteResourceSyncedCondition) { + remoteStorageNodeSet.UpdateRemoteResourceStatus(remoteResource, metav1.ConditionTrue, remoteObjRV) + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, StatusUpdateRequeueDelay) + } + } + + r.Log.Info("complete step syncRemoteObjects") + return Continue, ctrl.Result{}, nil +} + +func (r *Reconciler) removeUnusedRemoteObjects( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, + remoteObjects []client.Object, +) (bool, ctrl.Result, error) { + r.Log.Info("running step removeUnusedRemoteResources") + + // We should check every remote resource to need existence in cluster + // Get processed remote resources from object Status + candidatesToDelete := []v1alpha1.RemoteResource{} + for idx := range remoteStorageNodeSet.Status.RemoteResources { + // Remove remote resource from candidates to delete if it declared + // to using in current RemoteStorageNodeSet spec + existInSpec := false + for _, remoteObj := range remoteObjects { + if resources.EqualRemoteResourceWithObject( + &remoteStorageNodeSet.Status.RemoteResources[idx], + remoteObj, + ) { + existInSpec = true + break + } + } + if !existInSpec { + candidatesToDelete = append(candidatesToDelete, remoteStorageNodeSet.Status.RemoteResources[idx]) + } + } + + if len(candidatesToDelete) == 0 { + r.Log.Info("complete step removeUnusedRemoteObjects") + return Continue, ctrl.Result{}, nil + } + + existInStorage := false + anotherStorageNodeSets, err := r.getAnotherStorageNodeSets(ctx, remoteStorageNodeSet) + if err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to check remote resource usage in another: %v", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + if len(anotherStorageNodeSets) > 0 { + existInStorage = true + } + + // Check RemoteResource usage in StorageNodeSet + for _, remoteResource := range candidatesToDelete { + remoteObj, err := resources.ConvertRemoteResourceToObject(remoteResource, remoteStorageNodeSet.Namespace) + if err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to convert RemoteResource %s with name %s to object: %v", remoteResource.Kind, remoteResource.Name, err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + localObj := resources.CreateResource(remoteObj) + if err := r.Client.Get(ctx, types.NamespacedName{ + Name: localObj.GetName(), + Namespace: localObj.GetNamespace(), + }, localObj); err != nil { + if apierrors.IsNotFound(err) { + continue + } + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get RemoteResource %s with name %s as object: %v", remoteResource.Kind, remoteResource.Name, err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + // Remove annotation if no one another StorageNodeSet + if !existInStorage { + patch := []byte(fmt.Sprintf(`{"metadata": {"annotations": {"%s": null}}}`, ydbannotations.PrimaryResourceStorageAnnotation)) + updateErr := r.Client.Patch(ctx, localObj, client.RawPatch(types.StrategicMergePatchType, patch)) + if updateErr != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update resource %s with name %s: %s", remoteResource.Kind, remoteResource.Name, err), + ) + } else { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync UPDATE resource %s with name %s unset primaryResource annotation", remoteResource.Kind, remoteResource.Name), + ) + } + } + + // Delete resource if annotation `ydb.tech/primary-resource-database` does not exist + _, existInDatabase := localObj.GetAnnotations()[ydbannotations.PrimaryResourceDatabaseAnnotation] + if !existInDatabase { + // Try to delete unused resource from local cluster + deleteErr := r.Client.Delete(ctx, localObj) + if deleteErr != nil { + if !apierrors.IsNotFound(deleteErr) { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to delete resource %s with name %s: %s", remoteResource.Kind, remoteResource.Name, err), + ) + } + } else { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "Provisioning", + fmt.Sprintf("RemoteSync DELETE resource %s with name %s", remoteResource.Kind, remoteResource.Name), + ) + } + } + remoteStorageNodeSet.RemoveRemoteResourceStatus(remoteObj) + } + + return r.updateStatusRemoteObjects(ctx, remoteStorageNodeSet, StatusUpdateRequeueDelay) +} + +func (r *Reconciler) updateStatusRemoteObjects( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, + requeueAfter time.Duration, +) (bool, ctrl.Result, error) { + crRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + getErr := r.RemoteClient.Get(ctx, types.NamespacedName{ + Name: remoteStorageNodeSet.Name, + Namespace: remoteStorageNodeSet.Namespace, + }, crRemoteStorageNodeSet) + if getErr != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed fetching CR before status update for remote resources on remote cluster: %v", getErr), + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed fetching CR before status update for remote resources: %v", getErr), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, getErr + } + + crRemoteStorageNodeSet.Status.RemoteResources = append([]v1alpha1.RemoteResource{}, remoteStorageNodeSet.Status.RemoteResources...) + updateErr := r.RemoteClient.Status().Update(ctx, crRemoteStorageNodeSet) + if updateErr != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status for remote resources on remote cluster: %s", updateErr), + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status for remote resources: %s", updateErr), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, updateErr + } + + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status for remote resources updated on remote cluster", + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status for remote resources updated", + ) + + return Stop, ctrl.Result{RequeueAfter: requeueAfter}, nil +} + +func (r *Reconciler) getAnotherStorageNodeSets( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, +) ([]v1alpha1.StorageNodeSet, error) { + // Create label requirement that label `ydb.tech/storage-nodeset` which not equal + // to current StorageNodeSet object for exclude current nodeSet from List result + labelRequirement, err := labels.NewRequirement( + ydblabels.StorageNodeSetComponent, + selection.NotEquals, + []string{remoteStorageNodeSet.Labels[ydblabels.StorageNodeSetComponent]}, + ) + if err != nil { + return nil, err + } + + // Search another StorageNodeSets in current namespace with the same StorageRef + // but exclude current nodeSet from result + storageNodeSets := v1alpha1.StorageNodeSetList{} + if err := r.Client.List( + ctx, + &storageNodeSets, + client.InNamespace(remoteStorageNodeSet.Namespace), + client.MatchingLabelsSelector{ + Selector: labels.NewSelector().Add(*labelRequirement), + }, + client.MatchingFields{ + StorageRefField: remoteStorageNodeSet.Spec.StorageRef.Name, + }, + ); err != nil { + return nil, err + } + + return storageNodeSets.Items, nil +} diff --git a/internal/controllers/remotestoragenodeset/sync.go b/internal/controllers/remotestoragenodeset/sync.go new file mode 100644 index 00000000..05295ee2 --- /dev/null +++ b/internal/controllers/remotestoragenodeset/sync.go @@ -0,0 +1,185 @@ +package remotestoragenodeset + +import ( + "context" + "fmt" + "reflect" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +func (r *Reconciler) Sync(ctx context.Context, crRemoteStorageNodeSet *v1alpha1.RemoteStorageNodeSet) (ctrl.Result, error) { + var stop bool + var result ctrl.Result + var err error + + remoteStorageNodeSet := resources.NewRemoteStorageNodeSet(crRemoteStorageNodeSet) + remoteObjects := remoteStorageNodeSet.GetRemoteObjects(r.Scheme) + + stop, result, err = r.initRemoteObjectsStatus(ctx, &remoteStorageNodeSet, remoteObjects) + if stop { + return result, err + } + + stop, result, err = r.syncRemoteObjects(ctx, &remoteStorageNodeSet, remoteObjects) + if stop { + return result, err + } + + stop, result, err = r.handleResourcesSync(ctx, &remoteStorageNodeSet) + if stop { + return result, err + } + + stop, result, err = r.removeUnusedRemoteObjects(ctx, &remoteStorageNodeSet, remoteObjects) + if stop { + return result, err + } + + stop, result, err = r.updateRemoteStatus(ctx, &remoteStorageNodeSet) + if stop { + return result, err + } + + return ctrl.Result{}, nil +} + +func (r *Reconciler) handleResourcesSync( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, +) (bool, ctrl.Result, error) { + r.Log.Info("running step handleResourcesSync") + + for _, builder := range remoteStorageNodeSet.GetResourceBuilders() { + newResource := builder.Placeholder(remoteStorageNodeSet) + + result, err := resources.CreateOrUpdateOrMaybeIgnore(ctx, r.Client, newResource, func() error { + err := builder.Build(newResource) + if err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Failed building resources: %s", err), + ) + return err + } + remoteStorageNodeSet.SetPrimaryResourceAnnotations(newResource) + + return nil + }, func(oldObj, newObj runtime.Object) bool { + return false + }) + + eventMessage := fmt.Sprintf( + "Resource: %s, Namespace: %s, Name: %s", + reflect.TypeOf(newResource), + newResource.GetNamespace(), + newResource.GetName(), + ) + if err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ProvisioningFailed", + eventMessage+fmt.Sprintf(", failed to sync, error: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } else if result == controllerutil.OperationResultCreated || result == controllerutil.OperationResultUpdated { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "Provisioning", + eventMessage+fmt.Sprintf(", changed, result: %s", result), + ) + } + } + + r.Log.Info("complete step handleResourcesSync") + return Continue, ctrl.Result{}, nil +} + +func (r *Reconciler) updateRemoteStatus( + ctx context.Context, + remoteStorageNodeSet *resources.RemoteStorageNodeSetResource, +) (bool, ctrl.Result, error) { + r.Log.Info("running step updateRemoteStatus") + + crStorageNodeSet := &v1alpha1.StorageNodeSet{} + if err := r.Client.Get(ctx, types.NamespacedName{ + Name: remoteStorageNodeSet.Name, + Namespace: remoteStorageNodeSet.Namespace, + }, crStorageNodeSet); err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + "Failed fetching StorageNodeSet before status update", + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + crRemoteStorageNodeSet := &v1alpha1.RemoteStorageNodeSet{} + if err := r.RemoteClient.Get(ctx, types.NamespacedName{ + Name: remoteStorageNodeSet.Name, + Namespace: remoteStorageNodeSet.Namespace, + }, crRemoteStorageNodeSet); err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + "Failed fetching RemoteStorageNodeSet on remote cluster before status update", + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + "Failed fetching RemoteStorageNodeSet before status update", + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + crRemoteStorageNodeSet.Status.State = crStorageNodeSet.Status.State + crRemoteStorageNodeSet.Status.Conditions = append([]metav1.Condition{}, crStorageNodeSet.Status.Conditions...) + if err := r.RemoteClient.Status().Update(ctx, crRemoteStorageNodeSet); err != nil { + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status on remote cluster: %s", err), + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to update status: %s", err), + ) + + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + r.Recorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status updated on remote cluster", + ) + r.RemoteRecorder.Event( + remoteStorageNodeSet, + corev1.EventTypeNormal, + "StatusChanged", + "Status updated", + ) + + r.Log.Info("complete step updateRemoteStatus") + return Continue, ctrl.Result{}, nil +} diff --git a/internal/controllers/storage/config.go b/internal/controllers/storage/config.go new file mode 100644 index 00000000..ea8f5f1d --- /dev/null +++ b/internal/controllers/storage/config.go @@ -0,0 +1,327 @@ +package storage + +import ( + "context" + "fmt" + + "github.com/ydb-platform/ydb-go-sdk/v3" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/cms" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" +) + +func (r *Reconciler) replaceConfig( + ctx context.Context, + storage *resources.StorageClusterBuilder, + cmsConfig *cms.Config, + ydbOptions ydb.Option, +) (bool, ctrl.Result, error) { + response, err := cmsConfig.ReplaceConfig(ctx, ydbOptions) + if err != nil { + r.Log.Error(err, "failed to request CMS ReplaceConfig") + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionFalse, + ObservedGeneration: storage.Generation, + Reason: ReasonFailed, + Message: fmt.Sprintf("Failed to request CMS ReplaceConfig: %s", err), + }) + return Stop, ctrl.Result{RequeueAfter: ReplaceConfigOperationRequeueDelay}, err + } + + finished, operationID, err := cmsConfig.CheckReplaceConfigResponse(ctx, response) + if err != nil { + r.Log.Error(err, "failed response CMS ReplaceConfig") + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionFalse, + ObservedGeneration: storage.Generation, + Reason: ReasonFailed, + Message: fmt.Sprintf("Failed response CMS ReplaceConfig: %s", err), + }) + return r.updateStatus(ctx, storage, DefaultRequeueDelay) + } + + if !finished { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + string(StoragePreparing), + fmt.Sprintf("CMS ReplaceConfig operation in progress, operationID: %s", operationID), + ) + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionUnknown, + ObservedGeneration: storage.Generation, + Reason: ReasonInProgress, + Message: operationID, + }) + return r.updateStatus(ctx, storage, ReplaceConfigOperationRequeueDelay) + } + + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionTrue, + ObservedGeneration: storage.Generation, + Reason: ReasonCompleted, + Message: fmt.Sprintf("Config replaced to version: %d", cmsConfig.Version), + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) +} + +func (r *Reconciler) checkReplaceConfigOperation( + ctx context.Context, + storage *resources.StorageClusterBuilder, + cmsConfig *cms.Config, + ydbOptions ydb.Option, +) (bool, ctrl.Result, error) { + condition := meta.FindStatusCondition(storage.Status.Conditions, ReplaceConfigOperationCondition) + if len(condition.Message) == 0 { + // retry replace config + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionFalse, + Reason: ReasonFailed, + Message: "Something is wrong with the condition", + }) + return r.updateStatus(ctx, storage, ReplaceConfigOperationRequeueDelay) + } + + operation := &cms.Operation{ + StorageEndpoint: cmsConfig.StorageEndpoint, + Domain: cmsConfig.Domain, + ID: condition.Message, + } + response, err := operation.GetOperation(ctx, ydbOptions) + if err != nil { + r.Log.Error(err, "request CMS GetOperation error") + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to request CMS GetOperation: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + finished, operationID, err := operation.CheckGetOperationResponse(ctx, response) + if err != nil { + errMessage := fmt.Sprintf("Error replacing config to version %d: %s", cmsConfig.Version, err) + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "PreparingFailed", + errMessage, + ) + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionFalse, + Reason: ReasonFailed, + Message: errMessage, + }) + return Stop, ctrl.Result{RequeueAfter: ReplaceConfigOperationRequeueDelay}, err + } + + if !finished { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + string(StoragePreparing), + fmt.Sprintf("Config replacing operation is not completed, operationID: %s", operationID), + ) + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionUnknown, + ObservedGeneration: storage.Generation, + Reason: ReasonInProgress, + Message: operationID, + }) + return r.updateStatus(ctx, storage, ReplaceConfigOperationRequeueDelay) + } + + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ReplaceConfigOperationCondition, + Status: metav1.ConditionTrue, + ObservedGeneration: storage.Generation, + Reason: ReasonCompleted, + Message: fmt.Sprintf("Config replaced to version: %d", cmsConfig.Version), + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) +} + +func (r *Reconciler) setConfigPipelineStatus( + ctx context.Context, + storage *resources.StorageClusterBuilder, +) (bool, ctrl.Result, error) { + r.Log.Info("running step setConfigPipelineStatus") + isDynConfig, dynConfig, _ := v1alpha1.ParseDynConfig(storage.Spec.Configuration) + if !isDynConfig { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ConfigurationSyncedCondition, + Status: metav1.ConditionTrue, + ObservedGeneration: storage.Generation, + Reason: ReasonNotRequired, + Message: "Sync static configuration does not supported", + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + yamlConfig, err := v1alpha1.GetConfigForCMS(dynConfig) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get configuration for CMS: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + cmsConfig := &cms.Config{ + StorageEndpoint: storage.GetStorageEndpointWithProto(), + Domain: storage.Spec.Domain, + Config: string(yamlConfig), + DryRun: true, + AllowUnknownFields: true, + } + + creds, err := resources.GetYDBCredentials(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB credentials: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + tlsOptions, err := resources.GetYDBTLSOption(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB TLS options: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + ydbOpts := ydb.MergeOptions(ydb.WithCredentials(creds), tlsOptions) + + response, err := cmsConfig.GetConfig(ctx, ydbOpts) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + string(StorageProvisioning), + fmt.Sprintf("Failed to request CMS GetConfig: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + err = cmsConfig.ProcessConfigResponse(ctx, response) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + string(StorageProvisioning), + fmt.Sprintf("Failed to process config response: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + if cmsConfig.Version > dynConfig.Metadata.Version { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ConfigurationSyncedCondition, + Status: metav1.ConditionTrue, + ObservedGeneration: storage.Generation, + Reason: ReasonNotRequired, + Message: fmt.Sprintf("Configuration already synced to version %d", cmsConfig.Version), + }) + r.Log.Info("complete step setConfigPipelineStatus") + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ConfigurationSyncedCondition, + Status: metav1.ConditionUnknown, + ObservedGeneration: storage.Generation, + Reason: ReasonInProgress, + Message: fmt.Sprintf("Sync configuration in progress to version %d", dynConfig.Metadata.Version), + }) + r.Log.Info("complete step setConfigPipelineStatus") + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) +} + +func (r *Reconciler) handleConfigurationSync( + ctx context.Context, + storage *resources.StorageClusterBuilder, +) (bool, ctrl.Result, error) { + r.Log.Info("running step handleConfigurationSync") + + _, dynConfig, err := v1alpha1.ParseDynConfig(storage.Spec.Configuration) + if err != nil { + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + yamlConfig, err := v1alpha1.GetConfigForCMS(dynConfig) + if err != nil { + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + creds, err := resources.GetYDBCredentials(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB credentials: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + tlsOptions, err := resources.GetYDBTLSOption(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB credentials: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + ydbOpts := ydb.MergeOptions(ydb.WithCredentials(creds), tlsOptions) + + cmsConfig := &cms.Config{ + StorageEndpoint: storage.GetStorageEndpointWithProto(), + Domain: storage.Spec.Domain, + Config: string(yamlConfig), + DryRun: false, + AllowUnknownFields: true, + } + + condition := meta.FindStatusCondition(storage.Status.Conditions, ReplaceConfigOperationCondition) + if condition != nil && condition.ObservedGeneration == storage.Generation && condition.Status == metav1.ConditionUnknown { + return r.checkReplaceConfigOperation(ctx, storage, cmsConfig, ydbOpts) + } + + if condition == nil || condition.ObservedGeneration < storage.Generation || condition.Status == metav1.ConditionFalse { + return r.replaceConfig(ctx, storage, cmsConfig, ydbOpts) + } + + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: ConfigurationSyncedCondition, + Status: metav1.ConditionTrue, + ObservedGeneration: storage.Generation, + Reason: ReasonCompleted, + Message: fmt.Sprintf("Configuration synced successfully to version %d", cmsConfig.Version), + }) + r.Log.Info("complete step handleConfigurationSync") + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) +} diff --git a/internal/controllers/storage/controller.go b/internal/controllers/storage/controller.go index c8f168c0..34239316 100644 --- a/internal/controllers/storage/controller.go +++ b/internal/controllers/storage/controller.go @@ -2,25 +2,33 @@ package storage import ( "context" + "errors" + "fmt" "github.com/go-logr/logr" monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" - ydbv1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) // Reconciler reconciles a Storage object @@ -37,6 +45,9 @@ type Reconciler struct { //+kubebuilder:rbac:groups=ydb.tech,resources=storages,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=ydb.tech,resources=storages/status,verbs=get;update;patch //+kubebuilder:rbac:groups=ydb.tech,resources=storages/finalizers,verbs=update +//+kubebuilder:rbac:groups=ydb.tech,resources=remotestoragenodesets,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=ydb.tech,resources=remotestoragenodesets/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=ydb.tech,resources=remotestoragenodesets/finalizers,verbs=update //+kubebuilder:rbac:groups=ydb.tech,resources=storagenodesets,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=ydb.tech,resources=storagenodesets/status,verbs=get;update;patch //+kubebuilder:rbac:groups=ydb.tech,resources=storagenodesets/finalizers,verbs=update @@ -50,6 +61,8 @@ type Reconciler struct { //+kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=apps,resources=statefulsets/status,verbs=get;update;patch //+kubebuilder:rbac:groups=apps,resources=statefulsets/finalizers,verbs=get;list;watch +//+kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=batch,resources=jobs/status,verbs=get;update;patch //+kubebuilder:rbac:groups=monitoring.coreos.com,resources=servicemonitors,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=monitoring.coreos.com,resources=servicemonitors/status,verbs=get;update;patch @@ -58,63 +71,94 @@ type Reconciler struct { func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { r.Log = log.FromContext(ctx) - storage := &ydbv1alpha1.Storage{} - err := r.Get(ctx, req.NamespacedName, storage) + resource := &v1alpha1.Storage{} + err := r.Get(ctx, req.NamespacedName, resource) if err != nil { - if errors.IsNotFound(err) { - r.Log.Info("storage resources not found") + if apierrors.IsNotFound(err) { + r.Log.Info("Storage resource not found") return ctrl.Result{Requeue: false}, nil } r.Log.Error(err, "unexpected Get error") return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - result, err := r.Sync(ctx, storage) + + //nolint:nestif + // examine DeletionTimestamp to determine if object is under deletion + if resource.ObjectMeta.DeletionTimestamp.IsZero() { + // The object is not being deleted, so if it does not have our finalizer, + // then lets add the finalizer and update the object. This is equivalent + // to registering our finalizer. + if !controllerutil.ContainsFinalizer(resource, ydbannotations.StorageFinalizerKey) { + controllerutil.AddFinalizer(resource, ydbannotations.StorageFinalizerKey) + if err := r.Client.Update(ctx, resource); err != nil { + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + } else { + // The object is being deleted + if controllerutil.ContainsFinalizer(resource, ydbannotations.StorageFinalizerKey) { + // our finalizer is present, so lets handle any external dependency + if err := r.checkExistingDatabases(ctx, resource); err != nil { + // if fail to check dependency existence, return with error + // so that it can be retried. + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + // remove our finalizer from the list and update it. + controllerutil.RemoveFinalizer(resource, ydbannotations.StorageFinalizerKey) + if err := r.Client.Update(ctx, resource); err != nil { + return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + + // Stop reconciliation as the item is being deleted + return ctrl.Result{Requeue: false}, nil + } + + result, err := r.Sync(ctx, resource) if err != nil { r.Log.Error(err, "unexpected Sync error") } - return result, err -} - -func ignoreDeletionPredicate() predicate.Predicate { - return predicate.Funcs{ - UpdateFunc: func(e event.UpdateEvent) bool { - generationChanged := e.ObjectOld.GetGeneration() != e.ObjectNew.GetGeneration() - annotationsChanged := !annotations.CompareYdbTechAnnotations(e.ObjectOld.GetAnnotations(), e.ObjectNew.GetAnnotations()) - _, isService := e.ObjectOld.(*corev1.Service) - return generationChanged || annotationsChanged || isService - }, - DeleteFunc: func(e event.DeleteEvent) bool { - // Evaluates to false if the object has been confirmed deleted. - return !e.DeleteStateUnknown - }, - } + return result, err } -// SetupWithManager sets up the controller with the Manager. -func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { - controller := ctrl.NewControllerManagedBy(mgr).For(&ydbv1alpha1.Storage{}) - - r.Recorder = mgr.GetEventRecorderFor("Storage") +func createFieldIndexers(mgr ctrl.Manager) error { + if err := mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.RemoteStorageNodeSet{}, + OwnerControllerField, + func(obj client.Object) []string { + // grab the RemoteStorageNodeSet object, extract the owner... + remoteStorageNodeSet := obj.(*v1alpha1.RemoteStorageNodeSet) + owner := metav1.GetControllerOf(remoteStorageNodeSet) + if owner == nil { + return nil + } + // ...make sure it's a Storage... + if owner.APIVersion != v1alpha1.GroupVersion.String() || owner.Kind != StorageKind { + return nil + } - if r.WithServiceMonitors { - controller = controller. - Owns(&monitoringv1.ServiceMonitor{}) + // ...and if so, return it + return []string{owner.Name} + }); err != nil { + return err } if err := mgr.GetFieldIndexer().IndexField( context.Background(), - &ydbv1alpha1.StorageNodeSet{}, - OwnerControllerKey, + &v1alpha1.StorageNodeSet{}, + OwnerControllerField, func(obj client.Object) []string { // grab the StorageNodeSet object, extract the owner... - storageNodeSet := obj.(*ydbv1alpha1.StorageNodeSet) + storageNodeSet := obj.(*v1alpha1.StorageNodeSet) owner := metav1.GetControllerOf(storageNodeSet) if owner == nil { return nil } // ...make sure it's a Storage... - if owner.APIVersion != ydbv1alpha1.GroupVersion.String() || owner.Kind != "Storage" { + if owner.APIVersion != v1alpha1.GroupVersion.String() || owner.Kind != StorageKind { return nil } @@ -124,11 +168,140 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { return err } + if err := mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.Database{}, + StorageRefField, + func(obj client.Object) []string { + // grab the Database object, extract the .spec.storageRef.name... + database := obj.(*v1alpha1.Database) + return []string{database.Spec.StorageClusterRef.Name} + }); err != nil { + return err + } + + return mgr.GetFieldIndexer().IndexField( + context.Background(), + &v1alpha1.Storage{}, + SecretField, + func(obj client.Object) []string { + secrets := []string{} + storage := obj.(*v1alpha1.Storage) + for _, secret := range storage.Spec.Secrets { + secrets = append(secrets, secret.Name) + } + + return secrets + }) +} + +// SetupWithManager sets up the controller with the Manager. +func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { + r.Recorder = mgr.GetEventRecorderFor(StorageKind) + controller := ctrl.NewControllerManagedBy(mgr) + + if err := createFieldIndexers(mgr); err != nil { + r.Log.Error(err, "unexpected FieldIndexer error") + return err + } + + if r.WithServiceMonitors { + controller = controller. + Owns(&monitoringv1.ServiceMonitor{}) + } + return controller. - Owns(&ydbv1alpha1.StorageNodeSet{}). - Owns(&corev1.Service{}). - Owns(&appsv1.StatefulSet{}). - Owns(&corev1.ConfigMap{}). - WithEventFilter(ignoreDeletionPredicate()). + For(&v1alpha1.Storage{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Owns(&v1alpha1.RemoteStorageNodeSet{}, + builder.WithPredicates(resources.LastAppliedAnnotationPredicate()), // TODO: YDBOPS-9194 + ). + Owns(&v1alpha1.StorageNodeSet{}, + builder.WithPredicates(resources.LastAppliedAnnotationPredicate()), // TODO: YDBOPS-9194 + ). + Owns(&appsv1.StatefulSet{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Owns(&corev1.ConfigMap{}, + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Owns(&corev1.Service{}, + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + Watches( + &source.Kind{Type: &corev1.Secret{}}, + handler.EnqueueRequestsFromMapFunc(r.findStoragesForSecret), + builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), + ). + WithEventFilter(resources.IsStorageCreatePredicate()). + WithEventFilter(resources.IgnoreDeleteStateUnknownPredicate()). Complete(r) } + +func (r *Reconciler) findStoragesForSecret(secret client.Object) []reconcile.Request { + attachedStorages := &v1alpha1.StorageList{} + err := r.List( + context.Background(), + attachedStorages, + client.InNamespace(secret.GetNamespace()), + client.MatchingFields{SecretField: secret.GetName()}, + ) + if err != nil { + return []reconcile.Request{} + } + + requests := make([]reconcile.Request, len(attachedStorages.Items)) + for i, item := range attachedStorages.Items { + requests[i] = reconcile.Request{ + NamespacedName: types.NamespacedName{ + Name: item.GetName(), + Namespace: item.GetNamespace(), + }, + } + } + return requests +} + +func (r *Reconciler) checkExistingDatabases( + ctx context.Context, + storage *v1alpha1.Storage, +) error { + databaseList := &v1alpha1.DatabaseList{} + err := r.Client.List( + ctx, + databaseList, + client.InNamespace(storage.Namespace), + client.MatchingFields{ + StorageRefField: storage.Name, + }, + ) + if err != nil { + r.Log.Error(err, "failed to list Databases") + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to list Databases: %s", err), + ) + return err + } + + if len(databaseList.Items) > 0 { + var databases []string + for _, database := range databaseList.Items { + databases = append(databases, database.Name) + } + errMessage := fmt.Sprintf("Waiting for existing Databases to be deleted: %v", databases) + r.Log.Info(errMessage) + r.Recorder.Event( + storage, + corev1.EventTypeNormal, + string(StorageProvisioning), + fmt.Sprintf(errMessage, databases), + ) + return errors.New(errMessage) + } + + return nil +} diff --git a/internal/controllers/storage/controller_test.go b/internal/controllers/storage/controller_test.go index b0a0e564..b23e2498 100644 --- a/internal/controllers/storage/controller_test.go +++ b/internal/controllers/storage/controller_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "path/filepath" + "strings" "testing" . "github.com/onsi/ginkgo/v2" @@ -11,12 +12,17 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" - testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" ) var ( @@ -55,8 +61,25 @@ var _ = Describe("Storage controller medium tests", func() { Expect(k8sClient.Delete(ctx, &namespace)).Should(Succeed()) }) - It("Check volume has been propagated to pods", func() { - storageSample := testobjects.DefaultStorage(filepath.Join("..", "..", "..", "e2e", "tests", "data", "storage-block-4-2-config.yaml")) + It("Checking field propagation to objects", func() { + getStatefulSet := func(objName string) (appsv1.StatefulSet, error) { + foundStatefulSets := appsv1.StatefulSetList{} + err := k8sClient.List(ctx, &foundStatefulSets, client.InNamespace( + testobjects.YdbNamespace, + )) + if err != nil { + return appsv1.StatefulSet{}, err + } + for _, statefulSet := range foundStatefulSets.Items { + if statefulSet.Name == objName { + return statefulSet, nil + } + } + + return appsv1.StatefulSet{}, fmt.Errorf("Statefulset with name %s was not found", objName) + } + + storageSample := testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) tmpFilesDir := "/tmp/mounted_volume" testVolumeName := "sample-volume" @@ -76,6 +99,7 @@ var _ = Describe("Storage controller medium tests", func() { Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + By("Check volume has been propagated to pods...") storageStatefulSets := appsv1.StatefulSetList{} Eventually(func() bool { Expect(k8sClient.List(ctx, &storageStatefulSets, client.InNamespace( @@ -105,5 +129,181 @@ var _ = Describe("Storage controller medium tests", func() { } } Expect(foundVolume).To(BeTrue()) + + By("Check that configuration checksum annotation propagated to pods...", func() { + podAnnotations := storageSS.Spec.Template.Annotations + + foundStorage := v1alpha1.Storage{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: testobjects.StorageName, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)).Should(Succeed()) + + foundConfigurationChecksumAnnotation := false + if podAnnotations[annotations.ConfigurationChecksum] == resources.SHAChecksum(foundStorage.Spec.Configuration) { + foundConfigurationChecksumAnnotation = true + } + Expect(foundConfigurationChecksumAnnotation).To(BeTrue()) + }) + + By("Check that args with --label propagated to pods...", func() { + podContainerArgs := storageSS.Spec.Template.Spec.Containers[0].Args + var labelArgKey string + var labelArgValue string + for idx, arg := range podContainerArgs { + if arg == "--label" { + labelArgKey = strings.Split(podContainerArgs[idx+1], "=")[0] + labelArgValue = strings.Split(podContainerArgs[idx+1], "=")[1] + } + } + Expect(labelArgKey).Should(BeEquivalentTo(v1alpha1.LabelDeploymentKey)) + Expect(labelArgValue).Should(BeEquivalentTo(v1alpha1.LabelDeploymentValueKubernetes)) + }) + + By("Check that statefulset podTemplate labels remain immutable...", func() { + testLabelKey := "ydb-label" + testLabelValue := "test" + By("set additional labels to Storage...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + additionalLabels := resources.CopyDict(foundStorage.Spec.AdditionalLabels) + additionalLabels[testLabelKey] = testLabelValue + foundStorage.Spec.AdditionalLabels = additionalLabels + return k8sClient.Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("check that additional labels was added...") + foundStatefulSets := appsv1.StatefulSetList{} + Eventually(func() error { + err := k8sClient.List(ctx, &foundStatefulSets, + client.InNamespace(testobjects.YdbNamespace), + ) + if err != nil { + return err + } + value := foundStatefulSets.Items[0].Labels[testLabelKey] + if value != testLabelValue { + return fmt.Errorf("label value of `%s` in StatefulSet does not equal `%s`. Current labels: %s", testLabelKey, testLabelValue, foundStatefulSets.Items[0].Labels) + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("check that StatefulSet selector was not updated...") + Expect(*foundStatefulSets.Items[0].Spec.Selector).Should(BeEquivalentTo( + metav1.LabelSelector{ + MatchLabels: map[string]string{ + labels.StatefulsetComponent: storageSample.Name, + }, + }, + )) + }) + + By("Check that additionalPodLabels propagated into podTemplate...", func() { + testLabelKey := "ydb-pod-label" + testLabelValue := "test-podTemplate" + By("set additional pod labels to Storage...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + foundStorage.Spec.AdditionalPodLabels = make(map[string]string) + foundStorage.Spec.AdditionalPodLabels[testLabelKey] = testLabelValue + return k8sClient.Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("check that additional pod labels was added...") + foundStatefulSets := appsv1.StatefulSetList{} + Eventually(func() error { + err := k8sClient.List(ctx, &foundStatefulSets, + client.InNamespace(testobjects.YdbNamespace), + ) + if err != nil { + return err + } + value := foundStatefulSets.Items[0].Spec.Template.Labels[testLabelKey] + if value != testLabelValue { + return fmt.Errorf("label value of `%s` in StatefulSet does not equal `%s`. Current labels: %s", testLabelKey, testLabelValue, foundStatefulSets.Items[0].Labels) + } + return nil + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) + + By("check that delete StatefulSet event was detected...", func() { + foundStatefulSets := appsv1.StatefulSetList{} + Expect(k8sClient.List(ctx, &foundStatefulSets, client.InNamespace(testobjects.YdbNamespace))).ShouldNot(HaveOccurred()) + Expect(len(foundStatefulSets.Items)).Should(Equal(1)) + Expect(k8sClient.Delete(ctx, &foundStatefulSets.Items[0])).ShouldNot(HaveOccurred()) + Eventually(func() int { + Expect(k8sClient.List(ctx, &foundStatefulSets, client.InNamespace(testobjects.YdbNamespace))).ShouldNot(HaveOccurred()) + return len(foundStatefulSets.Items) + }, test.Timeout, test.Interval).Should(Equal(1)) + }) + + By("check --auth-token-file arg in StatefulSet...", func() { + By("create auth-token Secret with default name...") + defaultAuthTokenSecret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: v1alpha1.AuthTokenSecretName, + Namespace: testobjects.YdbNamespace, + }, + StringData: map[string]string{ + v1alpha1.AuthTokenSecretKey: "StaffApiUserToken: 'default-token'", + }, + } + Expect(k8sClient.Create(ctx, defaultAuthTokenSecret)) + + By("append auth-token Secret inside Storage manifest...") + Eventually(func() error { + foundStorage := v1alpha1.Storage{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: testobjects.StorageName, + Namespace: testobjects.YdbNamespace, + }, &foundStorage)) + foundStorage.Spec.Secrets = []*corev1.LocalObjectReference{ + { + Name: v1alpha1.AuthTokenSecretName, + }, + } + return k8sClient.Update(ctx, &foundStorage) + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + checkAuthTokenArgs := func() error { + statefulSet, err := getStatefulSet(testobjects.StorageName) + if err != nil { + return err + } + podContainerArgs := statefulSet.Spec.Template.Spec.Containers[0].Args + var argExist bool + var currentArgValue string + authTokenFileArgValue := fmt.Sprintf("%s/%s/%s", + v1alpha1.AdditionalSecretsDir, + v1alpha1.AuthTokenSecretName, + v1alpha1.AuthTokenSecretKey, + ) + for idx, arg := range podContainerArgs { + if arg == v1alpha1.AuthTokenFileArg { + argExist = true + currentArgValue = podContainerArgs[idx+1] + break + } + } + if !argExist { + return fmt.Errorf("arg `%s` did not found in StatefulSet podTemplate args: %v", v1alpha1.AuthTokenFileArg, podContainerArgs) + } + if authTokenFileArgValue != currentArgValue { + return fmt.Errorf("current arg `%s` value `%s` did not match with expected: %s", v1alpha1.AuthTokenFileArg, currentArgValue, authTokenFileArgValue) + } + return nil + } + + By("check that --auth-token-file arg was added to Statefulset template...") + Eventually(checkAuthTokenArgs, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + }) }) }) diff --git a/internal/controllers/storage/init.go b/internal/controllers/storage/init.go index db576c76..ec2f2207 100644 --- a/internal/controllers/storage/init.go +++ b/internal/controllers/storage/init.go @@ -4,80 +4,60 @@ import ( "context" "fmt" "regexp" + "strings" "time" ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" "google.golang.org/grpc/metadata" + batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/kubernetes" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck - "github.com/ydb-platform/ydb-kubernetes-operator/internal/exec" "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) var mismatchItemConfigGenerationRegexp = regexp.MustCompile(".*mismatch.*ItemConfigGenerationProvided# " + "0.*ItemConfigGenerationExpected# 1.*") -func (r *Reconciler) processSkipInitPipeline( +func (r *Reconciler) setInitPipelineStatus( ctx context.Context, storage *resources.StorageClusterBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step processSkipInitPipeline") - r.Log.Info("Storage initialization disabled (with annotation), proceed with caution") - - r.Recorder.Event( - storage, - corev1.EventTypeWarning, - "SkippingInit", - "Skipping initialization due to skip annotation present, be careful!", - ) - - return r.setInitStorageCompleted( - ctx, - storage, - "Storage initialization not performed because initialization is skipped", - ) -} - -func (r *Reconciler) setInitialStatus( - ctx context.Context, - storage *resources.StorageClusterBuilder, -) (bool, ctrl.Result, error) { - r.Log.Info("running step setInitialStatus") + if storage.Status.State == StoragePreparing { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageInitializedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Storage has not been initialized yet", + }) + storage.Status.State = StorageInitializing + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } // This block is special internal logic that skips all Storage initialization. - // It is needed when large clusters are migrated where `waitForStatefulSetToScale` - // does not make sense, since some nodes can be down for a long time (and it is okay, since - // database is healthy even with partial outage). if value, ok := storage.Annotations[v1alpha1.AnnotationSkipInitialization]; ok && value == v1alpha1.AnnotationValueTrue { - if meta.FindStatusCondition(storage.Status.Conditions, StorageInitializedCondition) == nil || - meta.IsStatusConditionFalse(storage.Status.Conditions, StorageInitializedCondition) { - return r.processSkipInitPipeline(ctx, storage) - } - return Stop, ctrl.Result{RequeueAfter: StorageInitializationRequeueDelay}, nil + r.Log.Info("Storage initialization disabled (with annotation), proceed with caution") + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "SkippingInit", + "Skipping initialization due to skip annotation present, be careful!", + ) + return r.setInitStorageCompleted(ctx, storage, "Storage initialization not performed because initialization is skipped") } - changed := false - if meta.FindStatusCondition(storage.Status.Conditions, StorageInitializedCondition) == nil { - meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ - Type: StorageInitializedCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Storage is not ready yet", - }) - changed = true - } - if storage.Status.State == StoragePending { - storage.Status.State = StoragePreparing - changed = true - } - if changed { - return r.setState(ctx, storage) + if meta.IsStatusConditionTrue(storage.Status.Conditions, OldStorageInitializedCondition) { + return r.setInitStorageCompleted(ctx, storage, "Storage initialized successfully") } return Continue, ctrl.Result{Requeue: false}, nil } @@ -88,101 +68,294 @@ func (r *Reconciler) setInitStorageCompleted( message string, ) (bool, ctrl.Result, error) { meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ - Type: StorageInitializedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: message, + Type: StorageInitializedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + Message: message, }) - - storage.Status.State = StorageReady - return r.setState(ctx, storage) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } -func (r *Reconciler) initializeStorage( +func (r *Reconciler) initializeBlobstorage( ctx context.Context, storage *resources.StorageClusterBuilder, - creds ydbCredentials.Credentials, ) (bool, ctrl.Result, error) { - r.Log.Info("running step runInitScripts") + initJob := &batchv1.Job{} + err := r.Get(ctx, types.NamespacedName{ + Name: fmt.Sprintf(resources.InitJobNameFormat, storage.Name), + Namespace: storage.Namespace, + }, initJob) - if storage.Status.State == StorageProvisioning { - storage.Status.State = StorageInitializing - return r.setState(ctx, storage) + //nolint:nestif + if apierrors.IsNotFound(err) { + if storage.Spec.OperatorConnection != nil { + creds, err := resources.GetYDBCredentials(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB credentials: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + if err := r.createOrUpdateOperatorTokenSecret(ctx, storage, creds); err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "InitializingStorage", + fmt.Sprintf("Failed to create operator token Secret, error: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + } + + if err := r.createInitBlobstorageJob(ctx, storage); err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "InitializingStorage", + fmt.Sprintf("Failed to create init blobstorage Job, error: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + r.Recorder.Event( + storage, + corev1.EventTypeNormal, + "InitializingStorage", + fmt.Sprintf("Successfully created Job %s", fmt.Sprintf(resources.InitJobNameFormat, storage.Name)), + ) + return Stop, ctrl.Result{RequeueAfter: StorageInitializationRequeueDelay}, nil } - // List Pods by label Selector - podList := &corev1.PodList{} - matchingLabels := client.MatchingLabels{} - for k, v := range storage.Labels { - matchingLabels[k] = v + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get Job: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - opts := []client.ListOption{ - client.InNamespace(storage.Namespace), - matchingLabels, + + if initJob.Status.Succeeded > 0 { + r.Log.Info("Init Job status succeeded") + r.Recorder.Event( + storage, + corev1.EventTypeNormal, + "InitializingStorage", + "Storage initialized successfully", + ) + return r.setInitStorageCompleted(ctx, storage, "Storage initialized successfully") + } + + var conditionFailed bool + for _, condition := range initJob.Status.Conditions { + if condition.Type == batchv1.JobFailed { + conditionFailed = true + break + } } - if err := r.List(ctx, podList, opts...); err != nil || len(podList.Items) == 0 { + + initialized, err := r.checkFailedJob(ctx, storage, initJob) + if err != nil { r.Recorder.Event( storage, corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to list storage pods: %s", err), + "ControllerError", + fmt.Sprintf("Failed to check logs for initBlobstorage Job: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - cmd := []string{ - fmt.Sprintf("%s/%s", v1alpha1.BinariesDir, v1alpha1.DaemonBinaryName), + if initialized { + r.Log.Info("Storage is already initialized, continuing...") + r.Recorder.Event( + storage, + corev1.EventTypeNormal, + "InitializingStorage", + "Storage initialization attempted and skipped, storage already initialized", + ) + if err := r.Delete(ctx, initJob, client.PropagationPolicy(metav1.DeletePropagationForeground)); err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to delete Job: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + return r.setInitStorageCompleted(ctx, storage, "Storage already initialized") } - if storage.Spec.OperatorConnection != nil { - ydbCtx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - token, err := creds.Token( - metadata.AppendToOutgoingContext(ydbCtx, "x-ydb-database", storage.Spec.Domain), + if initJob.Status.Failed == *initJob.Spec.BackoffLimit || conditionFailed { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "InitializingStorage", + "Failed initBlobstorage Job, check Pod logs for additional info", ) - if err != nil { - r.Log.Error(err, "initializeStorage error") - return Stop, ctrl.Result{RequeueAfter: StorageInitializationRequeueDelay}, err + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageInitializedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + }) + if err := r.Delete(ctx, initJob, client.PropagationPolicy(metav1.DeletePropagationForeground)); err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to delete initBlobstorage Job: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - cmd = append( - cmd, - "--token", - token, - ) + + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } - cmd = append( - cmd, - "-s", - storage.GetStorageEndpointWithProto(), + r.Recorder.Event( + storage, + corev1.EventTypeNormal, + "InitializingStorage", + fmt.Sprintf("Waiting for Job %s status update", initJob.Name), ) + return Stop, ctrl.Result{RequeueAfter: StorageInitializationRequeueDelay}, nil +} - cmd = append( - cmd, - "admin", "blobstorage", "config", "init", - "--yaml-file", - fmt.Sprintf("%s/%s", v1alpha1.ConfigDir, v1alpha1.ConfigFileName), - ) +func (r *Reconciler) checkFailedJob( + ctx context.Context, + storage *resources.StorageClusterBuilder, + job *batchv1.Job, +) (bool, error) { + podList := &corev1.PodList{} + opts := []client.ListOption{ + client.InNamespace(storage.Namespace), + client.MatchingLabels{ + "job-name": job.Name, + }, + } + if err := r.List(ctx, podList, opts...); err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to list pods for Job: %s", err), + ) + return false, fmt.Errorf("failed to list pods for checkFailedJob, error: %w", err) + } + + for _, pod := range podList.Items { + if pod.Status.Phase == corev1.PodFailed { + clientset, err := kubernetes.NewForConfig(r.Config) + if err != nil { + return false, fmt.Errorf("failed to initialize clientset for checkFailedJob, error: %w", err) + } - stdout, _, err := exec.InPod(r.Scheme, r.Config, storage.Namespace, podList.Items[0].Name, "ydb-storage", cmd) + podLogs, err := getPodLogs(ctx, clientset, storage.Namespace, pod.Name) + if err != nil { + return false, fmt.Errorf("failed to get pod logs for checkFailedJob, error: %w", err) + } + + if mismatchItemConfigGenerationRegexp.MatchString(podLogs) { + return true, nil + } + } + } + return false, nil +} + +func getPodLogs(ctx context.Context, clientset *kubernetes.Clientset, namespace, name string) (string, error) { + var logsBuilder strings.Builder + + streamCtx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + podLogs, err := clientset.CoreV1(). + Pods(namespace). + GetLogs(name, &corev1.PodLogOptions{}). + Stream(streamCtx) if err != nil { - if mismatchItemConfigGenerationRegexp.MatchString(stdout) { - r.Log.Info("Storage is already initialized, continuing...") - r.Recorder.Event( - storage, - corev1.EventTypeNormal, - "InitializingStorage", - "Storage initialization attempted and skipped, storage already initialized", - ) - return r.setInitStorageCompleted( - ctx, - storage, - "Storage already initialized", - ) + return "", fmt.Errorf("failed to stream GetLogs from pod %s/%s, error: %w", namespace, name, err) + } + defer podLogs.Close() + + buf := make([]byte, 4096) + for { + numBytes, err := podLogs.Read(buf) + if numBytes == 0 && err != nil { + break + } + logsBuilder.Write(buf[:numBytes]) + } + + return logsBuilder.String(), nil +} + +func shouldIgnoreJobUpdate() resources.IgnoreChangesFunction { + return func(oldObj, newObj runtime.Object) bool { + if _, ok := oldObj.(*batchv1.Job); ok { + return true + } + return false + } +} + +func (r *Reconciler) createInitBlobstorageJob( + ctx context.Context, + storage *resources.StorageClusterBuilder, +) error { + builder := storage.GetInitJobBuilder() + newResource := builder.Placeholder(storage) + _, err := resources.CreateOrUpdateOrMaybeIgnore(ctx, r.Client, newResource, func() error { + var err error + + err = builder.Build(newResource) + if err != nil { + return err } + err = ctrl.SetControllerReference(storage.Unwrap(), newResource, r.Scheme) + if err != nil { + return err + } + + return nil + }, shouldIgnoreJobUpdate()) + + return err +} - return Stop, ctrl.Result{RequeueAfter: StorageInitializationRequeueDelay}, err +func (r *Reconciler) createOrUpdateOperatorTokenSecret( + ctx context.Context, + storage *resources.StorageClusterBuilder, + creds ydbCredentials.Credentials, +) error { + ydbCtx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + token, err := creds.Token( + metadata.AppendToOutgoingContext(ydbCtx, "x-ydb-database", storage.Spec.Domain), + ) + if err != nil { + return fmt.Errorf("failed to get token from ydb credentials for createOrUpdateOperatorTokenSecret, error: %w", err) } - return r.setInitStorageCompleted(ctx, storage, "Storage initialized successfully") + builder := resources.GetOperatorTokenSecretBuilder(storage, token) + newResource := builder.Placeholder(storage) + _, err = resources.CreateOrUpdateOrMaybeIgnore(ctx, r.Client, newResource, func() error { + var err error + + err = builder.Build(newResource) + if err != nil { + return err + } + err = ctrl.SetControllerReference(storage.Unwrap(), newResource, r.Scheme) + if err != nil { + return err + } + + return nil + }, resources.DoNotIgnoreChanges()) + + return err } diff --git a/internal/controllers/storage/sync.go b/internal/controllers/storage/sync.go index bd926fa3..60852d93 100644 --- a/internal/controllers/storage/sync.go +++ b/internal/controllers/storage/sync.go @@ -4,12 +4,12 @@ import ( "context" "fmt" "reflect" + "time" "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Monitoring" - ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -18,206 +18,285 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - ydbv1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/connection" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck "github.com/ydb-platform/ydb-kubernetes-operator/internal/healthcheck" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) -func (r *Reconciler) Sync(ctx context.Context, cr *ydbv1alpha1.Storage) (ctrl.Result, error) { +func (r *Reconciler) Sync(ctx context.Context, cr *v1alpha1.Storage) (ctrl.Result, error) { var stop bool var result ctrl.Result var err error storage := resources.NewCluster(cr) - stop, result, err = storage.SetStatusOnFirstReconcile() + + stop, result, err = r.setInitialStatus(ctx, &storage) if stop { return result, err } - stop, result = r.checkStorageFrozen(&storage) + stop, result, err = r.handleResourcesSync(ctx, &storage) if stop { - return result, nil + return result, err } - stop, result, err = r.handlePauseResume(ctx, &storage) - if stop { - return result, err + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StorageInitializedCondition) { + return r.handleBlobstorageInit(ctx, &storage) } - stop, result, err = r.handleResourcesSync(ctx, &storage) + configSyncCondition := meta.FindStatusCondition(storage.Status.Conditions, ConfigurationSyncedCondition) + if configSyncCondition == nil || configSyncCondition.ObservedGeneration < storage.Generation { + stop, result, err = r.setConfigPipelineStatus(ctx, &storage) + if stop { + return result, err + } + } + + if !meta.IsStatusConditionTrue(storage.Status.Conditions, ConfigurationSyncedCondition) { + stop, result, err = r.handleConfigurationSync(ctx, &storage) + if stop { + return result, err + } + } + + if storage.Spec.NodeSets != nil { + stop, result, err = r.waitForNodeSetsToProvisioned(ctx, &storage) + if stop { + return result, err + } + } else { + stop, result, err = r.waitForStatefulSetToScale(ctx, &storage) + if stop { + return result, err + } + } + + stop, result, err = r.handlePauseResume(ctx, &storage) if stop { return result, err } - stop, result, err = r.syncNodeSetSpecInline(ctx, &storage) + stop, result, err = r.runSelfCheck(ctx, &storage, false) if stop { return result, err } - if !meta.IsStatusConditionTrue(storage.Status.Conditions, StorageInitializedCondition) { - return r.handleFirstStart(ctx, &storage) + return ctrl.Result{}, nil +} + +func (r *Reconciler) setInitialStatus( + ctx context.Context, + storage *resources.StorageClusterBuilder, +) (bool, ctrl.Result, error) { + r.Log.Info("running step setInitialStatus") + if storage.Status.Conditions == nil { + storage.Status.Conditions = []metav1.Condition{} + + if storage.Spec.Pause { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePausedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Transitioning to state Paused", + }) + } else { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageReadyCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Transitioning to state Ready", + }) + } + + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } - return ctrl.Result{}, nil + r.Log.Info("complete step setInitialStatus") + return Continue, ctrl.Result{}, nil } func (r *Reconciler) waitForStatefulSetToScale( ctx context.Context, storage *resources.StorageClusterBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step waitForStatefulSetToScale for Storage") + r.Log.Info("running step waitForStatefulSetToScale") - if storage.Status.State == StoragePreparing { - r.Recorder.Event( - storage, - corev1.EventTypeNormal, - string(StorageProvisioning), - fmt.Sprintf("Starting to track number of running storage pods, expected: %d", storage.Spec.Nodes), - ) + if storage.Status.State == StorageInitializing { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageProvisionedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: fmt.Sprintf("Waiting for scale to desired number of nodes: %d", storage.Spec.Nodes), + }) storage.Status.State = StorageProvisioning - return r.setState(ctx, storage) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } - found := &appsv1.StatefulSet{} + foundStatefulSet := &appsv1.StatefulSet{} err := r.Get(ctx, types.NamespacedName{ Name: storage.Name, Namespace: storage.Namespace, - }, found) + }, foundStatefulSet) if err != nil { - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { r.Recorder.Event( storage, corev1.EventTypeWarning, "ProvisioningFailed", fmt.Sprintf("StatefulSet with name %s was not found: %s", storage.Name, err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } r.Recorder.Event( storage, corev1.EventTypeWarning, - "ProvisioningFailed", - fmt.Sprintf("Failed to get StatefulSets: %s", err), - ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - - podLabels := labels.Common(storage.Name, make(map[string]string)) - podLabels.Merge(map[string]string{ - labels.ComponentKey: labels.StorageComponent, - }) - - matchingLabels := client.MatchingLabels{} - for k, v := range podLabels { - matchingLabels[k] = v - } - - podList := &corev1.PodList{} - opts := []client.ListOption{ - client.InNamespace(storage.Namespace), - matchingLabels, - } - - err = r.List(ctx, podList, opts...) - if err != nil { - r.Recorder.Event( - storage, - corev1.EventTypeWarning, - "ProvisioningFailed", - fmt.Sprintf("Failed to list cluster pods: %s", err), + "ControllerError", + fmt.Sprintf("Failed to get StatefulSet: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - runningPods := 0 - for _, e := range podList.Items { - if e.Status.Phase == "Running" { - runningPods++ - } - } - - if runningPods != int(storage.Spec.Nodes) { + if foundStatefulSet.Status.ReadyReplicas != storage.Spec.Nodes { r.Recorder.Event( storage, corev1.EventTypeNormal, string(StorageProvisioning), - fmt.Sprintf("Waiting for number of running storage pods to match expected: %d != %d", runningPods, storage.Spec.Nodes), + fmt.Sprintf("Waiting for number of running nodes to match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, storage.Spec.Nodes), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageProvisionedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: fmt.Sprintf("Number of running nodes does not match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, storage.Spec.Nodes), + }) + return r.updateStatus(ctx, storage, DefaultRequeueDelay) } + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StorageProvisionedCondition) { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageProvisionedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + Message: fmt.Sprintf("Successfully scaled to desired number of nodes: %d", storage.Spec.Nodes), + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step waitForStatefulSetToScale") return Continue, ctrl.Result{Requeue: false}, nil } -func (r *Reconciler) waitForStorageNodeSetsToReady( +func (r *Reconciler) waitForNodeSetsToProvisioned( ctx context.Context, storage *resources.StorageClusterBuilder, ) (bool, ctrl.Result, error) { - r.Log.Info("running step waitForStorageNodeSetToReady for Storage") + r.Log.Info("running step waitForNodeSetsToProvisioned") - if storage.Status.State == StoragePreparing { - r.Recorder.Event( - storage, - corev1.EventTypeNormal, - string(StorageProvisioning), - fmt.Sprintf("Starting to track readiness of running nodeSets objects, expected: %d", storage.Spec.Nodes), - ) + if storage.Status.State == StorageInitializing { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageProvisionedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Waiting for NodeSet resources to be Provisioned", + }) storage.Status.State = StorageProvisioning - return r.setState(ctx, storage) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } for _, nodeSetSpec := range storage.Spec.NodeSets { - foundStorageNodeSet := ydbv1alpha1.StorageNodeSet{} - storageNodeSetName := storage.Name + "-" + nodeSetSpec.Name - err := r.Get(ctx, types.NamespacedName{ - Name: storageNodeSetName, + var nodeSetObject client.Object + var nodeSetKind string + var nodeSetConditions []metav1.Condition + if nodeSetSpec.Remote != nil { + nodeSetObject = &v1alpha1.RemoteStorageNodeSet{} + nodeSetKind = RemoteStorageNodeSetKind + } else { + nodeSetObject = &v1alpha1.StorageNodeSet{} + nodeSetKind = StorageNodeSetKind + } + + nodeSetName := storage.Name + "-" + nodeSetSpec.Name + if err := r.Get(ctx, types.NamespacedName{ + Name: nodeSetName, Namespace: storage.Namespace, - }, &foundStorageNodeSet) - if err != nil { - if errors.IsNotFound(err) { + }, nodeSetObject); err != nil { + if apierrors.IsNotFound(err) { r.Recorder.Event( storage, corev1.EventTypeWarning, "ProvisioningFailed", - fmt.Sprintf("StorageNodeSet with name %s was not found: %s", storageNodeSetName, err), + fmt.Sprintf("%s with name %s was not found: %s", nodeSetKind, nodeSetName, err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } r.Recorder.Event( storage, corev1.EventTypeWarning, "ProvisioningFailed", - fmt.Sprintf("Failed to get StorageNodeSet: %s", err), + fmt.Sprintf("Failed to get %s with name %s: %s", nodeSetKind, nodeSetName, err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - if foundStorageNodeSet.Status.State != StorageNodeSetReady { - eventMessage := fmt.Sprintf("Waiting %s state for StorageNodeSet object %s, current: %s", - string(StorageReady), - foundStorageNodeSet.Name, - foundStorageNodeSet.Status.State, - ) + if nodeSetSpec.Remote != nil { + nodeSetConditions = nodeSetObject.(*v1alpha1.RemoteStorageNodeSet).Status.Conditions + } else { + nodeSetConditions = nodeSetObject.(*v1alpha1.StorageNodeSet).Status.Conditions + } + + condition := meta.FindStatusCondition(nodeSetConditions, NodeSetProvisionedCondition) + if condition == nil || condition.ObservedGeneration != nodeSetObject.GetGeneration() || condition.Status != metav1.ConditionTrue { r.Recorder.Event( storage, corev1.EventTypeNormal, string(StorageProvisioning), - eventMessage, + fmt.Sprintf( + "Waiting %s with name %s for condition NodeSetProvisioned to be True", + nodeSetKind, + nodeSetName, + ), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageProvisionedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: fmt.Sprintf( + "Waiting %s with name %s for condition NodeSetProvisioned to be True", + nodeSetKind, + nodeSetName, + ), + }) + return r.updateStatus(ctx, storage, DefaultRequeueDelay) } } - return Continue, ctrl.Result{Requeue: false}, nil + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StorageProvisionedCondition) { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageProvisionedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + Message: fmt.Sprintf("Successfully scaled to desired number of nodes: %d", storage.Spec.Nodes), + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step waitForNodeSetsToProvisioned") + return Continue, ctrl.Result{}, nil } func shouldIgnoreStorageChange(storage *resources.StorageClusterBuilder) resources.IgnoreChangesFunction { return func(oldObj, newObj runtime.Object) bool { - if _, ok := newObj.(*appsv1.StatefulSet); ok { - if storage.Spec.Pause && *oldObj.(*appsv1.StatefulSet).Spec.Replicas == 0 { + if statefulSet, ok := oldObj.(*appsv1.StatefulSet); ok { + if storage.Spec.Pause && *statefulSet.Spec.Replicas == 0 { return true } } @@ -231,6 +310,29 @@ func (r *Reconciler) handleResourcesSync( ) (bool, ctrl.Result, error) { r.Log.Info("running step handleResourcesSync") + if storage.Status.State == StoragePending { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePreparedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Waiting for sync resources", + }) + storage.Status.State = StoragePreparing + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + if !storage.Spec.OperatorSync { + r.Log.Info("`operatorSync: false` is set, no further steps will be run") + r.Recorder.Event( + storage, + corev1.EventTypeNormal, + string(StoragePreparing), + fmt.Sprintf("Found .spec.operatorSync set to %t, skip further steps", storage.Spec.OperatorSync), + ) + return Stop, ctrl.Result{}, nil + } + for _, builder := range storage.GetResourceBuilders(r.Config) { newResource := builder.Placeholder(storage) @@ -247,6 +349,7 @@ func (r *Reconciler) handleResourcesSync( ) return err } + err = ctrl.SetControllerReference(storage.Unwrap(), newResource, r.Scheme) if err != nil { r.Recorder.Event( @@ -274,7 +377,14 @@ func (r *Reconciler) handleResourcesSync( "ProvisioningFailed", eventMessage+fmt.Sprintf(", failed to sync, error: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Failed to sync resources", + }) + return r.updateStatus(ctx, storage, DefaultRequeueDelay) } else if result == controllerutil.OperationResultCreated || result == controllerutil.OperationResultUpdated { r.Recorder.Event( storage, @@ -285,20 +395,41 @@ func (r *Reconciler) handleResourcesSync( } } - r.Log.Info("resource sync complete") + if err := r.syncNodeSetSpecInline(ctx, storage); err != nil { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + Message: "Failed to sync NodeSet resources", + }) + return r.updateStatus(ctx, storage, DefaultRequeueDelay) + } + + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StoragePreparedCondition) { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePreparedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + Message: "Successfully synced resources", + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step handleResourcesSync") return Continue, ctrl.Result{Requeue: false}, nil } func (r *Reconciler) syncNodeSetSpecInline( ctx context.Context, storage *resources.StorageClusterBuilder, -) (bool, ctrl.Result, error) { - r.Log.Info("running step syncNodeSetSpecInline") - - storageNodeSets := &ydbv1alpha1.StorageNodeSetList{} +) error { matchingFields := client.MatchingFields{ - OwnerControllerKey: storage.Name, + OwnerControllerField: storage.Name, } + + storageNodeSets := &v1alpha1.StorageNodeSetList{} if err := r.List(ctx, storageNodeSets, client.InNamespace(storage.Namespace), matchingFields, @@ -309,17 +440,19 @@ func (r *Reconciler) syncNodeSetSpecInline( "ProvisioningFailed", fmt.Sprintf("Failed to list StorageNodeSets: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + return err } for _, storageNodeSet := range storageNodeSets.Items { storageNodeSet := storageNodeSet.DeepCopy() isFoundStorageNodeSetSpecInline := false for _, nodeSetSpecInline := range storage.Spec.NodeSets { - nodeSetName := storage.Name + "-" + nodeSetSpecInline.Name - if storageNodeSet.Name == nodeSetName { - isFoundStorageNodeSetSpecInline = true - break + if nodeSetSpecInline.Remote == nil { + nodeSetName := storage.Name + "-" + nodeSetSpecInline.Name + if storageNodeSet.Name == nodeSetName { + isFoundStorageNodeSetSpecInline = true + break + } } } @@ -331,7 +464,7 @@ func (r *Reconciler) syncNodeSetSpecInline( "ProvisioningFailed", fmt.Sprintf("Failed to delete StorageNodeSet: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + return err } r.Recorder.Event( storage, @@ -343,44 +476,89 @@ func (r *Reconciler) syncNodeSetSpecInline( storageNodeSet.Name), ) } + } + + remoteStorageNodeSets := &v1alpha1.RemoteStorageNodeSetList{} + if err := r.List(ctx, remoteStorageNodeSets, + client.InNamespace(storage.Namespace), + matchingFields, + ); err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ProvisioningFailed", + fmt.Sprintf("Failed to list RemoteStorageNodeSets: %s", err), + ) + return err + } + + for _, remoteStorageNodeSet := range remoteStorageNodeSets.Items { + remoteStorageNodeSet := remoteStorageNodeSet.DeepCopy() + isFoundRemoteStorageNodeSetSpecInline := false + for _, nodeSetSpecInline := range storage.Spec.NodeSets { + if nodeSetSpecInline.Remote != nil { + nodeSetName := storage.Name + "-" + nodeSetSpecInline.Name + if remoteStorageNodeSet.Name == nodeSetName { + isFoundRemoteStorageNodeSetSpecInline = true + break + } + } + } - oldGeneration := storageNodeSet.Status.ObservedStorageGeneration - if oldGeneration != storage.Generation { - storageNodeSet.Status.ObservedStorageGeneration = storage.Generation - if err := r.Status().Update(ctx, storageNodeSet); err != nil { + if !isFoundRemoteStorageNodeSetSpecInline { + if err := r.Delete(ctx, remoteStorageNodeSet); err != nil { r.Recorder.Event( - storageNodeSet, + storage, corev1.EventTypeWarning, - "ControllerError", - fmt.Sprintf("Failed setting status: %s", err), + "ProvisioningFailed", + fmt.Sprintf("Failed to delete RemoteStorageNodeSet: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + return err } r.Recorder.Event( - storageNodeSet, + storage, corev1.EventTypeNormal, - "StatusChanged", - fmt.Sprintf( - "StorageNodeSet updated observedStorageGeneration from %d to %d", - oldGeneration, - storage.Generation), + "Syncing", + fmt.Sprintf("Resource: %s, Namespace: %s, Name: %s, deleted", + reflect.TypeOf(remoteStorageNodeSet), + remoteStorageNodeSet.Namespace, + remoteStorageNodeSet.Name), ) } } - r.Log.Info("syncNodeSetSpecInline complete") - return Continue, ctrl.Result{Requeue: false}, nil + return nil } func (r *Reconciler) runSelfCheck( ctx context.Context, storage *resources.StorageClusterBuilder, - creds ydbCredentials.Credentials, waitForGoodResultWithoutIssues bool, ) (bool, ctrl.Result, error) { r.Log.Info("running step runSelfCheck") - result, err := healthcheck.GetSelfCheckResult(ctx, storage, creds) + creds, err := resources.GetYDBCredentials(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB credentials: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + tlsOptions, err := resources.GetYDBTLSOption(ctx, storage.Unwrap(), r.Config) + if err != nil { + r.Recorder.Event( + storage, + corev1.EventTypeWarning, + "ControllerError", + fmt.Sprintf("Failed to get YDB TLS options: %s", err), + ) + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + } + + result, err := healthcheck.GetSelfCheckResult(ctx, storage, creds, tlsOptions) if err != nil { r.Log.Error(err, "GetSelfCheckResult error") return Stop, ctrl.Result{RequeueAfter: SelfCheckRequeueDelay}, err @@ -406,21 +584,45 @@ func (r *Reconciler) runSelfCheck( return Stop, ctrl.Result{RequeueAfter: SelfCheckRequeueDelay}, err } + r.Log.Info("complete step runSelfCheck") return Continue, ctrl.Result{}, nil } -func (r *Reconciler) setState( +func (r *Reconciler) updateStatus( ctx context.Context, storage *resources.StorageClusterBuilder, + requeueAfter time.Duration, ) (bool, ctrl.Result, error) { - storageCr := &ydbv1alpha1.Storage{} - err := r.Get(ctx, client.ObjectKey{ + r.Log.Info("running updateStatus handler") + + if meta.IsStatusConditionFalse(storage.Status.Conditions, StoragePreparedCondition) || + meta.IsStatusConditionFalse(storage.Status.Conditions, StorageInitializedCondition) || + meta.IsStatusConditionFalse(storage.Status.Conditions, StorageProvisionedCondition) { + if storage.Spec.Pause { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + }) + } else { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storage.Generation, + }) + } + } + + storageCr := &v1alpha1.Storage{} + err := r.Get(ctx, types.NamespacedName{ Namespace: storage.Namespace, Name: storage.Name, }, storageCr) if err != nil { r.Recorder.Event( - storageCr, + storage, corev1.EventTypeWarning, "ControllerError", "Failed fetching CR before status update", @@ -431,163 +633,123 @@ func (r *Reconciler) setState( oldStatus := storageCr.Status.State storageCr.Status.State = storage.Status.State storageCr.Status.Conditions = storage.Status.Conditions - - err = r.Status().Update(ctx, storageCr) - if err != nil { + if err = r.Status().Update(ctx, storageCr); err != nil { r.Recorder.Event( - storageCr, + storage, corev1.EventTypeWarning, "ControllerError", fmt.Sprintf("Failed setting status: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } else if oldStatus != storage.Status.State { + } + if oldStatus != storage.Status.State { r.Recorder.Event( - storageCr, + storage, corev1.EventTypeNormal, "StatusChanged", - fmt.Sprintf("Storage moved from %s to %s", oldStatus, storage.Status.State), + fmt.Sprintf("Storage moved from %s to %s", oldStatus, storageCr.Status.State), ) } - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil + r.Log.Info("complete updateStatus handler") + return Stop, ctrl.Result{RequeueAfter: requeueAfter}, nil } -func (r *Reconciler) getYDBCredentials( +func (r *Reconciler) handlePauseResume( ctx context.Context, storage *resources.StorageClusterBuilder, -) (ydbCredentials.Credentials, ctrl.Result, error) { - r.Log.Info("running step getYDBCredentials") - - if auth := storage.Spec.OperatorConnection; auth != nil { - switch { - case auth.AccessToken != nil: - token, err := r.getSecretKey( - ctx, - storage.Storage.Namespace, - auth.AccessToken.SecretKeyRef, - ) - if err != nil { - return nil, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - return ydbCredentials.NewAccessTokenCredentials(token), ctrl.Result{Requeue: false}, nil - case auth.StaticCredentials != nil: - username := auth.StaticCredentials.Username - password := ydbv1alpha1.DefaultRootPassword - if auth.StaticCredentials.Password != nil { - var err error - password, err = r.getSecretKey( - ctx, - storage.Storage.Namespace, - auth.StaticCredentials.Password.SecretKeyRef, - ) - if err != nil { - return nil, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - } - endpoint := storage.GetStorageEndpoint() - secure := connection.LoadTLSCredentials(storage.IsStorageEndpointSecure()) - return ydbCredentials.NewStaticCredentials(username, password, endpoint, secure), ctrl.Result{Requeue: false}, nil +) (bool, ctrl.Result, error) { + r.Log.Info("running step handlePauseResume") + + if storage.Status.State == StorageProvisioning { + if storage.Spec.Pause { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + }) + storage.Status.State = StoragePaused + } else { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + }) + storage.Status.State = StorageReady } + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } - return ydbCredentials.NewAnonymousCredentials(), ctrl.Result{Requeue: false}, nil -} - -func (r *Reconciler) getSecretKey( - ctx context.Context, - namespace string, - secretKeyRef *corev1.SecretKeySelector, -) (string, error) { - secret := &corev1.Secret{} - err := r.Get(ctx, types.NamespacedName{ - Name: secretKeyRef.Name, - Namespace: namespace, - }, secret) - if err != nil { - return "", err - } - secretVal, exist := secret.Data[secretKeyRef.Key] - if !exist { - return "", fmt.Errorf( - "key %s does not exist in secretData %s", - secretKeyRef.Key, - secretKeyRef.Name, - ) - } - - return string(secretVal), nil -} -func (r *Reconciler) handlePauseResume( - ctx context.Context, - storage *resources.StorageClusterBuilder, -) (bool, ctrl.Result, error) { - r.Log.Info("running step handlePauseResume for Storage") if storage.Status.State == StorageReady && storage.Spec.Pause { r.Log.Info("`pause: true` was noticed, moving Storage to state `Paused`") meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ - Type: StoragePausedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: "State Storage set to Paused", + Type: StorageReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: storage.Generation, + Message: "Transitioning to state Paused", }) storage.Status.State = StoragePaused - return r.setState(ctx, storage) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) } if storage.Status.State == StoragePaused && !storage.Spec.Pause { r.Log.Info("`pause: false` was noticed, moving Storage to state `Ready`") - meta.RemoveStatusCondition(&storage.Status.Conditions, StoragePausedCondition) + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: storage.Generation, + Message: "Transitioning to state Ready", + }) storage.Status.State = StorageReady - return r.setState(ctx, storage) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + + if storage.Spec.Pause { + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StoragePausedCondition) { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StoragePausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } + } else { + if !meta.IsStatusConditionTrue(storage.Status.Conditions, StorageReadyCondition) { + meta.SetStatusCondition(&storage.Status.Conditions, metav1.Condition{ + Type: StorageReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storage.Generation, + }) + return r.updateStatus(ctx, storage, StatusUpdateRequeueDelay) + } } + r.Log.Info("complete step handlePauseResume") return Continue, ctrl.Result{}, nil } -func (r *Reconciler) handleFirstStart( +func (r *Reconciler) handleBlobstorageInit( ctx context.Context, storage *resources.StorageClusterBuilder, ) (ctrl.Result, error) { - stop, result, err := r.setInitialStatus(ctx, storage) - if stop { - return result, err - } - - if storage.Spec.NodeSets != nil { - stop, result, err = r.waitForStorageNodeSetsToReady(ctx, storage) - if stop { - return result, err - } - } else { - stop, result, err = r.waitForStatefulSetToScale(ctx, storage) - if stop { - return result, err - } - } + r.Log.Info("running step handleBlobstorageInit") - auth, result, err := r.getYDBCredentials(ctx, storage) - if auth == nil { + stop, result, err := r.setInitPipelineStatus(ctx, storage) + if stop { return result, err } - stop, result, err = r.runSelfCheck(ctx, storage, auth, false) + stop, result, err = r.initializeBlobstorage(ctx, storage) if stop { return result, err } - _, result, err = r.initializeStorage(ctx, storage, auth) - return result, err -} - -func (r *Reconciler) checkStorageFrozen( - storage *resources.StorageClusterBuilder, -) (bool, ctrl.Result) { - r.Log.Info("running step checkStorageFrozen for Storage") - if !storage.Spec.OperatorSync { - r.Log.Info("`operatorSync: false` is set, no further steps will be run") - return Stop, ctrl.Result{} - } - - return Continue, ctrl.Result{} + r.Log.Info("complete step handleBlobstorageInit") + return ctrl.Result{}, nil } diff --git a/internal/controllers/storagenodeset/controller.go b/internal/controllers/storagenodeset/controller.go index 6046cbcd..e65e2070 100644 --- a/internal/controllers/storagenodeset/controller.go +++ b/internal/controllers/storagenodeset/controller.go @@ -5,20 +5,19 @@ import ( "github.com/go-logr/logr" appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) // Reconciler reconciles a Storage object @@ -36,22 +35,20 @@ type Reconciler struct { //+kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=apps,resources=statefulsets/status,verbs=get;update;patch //+kubebuilder:rbac:groups=apps,resources=statefulsets/finalizers,verbs=get;list;watch -//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=core,resources=configmaps/status,verbs=get;update;patch // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - logger := log.FromContext(ctx) + r.Log = log.FromContext(ctx) - crStorageNodeSet := &api.StorageNodeSet{} + crStorageNodeSet := &v1alpha1.StorageNodeSet{} err := r.Get(ctx, req.NamespacedName, crStorageNodeSet) if err != nil { - if errors.IsNotFound(err) { - logger.Info("StorageNodeSet has been deleted") + if apierrors.IsNotFound(err) { + r.Log.Info("StorageNodeSet resource not found") return ctrl.Result{Requeue: false}, nil } - logger.Error(err, "unable to get StorageNodeSet") + r.Log.Error(err, "unable to get StorageNodeSet") return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } @@ -63,30 +60,19 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu return result, err } -func ignoreDeletionPredicate() predicate.Predicate { - return predicate.Funcs{ - UpdateFunc: func(e event.UpdateEvent) bool { - generationChanged := e.ObjectOld.GetGeneration() != e.ObjectNew.GetGeneration() - annotationsChanged := !annotations.CompareYdbTechAnnotations(e.ObjectOld.GetAnnotations(), e.ObjectNew.GetAnnotations()) - - return generationChanged || annotationsChanged - }, - DeleteFunc: func(e event.DeleteEvent) bool { - // Evaluates to false if the object has been confirmed deleted. - return !e.DeleteStateUnknown - }, - } -} - // SetupWithManager sets up the controller with the Manager. func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { - controller := ctrl.NewControllerManagedBy(mgr).For(&api.StorageNodeSet{}) - - r.Recorder = mgr.GetEventRecorderFor("StorageNodeSet") + r.Recorder = mgr.GetEventRecorderFor(StorageNodeSetKind) + controller := ctrl.NewControllerManagedBy(mgr) return controller. - Owns(&appsv1.StatefulSet{}). - Owns(&corev1.ConfigMap{}). - WithEventFilter(ignoreDeletionPredicate()). + For(&v1alpha1.StorageNodeSet{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + Owns(&appsv1.StatefulSet{}, + builder.WithPredicates(predicate.GenerationChangedPredicate{}), + ). + WithEventFilter(resources.IsStorageNodeSetCreatePredicate()). + WithEventFilter(resources.IgnoreDeleteStateUnknownPredicate()). Complete(r) } diff --git a/internal/controllers/storagenodeset/controller_test.go b/internal/controllers/storagenodeset/controller_test.go index 230fc2f0..0302c85a 100644 --- a/internal/controllers/storagenodeset/controller_test.go +++ b/internal/controllers/storagenodeset/controller_test.go @@ -15,10 +15,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage" "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storagenodeset" "github.com/ydb-platform/ydb-kubernetes-operator/internal/test" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" ) var ( @@ -62,15 +62,16 @@ var _ = Describe("StorageNodeSet controller medium tests", func() { }) It("Check controller operation through nodeSetSpec inline spec in Storage object", func() { - storageSample := testobjects.DefaultStorage(filepath.Join("..", "..", "..", "e2e", "tests", "data", "storage-block-4-2-config.yaml")) + storageSample := testobjects.DefaultStorage(filepath.Join("..", "..", "..", "tests", "data", "storage-mirror-3-dc-config.yaml")) // Test create inline nodeSetSpec in Storage object testNodeSetName := "nodeset" - for idx := 1; idx <= 4; idx++ { + storageNodeSetAmount := 3 + for idx := 1; idx <= storageNodeSetAmount; idx++ { storageSample.Spec.NodeSets = append(storageSample.Spec.NodeSets, v1alpha1.StorageNodeSetSpecInline{ Name: testNodeSetName + "-" + strconv.Itoa(idx), StorageNodeSpec: v1alpha1.StorageNodeSpec{ - Nodes: 2, + Nodes: 1, }, }) } @@ -84,14 +85,14 @@ var _ = Describe("StorageNodeSet controller medium tests", func() { ))).Should(Succeed()) foundStorageNodeSet := make(map[int]bool) for _, storageNodeSet := range storageNodeSets.Items { - for idxNodeSet := 1; idxNodeSet <= 4; idxNodeSet++ { + for idxNodeSet := 1; idxNodeSet <= storageNodeSetAmount; idxNodeSet++ { if storageNodeSet.Name == testobjects.StorageName+"-"+testNodeSetName+"-"+strconv.Itoa(idxNodeSet) { foundStorageNodeSet[idxNodeSet] = true break } } } - for idxNodeSet := 1; idxNodeSet <= 4; idxNodeSet++ { + for idxNodeSet := 1; idxNodeSet <= storageNodeSetAmount; idxNodeSet++ { if !foundStorageNodeSet[idxNodeSet] { return false } @@ -107,14 +108,14 @@ var _ = Describe("StorageNodeSet controller medium tests", func() { ))).Should(Succeed()) foundStatefulSet := make(map[int]bool) for _, statefulSet := range storageStatefulSets.Items { - for idxNodeSet := 1; idxNodeSet <= 4; idxNodeSet++ { + for idxNodeSet := 1; idxNodeSet <= storageNodeSetAmount; idxNodeSet++ { if statefulSet.Name == testobjects.StorageName+"-"+testNodeSetName+"-"+strconv.Itoa(idxNodeSet) { foundStatefulSet[idxNodeSet] = true break } } } - for idxNodeSet := 1; idxNodeSet <= 4; idxNodeSet++ { + for idxNodeSet := 1; idxNodeSet <= storageNodeSetAmount; idxNodeSet++ { if !foundStatefulSet[idxNodeSet] { return false } diff --git a/internal/controllers/storagenodeset/sync.go b/internal/controllers/storagenodeset/sync.go index 50b98c0d..12c7781a 100644 --- a/internal/controllers/storagenodeset/sync.go +++ b/internal/controllers/storagenodeset/sync.go @@ -4,55 +4,85 @@ import ( "context" "fmt" "reflect" + "time" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - ydbv1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) -func (r *Reconciler) Sync(ctx context.Context, crStorageNodeSet *ydbv1alpha1.StorageNodeSet) (ctrl.Result, error) { +func (r *Reconciler) Sync(ctx context.Context, crStorageNodeSet *v1alpha1.StorageNodeSet) (ctrl.Result, error) { var stop bool var result ctrl.Result var err error storageNodeSet := resources.NewStorageNodeSet(crStorageNodeSet) - stop, result, err = storageNodeSet.SetStatusOnFirstReconcile() + + stop, result, err = r.setInitialStatus(ctx, &storageNodeSet) if stop { return result, err } - stop, result = r.checkStorageFrozen(&storageNodeSet) + stop, result, err = r.handleResourcesSync(ctx, &storageNodeSet) if stop { - return result, nil + return result, err } - stop, result, err = r.handlePauseResume(ctx, &storageNodeSet) + stop, result, err = r.waitForStatefulSetToScale(ctx, &storageNodeSet) if stop { return result, err } - stop, result, err = r.handleResourcesSync(ctx, &storageNodeSet) + stop, result, err = r.handlePauseResume(ctx, &storageNodeSet) if stop { return result, err } - stop, result, err = r.waitForStatefulSetToScale(ctx, &storageNodeSet) - if stop { - return result, err + return ctrl.Result{}, nil +} + +func (r *Reconciler) setInitialStatus( + ctx context.Context, + storageNodeSet *resources.StorageNodeSetResource, +) (bool, ctrl.Result, error) { + r.Log.Info("running step setInitialStatus") + + if storageNodeSet.Status.Conditions == nil { + storageNodeSet.Status.Conditions = []metav1.Condition{} + + if storageNodeSet.Spec.Pause { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + Message: "Transitioning to state Paused", + }) + } else { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + Message: "Transitioning to state Ready", + }) + } + + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) } - return result, err + r.Log.Info("complete step setInitialStatus") + return Continue, ctrl.Result{}, nil } func (r *Reconciler) handleResourcesSync( @@ -61,6 +91,29 @@ func (r *Reconciler) handleResourcesSync( ) (bool, ctrl.Result, error) { r.Log.Info("running step handleResourcesSync") + if !storageNodeSet.Spec.OperatorSync { + r.Log.Info("`operatorSync: false` is set, no further steps will be run") + r.Recorder.Event( + storageNodeSet, + corev1.EventTypeNormal, + string(StorageNodeSetPreparing), + fmt.Sprintf("Found .spec.operatorSync set to %t, skip further steps", storageNodeSet.Spec.OperatorSync), + ) + return Stop, ctrl.Result{Requeue: false}, nil + } + + if storageNodeSet.Status.State == StorageNodeSetPending { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPreparedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + Message: "Waiting for sync resources", + }) + storageNodeSet.Status.State = StorageNodeSetPreparing + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) + } + for _, builder := range storageNodeSet.GetResourceBuilders(r.Config) { newResource := builder.Placeholder(storageNodeSet) @@ -104,34 +157,55 @@ func (r *Reconciler) handleResourcesSync( "ProvisioningFailed", eventMessage+fmt.Sprintf(", failed to sync, error: %s", err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPreparedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + Message: "Failed to sync resources", + }) + return r.updateStatus(ctx, storageNodeSet, DefaultRequeueDelay) } else if result == controllerutil.OperationResultCreated || result == controllerutil.OperationResultUpdated { r.Recorder.Event( storageNodeSet, corev1.EventTypeNormal, - string(StorageNodeSetProvisioning), + string(StorageNodeSetPreparing), eventMessage+fmt.Sprintf(", changed, result: %s", result), ) } } - r.Log.Info("resource sync complete") - return Continue, ctrl.Result{Requeue: false}, nil + + if !meta.IsStatusConditionTrue(storageNodeSet.Status.Conditions, NodeSetPreparedCondition) { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPreparedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storageNodeSet.Generation, + Message: "Successfully synced resources", + }) + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) + } + + r.Log.Info("complete step handleResourcesSync") + return Continue, ctrl.Result{}, nil } func (r *Reconciler) waitForStatefulSetToScale( ctx context.Context, storageNodeSet *resources.StorageNodeSetResource, ) (bool, ctrl.Result, error) { - r.Log.Info("running step waitForStatefulSetToScale for StorageNodeSet") + r.Log.Info("running step waitForStatefulSetToScale") - if storageNodeSet.Status.State == StorageNodeSetPending { - r.Recorder.Event( - storageNodeSet, - corev1.EventTypeNormal, - string(StorageNodeSetProvisioning), - fmt.Sprintf("Starting to track number of running storageNodeSet pods, expected: %d", storageNodeSet.Spec.Nodes)) + if storageNodeSet.Status.State == StorageNodeSetPreparing { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetProvisionedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + Message: fmt.Sprintf("Waiting for scale to desired nodes: %d", storageNodeSet.Spec.Nodes), + }) storageNodeSet.Status.State = StorageNodeSetProvisioning - return r.setState(ctx, storageNodeSet) + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) } foundStatefulSet := &appsv1.StatefulSet{} @@ -140,94 +214,90 @@ func (r *Reconciler) waitForStatefulSetToScale( Namespace: storageNodeSet.Namespace, }, foundStatefulSet) if err != nil { - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { r.Recorder.Event( storageNodeSet, corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to found StatefulSet: %s", err), + "ProvisioningFailed", + fmt.Sprintf("StatefulSet with name %s was not found: %s", storageNodeSet.Name, err), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil + return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } r.Recorder.Event( storageNodeSet, corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to get StatefulSets: %s", err), + "ControllerError", + fmt.Sprintf("Failed to get StatefulSet: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err } - matchingLabels := client.MatchingLabels{} - for k, v := range storageNodeSet.Labels { - matchingLabels[k] = v - } - - podList := &corev1.PodList{} - opts := []client.ListOption{ - client.InNamespace(storageNodeSet.Namespace), - matchingLabels, - } - if err = r.List(ctx, podList, opts...); err != nil { - r.Recorder.Event( - storageNodeSet, - corev1.EventTypeWarning, - "Syncing", - fmt.Sprintf("Failed to list storageNodeSet pods: %s", err), - ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } - - runningPods := 0 - for _, e := range podList.Items { - if e.Status.Phase == "Running" { - runningPods++ - } - } - - if runningPods != int(storageNodeSet.Spec.Nodes) { + if foundStatefulSet.Status.ReadyReplicas != storageNodeSet.Spec.Nodes { r.Recorder.Event( storageNodeSet, corev1.EventTypeNormal, string(StorageNodeSetProvisioning), - fmt.Sprintf("Waiting for number of running storageNodeSet pods to match expected: %d != %d", runningPods, storageNodeSet.Spec.Nodes), + fmt.Sprintf("Waiting for number of running nodes to match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, storageNodeSet.Spec.Nodes), ) - return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, nil - } - - if storageNodeSet.Spec.Pause { meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ - Type: StoragePausedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: "Scaled StorageNodeSet to 0 successfully", + Type: NodeSetProvisionedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + Message: fmt.Sprintf("Number of running nodes does not match expected: %d != %d", foundStatefulSet.Status.ReadyReplicas, storageNodeSet.Spec.Nodes), }) - storageNodeSet.Status.State = DatabaseNodeSetPaused - } else { + return r.updateStatus(ctx, storageNodeSet, DefaultRequeueDelay) + } + + if !meta.IsStatusConditionTrue(storageNodeSet.Status.Conditions, NodeSetProvisionedCondition) { meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ - Type: StorageNodeSetReadyCondition, - Status: "True", - Reason: ReasonCompleted, - Message: fmt.Sprintf("Scaled DatabaseNodeSet to %d successfully", storageNodeSet.Spec.Nodes), + Type: NodeSetProvisionedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storageNodeSet.Generation, + Message: fmt.Sprintf("Successfully scaled to desired number of nodes: %d", storageNodeSet.Spec.Nodes), }) - storageNodeSet.Status.State = DatabaseNodeSetReady + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) } - return r.setState(ctx, storageNodeSet) + r.Log.Info("complete step waitForStatefulSetToScale") + return Continue, ctrl.Result{}, nil } -func (r *Reconciler) setState( +func (r *Reconciler) updateStatus( ctx context.Context, storageNodeSet *resources.StorageNodeSetResource, + requeueAfter time.Duration, ) (bool, ctrl.Result, error) { - crStorageNodeSet := &ydbv1alpha1.StorageNodeSet{} - err := r.Get(ctx, client.ObjectKey{ + r.Log.Info("running updateStatus handler") + + if meta.IsStatusConditionFalse(storageNodeSet.Status.Conditions, NodeSetPreparedCondition) || + meta.IsStatusConditionFalse(storageNodeSet.Status.Conditions, NodeSetProvisionedCondition) { + if storageNodeSet.Spec.Pause { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + }) + } else { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + ObservedGeneration: storageNodeSet.Generation, + }) + } + } + + crStorageNodeSet := &v1alpha1.StorageNodeSet{} + err := r.Get(ctx, types.NamespacedName{ Namespace: storageNodeSet.Namespace, Name: storageNodeSet.Name, }, crStorageNodeSet) if err != nil { r.Recorder.Event( - crStorageNodeSet, + storageNodeSet, corev1.EventTypeWarning, "ControllerError", "Failed fetching CR before status update", @@ -238,32 +308,32 @@ func (r *Reconciler) setState( oldStatus := crStorageNodeSet.Status.State crStorageNodeSet.Status.State = storageNodeSet.Status.State crStorageNodeSet.Status.Conditions = storageNodeSet.Status.Conditions - - err = r.Status().Update(ctx, crStorageNodeSet) - if err != nil { + if err = r.Status().Update(ctx, crStorageNodeSet); err != nil { r.Recorder.Event( - crStorageNodeSet, + storageNodeSet, corev1.EventTypeWarning, "ControllerError", fmt.Sprintf("Failed setting status: %s", err), ) return Stop, ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err - } else if oldStatus != storageNodeSet.Status.State { + } + if oldStatus != storageNodeSet.Status.State { r.Recorder.Event( - crStorageNodeSet, + storageNodeSet, corev1.EventTypeNormal, "StatusChanged", fmt.Sprintf("StorageNodeSet moved from %s to %s", oldStatus, storageNodeSet.Status.State), ) } - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil + r.Log.Info("complete updateStatus handler") + return Stop, ctrl.Result{RequeueAfter: requeueAfter}, nil } func shouldIgnoreStorageNodeSetChange(storageNodeSet *resources.StorageNodeSetResource) resources.IgnoreChangesFunction { return func(oldObj, newObj runtime.Object) bool { - if _, ok := newObj.(*appsv1.StatefulSet); ok { - if storageNodeSet.Spec.Pause && *oldObj.(*appsv1.StatefulSet).Spec.Replicas == 0 { + if statefulSet, ok := oldObj.(*appsv1.StatefulSet); ok { + if storageNodeSet.Spec.Pause && *statefulSet.Spec.Replicas == 0 { return true } } @@ -275,42 +345,77 @@ func (r *Reconciler) handlePauseResume( ctx context.Context, storageNodeSet *resources.StorageNodeSetResource, ) (bool, ctrl.Result, error) { - r.Log.Info("running step handlePauseResume for Storage") - if storageNodeSet.Status.State == StorageReady && storageNodeSet.Spec.Pause { + r.Log.Info("running step handlePauseResume") + + if storageNodeSet.Status.State == StorageNodeSetProvisioning { + if storageNodeSet.Spec.Pause { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storageNodeSet.Generation, + }) + storageNodeSet.Status.State = StorageNodeSetPaused + } else { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storageNodeSet.Generation, + }) + storageNodeSet.Status.State = StorageNodeSetReady + } + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) + } + + if storageNodeSet.Status.State == StorageNodeSetReady && storageNodeSet.Spec.Pause { r.Log.Info("`pause: true` was noticed, moving StorageNodeSet to state `Paused`") - meta.RemoveStatusCondition(&storageNodeSet.Status.Conditions, StorageNodeSetReadyCondition) meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ - Type: StoragePausedCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Transitioning StorageNodeSet to Paused state", + Type: NodeSetReadyCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: storageNodeSet.Generation, + Message: "Transitioning to state Paused", }) storageNodeSet.Status.State = StorageNodeSetPaused - return r.setState(ctx, storageNodeSet) + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) } - if storageNodeSet.Status.State == StoragePaused && !storageNodeSet.Spec.Pause { - r.Log.Info("`pause: false` was noticed, moving Storage to state `Ready`") - meta.RemoveStatusCondition(&storageNodeSet.Status.Conditions, StoragePausedCondition) + if storageNodeSet.Status.State == StorageNodeSetPaused && !storageNodeSet.Spec.Pause { + r.Log.Info("`pause: false` was noticed, moving StorageNodeSet to state `Ready`") meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ - Type: StorageNodeSetReadyCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Recovering StorageNodeSet from Paused state", + Type: NodeSetPausedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonNotRequired, + ObservedGeneration: storageNodeSet.Generation, + Message: "Transitioning to state Ready", }) storageNodeSet.Status.State = StorageNodeSetReady - return r.setState(ctx, storageNodeSet) + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) } - return Continue, ctrl.Result{}, nil -} - -func (r *Reconciler) checkStorageFrozen(storageNodeSet *resources.StorageNodeSetResource) (bool, ctrl.Result) { - r.Log.Info("running step checkStorageFrozen for StorageNodeSet parent object") - if !storageNodeSet.Spec.OperatorSync { - r.Log.Info("`operatorSync: false` is set, no further steps will be run") - return Stop, ctrl.Result{} + if storageNodeSet.Spec.Pause { + if !meta.IsStatusConditionTrue(storageNodeSet.Status.Conditions, NodeSetPausedCondition) { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetPausedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storageNodeSet.Generation, + }) + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) + } + } else { + if !meta.IsStatusConditionTrue(storageNodeSet.Status.Conditions, NodeSetReadyCondition) { + meta.SetStatusCondition(&storageNodeSet.Status.Conditions, metav1.Condition{ + Type: NodeSetReadyCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + ObservedGeneration: storageNodeSet.Generation, + }) + return r.updateStatus(ctx, storageNodeSet, StatusUpdateRequeueDelay) + } } - return Continue, ctrl.Result{} + r.Log.Info("complete step handlePauseResume") + return Continue, ctrl.Result{}, nil } diff --git a/internal/exec/exec.go b/internal/exec/exec.go index bff2f23b..940e2119 100644 --- a/internal/exec/exec.go +++ b/internal/exec/exec.go @@ -58,6 +58,7 @@ func InPod( if err != nil { return stdout.String(), stderr.String(), errors.Wrapf( err, + //nolint:govet // TODO @jorres figure out why non-const error messages are not recommended fmt.Sprintf("failed to stream execution results back, stdout:\n\"%s\"stderr:\n\"%s\"", stdout.String(), stderr.String()), ) } diff --git a/internal/healthcheck/healthcheck.go b/internal/healthcheck/healthcheck.go index 7cd2e602..bd778661 100644 --- a/internal/healthcheck/healthcheck.go +++ b/internal/healthcheck/healthcheck.go @@ -6,7 +6,7 @@ import ( "github.com/ydb-platform/ydb-go-genproto/Ydb_Monitoring_V1" "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Monitoring" - "github.com/ydb-platform/ydb-go-sdk/v3" + ydb "github.com/ydb-platform/ydb-go-sdk/v3" ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" "google.golang.org/protobuf/proto" "sigs.k8s.io/controller-runtime/pkg/log" @@ -15,7 +15,12 @@ import ( "github.com/ydb-platform/ydb-kubernetes-operator/internal/resources" ) -func GetSelfCheckResult(ctx context.Context, cluster *resources.StorageClusterBuilder, creds ydbCredentials.Credentials) (*Ydb_Monitoring.SelfCheckResult, error) { +func GetSelfCheckResult( + ctx context.Context, + cluster *resources.StorageClusterBuilder, + creds ydbCredentials.Credentials, + opts ...ydb.Option, +) (*Ydb_Monitoring.SelfCheckResult, error) { logger := log.FromContext(ctx) getSelfCheckURL := fmt.Sprintf( "%s/%s", @@ -26,6 +31,7 @@ func GetSelfCheckResult(ctx context.Context, cluster *resources.StorageClusterBu db, err := connection.Open(ctx, getSelfCheckURL, ydb.WithCredentials(creds), + ydb.MergeOptions(opts...), ) if err != nil { return nil, err diff --git a/internal/labels/label.go b/internal/labels/label.go index 25422fa5..9c658075 100644 --- a/internal/labels/label.go +++ b/internal/labels/label.go @@ -1,9 +1,5 @@ package labels -import ( - "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" -) - // https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ const ( // NameKey The name of a higher level application this one is part of @@ -19,15 +15,18 @@ const ( // ServiceComponent The specialization of a Service resource ServiceComponent = "ydb.tech/service-for" - + // StatefulsetComponent The specialization of a Statefulset resource + StatefulsetComponent = "ydb.tech/statefulset-name" // StorageNodeSetComponent The specialization of a StorageNodeSet resource StorageNodeSetComponent = "ydb.tech/storage-nodeset" - // DatabaseNodeSetComponent The specialization of a DatabaseNodeSet resource DatabaseNodeSetComponent = "ydb.tech/database-nodeset" + // RemoteClusterKey The specialization of a remote k8s cluster + RemoteClusterKey = "ydb.tech/remote-cluster" - StorageComponent = "storage-node" - DynamicComponent = "dynamic-node" + StorageComponent = "storage-node" + DynamicComponent = "dynamic-node" + BlobstorageInitComponent = "blobstorage-init" GRPCComponent = "grpc" InterconnectComponent = "interconnect" @@ -45,28 +44,6 @@ func Common(name string, defaultLabels Labels) Labels { return l } -func StorageLabels(cluster *v1alpha1.Storage) Labels { - l := Common(cluster.Name, cluster.Labels) - - l.Merge(cluster.Spec.AdditionalLabels) - l.Merge(map[string]string{ - ComponentKey: StorageComponent, - }) - - return l -} - -func DatabaseLabels(database *v1alpha1.Database) Labels { - l := Common(database.Name, database.Labels) - - l.Merge(database.Spec.AdditionalLabels) - l.Merge(map[string]string{ - ComponentKey: DynamicComponent, - }) - - return l -} - func (l Labels) AsMap() map[string]string { return l } @@ -93,16 +70,6 @@ func (l Labels) Merge(other map[string]string) map[string]string { return l } -func (l Labels) MergeInPlace(other map[string]string) map[string]string { - result := l.Copy() - - for k, v := range other { - result[k] = v - } - - return result -} - func makeCommonLabels(other map[string]string, instance string) map[string]string { common := make(map[string]string) @@ -117,5 +84,17 @@ func makeCommonLabels(other map[string]string, instance string) map[string]strin common[ManagedByKey] = "ydb-operator" + if storageNodeSetName, exist := other[StorageNodeSetComponent]; exist { + common[StorageNodeSetComponent] = storageNodeSetName + } + + if databaseNodeSetName, exist := other[DatabaseNodeSetComponent]; exist { + common[DatabaseNodeSetComponent] = databaseNodeSetName + } + + if remoteCluster, exist := other[RemoteClusterKey]; exist { + common[RemoteClusterKey] = remoteCluster + } + return common } diff --git a/internal/ptr/ptr.go b/internal/ptr/ptr.go index 412cc841..5eac4c02 100644 --- a/internal/ptr/ptr.go +++ b/internal/ptr/ptr.go @@ -5,6 +5,11 @@ func Int32(v int32) *int32 { return &v } +// Int32 returns pointer to int64 value. +func Int64(v int64) *int64 { + return &v +} + // Bool returns pointer to bool value. func Bool(v bool) *bool { return &v diff --git a/internal/resources/configmap.go b/internal/resources/configmap.go index 39063112..861c4512 100644 --- a/internal/resources/configmap.go +++ b/internal/resources/configmap.go @@ -1,19 +1,42 @@ package resources import ( + "bytes" "errors" + "fmt" + "html/template" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/configuration/schema" ) +const keyConfigTmpl = `Keys { + ContainerPath: "{{ .ContainerPath }}" + Pin: "{{ .Pin }}" + Id: "{{ .ID }}" + Version: {{ .Version }} +}` + type ConfigMapBuilder struct { client.Object Name string - Data map[string]string Labels map[string]string + + Data map[string]string +} + +type EncryptionConfigBuilder struct { + client.Object + + Name string + Labels map[string]string + + KeyConfig schema.KeyConfig } func (b *ConfigMapBuilder) Build(obj client.Object) error { @@ -23,13 +46,43 @@ func (b *ConfigMapBuilder) Build(obj client.Object) error { } if cm.ObjectMeta.Name == "" { - cm.ObjectMeta.Name = b.GetName() + cm.ObjectMeta.Name = b.Name } cm.ObjectMeta.Namespace = b.GetNamespace() + cm.Labels = b.Labels + cm.Data = b.Data + + return nil +} + +func (b *EncryptionConfigBuilder) Build(obj client.Object) error { + cm, ok := obj.(*v1.ConfigMap) + if !ok { + return errors.New("failed to cast to ConfigMap object") + } + + if cm.ObjectMeta.Name == "" { + cm.ObjectMeta.Name = b.Name + } + cm.ObjectMeta.Namespace = b.GetNamespace() + cm.Labels = b.Labels + t, err := template.New("keyConfig").Parse(keyConfigTmpl) + if err != nil { + return fmt.Errorf("failed to parse keyConfig template: %w", err) + } + + var buf bytes.Buffer + err = t.Execute(&buf, b.KeyConfig.Keys[0]) + if err != nil { + return fmt.Errorf("failed to execute keyConfig template: %w", err) + } + + cm.Data = map[string]string{api.DatabaseEncryptionKeyConfigFile: buf.String()} + return nil } @@ -41,3 +94,12 @@ func (b *ConfigMapBuilder) Placeholder(cr client.Object) client.Object { }, } } + +func (b *EncryptionConfigBuilder) Placeholder(cr client.Object) client.Object { + return &v1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Name, + Namespace: cr.GetNamespace(), + }, + } +} diff --git a/internal/resources/database.go b/internal/resources/database.go index 2e0e350c..e2935036 100644 --- a/internal/resources/database.go +++ b/internal/resources/database.go @@ -1,14 +1,14 @@ package resources import ( + "fmt" + corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/configuration/schema" "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/metrics" ) @@ -21,30 +21,40 @@ type DatabaseBuilder struct { func NewDatabase(ydbCr *api.Database) DatabaseBuilder { cr := ydbCr.DeepCopy() + if cr.Spec.Service.Status.TLSConfiguration == nil { + cr.Spec.Service.Status.TLSConfiguration = &api.TLSConfiguration{Enabled: false} + } + return DatabaseBuilder{Database: cr, Storage: nil} } -func (b *DatabaseBuilder) SetStatusOnFirstReconcile() (bool, ctrl.Result, error) { - if b.Status.Conditions == nil { - b.Status.Conditions = []metav1.Condition{} +func (b *DatabaseBuilder) Unwrap() *api.Database { + return b.DeepCopy() +} - if b.Spec.Pause { - meta.SetStatusCondition(&b.Status.Conditions, metav1.Condition{ - Type: DatabasePausedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: "State Database set to Paused", - }) +func (b *DatabaseBuilder) buildSelectorLabels() labels.Labels { + l := labels.Common(b.Name, b.Labels) + l.Merge(map[string]string{labels.ComponentKey: labels.DynamicComponent}) - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil - } - } + return l +} + +func (b *DatabaseBuilder) buildLabels() labels.Labels { + l := b.buildSelectorLabels() + l.Merge(b.Spec.AdditionalLabels) - return Continue, ctrl.Result{}, nil + return l } -func (b *DatabaseBuilder) Unwrap() *api.Database { - return b.DeepCopy() +func (b *DatabaseBuilder) buildNodeSetLabels(nodeSetSpecInline api.DatabaseNodeSetSpecInline) labels.Labels { + l := b.buildLabels() + l.Merge(nodeSetSpecInline.Labels) + l.Merge(map[string]string{labels.DatabaseNodeSetComponent: nodeSetSpecInline.Name}) + if nodeSetSpecInline.Remote != nil { + l.Merge(map[string]string{labels.RemoteClusterKey: nodeSetSpecInline.Remote.Cluster}) + } + + return l } func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []ResourceBuilder { @@ -52,7 +62,11 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc return []ResourceBuilder{} } - databaseLabels := labels.DatabaseLabels(b.Unwrap()) + databaseLabels := b.buildLabels() + databaseSelectorLabels := b.buildSelectorLabels() + + statefulSetAnnotations := CopyDict(b.Spec.AdditionalAnnotations) + statefulSetAnnotations[annotations.ConfigurationChecksum] = SHAChecksum(b.Spec.Configuration) grpcServiceLabels := databaseLabels.Copy() grpcServiceLabels.Merge(b.Spec.Service.GRPC.AdditionalLabels) @@ -72,17 +86,23 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc var optionalBuilders []ResourceBuilder - optionalBuilders = append( - optionalBuilders, - &ConfigMapBuilder{ - Object: b, - Name: b.GetName(), - Data: map[string]string{ - api.ConfigFileName: b.Spec.Configuration, + if b.Spec.Configuration != "" { + // YDBOPS-9722 backward compatibility + cfg, _ := api.BuildConfiguration(b.Storage, b.Unwrap()) + + optionalBuilders = append( + optionalBuilders, + &ConfigMapBuilder{ + Object: b, + + Name: b.GetName(), + Data: map[string]string{ + api.ConfigFileName: string(cfg), + }, + Labels: databaseLabels, }, - Labels: databaseLabels, - }, - ) + ) + } if b.Spec.Monitoring != nil && b.Spec.Monitoring.Enabled { optionalBuilders = append(optionalBuilders, @@ -99,19 +119,49 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc ) } - if b.Spec.Encryption != nil && b.Spec.Encryption.Enabled && b.Spec.Encryption.Key == nil { - var pin string + if b.Spec.Encryption != nil && b.Spec.Encryption.Enabled { + // backward compatibility if b.Spec.Encryption.Pin == nil || len(*b.Spec.Encryption.Pin) == 0 { - pin = defaultPin - } else { - pin = *b.Spec.Encryption.Pin + encryptionPin := api.DefaultDatabaseEncryptionPin + b.Spec.Encryption.Pin = &encryptionPin + } + + if b.Spec.Encryption.Key == nil { + optionalBuilders = append( + optionalBuilders, + &EncryptionSecretBuilder{ + Object: b, + + Labels: databaseLabels, + Pin: *b.Spec.Encryption.Pin, + }, + ) + } + + keyConfig := schema.KeyConfig{ + Keys: []schema.Key{ + { + ContainerPath: fmt.Sprintf("%s/%s/%s", + wellKnownDirForAdditionalSecrets, + api.DatabaseEncryptionKeySecretDir, + api.DatabaseEncryptionKeySecretFile, + ), + ID: SHAChecksum(b.Spec.StorageClusterRef.Name), + Pin: b.Spec.Encryption.Pin, + Version: 1, + }, + }, } + optionalBuilders = append( optionalBuilders, - &EncryptionSecretBuilder{ + &EncryptionConfigBuilder{ Object: b, + + Name: fmt.Sprintf(EncryptionKeyConfigNameFormat, b.GetName()), Labels: databaseLabels, - Pin: pin, + + KeyConfig: keyConfig, }, ) } @@ -120,22 +170,23 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc optionalBuilders, &ServiceBuilder{ Object: b, - NameFormat: grpcServiceNameFormat, + NameFormat: GRPCServiceNameFormat, Labels: grpcServiceLabels, - SelectorLabels: databaseLabels, + SelectorLabels: databaseSelectorLabels, Annotations: b.Spec.Service.GRPC.AdditionalAnnotations, Ports: []corev1.ServicePort{{ - Name: api.GRPCServicePortName, - Port: api.GRPCPort, + Name: api.GRPCServicePortName, + Port: api.GRPCPort, + NodePort: b.Spec.Service.GRPC.ExternalPort, }}, IPFamilies: b.Spec.Service.GRPC.IPFamilies, IPFamilyPolicy: b.Spec.Service.GRPC.IPFamilyPolicy, }, &ServiceBuilder{ Object: b, - NameFormat: interconnectServiceNameFormat, + NameFormat: InterconnectServiceNameFormat, Labels: interconnectServiceLabels, - SelectorLabels: databaseLabels, + SelectorLabels: databaseSelectorLabels, Annotations: b.Spec.Service.Interconnect.AdditionalAnnotations, Headless: true, Ports: []corev1.ServicePort{{ @@ -147,9 +198,9 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc }, &ServiceBuilder{ Object: b, - NameFormat: statusServiceNameFormat, + NameFormat: StatusServiceNameFormat, Labels: statusServiceLabels, - SelectorLabels: databaseLabels, + SelectorLabels: databaseSelectorLabels, Annotations: b.Spec.Service.Status.AdditionalAnnotations, Ports: []corev1.ServicePort{{ Name: api.StatusServicePortName, @@ -165,9 +216,9 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc optionalBuilders, &ServiceBuilder{ Object: b, - NameFormat: datastreamsServiceNameFormat, + NameFormat: DatastreamsServiceNameFormat, Labels: datastreamsServiceLabels, - SelectorLabels: databaseLabels, + SelectorLabels: databaseSelectorLabels, Annotations: b.Spec.Service.Datastreams.AdditionalAnnotations, Ports: []corev1.ServicePort{{ Name: api.DatastreamsServicePortName, @@ -186,31 +237,63 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc Database: b.Unwrap(), RestConfig: restConfig, - Name: b.Name, - Labels: databaseLabels, + Name: b.Name, + Labels: databaseLabels, + Annotations: statefulSetAnnotations, }, ) } else { - for _, nodeSetSpecInline := range b.Spec.NodeSets { - nodeSetLabels := databaseLabels.Copy() - nodeSetLabels = nodeSetLabels.Merge(nodeSetSpecInline.AdditionalLabels) - nodeSetLabels = nodeSetLabels.Merge(map[string]string{labels.DatabaseNodeSetComponent: nodeSetSpecInline.Name}) + optionalBuilders = append(optionalBuilders, b.getNodeSetBuilders()...) + } - optionalBuilders = append( - optionalBuilders, + return optionalBuilders +} + +func (b *DatabaseBuilder) getNodeSetBuilders() []ResourceBuilder { + var nodeSetBuilders []ResourceBuilder + + for _, nodeSetSpecInline := range b.Spec.NodeSets { + nodeSetName := fmt.Sprintf("%s-%s", b.Name, nodeSetSpecInline.Name) + nodeSetLabels := b.buildNodeSetLabels(nodeSetSpecInline) + + nodeSetAnnotations := CopyDict(b.Annotations) + if nodeSetSpecInline.Annotations != nil { + for k, v := range nodeSetSpecInline.Annotations { + nodeSetAnnotations[k] = v + } + } + + databaseNodeSetSpec := b.recastDatabaseNodeSetSpecInline(nodeSetSpecInline.DeepCopy()) + if nodeSetSpecInline.Remote != nil { + nodeSetBuilders = append( + nodeSetBuilders, + &RemoteDatabaseNodeSetBuilder{ + Object: b, + + Name: nodeSetName, + Labels: nodeSetLabels, + Annotations: nodeSetAnnotations, + + DatabaseNodeSetSpec: databaseNodeSetSpec, + }, + ) + } else { + nodeSetBuilders = append( + nodeSetBuilders, &DatabaseNodeSetBuilder{ Object: b, - Name: b.Name + "-" + nodeSetSpecInline.Name, - Labels: nodeSetLabels, + Name: nodeSetName, + Labels: nodeSetLabels, + Annotations: nodeSetAnnotations, - DatabaseNodeSetSpec: b.recastDatabaseNodeSetSpecInline(nodeSetSpecInline.DeepCopy()), + DatabaseNodeSetSpec: databaseNodeSetSpec, }, ) } } - return optionalBuilders + return nodeSetBuilders } func (b *DatabaseBuilder) recastDatabaseNodeSetSpecInline(nodeSetSpecInline *api.DatabaseNodeSetSpecInline) api.DatabaseNodeSetSpec { @@ -218,7 +301,7 @@ func (b *DatabaseBuilder) recastDatabaseNodeSetSpecInline(nodeSetSpecInline *api nodeSetSpec.DatabaseRef = api.NamespacedRef{ Name: b.Name, - Namespace: b.GetNamespace(), + Namespace: b.Namespace, } nodeSetSpec.DatabaseClusterSpec = b.Spec.DatabaseClusterSpec @@ -253,10 +336,6 @@ func (b *DatabaseBuilder) recastDatabaseNodeSetSpecInline(nodeSetSpecInline *api nodeSetSpec.Tolerations = append(nodeSetSpec.Tolerations, nodeSetSpecInline.Tolerations...) } - if nodeSetSpecInline.PriorityClassName != nodeSetSpec.PriorityClassName { - nodeSetSpec.PriorityClassName = nodeSetSpecInline.PriorityClassName - } - nodeSetSpec.AdditionalLabels = CopyDict(b.Spec.AdditionalLabels) if nodeSetSpecInline.AdditionalLabels != nil { for k, v := range nodeSetSpecInline.AdditionalLabels { diff --git a/internal/resources/database_statefulset.go b/internal/resources/database_statefulset.go index 8bee90ac..fa04465b 100644 --- a/internal/resources/database_statefulset.go +++ b/internal/resources/database_statefulset.go @@ -3,9 +3,8 @@ package resources import ( "errors" "fmt" - "log" "regexp" - "strconv" + "strings" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -14,16 +13,18 @@ import ( "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/ptr" ) type DatabaseStatefulSetBuilder struct { - *v1alpha1.Database + *api.Database RestConfig *rest.Config - Name string - Labels map[string]string + Name string + Labels map[string]string + Annotations map[string]string } var annotationDataCenterPattern = regexp.MustCompile("^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$") @@ -38,7 +39,9 @@ func (b *DatabaseStatefulSetBuilder) Build(obj client.Object) error { sts.ObjectMeta.Name = b.Name } sts.ObjectMeta.Namespace = b.GetNamespace() - sts.ObjectMeta.Annotations = CopyDict(b.Spec.AdditionalAnnotations) + + sts.ObjectMeta.Labels = b.Labels + sts.ObjectMeta.Annotations = b.Annotations replicas := ptr.Int32(b.Spec.Nodes) if b.Spec.Pause { @@ -48,15 +51,17 @@ func (b *DatabaseStatefulSetBuilder) Build(obj client.Object) error { sts.Spec = appsv1.StatefulSetSpec{ Replicas: replicas, Selector: &metav1.LabelSelector{ - MatchLabels: b.Labels, + MatchLabels: map[string]string{ + labels.StatefulsetComponent: b.Name, + }, }, PodManagementPolicy: appsv1.ParallelPodManagement, RevisionHistoryLimit: ptr.Int32(10), - ServiceName: fmt.Sprintf(interconnectServiceNameFormat, b.Database.Name), + ServiceName: fmt.Sprintf(InterconnectServiceNameFormat, b.Database.Name), Template: b.buildPodTemplateSpec(), } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationUpdateStrategyOnDelete]; ok && value == v1alpha1.AnnotationValueTrue { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateStrategyOnDelete]; ok && value == api.AnnotationValueTrue { sts.Spec.UpdateStrategy = appsv1.StatefulSetUpdateStrategy{ Type: "OnDelete", } @@ -68,24 +73,60 @@ func (b *DatabaseStatefulSetBuilder) Build(obj client.Object) error { func (b *DatabaseStatefulSetBuilder) buildEnv() []corev1.EnvVar { var envVars []corev1.EnvVar - envVars = append(envVars, corev1.EnvVar{ - Name: "NODE_NAME", // for `--grpc-public-host` flag - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - APIVersion: "v1", - FieldPath: "metadata.name", + envVars = append(envVars, + corev1.EnvVar{ + Name: "POD_NAME", // for `--grpc-public-host` flag + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + APIVersion: "v1", + FieldPath: "metadata.name", + }, }, }, - }) + corev1.EnvVar{ + Name: "NODE_NAME", // for `--grpc-public-host` flag + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + APIVersion: "v1", + FieldPath: "metadata.name", + }, + }, + }, + corev1.EnvVar{ + Name: "POD_IP", // for `--grpc-public-address-` flag + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + APIVersion: "v1", + FieldPath: "status.podIP", + }, + }, + }, + ) return envVars } +func (b *DatabaseStatefulSetBuilder) buildPodTemplateLabels() labels.Labels { + podTemplateLabels := labels.Labels{} + + podTemplateLabels.Merge(b.Labels) + podTemplateLabels.Merge(map[string]string{labels.StatefulsetComponent: b.Name}) + podTemplateLabels.Merge(b.Spec.AdditionalPodLabels) + + return podTemplateLabels +} + func (b *DatabaseStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSpec { + podTemplateLabels := b.buildPodTemplateLabels() + + domain := api.DefaultDomainName + if dnsAnnotation, ok := b.GetAnnotations()[api.DNSDomainAnnotation]; ok { + domain = dnsAnnotation + } podTemplate := corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: b.Labels, - Annotations: CopyDict(b.Spec.AdditionalAnnotations), + Labels: podTemplateLabels, + Annotations: b.Annotations, }, Spec: corev1.PodSpec{ Containers: []corev1.Container{b.buildContainer()}, @@ -100,7 +141,7 @@ func (b *DatabaseStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSp DNSConfig: &corev1.PodDNSConfig{ Searches: []string{ - fmt.Sprintf(v1alpha1.InterconnectServiceFQDNFormat, b.Spec.StorageClusterRef.Name, b.Spec.StorageClusterRef.Namespace), + fmt.Sprintf(api.InterconnectServiceFQDNFormat, b.Spec.StorageClusterRef.Name, b.Spec.StorageClusterRef.Namespace, domain), }, }, }, @@ -108,7 +149,7 @@ func (b *DatabaseStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSp // InitContainer only needed for CaBundle manipulation for now, // may be probably used for other stuff later - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { podTemplate.Spec.InitContainers = append( []corev1.Container{b.buildCaStorePatchingInitContainer()}, b.Spec.InitContainers..., @@ -121,7 +162,7 @@ func (b *DatabaseStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSp podTemplate.Spec.ImagePullSecrets = []corev1.LocalObjectReference{{Name: *b.Spec.Image.PullSecret}} } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationUpdateDNSPolicy]; ok { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateDNSPolicy]; ok { switch value { case string(corev1.DNSClusterFirstWithHostNet), string(corev1.DNSClusterFirst), string(corev1.DNSDefault), string(corev1.DNSNone): podTemplate.Spec.DNSPolicy = corev1.DNSPolicy(value) @@ -135,7 +176,10 @@ func (b *DatabaseStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSp } func (b *DatabaseStatefulSetBuilder) buildVolumes() []corev1.Volume { - configMapName := b.Name + configMapName := b.Spec.StorageClusterRef.Name + if b.Spec.Configuration != "" { + configMapName = b.GetName() + } volumes := []corev1.Volume{ { @@ -149,19 +193,30 @@ func (b *DatabaseStatefulSetBuilder) buildVolumes() []corev1.Volume { } if b.Spec.Service.GRPC.TLSConfiguration.Enabled { - volumes = append(volumes, buildTLSVolume(grpcTLSVolumeName, b.Spec.Service.GRPC.TLSConfiguration)) + volumes = append(volumes, buildTLSVolume(GRPCTLSVolumeName, b.Spec.Service.GRPC.TLSConfiguration)) } if b.Spec.Service.Interconnect.TLSConfiguration.Enabled { volumes = append(volumes, buildTLSVolume(interconnectTLSVolumeName, b.Spec.Service.Interconnect.TLSConfiguration)) } + if b.Spec.Service.Status.TLSConfiguration.Enabled { + volumes = append(volumes, + buildTLSVolume(statusOriginTLSVolumeName, b.Spec.Service.Status.TLSConfiguration), + corev1.Volume{ + Name: statusTLSVolumeName, + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, + ) + } + if b.Spec.Encryption != nil && b.Spec.Encryption.Enabled { - volumes = append(volumes, b.buildEncryptionVolume()) + volumes = append(volumes, b.buildEncryptionVolumes()...) } if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled { - volumes = append(volumes, b.buildDatastreamsIAMServiceAccountKeyVolume()) if b.Spec.Service.Datastreams.TLSConfiguration.Enabled { volumes = append(volumes, buildTLSVolume(datastreamsTLSVolumeName, b.Spec.Service.Datastreams.TLSConfiguration)) } @@ -182,7 +237,7 @@ func (b *DatabaseStatefulSetBuilder) buildVolumes() []corev1.Volume { }) } - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { volumes = append(volumes, corev1.Volume{ Name: systemCertsVolumeName, VolumeSource: corev1.VolumeSource{ @@ -202,7 +257,12 @@ func (b *DatabaseStatefulSetBuilder) buildVolumes() []corev1.Volume { } func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainer() corev1.Container { - command, args := b.buildCaStorePatchingInitContainerArgs() + command, args := buildCAStorePatchingCommandArgs( + b.Spec.CABundle, + b.Spec.Service.GRPC, + b.Spec.Service.Interconnect, + b.Spec.Service.Status, + ) imagePullPolicy := corev1.PullIfNotPresent if b.Spec.Image.PullPolicyName != nil { imagePullPolicy = *b.Spec.Image.PullPolicyName @@ -238,17 +298,10 @@ func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainer() corev1. return container } -func (b *DatabaseStatefulSetBuilder) areAnyCertificatesAddedToStore() bool { - return len(b.Spec.CABundle) > 0 || - b.Spec.Service.GRPC.TLSConfiguration.Enabled || - b.Spec.Service.Interconnect.TLSConfiguration.Enabled || - b.Spec.Service.Datastreams.TLSConfiguration.Enabled -} - func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMounts() []corev1.VolumeMount { volumeMounts := []corev1.VolumeMount{} - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: localCertsVolumeName, MountPath: localCertsDir, @@ -262,9 +315,9 @@ func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMoun if b.Spec.Service.GRPC.TLSConfiguration.Enabled { volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: grpcTLSVolumeName, + Name: GRPCTLSVolumeName, ReadOnly: true, - MountPath: "/tls/grpc", // fixme const + MountPath: grpcTLSVolumeMountPath, }) } @@ -272,7 +325,7 @@ func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMoun volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: interconnectTLSVolumeName, ReadOnly: true, - MountPath: "/tls/interconnect", // fixme const + MountPath: interconnectTLSVolumeMountPath, }) } @@ -280,13 +333,26 @@ func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMoun volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: datastreamsTLSVolumeName, ReadOnly: true, - MountPath: "/tls/datastreams", // fixme const + MountPath: datastreamsTLSVolumeMountPath, + }) + } + + if b.Spec.Service.Status.TLSConfiguration.Enabled { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: statusOriginTLSVolumeName, + ReadOnly: true, + MountPath: statusOriginTLSVolumeMountPath, + }) + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: statusTLSVolumeName, + MountPath: statusTLSVolumeMountPath, }) } + return volumeMounts } -func buildTLSVolume(name string, configuration *v1alpha1.TLSConfiguration) corev1.Volume { // fixme move somewhere? +func buildTLSVolume(name string, configuration *api.TLSConfiguration) corev1.Volume { // fixme move somewhere? volume := corev1.Volume{ Name: name, VolumeSource: corev1.VolumeSource{ @@ -295,15 +361,15 @@ func buildTLSVolume(name string, configuration *v1alpha1.TLSConfiguration) corev Items: []corev1.KeyToPath{ { Key: configuration.CertificateAuthority.Key, - Path: "ca.crt", + Path: wellKnownNameForTLSCertificateAuthority, }, { Key: configuration.Certificate.Key, - Path: "tls.crt", + Path: wellKnownNameForTLSCertificate, }, { Key: configuration.Key.Key, - Path: "tls.key", + Path: wellKnownNameForTLSPrivateKey, }, }, }, @@ -313,47 +379,43 @@ func buildTLSVolume(name string, configuration *v1alpha1.TLSConfiguration) corev return volume } -func (b *DatabaseStatefulSetBuilder) buildEncryptionVolume() corev1.Volume { +func (b *DatabaseStatefulSetBuilder) buildEncryptionVolumes() []corev1.Volume { var secretName, secretKey string if b.Spec.Encryption.Key != nil { secretName = b.Spec.Encryption.Key.Name secretKey = b.Spec.Encryption.Key.Key } else { secretName = b.Name - secretKey = defaultEncryptionSecretKey + secretKey = wellKnownNameForEncryptionKeySecret } - return corev1.Volume{ - Name: encryptionVolumeName, + encryptionKeySecret := corev1.Volume{ + Name: encryptionKeySecretVolumeName, VolumeSource: corev1.VolumeSource{ Secret: &corev1.SecretVolumeSource{ SecretName: secretName, Items: []corev1.KeyToPath{ { Key: secretKey, - Path: v1alpha1.DatabaseEncryptionKeyFile, + Path: api.DatabaseEncryptionKeySecretFile, }, }, }, }, } -} -func (b *DatabaseStatefulSetBuilder) buildDatastreamsIAMServiceAccountKeyVolume() corev1.Volume { - return corev1.Volume{ - Name: datastreamsIAMServiceAccountKeyVolumeName, + encryptionKeyConfig := corev1.Volume{ + Name: encryptionKeyConfigVolumeName, VolumeSource: corev1.VolumeSource{ - Secret: &corev1.SecretVolumeSource{ - SecretName: b.Spec.Datastreams.IAMServiceAccountKey.Name, - Items: []corev1.KeyToPath{ - { - Key: b.Spec.Datastreams.IAMServiceAccountKey.Key, - Path: v1alpha1.DatastreamsIAMServiceAccountKeyFile, - }, + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: fmt.Sprintf(EncryptionKeyConfigNameFormat, b.GetName()), }, }, }, } + + return []corev1.Volume{encryptionKeySecret, encryptionKeyConfig} } func (b *DatabaseStatefulSetBuilder) buildContainer() corev1.Container { @@ -362,6 +424,7 @@ func (b *DatabaseStatefulSetBuilder) buildContainer() corev1.Container { if b.Spec.Image.PullPolicyName != nil { imagePullPolicy = *b.Spec.Image.PullPolicyName } + container := corev1.Container{ Name: "ydb-dynamic", Image: b.Spec.Image.Name, @@ -370,36 +433,31 @@ func (b *DatabaseStatefulSetBuilder) buildContainer() corev1.Container { Args: args, Env: b.buildEnv(), - VolumeMounts: b.buildVolumeMounts(), - SecurityContext: &corev1.SecurityContext{ - Privileged: ptr.Bool(false), - Capabilities: &corev1.Capabilities{ - Add: []corev1.Capability{"SYS_RAWIO"}, - }, - }, + VolumeMounts: b.buildVolumeMounts(), + SecurityContext: mergeSecurityContextWithDefaults(b.Spec.SecurityContext), } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationDisableLivenessProbe]; !ok || value != v1alpha1.AnnotationValueTrue { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationDisableLivenessProbe]; !ok || value != api.AnnotationValueTrue { container.LivenessProbe = &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ TCPSocket: &corev1.TCPSocketAction{ - Port: intstr.FromInt(v1alpha1.GRPCPort), + Port: intstr.FromInt(api.GRPCPort), }, }, } } ports := []corev1.ContainerPort{{ - Name: "grpc", ContainerPort: v1alpha1.GRPCPort, + Name: "grpc", ContainerPort: api.GRPCPort, }, { - Name: "interconnect", ContainerPort: v1alpha1.InterconnectPort, + Name: "interconnect", ContainerPort: api.InterconnectPort, }, { - Name: "status", ContainerPort: v1alpha1.StatusPort, + Name: "status", ContainerPort: api.StatusPort, }} if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled { ports = append(ports, corev1.ContainerPort{ - Name: "datastreams", ContainerPort: v1alpha1.DatastreamsPort, + Name: "datastreams", ContainerPort: api.DatastreamsPort, }) } @@ -419,14 +477,15 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: configVolumeName, ReadOnly: true, - MountPath: v1alpha1.ConfigDir, + MountPath: fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName), + SubPath: api.ConfigFileName, }) if b.Spec.Service.GRPC.TLSConfiguration.Enabled { volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: grpcTLSVolumeName, + Name: GRPCTLSVolumeName, ReadOnly: true, - MountPath: "/tls/grpc", // fixme const + MountPath: grpcTLSVolumeMountPath, }) } @@ -434,29 +493,39 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: interconnectTLSVolumeName, ReadOnly: true, - MountPath: "/tls/interconnect", // fixme const + MountPath: interconnectTLSVolumeMountPath, }) } - if b.Spec.Encryption != nil && b.Spec.Encryption.Enabled { + if b.Spec.Service.Status.TLSConfiguration.Enabled { volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: encryptionVolumeName, + Name: statusTLSVolumeName, ReadOnly: true, - MountPath: v1alpha1.DatabaseEncryptionKeyPath, + MountPath: statusTLSVolumeMountPath, }) } - if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled { + if b.Spec.Encryption != nil && b.Spec.Encryption.Enabled { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: encryptionKeyConfigVolumeName, + ReadOnly: true, + MountPath: fmt.Sprintf("%s/%s", api.ConfigDir, api.DatabaseEncryptionKeyConfigFile), + SubPath: api.DatabaseEncryptionKeyConfigFile, + }) + volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: datastreamsIAMServiceAccountKeyVolumeName, + Name: encryptionKeySecretVolumeName, ReadOnly: true, - MountPath: v1alpha1.DatastreamsIAMServiceAccountKeyPath, + MountPath: fmt.Sprintf("%s/%s", wellKnownDirForAdditionalSecrets, api.DatabaseEncryptionKeySecretDir), }) + } + + if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled { if b.Spec.Service.Datastreams.TLSConfiguration.Enabled { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: datastreamsTLSVolumeName, ReadOnly: true, - MountPath: "/tls/datastreams", // fixme const + MountPath: datastreamsTLSVolumeMountPath, }) } } @@ -468,7 +537,7 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { }) } - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: localCertsVolumeName, MountPath: localCertsDir, @@ -490,96 +559,152 @@ func (b *DatabaseStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { return volumeMounts } -func (b *DatabaseStatefulSetBuilder) buildCaStorePatchingInitContainerArgs() ([]string, []string) { - command := []string{"/bin/bash", "-c"} - - arg := "" - - if len(b.Spec.CABundle) > 0 { - arg += fmt.Sprintf("printf $%s | base64 --decode > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName) - } - - if b.Spec.Service.GRPC.TLSConfiguration.Enabled { - arg += fmt.Sprintf("cp /tls/grpc/ca.crt %s/grpcRoot.crt && ", localCertsDir) // fixme const - } - - if b.Spec.Service.Interconnect.TLSConfiguration.Enabled { - arg += fmt.Sprintf("cp /tls/interconnect/ca.crt %s/interconnectRoot.crt && ", localCertsDir) // fixme const - } - - if arg != "" { - arg += updateCACertificatesBin - } - - args := []string{arg} - - return command, args -} - func (b *DatabaseStatefulSetBuilder) buildContainerArgs() ([]string, []string) { - command := []string{fmt.Sprintf("%s/%s", v1alpha1.BinariesDir, v1alpha1.DaemonBinaryName)} + domain := api.DefaultDomainName + if dnsAnnotation, ok := b.GetAnnotations()[api.DNSDomainAnnotation]; ok { + domain = dnsAnnotation + } + command := []string{fmt.Sprintf("%s/%s", api.BinariesDir, api.DaemonBinaryName)} args := []string{ "server", "--mon-port", - fmt.Sprintf("%d", v1alpha1.StatusPort), + fmt.Sprintf("%d", api.StatusPort), "--ic-port", - fmt.Sprintf("%d", v1alpha1.InterconnectPort), + fmt.Sprintf("%d", api.InterconnectPort), "--yaml-config", - fmt.Sprintf("%s/%s", v1alpha1.ConfigDir, v1alpha1.ConfigFileName), + fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName), "--tenant", b.GetDatabasePath(), "--node-broker", b.Spec.StorageEndpoint, + + "--label", + fmt.Sprintf("%s=%s", api.LabelDeploymentKey, api.LabelDeploymentValueKubernetes), } - for _, secret := range b.Spec.Secrets { - exists, err := checkSecretHasField( - b.GetNamespace(), - secret.Name, - v1alpha1.YdbAuthToken, - b.RestConfig, + if b.Spec.SharedResources != nil { + args = append(args, + "--label", + fmt.Sprintf("%s=%s", api.LabelSharedDatabaseKey, api.LabelSharedDatabaseValueTrue), + ) + } else { + args = append(args, + "--label", + fmt.Sprintf("%s=%s", api.LabelSharedDatabaseKey, api.LabelSharedDatabaseValueFalse), ) + } + + if b.Spec.Encryption != nil && b.Spec.Encryption.Enabled { + args = append(args, + "--key-file", + fmt.Sprintf("%s/%s", api.ConfigDir, api.DatabaseEncryptionKeyConfigFile), + ) + } - if err != nil { - log.Default().Printf("Failed to inspect a secret %s: %s\n", secret.Name, err.Error()) - } else if exists { + // hotfix KIKIMR-16728 + if b.Spec.Service.GRPC.TLSConfiguration.Enabled { + args = append(args, + "--grpc-cert", + fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificate), + "--grpc-key", + fmt.Sprintf("%s/%s", grpcTLSVolumeMountPath, wellKnownNameForTLSPrivateKey), + "--grpc-ca", + fmt.Sprintf("%s/%s", systemCertsDir, caCertificatesFileName), + ) + } + + if b.Spec.Service.Status.TLSConfiguration.Enabled { + args = append(args, + "--mon-cert", + fmt.Sprintf("%s/%s", statusTLSVolumeMountPath, statusBundleFileName), + ) + } + + authTokenSecretName := api.AuthTokenSecretName + authTokenSecretKey := api.AuthTokenSecretKey + if value, ok := b.ObjectMeta.Annotations[api.AnnotationAuthTokenSecretName]; ok { + authTokenSecretName = value + } + if value, ok := b.ObjectMeta.Annotations[api.AnnotationAuthTokenSecretKey]; ok { + authTokenSecretKey = value + } + for _, secret := range b.Spec.Secrets { + if secret.Name == authTokenSecretName { args = append(args, - "--auth-token-file", + api.AuthTokenFileArg, fmt.Sprintf( "%s/%s/%s", wellKnownDirForAdditionalSecrets, - secret.Name, - v1alpha1.YdbAuthToken, + authTokenSecretName, + authTokenSecretKey, ), ) } } publicHostOption := "--grpc-public-host" - publicHost := fmt.Sprintf(v1alpha1.GRPCServiceFQDNFormat, b.Database.Name, b.GetNamespace()) // FIXME .svc.cluster.local + publicHostDomain := fmt.Sprintf(api.InterconnectServiceFQDNFormat, b.Database.Name, b.GetNamespace(), domain) + publicHost := fmt.Sprintf("%s.%s", "$(POD_NAME)", publicHostDomain) + if b.Spec.Service.GRPC.ExternalHost != "" { - publicHost = b.Spec.Service.GRPC.ExternalHost + publicHost = fmt.Sprintf("%s.%s", "$(POD_NAME)", b.Spec.Service.GRPC.ExternalHost) + } + if value, ok := b.ObjectMeta.Annotations[api.AnnotationGRPCPublicHost]; ok { + publicHost = value } + if !(strings.HasPrefix(publicHost, "$(POD_NAME)") || strings.HasPrefix(publicHost, "$(NODE_NAME)")) { + publicHost = fmt.Sprintf("%s.%s", "$(POD_NAME)", publicHost) + } + + if b.Spec.Service.GRPC.IPDiscovery != nil && b.Spec.Service.GRPC.IPDiscovery.Enabled { + targetNameOverride := b.Spec.Service.GRPC.IPDiscovery.TargetNameOverride + ipFamilyArg := "--grpc-public-address-v4" + + if b.Spec.Service.GRPC.IPDiscovery.IPFamily == corev1.IPv6Protocol { + ipFamilyArg = "--grpc-public-address-v6" + } + + args = append( + args, + + ipFamilyArg, + "$(POD_IP)", + ) + if targetNameOverride != "" { + args = append( + args, + "--grpc-public-target-name-override", + fmt.Sprintf("%s.%s", "$(POD_NAME)", targetNameOverride), + ) + } + } + publicPortOption := "--grpc-public-port" - publicPort := v1alpha1.GRPCPort + publicPort := fmt.Sprintf("%d", api.GRPCPort) + if b.Spec.Service.GRPC.ExternalPort > 0 { + publicPort = fmt.Sprintf("%d", b.Spec.Service.GRPC.ExternalPort) + } + if value, ok := b.ObjectMeta.Annotations[api.AnnotationGRPCPublicPort]; ok { + publicPort = value + } args = append( args, publicHostOption, - fmt.Sprintf("%s.%s", "$(NODE_NAME)", publicHost), // fixme $(NODE_NAME) + publicHost, publicPortOption, - strconv.Itoa(publicPort), + publicPort, ) - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationDataCenter]; ok { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationDataCenter]; ok { if annotationDataCenterPattern.MatchString(value) { args = append(args, "--data-center", @@ -588,14 +713,14 @@ func (b *DatabaseStatefulSetBuilder) buildContainerArgs() ([]string, []string) { } } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationNodeHost]; ok { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationNodeHost]; ok { args = append(args, "--node-host", value, ) } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationNodeDomain]; ok { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationNodeDomain]; ok { args = append(args, "--node-domain", value, diff --git a/internal/resources/databasenodeset.go b/internal/resources/databasenodeset.go index c6d04060..478cc0b2 100644 --- a/internal/resources/databasenodeset.go +++ b/internal/resources/databasenodeset.go @@ -3,21 +3,20 @@ package resources import ( "errors" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" ) type DatabaseNodeSetBuilder struct { client.Object - Name string - Labels map[string]string + Name string + Labels map[string]string + Annotations map[string]string DatabaseNodeSetSpec api.DatabaseNodeSetSpec } @@ -38,6 +37,8 @@ func (b *DatabaseNodeSetBuilder) Build(obj client.Object) error { dns.ObjectMeta.Namespace = b.GetNamespace() dns.ObjectMeta.Labels = b.Labels + dns.ObjectMeta.Annotations = b.Annotations + dns.Spec = b.DatabaseNodeSetSpec return nil @@ -53,25 +54,23 @@ func (b *DatabaseNodeSetBuilder) Placeholder(cr client.Object) client.Object { } func (b *DatabaseNodeSetResource) GetResourceBuilders(restConfig *rest.Config) []ResourceBuilder { - database := b.recastDatabaseNodeSet() + ydbCr := api.RecastDatabaseNodeSet(b.Unwrap()) + databaseBuilder := NewDatabase(ydbCr) + + statefulSetName := b.Name + statefulSetLabels := databaseBuilder.buildLabels() + statefulSetAnnotations := CopyDict(b.Spec.AdditionalAnnotations) + statefulSetAnnotations[annotations.ConfigurationChecksum] = SHAChecksum(b.Spec.Configuration) var resourceBuilders []ResourceBuilder resourceBuilders = append(resourceBuilders, &DatabaseStatefulSetBuilder{ - Database: database.DeepCopy(), + Database: ydbCr, RestConfig: restConfig, - Name: b.Name, - Labels: b.Labels, - }, - &ConfigMapBuilder{ - Object: b, - - Name: b.Name, - Data: map[string]string{ - api.ConfigFileName: b.Spec.Configuration, - }, - Labels: b.Labels, + Name: statefulSetName, + Labels: statefulSetLabels, + Annotations: statefulSetAnnotations, }, ) return resourceBuilders @@ -80,42 +79,13 @@ func (b *DatabaseNodeSetResource) GetResourceBuilders(restConfig *rest.Config) [ func NewDatabaseNodeSet(databaseNodeSet *api.DatabaseNodeSet) DatabaseNodeSetResource { crDatabaseNodeSet := databaseNodeSet.DeepCopy() - return DatabaseNodeSetResource{DatabaseNodeSet: crDatabaseNodeSet} -} - -func (b *DatabaseNodeSetResource) SetStatusOnFirstReconcile() (bool, ctrl.Result, error) { - if b.Status.Conditions == nil { - b.Status.Conditions = []metav1.Condition{} - - if b.Spec.Pause { - meta.SetStatusCondition(&b.Status.Conditions, metav1.Condition{ - Type: DatabasePausedCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Transitioning DatabaseNodeSet to Paused state", - }) - - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil - } + if crDatabaseNodeSet.Spec.Service.Status.TLSConfiguration == nil { + crDatabaseNodeSet.Spec.Service.Status.TLSConfiguration = &api.TLSConfiguration{Enabled: false} } - return Continue, ctrl.Result{}, nil + return DatabaseNodeSetResource{DatabaseNodeSet: crDatabaseNodeSet} } func (b *DatabaseNodeSetResource) Unwrap() *api.DatabaseNodeSet { return b.DeepCopy() } - -func (b *DatabaseNodeSetResource) recastDatabaseNodeSet() *api.Database { - return &api.Database{ - ObjectMeta: metav1.ObjectMeta{ - Name: b.DatabaseNodeSet.Spec.DatabaseRef.Name, - Namespace: b.DatabaseNodeSet.Spec.DatabaseRef.Namespace, - Labels: b.DatabaseNodeSet.Labels, - }, - Spec: api.DatabaseSpec{ - DatabaseClusterSpec: b.Spec.DatabaseClusterSpec, - DatabaseNodeSpec: b.Spec.DatabaseNodeSpec, - }, - } -} diff --git a/internal/resources/encryption.go b/internal/resources/encryption.go index 276370a8..a3187007 100644 --- a/internal/resources/encryption.go +++ b/internal/resources/encryption.go @@ -2,6 +2,7 @@ package resources import ( "errors" + "fmt" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -13,8 +14,8 @@ import ( type EncryptionSecretBuilder struct { client.Object - Pin string Labels map[string]string + Pin string } func (b *EncryptionSecretBuilder) Build(obj client.Object) error { @@ -28,17 +29,17 @@ func (b *EncryptionSecretBuilder) Build(obj client.Object) error { } sec.ObjectMeta.Namespace = b.GetNamespace() - // Do not update already existing secret data - if (sec.StringData == nil || len(sec.StringData) == 0) && (sec.Data == nil || len(sec.Data) == 0) { - key, err := encryption.GenerateRSAKey(b.Pin) - if err != nil { - return err - } - sec.StringData = map[string]string{ - defaultEncryptionSecretKey: key, - } - } sec.Labels = b.Labels + + key, err := encryption.GenerateRSAKey(b.Pin) + if err != nil { + return fmt.Errorf("failed to generate key for encryption: %w", err) + } + + sec.StringData = map[string]string{ + wellKnownNameForEncryptionKeySecret: key, + } + sec.Type = corev1.SecretTypeOpaque return nil @@ -47,7 +48,7 @@ func (b *EncryptionSecretBuilder) Build(obj client.Object) error { func (b *EncryptionSecretBuilder) Placeholder(cr client.Object) client.Object { return &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ - Name: cr.GetName(), + Name: b.GetName(), Namespace: cr.GetNamespace(), }, } diff --git a/internal/resources/predicate.go b/internal/resources/predicate.go new file mode 100644 index 00000000..65e1a241 --- /dev/null +++ b/internal/resources/predicate.go @@ -0,0 +1,91 @@ +package resources + +import ( + "k8s.io/apimachinery/pkg/labels" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/predicate" + + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" +) + +func LastAppliedAnnotationPredicate() predicate.Predicate { + return predicate.Funcs{ + UpdateFunc: func(e event.UpdateEvent) bool { + return !annotations.CompareLastAppliedAnnotation( + e.ObjectOld.GetAnnotations(), + e.ObjectNew.GetAnnotations(), + ) + }, + } +} + +func IsStorageCreatePredicate() predicate.Predicate { + return predicate.Funcs{ + CreateFunc: func(e event.CreateEvent) bool { + _, isStorage := e.Object.(*api.Storage) + return isStorage + }, + } +} + +func IsStorageNodeSetCreatePredicate() predicate.Predicate { + return predicate.Funcs{ + CreateFunc: func(e event.CreateEvent) bool { + _, isStorageNodeSet := e.Object.(*api.StorageNodeSet) + return isStorageNodeSet + }, + } +} + +func IsRemoteStorageNodeSetCreatePredicate() predicate.Predicate { + return predicate.Funcs{ + CreateFunc: func(e event.CreateEvent) bool { + _, isRemoteStorageNodeSet := e.Object.(*api.RemoteStorageNodeSet) + return isRemoteStorageNodeSet + }, + } +} + +func IsDatabaseCreatePredicate() predicate.Predicate { + return predicate.Funcs{ + CreateFunc: func(e event.CreateEvent) bool { + _, isDatabase := e.Object.(*api.Database) + return isDatabase + }, + } +} + +func IsDatabaseNodeSetCreatePredicate() predicate.Predicate { + return predicate.Funcs{ + CreateFunc: func(e event.CreateEvent) bool { + _, isDatabaseNodeSet := e.Object.(*api.DatabaseNodeSet) + return isDatabaseNodeSet + }, + } +} + +func IsRemoteDatabaseNodeSetCreatePredicate() predicate.Predicate { + return predicate.Funcs{ + CreateFunc: func(e event.CreateEvent) bool { + _, isRemoteDatabaseNodeSet := e.Object.(*api.RemoteDatabaseNodeSet) + return isRemoteDatabaseNodeSet + }, + } +} + +func IgnoreDeleteStateUnknownPredicate() predicate.Predicate { + return predicate.Funcs{ + DeleteFunc: func(e event.DeleteEvent) bool { + // Evaluates to false if the object has been confirmed deleted. + return !e.DeleteStateUnknown + }, + } +} + +func LabelExistsPredicate(selector labels.Selector) predicate.Predicate { + return predicate.NewPredicateFuncs(func(o client.Object) bool { + return selector.Matches(labels.Set(o.GetLabels())) + }) +} diff --git a/internal/resources/remotedatabasenodeset.go b/internal/resources/remotedatabasenodeset.go new file mode 100644 index 00000000..e4d776a8 --- /dev/null +++ b/internal/resources/remotedatabasenodeset.go @@ -0,0 +1,253 @@ +package resources + +import ( + "errors" + "fmt" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck +) + +type RemoteDatabaseNodeSetBuilder struct { + client.Object + + Name string + Labels map[string]string + Annotations map[string]string + + DatabaseNodeSetSpec api.DatabaseNodeSetSpec +} + +type RemoteDatabaseNodeSetResource struct { + *api.RemoteDatabaseNodeSet +} + +func (b *RemoteDatabaseNodeSetBuilder) Build(obj client.Object) error { + dns, ok := obj.(*api.RemoteDatabaseNodeSet) + if !ok { + return errors.New("failed to cast to RemoteDatabaseNodeSet object") + } + + if dns.ObjectMeta.Name == "" { + dns.ObjectMeta.Name = b.Name + } + dns.ObjectMeta.Namespace = b.GetNamespace() + + dns.ObjectMeta.Labels = b.Labels + dns.ObjectMeta.Annotations = b.Annotations + + dns.Spec = b.DatabaseNodeSetSpec + + return nil +} + +func (b *RemoteDatabaseNodeSetBuilder) Placeholder(cr client.Object) client.Object { + return &api.RemoteDatabaseNodeSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Name, + Namespace: cr.GetNamespace(), + }, + } +} + +func (b *RemoteDatabaseNodeSetResource) GetResourceBuilders() []ResourceBuilder { + var resourceBuilders []ResourceBuilder + + nodeSetAnnotations := CopyDict(b.Annotations) + delete(nodeSetAnnotations, ydbannotations.LastAppliedAnnotation) + + resourceBuilders = append(resourceBuilders, + &DatabaseNodeSetBuilder{ + Object: b, + + Name: b.Name, + Labels: b.Labels, + Annotations: nodeSetAnnotations, + + DatabaseNodeSetSpec: b.Spec, + }, + ) + + return resourceBuilders +} + +func NewRemoteDatabaseNodeSet(remoteDatabaseNodeSet *api.RemoteDatabaseNodeSet) RemoteDatabaseNodeSetResource { + crRemoteDatabaseNodeSet := remoteDatabaseNodeSet.DeepCopy() + + if crRemoteDatabaseNodeSet.Spec.Service.Status.TLSConfiguration == nil { + crRemoteDatabaseNodeSet.Spec.Service.Status.TLSConfiguration = &api.TLSConfiguration{Enabled: false} + } + + return RemoteDatabaseNodeSetResource{RemoteDatabaseNodeSet: crRemoteDatabaseNodeSet} +} + +func (b *RemoteDatabaseNodeSetResource) GetRemoteObjects( + scheme *runtime.Scheme, +) []client.Object { + remoteObjects := []client.Object{} + + // sync Secrets + for _, secret := range b.Spec.Secrets { + remoteObjects = append(remoteObjects, + &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: secret.Name, + Namespace: b.Namespace, + }, + }) + } + + // sync ConfigMap + if b.Spec.Configuration != "" { + remoteObjects = append(remoteObjects, + &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Spec.DatabaseRef.Name, + Namespace: b.Namespace, + }, + }) + } else { + remoteObjects = append(remoteObjects, + &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Spec.StorageClusterRef.Name, + Namespace: b.Namespace, + }, + }) + } + + // sync Services + remoteObjects = append(remoteObjects, + &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(GRPCServiceNameFormat, b.Spec.DatabaseRef.Name), + Namespace: b.Namespace, + }, + }, + &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(InterconnectServiceNameFormat, b.Spec.DatabaseRef.Name), + Namespace: b.Namespace, + }, + }, + &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(StatusServiceNameFormat, b.Spec.DatabaseRef.Name), + Namespace: b.Namespace, + }, + }, + ) + if b.Spec.Datastreams != nil && b.Spec.Datastreams.Enabled { + remoteObjects = append(remoteObjects, + &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(DatastreamsServiceNameFormat, b.Spec.DatabaseRef.Name), + Namespace: b.Namespace, + }, + }) + } + + for _, remoteObj := range remoteObjects { + remoteObjGVK, _ := apiutil.GVKForObject(remoteObj, scheme) + remoteObj.GetObjectKind().SetGroupVersionKind(remoteObjGVK) + } + + return remoteObjects +} + +func (b *RemoteDatabaseNodeSetResource) SetPrimaryResourceAnnotations(obj client.Object) { + annotations := make(map[string]string) + for key, value := range obj.GetAnnotations() { + annotations[key] = value + } + + if _, exist := annotations[ydbannotations.PrimaryResourceDatabaseAnnotation]; !exist { + annotations[ydbannotations.PrimaryResourceDatabaseAnnotation] = b.Spec.DatabaseRef.Name + } + + obj.SetAnnotations(annotations) +} + +func (b *RemoteDatabaseNodeSetResource) UnsetPrimaryResourceAnnotations(obj client.Object) { + annotations := make(map[string]string) + for key, value := range obj.GetAnnotations() { + if key != annotations[ydbannotations.PrimaryResourceDatabaseAnnotation] { + annotations[key] = value + } + } + obj.SetAnnotations(annotations) +} + +func (b *RemoteDatabaseNodeSetResource) CreateRemoteResourceStatus( + remoteObj client.Object, +) { + b.Status.RemoteResources = append( + b.Status.RemoteResources, + api.RemoteResource{ + Group: remoteObj.GetObjectKind().GroupVersionKind().Group, + Version: remoteObj.GetObjectKind().GroupVersionKind().Version, + Kind: remoteObj.GetObjectKind().GroupVersionKind().Kind, + Name: remoteObj.GetName(), + State: ResourceSyncPending, + Conditions: []metav1.Condition{}, + }, + ) + meta.SetStatusCondition( + &b.Status.RemoteResources[len(b.Status.RemoteResources)-1].Conditions, + metav1.Condition{ + Type: RemoteResourceSyncedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + }, + ) +} + +func (b *RemoteDatabaseNodeSetResource) UpdateRemoteResourceStatus( + remoteResource *api.RemoteResource, + status metav1.ConditionStatus, + resourceVersion string, +) { + if status == metav1.ConditionFalse { + meta.SetStatusCondition(&remoteResource.Conditions, + metav1.Condition{ + Type: RemoteResourceSyncedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + Message: fmt.Sprintf("Failed to sync remoteObject to resourceVersion %s", resourceVersion), + }) + remoteResource.State = ResourceSyncPending + } + + if status == metav1.ConditionTrue { + meta.SetStatusCondition(&remoteResource.Conditions, + metav1.Condition{ + Type: RemoteResourceSyncedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + Message: fmt.Sprintf("Successfully synced remoteObject to resourceVersion %s", resourceVersion), + }) + remoteResource.State = ResourceSyncSuccess + } +} + +func (b *RemoteDatabaseNodeSetResource) RemoveRemoteResourceStatus(remoteObj client.Object) { + var idxRemoteObj int + for idx := range b.Status.RemoteResources { + if EqualRemoteResourceWithObject(&b.Status.RemoteResources[idx], remoteObj) { + idxRemoteObj = idx + break + } + } + b.Status.RemoteResources = append( + b.Status.RemoteResources[:idxRemoteObj], + b.Status.RemoteResources[idxRemoteObj+1:]..., + ) +} diff --git a/internal/resources/remotestoragenodeset.go b/internal/resources/remotestoragenodeset.go new file mode 100644 index 00000000..ad34c985 --- /dev/null +++ b/internal/resources/remotestoragenodeset.go @@ -0,0 +1,232 @@ +package resources + +import ( + "errors" + "fmt" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck +) + +type RemoteStorageNodeSetBuilder struct { + client.Object + + Name string + Labels map[string]string + Annotations map[string]string + + StorageNodeSetSpec api.StorageNodeSetSpec +} + +type RemoteStorageNodeSetResource struct { + *api.RemoteStorageNodeSet +} + +func (b *RemoteStorageNodeSetBuilder) Build(obj client.Object) error { + dns, ok := obj.(*api.RemoteStorageNodeSet) + if !ok { + return errors.New("failed to cast to RemoteStorageNodeSet object") + } + + if dns.ObjectMeta.Name == "" { + dns.ObjectMeta.Name = b.Name + } + dns.ObjectMeta.Namespace = b.GetNamespace() + + dns.ObjectMeta.Labels = b.Labels + dns.ObjectMeta.Annotations = b.Annotations + + dns.Spec = b.StorageNodeSetSpec + + return nil +} + +func (b *RemoteStorageNodeSetBuilder) Placeholder(cr client.Object) client.Object { + return &api.RemoteStorageNodeSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Name, + Namespace: cr.GetNamespace(), + }, + } +} + +func (b *RemoteStorageNodeSetResource) GetResourceBuilders() []ResourceBuilder { + var resourceBuilders []ResourceBuilder + + nodeSetAnnotations := CopyDict(b.Annotations) + delete(nodeSetAnnotations, ydbannotations.LastAppliedAnnotation) + + resourceBuilders = append(resourceBuilders, + &StorageNodeSetBuilder{ + Object: b, + + Name: b.Name, + Labels: b.Labels, + Annotations: nodeSetAnnotations, + + StorageNodeSetSpec: b.Spec, + }, + ) + + return resourceBuilders +} + +func NewRemoteStorageNodeSet(remoteStorageNodeSet *api.RemoteStorageNodeSet) RemoteStorageNodeSetResource { + crRemoteStorageNodeSet := remoteStorageNodeSet.DeepCopy() + + if crRemoteStorageNodeSet.Spec.Service.Status.TLSConfiguration == nil { + crRemoteStorageNodeSet.Spec.Service.Status.TLSConfiguration = &api.TLSConfiguration{Enabled: false} + } + + return RemoteStorageNodeSetResource{RemoteStorageNodeSet: crRemoteStorageNodeSet} +} + +func (b *RemoteStorageNodeSetResource) GetRemoteObjects( + scheme *runtime.Scheme, +) []client.Object { + remoteObjects := []client.Object{} + + // sync Secrets + for _, secret := range b.Spec.Secrets { + remoteObjects = append(remoteObjects, + &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: secret.Name, + Namespace: b.Namespace, + }, + }) + } + + // sync ConfigMap + remoteObjects = append(remoteObjects, + &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Spec.StorageRef.Name, + Namespace: b.Namespace, + }, + }) + + // sync Services + remoteObjects = append(remoteObjects, + &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(GRPCServiceNameFormat, b.Spec.StorageRef.Name), + Namespace: b.Namespace, + }, + }, + &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(InterconnectServiceNameFormat, b.Spec.StorageRef.Name), + Namespace: b.Namespace, + }, + }, + &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf(StatusServiceNameFormat, b.Spec.StorageRef.Name), + Namespace: b.Namespace, + }, + }, + ) + + for _, remoteObj := range remoteObjects { + remoteObjGVK, _ := apiutil.GVKForObject(remoteObj, scheme) + remoteObj.GetObjectKind().SetGroupVersionKind(remoteObjGVK) + } + + return remoteObjects +} + +func (b *RemoteStorageNodeSetResource) SetPrimaryResourceAnnotations(obj client.Object) { + annotations := make(map[string]string) + for key, value := range obj.GetAnnotations() { + annotations[key] = value + } + + if _, exist := annotations[ydbannotations.PrimaryResourceStorageAnnotation]; !exist { + annotations[ydbannotations.PrimaryResourceStorageAnnotation] = b.Spec.StorageRef.Name + } + + obj.SetAnnotations(annotations) +} + +func (b *RemoteStorageNodeSetResource) UnsetPrimaryResourceAnnotations(obj client.Object) { + annotations := make(map[string]string) + for key, value := range obj.GetAnnotations() { + if key != annotations[ydbannotations.PrimaryResourceStorageAnnotation] { + annotations[key] = value + } + } + obj.SetAnnotations(annotations) +} + +func (b *RemoteStorageNodeSetResource) CreateRemoteResourceStatus(remoteObj client.Object) { + b.Status.RemoteResources = append( + b.Status.RemoteResources, + api.RemoteResource{ + Group: remoteObj.GetObjectKind().GroupVersionKind().Group, + Version: remoteObj.GetObjectKind().GroupVersionKind().Version, + Kind: remoteObj.GetObjectKind().GroupVersionKind().Kind, + Name: remoteObj.GetName(), + State: ResourceSyncPending, + Conditions: []metav1.Condition{}, + }, + ) + meta.SetStatusCondition( + &b.Status.RemoteResources[len(b.Status.RemoteResources)-1].Conditions, + metav1.Condition{ + Type: RemoteResourceSyncedCondition, + Status: metav1.ConditionUnknown, + Reason: ReasonInProgress, + }, + ) +} + +func (b *RemoteStorageNodeSetResource) UpdateRemoteResourceStatus( + remoteResource *api.RemoteResource, + status metav1.ConditionStatus, + resourceVersion string, +) { + if status == metav1.ConditionFalse { + meta.SetStatusCondition(&remoteResource.Conditions, + metav1.Condition{ + Type: RemoteResourceSyncedCondition, + Status: metav1.ConditionFalse, + Reason: ReasonInProgress, + Message: fmt.Sprintf("Failed to sync remoteObject to resourceVersion %s", resourceVersion), + }) + remoteResource.State = ResourceSyncPending + } + + if status == metav1.ConditionTrue { + meta.SetStatusCondition(&remoteResource.Conditions, + metav1.Condition{ + Type: RemoteResourceSyncedCondition, + Status: metav1.ConditionTrue, + Reason: ReasonCompleted, + Message: fmt.Sprintf("Successfully synced remoteObject to resourceVersion %s", resourceVersion), + }) + remoteResource.State = ResourceSyncSuccess + } +} + +func (b *RemoteStorageNodeSetResource) RemoveRemoteResourceStatus(remoteObj client.Object) { + var idxRemoteObj int + for idx := range b.Status.RemoteResources { + if EqualRemoteResourceWithObject(&b.Status.RemoteResources[idx], remoteObj) { + idxRemoteObj = idx + break + } + } + b.Status.RemoteResources = append( + b.Status.RemoteResources[:idxRemoteObj], + b.Status.RemoteResources[idxRemoteObj+1:]..., + ) +} diff --git a/internal/resources/resource.go b/internal/resources/resource.go index 2cf2d9bc..81acea22 100644 --- a/internal/resources/resource.go +++ b/internal/resources/resource.go @@ -2,46 +2,78 @@ package resources import ( "context" + "crypto/sha256" + "encoding/hex" + "errors" "fmt" "github.com/banzaicloud/k8s-objectmatcher/patch" + "github.com/golang-jwt/jwt/v4" + ydb "github.com/ydb-platform/ydb-go-sdk/v3" + ydbCredentials "github.com/ydb-platform/ydb-go-sdk/v3/credentials" appsv1 "k8s.io/api/apps/v1" - "k8s.io/apimachinery/pkg/api/errors" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/rest" + "k8s.io/kubectl/pkg/scheme" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" ctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/connection" ) const ( - grpcServiceNameFormat = "%s-grpc" - interconnectServiceNameFormat = "%s-interconnect" - statusServiceNameFormat = "%s-status" - datastreamsServiceNameFormat = "%s-datastreams" + GRPCServiceNameFormat = "%s-grpc" + InterconnectServiceNameFormat = "%s-interconnect" + StatusServiceNameFormat = "%s-status" + DatastreamsServiceNameFormat = "%s-datastreams" - grpcTLSVolumeName = "grpc-tls-volume" + GRPCTLSVolumeName = "grpc-tls-volume" interconnectTLSVolumeName = "interconnect-tls-volume" datastreamsTLSVolumeName = "datastreams-tls-volume" + statusTLSVolumeName = "status-tls-volume" + statusOriginTLSVolumeName = "status-origin-tls-volume" + + grpcTLSVolumeMountPath = "/tls/grpc" + interconnectTLSVolumeMountPath = "/tls/interconnect" + datastreamsTLSVolumeMountPath = "/tls/datastreams" + statusTLSVolumeMountPath = "/tls/status" + statusOriginTLSVolumeMountPath = "/tls/status-origin" - systemCertsVolumeName = "init-main-shared-certs-volume" - localCertsVolumeName = "init-main-shared-source-dir-volume" + InitJobNameFormat = "%s-blobstorage-init" + OperatorTokenSecretNameFormat = "%s-operator-token" + EncryptionKeyConfigNameFormat = "%s-encryption-key" - wellKnownDirForAdditionalSecrets = "/opt/ydb/secrets" - wellKnownDirForAdditionalVolumes = "/opt/ydb/volumes" + systemCertsVolumeName = "init-main-shared-certs-volume" + localCertsVolumeName = "init-main-shared-source-dir-volume" + operatorTokenVolumeName = "operator-token-volume" - caBundleEnvName = "CA_BUNDLE" - caBundleFileName = "userCABundle.crt" + wellKnownDirForAdditionalSecrets = "/opt/ydb/secrets" + wellKnownDirForAdditionalVolumes = "/opt/ydb/volumes" + wellKnownNameForOperatorToken = "token-file" + wellKnownNameForTLSCertificateAuthority = "ca.crt" + wellKnownNameForTLSCertificate = "tls.crt" + wellKnownNameForTLSPrivateKey = "tls.key" + wellKnownNameForEncryptionKeySecret = "key" + + caBundleEnvName = "CA_BUNDLE" + caBundleFileName = "userCABundle.crt" + caCertificatesFileName = "ca-certificates.crt" + updateCACertificatesBin = "update-ca-certificates" + statusBundleFileName = "web.pem" localCertsDir = "/usr/local/share/ca-certificates" systemCertsDir = "/etc/ssl/certs" - lastAppliedAnnotation = "ydb.tech/last-applied" - encryptionVolumeName = "encryption" - datastreamsIAMServiceAccountKeyVolumeName = "datastreams-iam-sa-key" - defaultEncryptionSecretKey = "key" - defaultPin = "EmptyPin" - - updateCACertificatesBin = "update-ca-certificates" + encryptionKeyConfigVolumeName = "encryption-config" + encryptionKeySecretVolumeName = "encryption-key" ) type ResourceBuilder interface { @@ -50,7 +82,7 @@ type ResourceBuilder interface { } var ( - annotator = patch.NewAnnotator(lastAppliedAnnotation) + annotator = patch.NewAnnotator(ydbannotations.LastAppliedAnnotation) patchMaker = patch.NewPatchMaker(annotator) ) @@ -69,6 +101,12 @@ func mutate(f ctrlutil.MutateFn, key client.ObjectKey, obj client.Object) error type IgnoreChangesFunction func(oldObj, newObj runtime.Object) bool +func DoNotIgnoreChanges() IgnoreChangesFunction { + return func(oldObj, newObj runtime.Object) bool { + return false + } +} + func tryProcessNonExistingObject( ctx context.Context, c client.Client, @@ -84,7 +122,7 @@ func tryProcessNonExistingObject( return true, ctrlutil.OperationResultNone, nil } - if !errors.IsNotFound(err) { + if !apierrors.IsNotFound(err) { return false, ctrlutil.OperationResultNone, err } @@ -132,6 +170,15 @@ func CreateOrUpdateOrMaybeIgnore( return ctrlutil.OperationResultNone, nil } + // Prevent updating selectorLabels for StatefulSet + if updated, ok := obj.(*appsv1.StatefulSet); ok { + existingMatchLabels := CopyDict(existing.(*appsv1.StatefulSet).Spec.Selector.MatchLabels) + updatedMatchLabels := CopyDict(updated.Spec.Selector.MatchLabels) + if !CompareMaps(updatedMatchLabels, existingMatchLabels) { + obj.(*appsv1.StatefulSet).Spec.Selector.MatchLabels = existingMatchLabels + } + } + changed, err := CheckObjectUpdatedIgnoreStatus(existing, obj) if err != nil || !changed { return ctrlutil.OperationResultNone, err @@ -166,3 +213,371 @@ func CopyDict(src map[string]string) map[string]string { } return dst } + +func CreateResource(obj client.Object) client.Object { + createdObj := obj.DeepCopyObject().(client.Object) + + // Remove or reset fields + createdObj.SetResourceVersion("") + createdObj.SetCreationTimestamp(metav1.Time{}) + createdObj.SetUID("") + createdObj.SetOwnerReferences([]metav1.OwnerReference{}) + createdObj.SetFinalizers([]string{}) + createdObj.SetManagedFields([]metav1.ManagedFieldsEntry{}) + + if svc, ok := createdObj.(*corev1.Service); ok { + svc.Spec.ClusterIP = "" + svc.Spec.ClusterIPs = nil + } + + // Set remoteResourceVersion annotation + SetRemoteResourceVersionAnnotation(createdObj, obj.GetResourceVersion()) + + return createdObj +} + +func UpdateResource(oldObj, newObj client.Object) client.Object { + updatedObj := newObj.DeepCopyObject().(client.Object) + + // Save current fields + updatedObj.SetResourceVersion(oldObj.GetResourceVersion()) + updatedObj.SetCreationTimestamp(oldObj.GetCreationTimestamp()) + updatedObj.SetUID(oldObj.GetUID()) + updatedObj.SetOwnerReferences(oldObj.GetOwnerReferences()) + updatedObj.SetFinalizers(oldObj.GetFinalizers()) + updatedObj.SetManagedFields(oldObj.GetManagedFields()) + + // Specific fields to save for Service object + if svc, ok := updatedObj.(*corev1.Service); ok { + svc.Spec.ClusterIP = oldObj.(*corev1.Service).Spec.ClusterIP + svc.Spec.ClusterIPs = append([]string{}, oldObj.(*corev1.Service).Spec.ClusterIPs...) + } + + // Copy primaryResource annotations + CopyPrimaryResourceObjectAnnotation(updatedObj, oldObj.GetAnnotations()) + + // Set remoteResourceVersion annotation + SetRemoteResourceVersionAnnotation(updatedObj, newObj.GetResourceVersion()) + + return updatedObj +} + +func CopyPrimaryResourceObjectAnnotation(obj client.Object, oldAnnotations map[string]string) { + annotations := CopyDict(obj.GetAnnotations()) + for key, value := range oldAnnotations { + if key == ydbannotations.PrimaryResourceDatabaseAnnotation || + key == ydbannotations.PrimaryResourceStorageAnnotation { + annotations[key] = value + } + } + obj.SetAnnotations(annotations) +} + +func SetRemoteResourceVersionAnnotation(obj client.Object, resourceVersion string) { + annotations := make(map[string]string) + for key, value := range obj.GetAnnotations() { + annotations[key] = value + } + annotations[ydbannotations.RemoteResourceVersionAnnotation] = resourceVersion + obj.SetAnnotations(annotations) +} + +func ConvertRemoteResourceToObject(remoteResource api.RemoteResource, namespace string) (client.Object, error) { + // Create an unstructured object + obj := &unstructured.Unstructured{ + Object: map[string]interface{}{ + "apiVersion": remoteResource.Version, + "group": remoteResource.Group, + "kind": remoteResource.Kind, + "metadata": map[string]interface{}{ + "name": remoteResource.Name, + "namespace": namespace, + }, + }, + } + + // Convert unstructured object to runtime.Object + var runtimeObj runtime.Object + runtimeObj, err := scheme.Scheme.New( + schema.GroupVersionKind{ + Group: remoteResource.Group, + Version: remoteResource.Version, + Kind: remoteResource.Kind, + }, + ) + if err != nil { + return nil, err + } + + // Copy data from unstructured to runtime object + err = scheme.Scheme.Convert(obj, runtimeObj, nil) + if err != nil { + return nil, err + } + + // Assert runtime.Object to client.Object + return runtimeObj.(client.Object), nil +} + +func GetPatchResult( + localObj client.Object, + remoteObj client.Object, +) (*patch.PatchResult, error) { + // Get diff resources and compare bytes by k8s-objectmatcher PatchMaker + updatedObj := UpdateResource(localObj, remoteObj) + patchResult, err := patchMaker.Calculate(localObj, updatedObj, + []patch.CalculateOption{ + patch.IgnoreStatusFields(), + }..., + ) + if err != nil { + return nil, err + } + + return patchResult, nil +} + +func EqualRemoteResourceWithObject( + remoteResource *api.RemoteResource, + remoteObj client.Object, +) bool { + if remoteObj.GetName() == remoteResource.Name && + remoteObj.GetObjectKind().GroupVersionKind().Kind == remoteResource.Kind && + remoteObj.GetObjectKind().GroupVersionKind().Group == remoteResource.Group && + remoteObj.GetObjectKind().GroupVersionKind().Version == remoteResource.Version { + return true + } + return false +} + +func getYDBStaticCredentials( + ctx context.Context, + storage *api.Storage, + restConfig *rest.Config, +) (ydbCredentials.Credentials, error) { + auth := storage.Spec.OperatorConnection + username := auth.StaticCredentials.Username + password := api.DefaultRootPassword + if auth.StaticCredentials.Password != nil { + var err error + password, err = GetSecretKey( + ctx, + storage.Namespace, + restConfig, + auth.StaticCredentials.Password.SecretKeyRef, + ) + if err != nil { + return nil, fmt.Errorf( + "failed to get password for StaticCredentials from secret: %s, key: %s, error: %w", + auth.StaticCredentials.Password.SecretKeyRef.Name, + auth.StaticCredentials.Password.SecretKeyRef.Key, + err) + } + } + endpoint := storage.GetStorageEndpoint() + + var caBundle []byte + if storage.IsStorageEndpointSecure() { + var err error + caBundle, err = getStorageGrpcServiceCABundle(ctx, storage, restConfig) + if err != nil { + return nil, err + } + } + dialOptions, err := connection.LoadTLSCredentials(storage.IsStorageEndpointSecure(), caBundle) + if err != nil { + return nil, err + } + + return ydbCredentials.NewStaticCredentials( + username, + password, + endpoint, + ydbCredentials.WithGrpcDialOptions(dialOptions), + ), nil +} + +func getYDBOauth2Credentials( + ctx context.Context, + storage *api.Storage, + restConfig *rest.Config, +) (ydbCredentials.Credentials, error) { + auth := storage.Spec.OperatorConnection + privateKey, err := GetSecretKey( + ctx, + storage.Namespace, + restConfig, + auth.Oauth2TokenExchange.PrivateKey.SecretKeyRef, + ) + if err != nil { + return nil, fmt.Errorf( + "failed to get RSA private key for Oauth2TokenExchange from secret: %s, key: %s, error: %w", + auth.Oauth2TokenExchange.PrivateKey.SecretKeyRef.Name, + auth.Oauth2TokenExchange.PrivateKey.SecretKeyRef.Key, + err) + } + + keyID := *auth.Oauth2TokenExchange.KeyID + signMethod := jwt.GetSigningMethod(auth.Oauth2TokenExchange.SignAlg) + privateKeyPEM, err := jwt.ParseRSAPrivateKeyFromPEM([]byte(privateKey)) + if err != nil { + return nil, fmt.Errorf( + "failed to parse RSA private key for Oauth2TokenExchange from secret: %s, key: %s, error: %w", + auth.Oauth2TokenExchange.PrivateKey.SecretKeyRef.Name, + auth.Oauth2TokenExchange.PrivateKey.SecretKeyRef.Key, + err, + ) + } + + return ydbCredentials.NewOauth2TokenExchangeCredentials( + ydbCredentials.WithTokenEndpoint(auth.Oauth2TokenExchange.Endpoint), + ydbCredentials.WithAudience(auth.Oauth2TokenExchange.Audience), + ydbCredentials.WithJWTSubjectToken( + ydbCredentials.WithKeyID(keyID), + ydbCredentials.WithSigningMethod(signMethod), + ydbCredentials.WithPrivateKey(privateKeyPEM), + ydbCredentials.WithIssuer(auth.Oauth2TokenExchange.Issuer), + ydbCredentials.WithSubject(auth.Oauth2TokenExchange.Subject), + ydbCredentials.WithID(auth.Oauth2TokenExchange.ID), + ydbCredentials.WithAudience(auth.Oauth2TokenExchange.Audience), + )) +} + +func GetYDBCredentials( + ctx context.Context, + storage *api.Storage, + restConfig *rest.Config, +) (ydbCredentials.Credentials, error) { + auth := storage.Spec.OperatorConnection + if auth == nil { + return ydbCredentials.NewAnonymousCredentials(), nil + } + + if auth.AccessToken != nil { + token, err := GetSecretKey( + ctx, + storage.Namespace, + restConfig, + auth.AccessToken.SecretKeyRef, + ) + if err != nil { + return nil, fmt.Errorf( + "failed to get token for AccessToken from secret: %s, key: %s, error: %w", + auth.AccessToken.SecretKeyRef.Name, + auth.AccessToken.SecretKeyRef.Key, + err) + } + + return ydbCredentials.NewAccessTokenCredentials(token), nil + } + + if auth.StaticCredentials != nil { + return getYDBStaticCredentials(ctx, storage, restConfig) + } + + if auth.Oauth2TokenExchange != nil { + return getYDBOauth2Credentials(ctx, storage, restConfig) + } + + return nil, errors.New("unsupported auth type for GetYDBCredentials") +} + +func getStorageGrpcServiceCABundle( + ctx context.Context, + storage *api.Storage, + restConfig *rest.Config, +) ([]byte, error) { + if !storage.IsStorageEndpointSecure() { + return nil, errors.New("can't get storage grpc CA for insecure endpoint") + } + + tlsConfig := storage.Spec.Service.GRPC.TLSConfiguration + caBody, err := GetSecretKey( + ctx, + storage.Namespace, + restConfig, + &tlsConfig.CertificateAuthority, + ) + if err != nil { + return nil, fmt.Errorf( + "failed to get CA for storage grpc service from secret: %s, key: %s, error: %w", + tlsConfig.CertificateAuthority.Name, + tlsConfig.CertificateAuthority.Key, + err) + } + return []byte(caBody), nil +} + +func GetYDBTLSOption( + ctx context.Context, + storage *api.Storage, + restConfig *rest.Config, +) (ydb.Option, error) { + if !storage.IsStorageEndpointSecure() { + return ydb.WithInsecure(), nil + } + caBundle, err := getStorageGrpcServiceCABundle(ctx, storage, restConfig) + if err != nil { + return nil, err + } + return ydb.WithCertificatesFromPem(caBundle), nil +} + +func buildCAStorePatchingCommandArgs( + caBundle string, + grpcService api.GRPCService, + interconnectService api.InterconnectService, + statusService api.StatusService, +) ([]string, []string) { + command := []string{"/bin/bash", "-c"} + + arg := "" + + if len(caBundle) > 0 { + arg += fmt.Sprintf("printf $%s | base64 --decode > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName) + } + + if grpcService.TLSConfiguration.Enabled { + arg += fmt.Sprintf("cp %s/%s %s/grpcRoot.crt && ", grpcTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority, localCertsDir) + } + + if interconnectService.TLSConfiguration.Enabled { + arg += fmt.Sprintf("cp %s/%s %s/interconnectRoot.crt && ", interconnectTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority, localCertsDir) + } + + if statusService.TLSConfiguration != nil && statusService.TLSConfiguration.Enabled { + arg += fmt.Sprintf("cp %s/%s %s/web.crt && ", statusOriginTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority, localCertsDir) + arg += fmt.Sprintf("cat %s/%s %s/%s %s/%s > %s/%s && ", + statusOriginTLSVolumeMountPath, wellKnownNameForTLSPrivateKey, + statusOriginTLSVolumeMountPath, wellKnownNameForTLSCertificate, + statusOriginTLSVolumeMountPath, wellKnownNameForTLSCertificateAuthority, + statusTLSVolumeMountPath, statusBundleFileName, + ) + } + + if arg != "" { + arg += updateCACertificatesBin + } + + args := []string{arg} + + return command, args +} + +func SHAChecksum(text string) string { + hasher := sha256.New() + hasher.Write([]byte(text)) + return hex.EncodeToString(hasher.Sum(nil)) +} + +func CompareMaps(map1, map2 map[string]string) bool { + if len(map1) != len(map2) { + return false + } + for key1, value1 := range map1 { + if value2, ok := map2[key1]; !ok || value2 != value1 { + return false + } + } + return true +} diff --git a/internal/resources/secret.go b/internal/resources/secret.go index 6937174b..d9c81a4a 100644 --- a/internal/resources/secret.go +++ b/internal/resources/secret.go @@ -3,32 +3,82 @@ package resources import ( "context" "errors" + "fmt" + "time" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" ) -func checkSecretHasField( +func GetSecretKey( + ctx context.Context, namespace string, - secretName string, - secretField string, config *rest.Config, -) (bool, error) { + secretKeyRef *corev1.SecretKeySelector, +) (string, error) { clientset, err := kubernetes.NewForConfig(config) if err != nil { - return false, errors.New("failed to create kubernetes clientset") + return "", fmt.Errorf("failed to create kubernetes clientset, error: %w", err) } - req, err := clientset. - CoreV1(). - Secrets(namespace). - Get(context.TODO(), secretName, v1.GetOptions{}) + getCtx, cancel := context.WithTimeout(ctx, time.Second) + defer cancel() + secret, err := clientset.CoreV1().Secrets(namespace).Get(getCtx, secretKeyRef.Name, metav1.GetOptions{}) if err != nil { - return false, err + return "", fmt.Errorf("failed to get secret %s, error: %w", secretKeyRef.Name, err) } - _, exists := req.Data[secretField] + secretVal, exist := secret.Data[secretKeyRef.Key] + if !exist { + errMsg := fmt.Sprintf("key %s does not exist in secret %s", secretKeyRef.Key, secretKeyRef.Name) + return "", errors.New(errMsg) + } + + return string(secretVal), nil +} + +type OperatorTokenSecretBuilder struct { + client.Object + + Name string + Token string +} + +func (b *OperatorTokenSecretBuilder) Build(obj client.Object) error { + secret, ok := obj.(*corev1.Secret) + if !ok { + return errors.New("failed to cast to Job object") + } + + if secret.ObjectMeta.Name == "" { + secret.ObjectMeta.Name = b.Name + } + secret.ObjectMeta.Namespace = b.GetNamespace() - return exists, nil + secret.Data = map[string][]byte{ + wellKnownNameForOperatorToken: []byte(b.Token), + } + + return nil +} + +func (b *OperatorTokenSecretBuilder) Placeholder(obj client.Object) client.Object { + return &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Name, + Namespace: obj.GetNamespace(), + }, + } +} + +func GetOperatorTokenSecretBuilder(obj client.Object, operatorToken string) ResourceBuilder { + return &OperatorTokenSecretBuilder{ + Object: obj, + + Name: fmt.Sprintf(OperatorTokenSecretNameFormat, obj.GetName()), + Token: operatorToken, + } } diff --git a/internal/resources/security_context.go b/internal/resources/security_context.go new file mode 100644 index 00000000..c7f3367f --- /dev/null +++ b/internal/resources/security_context.go @@ -0,0 +1,47 @@ +package resources + +import ( + corev1 "k8s.io/api/core/v1" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/ptr" +) + +func contains(s []corev1.Capability, v corev1.Capability) bool { + for _, vs := range s { + if vs == v { + return true + } + } + return false +} + +func mergeSecurityContextWithDefaults(context *corev1.SecurityContext) *corev1.SecurityContext { + var result *corev1.SecurityContext + defaultCapabilities := []corev1.Capability{"SYS_RAWIO"} + + if context != nil { + result = context.DeepCopy() + } else { + result = &corev1.SecurityContext{} + } + + // set defaults + + if result.Privileged == nil { + result.Privileged = ptr.Bool(false) + } + + if result.Capabilities == nil { + result.Capabilities = &corev1.Capabilities{ + Add: []corev1.Capability{}, + } + } + + for _, defaultCapability := range defaultCapabilities { + if !contains(result.Capabilities.Add, defaultCapability) { + result.Capabilities.Add = append(result.Capabilities.Add, defaultCapability) + } + } + + return result +} diff --git a/internal/resources/security_context_test.go b/internal/resources/security_context_test.go new file mode 100644 index 00000000..fcb0cf55 --- /dev/null +++ b/internal/resources/security_context_test.go @@ -0,0 +1,55 @@ +package resources + +import ( + "testing" + + corev1 "k8s.io/api/core/v1" + + "github.com/ydb-platform/ydb-kubernetes-operator/internal/ptr" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestSecurityContextMerge(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "SecurityContext builder") +} + +var _ = Describe("SecurityContext builder", func() { + It("no securityContext passed", func() { + Expect(mergeSecurityContextWithDefaults(nil)).Should(BeEquivalentTo(&corev1.SecurityContext{ + Privileged: ptr.Bool(false), + Capabilities: &corev1.Capabilities{ + Add: []corev1.Capability{"SYS_RAWIO"}, + }, + })) + }) + It("securityContext with Capabilities passed", func() { + ctx := &corev1.SecurityContext{ + Privileged: ptr.Bool(false), + Capabilities: &corev1.Capabilities{ + Add: []corev1.Capability{"SYS_PTRACE"}, + }, + } + Expect(mergeSecurityContextWithDefaults(ctx)).Should(BeEquivalentTo(&corev1.SecurityContext{ + Privileged: ptr.Bool(false), + Capabilities: &corev1.Capabilities{ + Add: []corev1.Capability{"SYS_PTRACE", "SYS_RAWIO"}, + }, + })) + }) + It("securityContext without Capabilities passed", func() { + ctx := &corev1.SecurityContext{ + Privileged: ptr.Bool(true), + RunAsUser: ptr.Int64(10), + } + Expect(mergeSecurityContextWithDefaults(ctx)).Should(BeEquivalentTo(&corev1.SecurityContext{ + Privileged: ptr.Bool(true), + RunAsUser: ptr.Int64(10), + Capabilities: &corev1.Capabilities{ + Add: []corev1.Capability{"SYS_RAWIO"}, + }, + })) + }) +}) diff --git a/internal/resources/service.go b/internal/resources/service.go index 07a2e289..e32d1aaf 100644 --- a/internal/resources/service.go +++ b/internal/resources/service.go @@ -62,6 +62,12 @@ func (b *ServiceBuilder) Build(obj client.Object) error { service.Spec.ClusterIP = "None" } + for _, port := range service.Spec.Ports { + if port.NodePort > 0 { + service.Spec.Type = corev1.ServiceTypeNodePort + } + } + return nil } diff --git a/internal/resources/servicemonitor.go b/internal/resources/servicemonitor.go index be77ce9b..3656acef 100644 --- a/internal/resources/servicemonitor.go +++ b/internal/resources/servicemonitor.go @@ -8,7 +8,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/metrics" ) @@ -19,7 +19,7 @@ type ServiceMonitorBuilder struct { Name string MetricsServices []metrics.Service TargetPort int - Options *v1alpha1.MonitoringOptions + Options *api.MonitoringOptions Labels labels.Labels SelectorLabels labels.Labels diff --git a/internal/resources/storage.go b/internal/resources/storage.go index e8c3e0aa..77238adb 100644 --- a/internal/resources/storage.go +++ b/internal/resources/storage.go @@ -1,14 +1,14 @@ package resources import ( + "fmt" + + "gopkg.in/yaml.v3" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/metrics" ) @@ -20,48 +20,79 @@ type StorageClusterBuilder struct { func NewCluster(ydbCr *api.Storage) StorageClusterBuilder { cr := ydbCr.DeepCopy() + if cr.Spec.Service.Status.TLSConfiguration == nil { + cr.Spec.Service.Status.TLSConfiguration = &api.TLSConfiguration{Enabled: false} + } + return StorageClusterBuilder{cr} } -func (b *StorageClusterBuilder) SetStatusOnFirstReconcile() (bool, ctrl.Result, error) { - if b.Status.Conditions == nil { - b.Status.Conditions = []metav1.Condition{} +func (b *StorageClusterBuilder) Unwrap() *api.Storage { + return b.DeepCopy() +} - if b.Spec.Pause { - meta.SetStatusCondition(&b.Status.Conditions, metav1.Condition{ - Type: StoragePausedCondition, - Status: "True", - Reason: ReasonCompleted, - Message: "State Storage set to Paused", - }) +func (b *StorageClusterBuilder) buildSelectorLabels(component string) labels.Labels { + l := labels.Common(b.Name, b.Labels) + l.Merge(map[string]string{labels.ComponentKey: component}) - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil - } + return l +} + +func (b *StorageClusterBuilder) buildLabels() labels.Labels { + l := b.buildSelectorLabels(labels.StorageComponent) + l.Merge(b.Spec.AdditionalLabels) + + return l +} + +func (b *StorageClusterBuilder) buildInitJobLabels() labels.Labels { + l := b.buildSelectorLabels(labels.BlobstorageInitComponent) + l.Merge(b.Spec.AdditionalLabels) + + if b.Spec.InitJob != nil { + l.Merge(b.Spec.InitJob.AdditionalLabels) } - return Continue, ctrl.Result{}, nil + return l } -func (b *StorageClusterBuilder) Unwrap() *api.Storage { - return b.DeepCopy() +func (b *StorageClusterBuilder) buildNodeSetLabels(nodeSetSpecInline api.StorageNodeSetSpecInline) labels.Labels { + l := b.buildLabels() + l.Merge(nodeSetSpecInline.Labels) + l.Merge(map[string]string{labels.StorageNodeSetComponent: nodeSetSpecInline.Name}) + if nodeSetSpecInline.Remote != nil { + l.Merge(map[string]string{labels.RemoteClusterKey: nodeSetSpecInline.Remote.Cluster}) + } + + return l } -func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []ResourceBuilder { - storageLabels := labels.StorageLabels(b.Unwrap()) +func (b *StorageClusterBuilder) GetInitJobBuilder() ResourceBuilder { + jobName := fmt.Sprintf(InitJobNameFormat, b.Name) + jobLabels := b.buildInitJobLabels() - var optionalBuilders []ResourceBuilder + jobAnnotations := CopyDict(b.Annotations) + if b.Spec.InitJob != nil { + for k, v := range b.Spec.InitJob.AdditionalAnnotations { + jobAnnotations[k] = v + } + } - optionalBuilders = append( - optionalBuilders, - &ConfigMapBuilder{ - Object: b, - Name: b.Storage.GetName(), - Data: map[string]string{ - api.ConfigFileName: b.Spec.Configuration, - }, - Labels: storageLabels, - }, - ) + return &StorageInitJobBuilder{ + Storage: b.Unwrap(), + + Name: jobName, + Labels: jobLabels, + Annotations: jobAnnotations, + } +} + +func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []ResourceBuilder { + storageLabels := b.buildLabels() + storageSelectorLabels := b.buildSelectorLabels(labels.StorageComponent) + + statefulSetAnnotations := CopyDict(b.Spec.AdditionalAnnotations) + statefulSetAnnotations[annotations.ConfigurationChecksum] = SHAChecksum(b.Spec.Configuration) grpcServiceLabels := storageLabels.Copy() grpcServiceLabels.Merge(b.Spec.Service.GRPC.AdditionalLabels) @@ -75,6 +106,38 @@ func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []R statusServiceLabels.Merge(b.Spec.Service.Status.AdditionalLabels) statusServiceLabels.Merge(map[string]string{labels.ServiceComponent: labels.StatusComponent}) + var optionalBuilders []ResourceBuilder + + success, dynconfig, _ := api.ParseDynConfig(b.Spec.Configuration) + if !success { + // YDBOPS-9722 backward compatibility + cfg, _ := api.BuildConfiguration(b.Unwrap(), nil) + optionalBuilders = append( + optionalBuilders, + &ConfigMapBuilder{ + Object: b, + Name: b.Storage.GetName(), + Data: map[string]string{ + api.ConfigFileName: string(cfg), + }, + Labels: storageLabels, + }, + ) + } else { + cfg, _ := yaml.Marshal(dynconfig.Config) + optionalBuilders = append( + optionalBuilders, + &ConfigMapBuilder{ + Object: b, + Name: b.Storage.GetName(), + Data: map[string]string{ + api.ConfigFileName: string(cfg), + }, + Labels: storageLabels, + }, + ) + } + if b.Spec.Monitoring.Enabled { optionalBuilders = append(optionalBuilders, &ServiceMonitorBuilder{ @@ -97,37 +160,22 @@ func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []R Storage: b.Unwrap(), RestConfig: restConfig, - Name: b.Name, - Labels: storageLabels, + Name: b.Name, + Labels: storageLabels, + Annotations: statefulSetAnnotations, }, ) } else { - for _, nodeSetSpecInline := range b.Spec.NodeSets { - nodeSetLabels := storageLabels.Copy() - nodeSetLabels = nodeSetLabels.Merge(nodeSetSpecInline.AdditionalLabels) - nodeSetLabels = nodeSetLabels.Merge(map[string]string{labels.StorageNodeSetComponent: nodeSetSpecInline.Name}) - - optionalBuilders = append( - optionalBuilders, - &StorageNodeSetBuilder{ - Object: b, - - Name: b.Name + "-" + nodeSetSpecInline.Name, - Labels: nodeSetLabels, - - StorageNodeSetSpec: b.recastStorageNodeSetSpecInline(nodeSetSpecInline.DeepCopy()), - }, - ) - } + optionalBuilders = append(optionalBuilders, b.getNodeSetBuilders()...) } return append( optionalBuilders, &ServiceBuilder{ Object: b, - NameFormat: grpcServiceNameFormat, + NameFormat: GRPCServiceNameFormat, Labels: grpcServiceLabels, - SelectorLabels: storageLabels, + SelectorLabels: storageSelectorLabels, Annotations: b.Spec.Service.GRPC.AdditionalAnnotations, Ports: []corev1.ServicePort{{ Name: api.GRPCServicePortName, @@ -138,9 +186,9 @@ func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []R }, &ServiceBuilder{ Object: b, - NameFormat: interconnectServiceNameFormat, + NameFormat: InterconnectServiceNameFormat, Labels: interconnectServiceLabels, - SelectorLabels: storageLabels, + SelectorLabels: storageSelectorLabels, Annotations: b.Spec.Service.Interconnect.AdditionalAnnotations, Headless: true, Ports: []corev1.ServicePort{{ @@ -152,10 +200,10 @@ func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []R }, &ServiceBuilder{ Object: b, - NameFormat: statusServiceNameFormat, + NameFormat: StatusServiceNameFormat, Labels: statusServiceLabels, - SelectorLabels: storageLabels, - Annotations: b.Spec.Service.GRPC.AdditionalAnnotations, + SelectorLabels: storageSelectorLabels, + Annotations: b.Spec.Service.Status.AdditionalAnnotations, Ports: []corev1.ServicePort{{ Name: api.StatusServicePortName, Port: api.StatusPort, @@ -166,6 +214,53 @@ func (b *StorageClusterBuilder) GetResourceBuilders(restConfig *rest.Config) []R ) } +func (b *StorageClusterBuilder) getNodeSetBuilders() []ResourceBuilder { + var nodeSetBuilders []ResourceBuilder + + for _, nodeSetSpecInline := range b.Spec.NodeSets { + nodeSetName := fmt.Sprintf("%s-%s", b.Name, nodeSetSpecInline.Name) + nodeSetLabels := b.buildNodeSetLabels(nodeSetSpecInline) + + nodeSetAnnotations := CopyDict(b.Annotations) + if nodeSetSpecInline.Annotations != nil { + for k, v := range nodeSetSpecInline.Annotations { + nodeSetAnnotations[k] = v + } + } + + storageNodeSetSpec := b.recastStorageNodeSetSpecInline(nodeSetSpecInline.DeepCopy()) + if nodeSetSpecInline.Remote != nil { + nodeSetBuilders = append( + nodeSetBuilders, + &RemoteStorageNodeSetBuilder{ + Object: b, + + Name: nodeSetName, + Labels: nodeSetLabels, + Annotations: nodeSetAnnotations, + + StorageNodeSetSpec: storageNodeSetSpec, + }, + ) + } else { + nodeSetBuilders = append( + nodeSetBuilders, + &StorageNodeSetBuilder{ + Object: b, + + Name: nodeSetName, + Labels: nodeSetLabels, + Annotations: nodeSetAnnotations, + + StorageNodeSetSpec: storageNodeSetSpec, + }, + ) + } + } + + return nodeSetBuilders +} + func (b *StorageClusterBuilder) recastStorageNodeSetSpecInline(nodeSetSpecInline *api.StorageNodeSetSpecInline) api.StorageNodeSetSpec { nodeSetSpec := api.StorageNodeSetSpec{} @@ -187,10 +282,6 @@ func (b *StorageClusterBuilder) recastStorageNodeSetSpecInline(nodeSetSpecInline nodeSetSpec.Resources = nodeSetSpecInline.Resources } - if nodeSetSpecInline.HostNetwork != nodeSetSpec.HostNetwork { - nodeSetSpec.HostNetwork = nodeSetSpecInline.HostNetwork - } - nodeSetSpec.NodeSelector = CopyDict(b.Spec.NodeSelector) if nodeSetSpecInline.NodeSelector != nil { for k, v := range nodeSetSpecInline.NodeSelector { @@ -210,10 +301,6 @@ func (b *StorageClusterBuilder) recastStorageNodeSetSpecInline(nodeSetSpecInline nodeSetSpec.TopologySpreadConstraints = append(nodeSetSpec.TopologySpreadConstraints, nodeSetSpecInline.TopologySpreadConstraints...) } - if nodeSetSpecInline.PriorityClassName != nodeSetSpec.PriorityClassName { - nodeSetSpec.PriorityClassName = nodeSetSpecInline.PriorityClassName - } - nodeSetSpec.AdditionalLabels = CopyDict(b.Spec.AdditionalLabels) if nodeSetSpecInline.AdditionalLabels != nil { for k, v := range nodeSetSpecInline.AdditionalLabels { diff --git a/internal/resources/storage_init_job.go b/internal/resources/storage_init_job.go new file mode 100644 index 00000000..51da7006 --- /dev/null +++ b/internal/resources/storage_init_job.go @@ -0,0 +1,353 @@ +package resources + +import ( + "errors" + "fmt" + + batchv1 "k8s.io/api/batch/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/ptr" +) + +type StorageInitJobBuilder struct { + *api.Storage + + Name string + + Labels map[string]string + Annotations map[string]string +} + +func (b *StorageInitJobBuilder) Build(obj client.Object) error { + job, ok := obj.(*batchv1.Job) + if !ok { + return errors.New("failed to cast to Job object") + } + + if job.ObjectMeta.Name == "" { + job.ObjectMeta.Name = b.Name + } + job.ObjectMeta.Namespace = b.GetNamespace() + job.ObjectMeta.Labels = b.Labels + job.ObjectMeta.Annotations = b.Annotations + + job.Spec = batchv1.JobSpec{ + Parallelism: ptr.Int32(1), + Completions: ptr.Int32(1), + ActiveDeadlineSeconds: ptr.Int64(300), + BackoffLimit: ptr.Int32(6), + Template: b.buildInitJobPodTemplateSpec(), + } + + return nil +} + +func (b *StorageInitJobBuilder) Placeholder(cr client.Object) client.Object { + return &batchv1.Job{ + ObjectMeta: metav1.ObjectMeta{ + Name: b.Name, + Namespace: cr.GetNamespace(), + }, + } +} + +func (b *StorageInitJobBuilder) buildInitJobPodTemplateSpec() corev1.PodTemplateSpec { + domain := api.DefaultDomainName + if dnsAnnotation, ok := b.GetAnnotations()[api.DNSDomainAnnotation]; ok { + domain = dnsAnnotation + } + dnsConfigSearches := []string{ + fmt.Sprintf(api.InterconnectServiceFQDNFormat, b.Storage.Name, b.GetNamespace(), domain), + } + podTemplate := corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: b.Labels, + Annotations: b.Annotations, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{b.buildInitJobContainer()}, + Volumes: b.buildInitJobVolumes(), + RestartPolicy: corev1.RestartPolicyNever, + DNSConfig: &corev1.PodDNSConfig{ + Searches: dnsConfigSearches, + }, + InitContainers: b.Spec.InitContainers, + }, + } + + if b.Spec.InitJob != nil { + if b.Spec.InitJob.NodeSelector != nil { + podTemplate.Spec.NodeSelector = b.Spec.InitJob.NodeSelector + } + + if b.Spec.InitJob.Affinity != nil { + podTemplate.Spec.Affinity = b.Spec.InitJob.Affinity + } + + if b.Spec.InitJob.Tolerations != nil { + podTemplate.Spec.Tolerations = b.Spec.InitJob.Tolerations + } + } + + // append an init container for updating the ca.crt if we have any certificates + if b.AnyCertificatesAdded() { + podTemplate.Spec.InitContainers = append( + []corev1.Container{b.buildCaStorePatchingInitContainer()}, + b.Spec.InitContainers..., + ) + } + + if b.Spec.HostNetwork { + podTemplate.Spec.HostNetwork = true + } + + if b.Spec.Image.PullSecret != nil { + podTemplate.Spec.ImagePullSecrets = []corev1.LocalObjectReference{{Name: *b.Spec.Image.PullSecret}} + } + + if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateDNSPolicy]; ok { + switch value { + case string(corev1.DNSClusterFirstWithHostNet), string(corev1.DNSClusterFirst), string(corev1.DNSDefault), string(corev1.DNSNone): + podTemplate.Spec.DNSPolicy = corev1.DNSPolicy(value) + case "": + podTemplate.Spec.DNSPolicy = corev1.DNSClusterFirst + default: + } + } + + return podTemplate +} + +func (b *StorageInitJobBuilder) buildInitJobVolumes() []corev1.Volume { + configMapName := b.Storage.Name + + volumes := []corev1.Volume{ + { + Name: configVolumeName, + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{Name: configMapName}, + }, + }, + }, + } + + if b.Spec.Service.Interconnect.TLSConfiguration.Enabled { + volumes = append(volumes, buildTLSVolume(interconnectTLSVolumeName, b.Spec.Service.Interconnect.TLSConfiguration)) + } + + if b.Spec.Service.GRPC.TLSConfiguration.Enabled { + volumes = append(volumes, buildTLSVolume(GRPCTLSVolumeName, b.Spec.Service.GRPC.TLSConfiguration)) + } + + if b.Spec.OperatorConnection != nil { + secretName := fmt.Sprintf(OperatorTokenSecretNameFormat, b.Storage.Name) + volumes = append(volumes, + corev1.Volume{ + Name: operatorTokenVolumeName, + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + SecretName: secretName, + }, + }, + }) + } + + for _, secret := range b.Spec.Secrets { + volumes = append(volumes, corev1.Volume{ + Name: secret.Name, + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + SecretName: secret.Name, + }, + }, + }) + } + + for _, volume := range b.Spec.Volumes { + volumes = append(volumes, *volume) + } + + if b.AnyCertificatesAdded() { + volumes = append(volumes, corev1.Volume{ + Name: systemCertsVolumeName, + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }) + + volumes = append(volumes, corev1.Volume{ + Name: localCertsVolumeName, + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }) + } + + return volumes +} + +func (b *StorageInitJobBuilder) buildInitJobContainer() corev1.Container { // todo add init container for sparse files? + imagePullPolicy := corev1.PullIfNotPresent + if b.Spec.Image.PullPolicyName != nil { + imagePullPolicy = *b.Spec.Image.PullPolicyName + } + + command, args := b.buildBlobStorageInitCommandArgs() + + container := corev1.Container{ + Name: "ydb-init-blobstorage", + Image: b.Spec.Image.Name, + ImagePullPolicy: imagePullPolicy, + Command: command, + Args: args, + + SecurityContext: &corev1.SecurityContext{ + Privileged: ptr.Bool(false), + Capabilities: &corev1.Capabilities{ + Add: []corev1.Capability{"SYS_RAWIO"}, + }, + }, + + VolumeMounts: b.buildJobVolumeMounts(), + Resources: corev1.ResourceRequirements{}, + } + + if b.Spec.InitJob != nil { + if b.Spec.InitJob.Resources != nil { + container.Resources = *b.Spec.InitJob.Resources + } + } + + return container +} + +func (b *StorageInitJobBuilder) appendTLSVolumeMounts(volumeMounts []corev1.VolumeMount) []corev1.VolumeMount { + if b.Spec.Service.GRPC.TLSConfiguration.Enabled { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: GRPCTLSVolumeName, + ReadOnly: true, + MountPath: grpcTLSVolumeMountPath, + }) + } + + if b.Spec.Service.Interconnect.TLSConfiguration.Enabled { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: interconnectTLSVolumeName, + ReadOnly: true, + MountPath: interconnectTLSVolumeMountPath, + }) + } + + if b.AnyCertificatesAdded() { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: localCertsVolumeName, + MountPath: localCertsDir, + }) + + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: systemCertsVolumeName, + MountPath: systemCertsDir, + }) + } + return volumeMounts +} + +func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount { + volumeMounts := []corev1.VolumeMount{ + { + Name: configVolumeName, + ReadOnly: true, + MountPath: fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName), + SubPath: api.ConfigFileName, + }, + } + + if b.Spec.OperatorConnection != nil { + secretName := fmt.Sprintf(OperatorTokenSecretNameFormat, b.Storage.Name) + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: operatorTokenVolumeName, + ReadOnly: true, + MountPath: fmt.Sprintf("%s/%s", wellKnownDirForAdditionalSecrets, secretName), + }) + } + + volumeMounts = b.appendTLSVolumeMounts(volumeMounts) + + return volumeMounts +} + +func (b *StorageInitJobBuilder) buildCaStorePatchingInitContainer() corev1.Container { + command, args := buildCAStorePatchingCommandArgs( + b.Spec.CABundle, + b.Spec.Service.GRPC, + b.Spec.Service.Interconnect, + api.StatusService{TLSConfiguration: &api.TLSConfiguration{Enabled: false}}, + ) + imagePullPolicy := corev1.PullIfNotPresent + if b.Spec.Image.PullPolicyName != nil { + imagePullPolicy = *b.Spec.Image.PullPolicyName + } + + container := corev1.Container{ + Name: "ydb-storage-init-container", + Image: b.Spec.Image.Name, + ImagePullPolicy: imagePullPolicy, + Command: command, + Args: args, + SecurityContext: &corev1.SecurityContext{ + RunAsUser: new(int64), + }, + + VolumeMounts: b.buildCaStorePatchingInitContainerVolumeMounts(), + Resources: corev1.ResourceRequirements{}, + } + if len(b.Spec.CABundle) > 0 { + container.Env = []corev1.EnvVar{ + { + Name: caBundleEnvName, + Value: b.Spec.CABundle, + }, + } + } + return container +} + +func (b *StorageInitJobBuilder) buildCaStorePatchingInitContainerVolumeMounts() []corev1.VolumeMount { + return b.appendTLSVolumeMounts([]corev1.VolumeMount{}) +} + +func (b *StorageInitJobBuilder) buildBlobStorageInitCommandArgs() ([]string, []string) { + command := []string{ + fmt.Sprintf("%s/%s", api.BinariesDir, api.DaemonBinaryName), + } + + args := []string{} + if b.Storage.Spec.OperatorConnection != nil { + secretName := fmt.Sprintf(OperatorTokenSecretNameFormat, b.Storage.Name) + args = append( + args, + "-f", + fmt.Sprintf("%s/%s/%s", wellKnownDirForAdditionalSecrets, secretName, wellKnownNameForOperatorToken), + ) + } + + endpoint := b.Storage.GetStorageEndpointWithProto() + args = append( + args, + "-s", + endpoint, + ) + + args = append( + args, + "admin", "blobstorage", "config", "init", "--yaml-file", + fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName), + ) + + return command, args +} diff --git a/internal/resources/storage_statefulset.go b/internal/resources/storage_statefulset.go index 40742a94..5fb87671 100644 --- a/internal/resources/storage_statefulset.go +++ b/internal/resources/storage_statefulset.go @@ -3,7 +3,6 @@ package resources import ( "errors" "fmt" - "log" "strconv" appsv1 "k8s.io/api/apps/v1" @@ -13,7 +12,8 @@ import ( "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels" "github.com/ydb-platform/ydb-kubernetes-operator/internal/ptr" ) @@ -22,11 +22,12 @@ const ( ) type StorageStatefulSetBuilder struct { - *v1alpha1.Storage + *api.Storage RestConfig *rest.Config - Name string - Labels map[string]string + Name string + Labels map[string]string + Annotations map[string]string } func StringRJust(str, pad string, length int) string { @@ -39,11 +40,11 @@ func StringRJust(str, pad string, length int) string { } func (b *StorageStatefulSetBuilder) GeneratePVCName(index int) string { - return b.Name + "-" + StringRJust(strconv.Itoa(index), "0", v1alpha1.DiskNumberMaxDigits) + return b.Name + "-" + StringRJust(strconv.Itoa(index), "0", api.DiskNumberMaxDigits) } func (b *StorageStatefulSetBuilder) GenerateDeviceName(index int) string { - return v1alpha1.DiskPathPrefix + "_" + StringRJust(strconv.Itoa(index), "0", v1alpha1.DiskNumberMaxDigits) + return api.DiskPathPrefix + "_" + StringRJust(strconv.Itoa(index), "0", api.DiskNumberMaxDigits) } func (b *StorageStatefulSetBuilder) Build(obj client.Object) error { @@ -56,7 +57,8 @@ func (b *StorageStatefulSetBuilder) Build(obj client.Object) error { sts.ObjectMeta.Name = b.Name } sts.ObjectMeta.Namespace = b.GetNamespace() - sts.ObjectMeta.Annotations = CopyDict(b.Spec.AdditionalAnnotations) + sts.ObjectMeta.Labels = b.Labels + sts.ObjectMeta.Annotations = b.Annotations replicas := ptr.Int32(b.Spec.Nodes) if b.Spec.Pause { @@ -66,15 +68,17 @@ func (b *StorageStatefulSetBuilder) Build(obj client.Object) error { sts.Spec = appsv1.StatefulSetSpec{ Replicas: replicas, Selector: &metav1.LabelSelector{ - MatchLabels: b.Labels, + MatchLabels: map[string]string{ + labels.StatefulsetComponent: b.Name, + }, }, PodManagementPolicy: appsv1.ParallelPodManagement, RevisionHistoryLimit: ptr.Int32(10), - ServiceName: fmt.Sprintf(interconnectServiceNameFormat, b.Storage.Name), + ServiceName: fmt.Sprintf(InterconnectServiceNameFormat, b.Storage.Name), Template: b.buildPodTemplateSpec(), } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationUpdateStrategyOnDelete]; ok && value == v1alpha1.AnnotationValueTrue { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateStrategyOnDelete]; ok && value == api.AnnotationValueTrue { sts.Spec.UpdateStrategy = appsv1.StatefulSetUpdateStrategy{ Type: "OnDelete", } @@ -97,14 +101,31 @@ func (b *StorageStatefulSetBuilder) Build(obj client.Object) error { return nil } +func (b *StorageStatefulSetBuilder) buildPodTemplateLabels() labels.Labels { + podTemplateLabels := labels.Labels{} + + podTemplateLabels.Merge(b.Labels) + podTemplateLabels.Merge(map[string]string{labels.StatefulsetComponent: b.Name}) + podTemplateLabels.Merge(b.Spec.AdditionalPodLabels) + + return podTemplateLabels +} + func (b *StorageStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSpec { + podTemplateLabels := b.buildPodTemplateLabels() + + domain := api.DefaultDomainName + if dnsAnnotation, ok := b.GetAnnotations()[api.DNSDomainAnnotation]; ok { + domain = dnsAnnotation + } dnsConfigSearches := []string{ - fmt.Sprintf(v1alpha1.InterconnectServiceFQDNFormat, b.Storage.Name, b.GetNamespace()), + fmt.Sprintf(api.InterconnectServiceFQDNFormat, b.Storage.Name, b.GetNamespace(), domain), } + podTemplate := corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: b.Labels, - Annotations: CopyDict(b.Spec.AdditionalAnnotations), + Labels: podTemplateLabels, + Annotations: b.Annotations, }, Spec: corev1.PodSpec{ Containers: []corev1.Container{b.buildContainer()}, @@ -125,7 +146,7 @@ func (b *StorageStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSpe // InitContainer only needed for CaBundle manipulation for now, // may be probably used for other stuff later - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { podTemplate.Spec.InitContainers = append( []corev1.Container{b.buildCaStorePatchingInitContainer()}, b.Spec.InitContainers..., @@ -142,7 +163,7 @@ func (b *StorageStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSpe podTemplate.Spec.ImagePullSecrets = []corev1.LocalObjectReference{{Name: *b.Spec.Image.PullSecret}} } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationUpdateDNSPolicy]; ok { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateDNSPolicy]; ok { switch value { case string(corev1.DNSClusterFirstWithHostNet), string(corev1.DNSClusterFirst), string(corev1.DNSDefault), string(corev1.DNSNone): podTemplate.Spec.DNSPolicy = corev1.DNSPolicy(value) @@ -160,7 +181,7 @@ func (b *StorageStatefulSetBuilder) buildTopologySpreadConstraints() []corev1.To return b.Spec.TopologySpreadConstraints } - if b.Spec.Erasure != v1alpha1.ErasureMirror3DC { + if b.Spec.Erasure != api.ErasureMirror3DC { return []corev1.TopologySpreadConstraint{} } @@ -181,7 +202,7 @@ func (b *StorageStatefulSetBuilder) buildTopologySpreadConstraints() []corev1.To } func (b *StorageStatefulSetBuilder) buildVolumes() []corev1.Volume { - configMapName := b.Name + configMapName := b.Storage.Name volumes := []corev1.Volume{ { @@ -195,13 +216,25 @@ func (b *StorageStatefulSetBuilder) buildVolumes() []corev1.Volume { } if b.Spec.Service.GRPC.TLSConfiguration.Enabled { - volumes = append(volumes, buildTLSVolume(grpcTLSVolumeName, b.Spec.Service.GRPC.TLSConfiguration)) + volumes = append(volumes, buildTLSVolume(GRPCTLSVolumeName, b.Spec.Service.GRPC.TLSConfiguration)) } if b.Spec.Service.Interconnect.TLSConfiguration.Enabled { volumes = append(volumes, buildTLSVolume(interconnectTLSVolumeName, b.Spec.Service.Interconnect.TLSConfiguration)) } + if b.Spec.Service.Status.TLSConfiguration.Enabled { + volumes = append(volumes, + buildTLSVolume(statusOriginTLSVolumeName, b.Spec.Service.Status.TLSConfiguration), + corev1.Volume{ + Name: statusTLSVolumeName, + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, + ) + } + for _, secret := range b.Spec.Secrets { volumes = append(volumes, corev1.Volume{ Name: secret.Name, @@ -217,7 +250,7 @@ func (b *StorageStatefulSetBuilder) buildVolumes() []corev1.Volume { volumes = append(volumes, *volume) } - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { volumes = append(volumes, corev1.Volume{ Name: systemCertsVolumeName, VolumeSource: corev1.VolumeSource{ @@ -237,7 +270,12 @@ func (b *StorageStatefulSetBuilder) buildVolumes() []corev1.Volume { } func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainer() corev1.Container { - command, args := b.buildCaStorePatchingInitContainerArgs() + command, args := buildCAStorePatchingCommandArgs( + b.Spec.CABundle, + b.Spec.Service.GRPC, + b.Spec.Service.Interconnect, + b.Spec.Service.Status, + ) containerResources := corev1.ResourceRequirements{} if b.Spec.Resources != nil { containerResources = *b.Spec.Resources @@ -271,16 +309,10 @@ func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainer() corev1.C return container } -func (b *StorageStatefulSetBuilder) areAnyCertificatesAddedToStore() bool { - return len(b.Spec.CABundle) > 0 || - b.Spec.Service.GRPC.TLSConfiguration.Enabled || - b.Spec.Service.Interconnect.TLSConfiguration.Enabled -} - func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMounts() []corev1.VolumeMount { volumeMounts := []corev1.VolumeMount{} - if b.areAnyCertificatesAddedToStore() { + if b.AnyCertificatesAdded() { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: localCertsVolumeName, MountPath: localCertsDir, @@ -294,9 +326,9 @@ func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMount if b.Spec.Service.GRPC.TLSConfiguration.Enabled { volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: grpcTLSVolumeName, + Name: GRPCTLSVolumeName, ReadOnly: true, - MountPath: "/tls/grpc", // fixme const + MountPath: grpcTLSVolumeMountPath, }) } @@ -304,9 +336,23 @@ func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainerVolumeMount volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: interconnectTLSVolumeName, ReadOnly: true, - MountPath: "/tls/interconnect", // fixme const + MountPath: interconnectTLSVolumeMountPath, + }) + } + + if b.Spec.Service.Status.TLSConfiguration.Enabled { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: statusOriginTLSVolumeName, + ReadOnly: true, + MountPath: statusOriginTLSVolumeMountPath, + }) + + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: statusTLSVolumeName, + MountPath: statusTLSVolumeMountPath, }) } + return volumeMounts } @@ -328,30 +374,25 @@ func (b *StorageStatefulSetBuilder) buildContainer() corev1.Container { // todo Command: command, Args: args, - SecurityContext: &corev1.SecurityContext{ - Privileged: ptr.Bool(false), - Capabilities: &corev1.Capabilities{ - Add: []corev1.Capability{"SYS_RAWIO"}, - }, - }, + SecurityContext: mergeSecurityContextWithDefaults(b.Spec.SecurityContext), Ports: []corev1.ContainerPort{{ - Name: "grpc", ContainerPort: v1alpha1.GRPCPort, + Name: "grpc", ContainerPort: api.GRPCPort, }, { - Name: "interconnect", ContainerPort: v1alpha1.InterconnectPort, + Name: "interconnect", ContainerPort: api.InterconnectPort, }, { - Name: "status", ContainerPort: v1alpha1.StatusPort, + Name: "status", ContainerPort: api.StatusPort, }}, VolumeMounts: b.buildVolumeMounts(), Resources: containerResources, } - if value, ok := b.ObjectMeta.Annotations[v1alpha1.AnnotationDisableLivenessProbe]; !ok || value != v1alpha1.AnnotationValueTrue { + if value, ok := b.ObjectMeta.Annotations[api.AnnotationDisableLivenessProbe]; !ok || value != api.AnnotationValueTrue { container.LivenessProbe = &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ TCPSocket: &corev1.TCPSocketAction{ - Port: intstr.FromInt(v1alpha1.GRPCPort), + Port: intstr.FromInt(api.GRPCPort), }, }, } @@ -365,7 +406,7 @@ func (b *StorageStatefulSetBuilder) buildContainer() corev1.Container { // todo volumeMountList, corev1.VolumeMount{ Name: b.GeneratePVCName(i), - MountPath: v1alpha1.DiskFilePath, + MountPath: api.DiskFilePath, }, ) } @@ -390,15 +431,16 @@ func (b *StorageStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { { Name: configVolumeName, ReadOnly: true, - MountPath: v1alpha1.ConfigDir, + MountPath: fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName), + SubPath: api.ConfigFileName, }, } if b.Spec.Service.GRPC.TLSConfiguration.Enabled { volumeMounts = append(volumeMounts, corev1.VolumeMount{ - Name: grpcTLSVolumeName, + Name: GRPCTLSVolumeName, ReadOnly: true, - MountPath: "/tls/grpc", // fixme const + MountPath: grpcTLSVolumeMountPath, }) } @@ -406,11 +448,19 @@ func (b *StorageStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: interconnectTLSVolumeName, ReadOnly: true, - MountPath: "/tls/interconnect", // fixme const + MountPath: interconnectTLSVolumeMountPath, }) } - if b.areAnyCertificatesAddedToStore() { + if b.Spec.Service.Status.TLSConfiguration.Enabled { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ + Name: statusTLSVolumeName, + ReadOnly: true, + MountPath: statusTLSVolumeMountPath, + }) + } + + if b.AnyCertificatesAdded() { volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: localCertsVolumeName, MountPath: localCertsDir, @@ -439,70 +489,53 @@ func (b *StorageStatefulSetBuilder) buildVolumeMounts() []corev1.VolumeMount { return volumeMounts } -func (b *StorageStatefulSetBuilder) buildCaStorePatchingInitContainerArgs() ([]string, []string) { - command := []string{"/bin/bash", "-c"} - - arg := "" - - if len(b.Spec.CABundle) > 0 { - arg += fmt.Sprintf("printf $%s | base64 --decode > %s/%s && ", caBundleEnvName, localCertsDir, caBundleFileName) - } - - if b.Spec.Service.GRPC.TLSConfiguration.Enabled { - arg += fmt.Sprintf("cp /tls/grpc/ca.crt %s/grpcRoot.crt && ", localCertsDir) // fixme const - } - - if b.Spec.Service.Interconnect.TLSConfiguration.Enabled { - arg += fmt.Sprintf("cp /tls/interconnect/ca.crt %s/interconnectRoot.crt && ", localCertsDir) // fixme const - } - - if arg != "" { - arg += updateCACertificatesBin - } - - args := []string{arg} - - return command, args -} - func (b *StorageStatefulSetBuilder) buildContainerArgs() ([]string, []string) { - command := []string{fmt.Sprintf("%s/%s", v1alpha1.BinariesDir, v1alpha1.DaemonBinaryName)} + command := []string{fmt.Sprintf("%s/%s", api.BinariesDir, api.DaemonBinaryName)} var args []string args = append(args, "server", "--mon-port", - fmt.Sprintf("%d", v1alpha1.StatusPort), + fmt.Sprintf("%d", api.StatusPort), "--ic-port", - fmt.Sprintf("%d", v1alpha1.InterconnectPort), + fmt.Sprintf("%d", api.InterconnectPort), "--yaml-config", - fmt.Sprintf("%s/%s", v1alpha1.ConfigDir, v1alpha1.ConfigFileName), + fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName), "--node", "static", + + "--label", + fmt.Sprintf("%s=%s", api.LabelDeploymentKey, api.LabelDeploymentValueKubernetes), ) - for _, secret := range b.Spec.Secrets { - exists, err := checkSecretHasField( - b.GetNamespace(), - secret.Name, - v1alpha1.YdbAuthToken, - b.RestConfig, + if b.Spec.Service.Status.TLSConfiguration.Enabled { + args = append(args, + "--mon-cert", + fmt.Sprintf("%s/%s", statusTLSVolumeMountPath, statusBundleFileName), ) + } - if err != nil { - log.Default().Printf("Failed to inspect a secret %s: %s\n", secret.Name, err.Error()) - } else if exists { + authTokenSecretName := api.AuthTokenSecretName + authTokenSecretKey := api.AuthTokenSecretKey + if value, ok := b.ObjectMeta.Annotations[api.AnnotationAuthTokenSecretName]; ok { + authTokenSecretName = value + } + if value, ok := b.ObjectMeta.Annotations[api.AnnotationAuthTokenSecretKey]; ok { + authTokenSecretKey = value + } + for _, secret := range b.Spec.Secrets { + if secret.Name == authTokenSecretName { args = append(args, - "--auth-token-file", + api.AuthTokenFileArg, fmt.Sprintf( "%s/%s/%s", wellKnownDirForAdditionalSecrets, - secret.Name, - v1alpha1.YdbAuthToken, + authTokenSecretName, + authTokenSecretKey, ), ) } diff --git a/internal/resources/storagenodeset.go b/internal/resources/storagenodeset.go index 85e2e269..78a0964e 100644 --- a/internal/resources/storagenodeset.go +++ b/internal/resources/storagenodeset.go @@ -3,21 +3,21 @@ package resources import ( "errors" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" - . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck + "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations" ) type StorageNodeSetBuilder struct { client.Object - Name string - Labels map[string]string + Name string + Labels map[string]string + Annotations map[string]string + StorageNodeSetSpec api.StorageNodeSetSpec } @@ -37,6 +37,8 @@ func (b *StorageNodeSetBuilder) Build(obj client.Object) error { sns.ObjectMeta.Namespace = b.GetNamespace() sns.ObjectMeta.Labels = b.Labels + sns.ObjectMeta.Annotations = b.Annotations + sns.Spec = b.StorageNodeSetSpec return nil @@ -52,26 +54,24 @@ func (b *StorageNodeSetBuilder) Placeholder(cr client.Object) client.Object { } func (b *StorageNodeSetResource) GetResourceBuilders(restConfig *rest.Config) []ResourceBuilder { - storage := b.recastStorageNodeSet() + ydbCr := api.RecastStorageNodeSet(b.Unwrap()) + clusterBuilder := NewCluster(ydbCr) + + statefulSetName := b.Name + statefulSetLabels := clusterBuilder.buildLabels() + statefulSetAnnotations := CopyDict(b.Spec.AdditionalAnnotations) + statefulSetAnnotations[annotations.ConfigurationChecksum] = SHAChecksum(b.Spec.Configuration) var resourceBuilders []ResourceBuilder resourceBuilders = append( resourceBuilders, &StorageStatefulSetBuilder{ - Storage: storage.DeepCopy(), + Storage: ydbCr, RestConfig: restConfig, - Name: b.Name, - Labels: b.Labels, - }, - &ConfigMapBuilder{ - Object: b, - - Name: b.Name, - Data: map[string]string{ - api.ConfigFileName: b.Spec.Configuration, - }, - Labels: b.Labels, + Name: statefulSetName, + Labels: statefulSetLabels, + Annotations: statefulSetAnnotations, }, ) @@ -81,44 +81,13 @@ func (b *StorageNodeSetResource) GetResourceBuilders(restConfig *rest.Config) [] func NewStorageNodeSet(storageNodeSet *api.StorageNodeSet) StorageNodeSetResource { crStorageNodeSet := storageNodeSet.DeepCopy() - return StorageNodeSetResource{ - StorageNodeSet: crStorageNodeSet, + if crStorageNodeSet.Spec.Service.Status.TLSConfiguration == nil { + crStorageNodeSet.Spec.Service.Status.TLSConfiguration = &api.TLSConfiguration{Enabled: false} } -} - -func (b *StorageNodeSetResource) SetStatusOnFirstReconcile() (bool, ctrl.Result, error) { - if b.Status.Conditions == nil { - b.Status.Conditions = []metav1.Condition{} - if b.Spec.Pause { - meta.SetStatusCondition(&b.Status.Conditions, metav1.Condition{ - Type: StoragePausedCondition, - Status: "False", - Reason: ReasonInProgress, - Message: "Transitioning StorageNodeSet to Paused state", - }) - - return Stop, ctrl.Result{RequeueAfter: StatusUpdateRequeueDelay}, nil - } - } - - return Continue, ctrl.Result{}, nil + return StorageNodeSetResource{StorageNodeSet: crStorageNodeSet} } func (b *StorageNodeSetResource) Unwrap() *api.StorageNodeSet { return b.DeepCopy() } - -func (b *StorageNodeSetResource) recastStorageNodeSet() api.Storage { - return api.Storage{ - ObjectMeta: metav1.ObjectMeta{ - Name: b.StorageNodeSet.Spec.StorageRef.Name, - Namespace: b.StorageNodeSet.Spec.StorageRef.Namespace, - Labels: b.StorageNodeSet.Labels, - }, - Spec: api.StorageSpec{ - StorageClusterSpec: b.StorageNodeSet.Spec.StorageClusterSpec, - StorageNodeSpec: b.StorageNodeSet.Spec.StorageNodeSpec, - }, - } -} diff --git a/internal/test/k8s_helpers.go b/internal/test/k8s_helpers.go index a574dd9e..b135bd05 100644 --- a/internal/test/k8s_helpers.go +++ b/internal/test/k8s_helpers.go @@ -4,11 +4,18 @@ import ( "context" "path/filepath" "runtime" + "strings" "time" . "github.com/onsi/ginkgo/v2" //nolint:revive,stylecheck . "github.com/onsi/gomega" //nolint:revive,stylecheck monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/kubernetes" "k8s.io/kubectl/pkg/scheme" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -29,7 +36,112 @@ type Reconciler interface { SetupWithManager(manager ctrl.Manager) error } -func SetupK8STestManager(testCtx *context.Context, k8sClient *client.Client, controllers func(mgr *manager.Manager) []Reconciler) { +func DeleteAllObjects(env *envtest.Environment, k8sClient client.Client, objs ...client.Object) { + for _, obj := range objs { + ctx := context.Background() + clientGo, err := kubernetes.NewForConfig(env.Config) + Expect(err).ShouldNot(HaveOccurred()) + Expect(client.IgnoreNotFound(k8sClient.Delete(ctx, obj))).Should(Succeed()) + + //nolint:nestif + if ns, ok := obj.(*corev1.Namespace); ok { + // Normally the kube-controller-manager would handle finalization + // and garbage collection of namespaces, but with envtest, we aren't + // running a kube-controller-manager. Instead we're gonna approximate + // (poorly) the kube-controller-manager by explicitly deleting some + // resources within the namespace and then removing the `kubernetes` + // finalizer from the namespace resource so it can finish deleting. + // Note that any resources within the namespace that we don't + // successfully delete could reappear if the namespace is ever + // recreated with the same name. + + // Look up all namespaced resources under the discovery API + _, apiResources, err := clientGo.Discovery().ServerGroupsAndResources() + Expect(err).ShouldNot(HaveOccurred()) + namespacedGVKs := make(map[string]schema.GroupVersionKind) + for _, apiResourceList := range apiResources { + defaultGV, err := schema.ParseGroupVersion(apiResourceList.GroupVersion) + Expect(err).ShouldNot(HaveOccurred()) + for _, r := range apiResourceList.APIResources { + if !r.Namespaced || strings.Contains(r.Name, "/") { + // skip non-namespaced and subresources + continue + } + gvk := schema.GroupVersionKind{ + Group: defaultGV.Group, + Version: defaultGV.Version, + Kind: r.Kind, + } + if r.Group != "" { + gvk.Group = r.Group + } + if r.Version != "" { + gvk.Version = r.Version + } + namespacedGVKs[gvk.String()] = gvk + } + } + + // Delete all namespaced resources in this namespace + for _, gvk := range namespacedGVKs { + var u unstructured.Unstructured + u.SetGroupVersionKind(gvk) + err := k8sClient.DeleteAllOf(ctx, &u, client.InNamespace(ns.Name)) + Expect(client.IgnoreNotFound(ignoreMethodNotAllowed(err))).ShouldNot(HaveOccurred()) + } + + // Delete all Services in this namespace + serviceList := corev1.ServiceList{} + err = k8sClient.List(ctx, &serviceList, client.InNamespace(ns.Name)) + Expect(err).ShouldNot(HaveOccurred()) + for idx := range serviceList.Items { + policy := metav1.DeletePropagationForeground + err = k8sClient.Delete(ctx, &serviceList.Items[idx], &client.DeleteOptions{PropagationPolicy: &policy}) + Expect(err).ShouldNot(HaveOccurred()) + } + + Eventually(func() error { + key := client.ObjectKeyFromObject(ns) + if err := k8sClient.Get(ctx, key, ns); err != nil { + return client.IgnoreNotFound(err) + } + // remove `kubernetes` finalizer + const kubernetes = "kubernetes" + finalizers := []corev1.FinalizerName{} + for _, f := range ns.Spec.Finalizers { + if f != kubernetes { + finalizers = append(finalizers, f) + } + } + ns.Spec.Finalizers = finalizers + + // We have to use the k8s.io/client-go library here to expose + // ability to patch the /finalize subresource on the namespace + _, err = clientGo.CoreV1().Namespaces().Finalize(ctx, ns, metav1.UpdateOptions{}) + return err + }, Timeout, Interval).Should(Succeed()) + } + + Eventually(func() metav1.StatusReason { + key := client.ObjectKeyFromObject(obj) + if err := k8sClient.Get(ctx, key, obj); err != nil { + return apierrors.ReasonForError(err) + } + return "" + }, Timeout, Interval).Should(Equal(metav1.StatusReasonNotFound)) + } +} + +func ignoreMethodNotAllowed(err error) error { + if err != nil { + if apierrors.ReasonForError(err) == metav1.StatusReasonMethodNotAllowed { + return nil + } + } + return err +} + +func SetupK8STestManager(testCtx *context.Context, k8sClient *client.Client, controllers func(mgr *manager.Manager) []Reconciler) *envtest.Environment { ctx, cancel := context.WithCancel(context.TODO()) *testCtx = ctx @@ -83,4 +195,6 @@ func SetupK8STestManager(testCtx *context.Context, k8sClient *client.Client, con err := testEnv.Stop() Expect(err).NotTo(HaveOccurred()) }) + + return testEnv } diff --git a/samples/database.yaml b/samples/database.yaml index 60dcd62f..0aa381de 100644 --- a/samples/database.yaml +++ b/samples/database.yaml @@ -4,7 +4,7 @@ metadata: name: database-sample spec: image: - name: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17 nodes: 3 resources: storageUnits: diff --git a/samples/kind/database-3dc.yaml b/samples/kind/database-3dc.yaml new file mode 100644 index 00000000..51646414 --- /dev/null +++ b/samples/kind/database-3dc.yaml @@ -0,0 +1,24 @@ +apiVersion: ydb.tech/v1alpha1 +kind: Database +metadata: + name: database-kind-sample +spec: + image: + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - storage-node + topologyKey: "kubernetes.io/hostname" + nodes: 3 + resources: + storageUnits: + - count: 1 + unitKind: ssd + storageClusterRef: + name: storage-kind-sample diff --git a/samples/kind/database.yaml b/samples/kind/database.yaml new file mode 100644 index 00000000..15b607bb --- /dev/null +++ b/samples/kind/database.yaml @@ -0,0 +1,14 @@ +apiVersion: ydb.tech/v1alpha1 +kind: Database +metadata: + name: database-kind-sample +spec: + image: + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 + nodes: 1 + resources: + storageUnits: + - count: 1 + unitKind: ssd + storageClusterRef: + name: storage-kind-sample diff --git a/samples/kind/kind-3dc-config.yaml b/samples/kind/kind-3dc-config.yaml new file mode 100644 index 00000000..c21201fc --- /dev/null +++ b/samples/kind/kind-3dc-config.yaml @@ -0,0 +1,13 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: + - role: control-plane + - role: worker + labels: + topology.kubernetes.io/zone: az-1 + - role: worker + labels: + topology.kubernetes.io/zone: az-2 + - role: worker + labels: + topology.kubernetes.io/zone: az-3 diff --git a/samples/kind/kind-config.yaml b/samples/kind/kind-config.yaml new file mode 100644 index 00000000..33738683 --- /dev/null +++ b/samples/kind/kind-config.yaml @@ -0,0 +1,7 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: + - role: control-plane + - role: worker + labels: + topology.kubernetes.io/zone: az-1 diff --git a/samples/kind/storage-mirror-3dc.yaml b/samples/kind/storage-mirror-3dc.yaml new file mode 100644 index 00000000..cfe42a77 --- /dev/null +++ b/samples/kind/storage-mirror-3dc.yaml @@ -0,0 +1,113 @@ +apiVersion: ydb.tech/v1alpha1 +kind: Storage +metadata: + name: storage-kind-sample +spec: + image: + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - storage-node + topologyKey: "kubernetes.io/hostname" + dataStore: [] + nodes: 3 + domain: Root + erasure: mirror-3-dc + configuration: |- + actor_system_config: + cpu_count: 1 + node_type: STORAGE + use_auto_config: true + blob_storage_config: + service_set: + groups: + - erasure_species: mirror-3-dc + rings: + - fail_domains: + - vdisk_locations: + - node_id: 1 + pdisk_category: SSD + path: SectorMap:1:64 + - vdisk_locations: + - node_id: 1 + pdisk_category: SSD + path: SectorMap:2:64 + - vdisk_locations: + - node_id: 1 + pdisk_category: SSD + path: SectorMap:3:64 + - fail_domains: + - vdisk_locations: + - node_id: 2 + pdisk_category: SSD + path: SectorMap:1:64 + - vdisk_locations: + - node_id: 2 + pdisk_category: SSD + path: SectorMap:2:64 + - vdisk_locations: + - node_id: 2 + pdisk_category: SSD + path: SectorMap:3:64 + - fail_domains: + - vdisk_locations: + - node_id: 3 + pdisk_category: SSD + path: SectorMap:1:64 + - vdisk_locations: + - node_id: 3 + pdisk_category: SSD + path: SectorMap:2:64 + - vdisk_locations: + - node_id: 3 + pdisk_category: SSD + path: SectorMap:3:64 + channel_profile_config: + profile: + - channel: + - erasure_species: mirror-3-dc + pdisk_category: 0 + storage_pool_kind: ssd + - erasure_species: mirror-3-dc + pdisk_category: 0 + storage_pool_kind: ssd + - erasure_species: mirror-3-dc + pdisk_category: 0 + storage_pool_kind: ssd + profile_id: 0 + domains_config: + domain: + - name: Root + storage_pool_types: + - kind: ssd + pool_config: + box_id: 1 + erasure_species: mirror-3-dc + kind: ssd + pdisk_filter: + - property: + - type: SSD + vdisk_kind: Default + state_storage: + - ring: + node: [1, 2, 3] + nto_select: 3 + ssid: 1 + grpc_config: + port: 2135 + host_configs: + - drive: + - path: SectorMap:1:64 + type: SSD + - path: SectorMap:2:64 + type: SSD + - path: SectorMap:3:64 + type: SSD + host_config_id: 1 + static_erasure: mirror-3-dc diff --git a/samples/kind/storage.yaml b/samples/kind/storage.yaml new file mode 100644 index 00000000..84874e1f --- /dev/null +++ b/samples/kind/storage.yaml @@ -0,0 +1,65 @@ +apiVersion: ydb.tech/v1alpha1 +kind: Storage +metadata: + name: storage-kind-sample +spec: + dataStore: [] + image: + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 + nodes: 1 + domain: Root + erasure: none + configuration: |- + actor_system_config: + cpu_count: 1 + node_type: STORAGE + use_auto_config: true + blob_storage_config: + service_set: + groups: + - erasure_species: none + rings: + - fail_domains: + - vdisk_locations: + - node_id: 1 + path: SectorMap:1:64 + pdisk_category: SSD + channel_profile_config: + profile: + - channel: + - erasure_species: none + pdisk_category: 0 + storage_pool_kind: ssd + - erasure_species: none + pdisk_category: 0 + storage_pool_kind: ssd + - erasure_species: none + pdisk_category: 0 + storage_pool_kind: ssd + profile_id: 0 + domains_config: + domain: + - name: Root + storage_pool_types: + - kind: ssd + pool_config: + box_id: 1 + erasure_species: none + kind: ssd + pdisk_filter: + - property: + - type: SSD + vdisk_kind: Default + state_storage: + - ring: + node: [1] + nto_select: 1 + ssid: 1 + grpc_config: + port: 2135 + host_configs: + - drive: + - path: SectorMap:1:64 + type: SSD + host_config_id: 1 + static_erasure: none diff --git a/samples/minikube/database.yaml b/samples/minikube/database.yaml index 9066208d..af2c61f1 100644 --- a/samples/minikube/database.yaml +++ b/samples/minikube/database.yaml @@ -4,7 +4,7 @@ metadata: name: database-minikube-sample spec: image: - name: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 nodes: 1 domain: Root service: diff --git a/samples/minikube/storage.yaml b/samples/minikube/storage.yaml index f3fabc6a..0c407115 100644 --- a/samples/minikube/storage.yaml +++ b/samples/minikube/storage.yaml @@ -5,7 +5,7 @@ metadata: spec: dataStore: [] image: - name: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 nodes: 1 domain: Root erasure: none diff --git a/samples/remote-rbac.yml b/samples/remote-rbac.yml new file mode 100644 index 00000000..68834d8b --- /dev/null +++ b/samples/remote-rbac.yml @@ -0,0 +1,92 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: yc-dev + namespace: ydb +--- +apiVersion: v1 +kind: Secret +metadata: + name: yc-dev-token + namespace: ydb + annotations: + kubernetes.io/service-account.name: yc-dev +type: kubernetes.io/service-account-token +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: ydb-operator-remote + namespace: ydb +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch +- apiGroups: + - ydb.tech + resources: + - remotedatabasenodesets + - remotestoragenodesets + verbs: + - get + - list + - watch +- apiGroups: + - ydb.tech + resources: + - remotedatabasenodesets + - remotestoragenodesets + verbs: + - update +- apiGroups: + - ydb.tech + resources: + - remotedatabasenodesets/status + - remotestoragenodesets/status + verbs: + - get + - patch + - update +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: ydb-operator-remote-rolebinding + namespace: ydb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: ydb-operator-remote +subjects: +- kind: ServiceAccount + name: yc-dev + namespace: ydb diff --git a/samples/storage-block-4-2.yaml b/samples/storage-block-4-2.yaml index 5890ee74..e4bfa4c8 100644 --- a/samples/storage-block-4-2.yaml +++ b/samples/storage-block-4-2.yaml @@ -11,7 +11,7 @@ spec: storage: 93Gi volumeMode: Block image: - name: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17 nodes: 8 erasure: block-4-2 configuration: |- diff --git a/samples/storage-mirror-3dc-nodeset.yaml b/samples/storage-mirror-3dc-nodeset.yaml new file mode 100644 index 00000000..5029331c --- /dev/null +++ b/samples/storage-mirror-3dc-nodeset.yaml @@ -0,0 +1,140 @@ +apiVersion: ydb.tech/v1alpha1 +kind: Storage +metadata: + name: storage-sample +spec: + dataStore: + - volumeMode: Block + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 80Gi + image: + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17 + nodes: 9 + nodeSets: + - name: nodeset-1 + nodes: 9 + remote: + cluster: "yc-dev" + erasure: mirror-3-dc + configuration: |- + static_erasure: mirror-3-dc + host_configs: + - drive: + - path: /dev/kikimr_ssd_00 + type: SSD + host_config_id: 1 + grpc_config: + port: 2135 + domains_config: + domain: + - name: Root + storage_pool_types: + - kind: ssd + pool_config: + box_id: 1 + erasure_species: mirror-3-dc + kind: ssd + pdisk_filter: + - property: + - type: SSD + vdisk_kind: Default + state_storage: + - ring: + node: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] + nto_select: 5 + ssid: 1 + actor_system_config: + batch_executor: 2 + io_executor: 3 + executor: + - name: System + spin_threshold: 0 + threads: 2 + type: BASIC + - name: User + spin_threshold: 0 + threads: 3 + type: BASIC + - name: Batch + spin_threshold: 0 + threads: 2 + type: BASIC + - name: IO + threads: 1 + time_per_mailbox_micro_secs: 100 + type: IO + - name: IC + spin_threshold: 10 + threads: 1 + time_per_mailbox_micro_secs: 100 + type: BASIC + scheduler: + progress_threshold: 10000 + resolution: 256 + spin_threshold: 0 + service_executor: + - executor_id: 4 + service_name: Interconnect + blob_storage_config: + service_set: + availability_domains: 1 + groups: + - erasure_species: mirror-3-dc + group_id: 0 + group_generation: 1 + rings: + - fail_domains: + - vdisk_locations: + - node_id: 1 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - vdisk_locations: + - node_id: 2 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - vdisk_locations: + - node_id: 3 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - fail_domains: + - vdisk_locations: + - node_id: 4 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - vdisk_locations: + - node_id: 5 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - vdisk_locations: + - node_id: 6 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - fail_domains: + - vdisk_locations: + - node_id: 7 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - vdisk_locations: + - node_id: 8 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + - vdisk_locations: + - node_id: 9 + pdisk_category: SSD + path: /dev/kikimr_ssd_00 + channel_profile_config: + profile: + - channel: + - erasure_species: mirror-3-dc + pdisk_category: 1 + storage_pool_kind: ssd + - erasure_species: mirror-3-dc + pdisk_category: 1 + storage_pool_kind: ssd + - erasure_species: mirror-3-dc + pdisk_category: 1 + storage_pool_kind: ssd + profile_id: 0 diff --git a/samples/storage-mirror-3dc.yaml b/samples/storage-mirror-3dc.yaml index 07f9b307..b4d0801a 100644 --- a/samples/storage-mirror-3dc.yaml +++ b/samples/storage-mirror-3dc.yaml @@ -11,7 +11,7 @@ spec: requests: storage: 80Gi image: - name: cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44 + name: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7 nodes: 9 erasure: mirror-3-dc configuration: |- diff --git a/tests/cfg/kind-cluster-config.yaml b/tests/cfg/kind-cluster-config.yaml new file mode 100644 index 00000000..82348230 --- /dev/null +++ b/tests/cfg/kind-cluster-config.yaml @@ -0,0 +1,24 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + +- role: worker + extraPortMappings: + - containerPort: 30001 + hostPort: 30001 + listenAddress: "127.0.0.1" + protocol: tcp + labels: + topology.kubernetes.io/zone: az-1 + worker: true + +- role: worker + labels: + topology.kubernetes.io/zone: az-2 + worker: true + +- role: worker + labels: + topology.kubernetes.io/zone: az-3 + worker: true diff --git a/e2e/operator-values.yaml b/tests/cfg/operator-local-values.yaml similarity index 80% rename from e2e/operator-values.yaml rename to tests/cfg/operator-local-values.yaml index 41c1efe4..f81cad01 100644 --- a/e2e/operator-values.yaml +++ b/tests/cfg/operator-local-values.yaml @@ -1,7 +1,7 @@ image: + pullPolicy: IfNotPresent repository: kind/ydb-operator tag: current - pullPolicy: Never webhook: enabled: true diff --git a/tests/cfg/operator-values.yaml b/tests/cfg/operator-values.yaml new file mode 100644 index 00000000..edc33299 --- /dev/null +++ b/tests/cfg/operator-values.yaml @@ -0,0 +1,5 @@ +webhook: + enabled: true + + patch: + enabled: true diff --git a/tests/compatibility/compatibility_suite_test.go b/tests/compatibility/compatibility_suite_test.go new file mode 100644 index 00000000..1b28479c --- /dev/null +++ b/tests/compatibility/compatibility_suite_test.go @@ -0,0 +1,364 @@ +package compatibility + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/kubectl/pkg/scheme" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + logf "sigs.k8s.io/controller-runtime/pkg/log" + + v1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" + . "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-utils" +) + +var ( + k8sClient client.Client + restConfig *rest.Config + + testEnv *envtest.Environment + + oldVersion string + newVersion string +) + +func TestCompatibility(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Compatibility Suite") +} + +var _ = BeforeSuite(func() { + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) + + useExistingCluster := true + testEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "deploy", "ydb-operator", "crds")}, + ErrorIfCRDPathMissing: true, + UseExistingCluster: &useExistingCluster, + } + + cfg, err := testEnv.Start() + Expect(err).NotTo(HaveOccurred()) + Expect(cfg).NotTo(BeNil()) + + if useExistingCluster && !(strings.Contains(cfg.Host, "127.0.0.1") || strings.Contains(cfg.Host, "::1") || strings.Contains(cfg.Host, "localhost")) { + Fail("You are trying to run e2e tests against some real cluster, not the local `kind` cluster!") + } + + err = v1alpha1.AddToScheme(scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) + + k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) + Expect(err).NotTo(HaveOccurred()) + Expect(k8sClient).NotTo(BeNil()) + + clientset, err := kubernetes.NewForConfig(cfg) + Expect(err).NotTo(HaveOccurred()) + Expect(clientset).NotTo(BeNil()) + + oldVersion = os.Getenv("PREVIOUS_VERSION") + newVersion = os.Getenv("NEW_VERSION") + Expect(oldVersion).NotTo(BeEmpty(), "PREVIOUS_VERSION environment variable is required") + Expect(newVersion).NotTo(BeEmpty(), "NEW_VERSION environment variable is required") +}) + +var _ = Describe("Operator Compatibility Test", func() { + var ( + ctx context.Context + namespace corev1.Namespace + storageSample *v1alpha1.Storage + databaseSample *v1alpha1.Database + ) + + BeforeEach(func() { + ctx = context.Background() + + namespace = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + Name: testobjects.YdbNamespace, + }, + } + Expect(k8sClient.Create(ctx, &namespace)).Should(Succeed()) + + Eventually(func() bool { + ns := &corev1.Namespace{} + err := k8sClient.Get(ctx, client.ObjectKey{Name: namespace.Name}, ns) + return err == nil + }, Timeout, Interval).Should(BeTrue()) + + By(fmt.Sprintf("Installing previous operator version %s", oldVersion)) + InstallOperatorWithHelm(testobjects.YdbNamespace, oldVersion) + + storageSample = testobjects.DefaultStorage(filepath.Join("..", "data", "storage-mirror-3-dc-config.yaml")) + databaseSample = testobjects.DefaultDatabase() + }) + + It("Upgrades from old operator to new operator, objects persist, YQL works", func() { + By("Creating Storage resource") + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, storageSample)).Should(Succeed()) + + By("Waiting for Storage to be ready") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("Creating Database resource") + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, databaseSample)).Should(Succeed()) + defer DeleteDatabase(ctx, k8sClient, databaseSample) + + By("Waiting for Database to be ready") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By(fmt.Sprintf("Upgrading CRDs from %s to %s", oldVersion, newVersion)) + UpdateCRDsTo(YdbOperatorReleaseName, namespace.Name, newVersion) + + By(fmt.Sprintf("Upgrading operator from %s to %s, with uninstalling, just to cause more chaos", oldVersion, newVersion)) + UninstallOperatorWithHelm(testobjects.YdbNamespace) + InstallOperatorWithHelm(testobjects.YdbNamespace, newVersion) + + By("Verifying Storage + Database are the same objects after upgrade") + Consistently(func() error { + storageAfterUpgrade := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &storageAfterUpgrade) + if err != nil { + return err + } + if storageAfterUpgrade.UID != storageSample.UID { + return fmt.Errorf("storage UID has changed") + } + + databaseAfterUpgrade := v1alpha1.Database{} + err = k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &databaseAfterUpgrade) + if err != nil { + return err + } + if databaseAfterUpgrade.UID != databaseSample.UID { + return fmt.Errorf("database UID has changed") + } + return nil + }, ConsistentConditionTimeout, Interval).Should(Succeed()) + + By("Restarting storage pods (one by one, no rolling restart, for simplicity)") + RestartPodsNoRollingRestart(ctx, k8sClient, testobjects.YdbNamespace, "ydb-cluster", "kind-storage") + + By("Restarting database pods (one by one, no rolling restart, for simplicity)") + RestartPodsNoRollingRestart(ctx, k8sClient, testobjects.YdbNamespace, "ydb-cluster", "kind-database") + + database := v1alpha1.Database{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &database)).Should(Succeed()) + storageEndpoint := database.Spec.StorageEndpoint + + databasePods := corev1.PodList{} + Expect(k8sClient.List(ctx, &databasePods, + client.InNamespace(testobjects.YdbNamespace), + client.MatchingLabels{"ydb-cluster": "kind-database"}), + ).Should(Succeed()) + + Expect(databasePods.Items).ToNot(BeEmpty()) + podName := databasePods.Items[0].Name + + By("bring YDB CLI inside ydb database pod...") + BringYdbCliToPod(podName, testobjects.YdbNamespace) + + By("execute simple query inside ydb database pod...") + databasePath := "/" + testobjects.DefaultDomain + "/" + databaseSample.Name + ExecuteSimpleTableE2ETest(podName, testobjects.YdbNamespace, storageEndpoint, databasePath) + }) + + It("Upgrades from old operator to new operator, applying objects later succeeds", func() { + By("Creating Storage resource") + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, storageSample)).Should(Succeed()) + + By("Waiting for Storage to be ready") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("Creating Database resource") + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, databaseSample)).Should(Succeed()) + defer DeleteDatabase(ctx, k8sClient, databaseSample) + + By("Waiting for Database to be ready") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By(fmt.Sprintf("Upgrading CRDs from %s to %s", oldVersion, newVersion)) + UpdateCRDsTo(YdbOperatorReleaseName, namespace.Name, newVersion) + + By(fmt.Sprintf("Upgrading operator from %s to %s, with uninstalling, just to cause more chaos", oldVersion, newVersion)) + UninstallOperatorWithHelm(testobjects.YdbNamespace) + InstallOperatorWithHelm(testobjects.YdbNamespace, newVersion) + + By("Verifying Storage + Database are the same objects after upgrade") + Consistently(func() error { + storageAfterUpgrade := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &storageAfterUpgrade) + if err != nil { + return err + } + if storageAfterUpgrade.UID != storageSample.UID { + return fmt.Errorf("storage UID has changed") + } + + databaseAfterUpgrade := v1alpha1.Database{} + err = k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &databaseAfterUpgrade) + if err != nil { + return err + } + if databaseAfterUpgrade.UID != databaseSample.UID { + return fmt.Errorf("database UID has changed") + } + return nil + }, ConsistentConditionTimeout, Interval).Should(Succeed()) + + By("Restarting storage pods (one by one, no rolling restart, for simplicity)") + RestartPodsNoRollingRestart(ctx, k8sClient, testobjects.YdbNamespace, "ydb-cluster", "kind-storage") + + By("Restarting database pods (one by one, no rolling restart, for simplicity)") + RestartPodsNoRollingRestart(ctx, k8sClient, testobjects.YdbNamespace, "ydb-cluster", "kind-database") + + // This is probably the most important check. + // If any major fields moved or got deleted, updating a resource will fail + // For this to work even better, TODO @jorres make this storage object as full as possible + // (utilizing as many fields), as it will help catching an error + By("applying the storage again must NOT fail because of CRD issues...") + Expect(k8sClient.Get(ctx, client.ObjectKey{ + Name: storageSample.Name, + Namespace: storageSample.Namespace, + }, storageSample)).Should(Succeed()) + Expect(k8sClient.Update(ctx, storageSample)).Should(Succeed()) + + By("applying the database again must NOT fail because of CRD issues...") + Expect(k8sClient.Get(ctx, client.ObjectKey{ + Name: databaseSample.Name, + Namespace: databaseSample.Namespace, + }, databaseSample)).Should(Succeed()) + Expect(k8sClient.Update(ctx, databaseSample)).Should(Succeed()) + }) + + AfterEach(func() { + By("Uninstalling operator") + UninstallOperatorWithHelm(testobjects.YdbNamespace) + + By("Deleting namespace") + Expect(k8sClient.Delete(ctx, &namespace)).Should(Succeed()) + Eventually(func() bool { + ns := &corev1.Namespace{} + err := k8sClient.Get(ctx, client.ObjectKey{Name: namespace.Name}, ns) + return apierrors.IsNotFound(err) + }, Timeout, Interval).Should(BeTrue()) + }) +}) + +func UpdateCRDsTo(releaseName, namespace, version string) { + tempDir, err := os.MkdirTemp("", "helm-chart-*") + Expect(err).ShouldNot(HaveOccurred()) + defer os.RemoveAll(tempDir) + + cmd := exec.Command("helm", "pull", YdbOperatorRemoteChart, "--version", version, "--untar", "--untardir", tempDir) + output, err := cmd.CombinedOutput() + Expect(err).ShouldNot(HaveOccurred(), string(output)) + + crdDir := filepath.Join(tempDir, YdbOperatorRemoteChart, "crds") + crdFiles, err := filepath.Glob(filepath.Join(crdDir, "*.yaml")) + Expect(err).ShouldNot(HaveOccurred()) + for _, crdFile := range crdFiles { + cmd := exec.Command("kubectl", "apply", "-f", crdFile) + output, err := cmd.CombinedOutput() + Expect(err).ShouldNot(HaveOccurred(), fmt.Sprintf("failed to apply CRD %s: %s", crdFile, string(output))) + } +} + +var _ = AfterSuite(func() { + By("cleaning up the test environment") + err := testEnv.Stop() + Expect(err).NotTo(HaveOccurred()) +}) + +// This was the fastest way to implement restart without bringing rolling +// restart to operator itself or using ydbops. If you read this and +// operator already can do rolling restart natively, please rewrite +// this function! +func RestartPodsNoRollingRestart( + ctx context.Context, + k8sClient client.Client, + namespace string, + labelKey, labelValue string, +) { + podList := corev1.PodList{} + + Expect(k8sClient.List(ctx, &podList, client.InNamespace(namespace), client.MatchingLabels{ + labelKey: labelValue, + })).Should(Succeed()) + + for _, pod := range podList.Items { + originalUID := pod.UID + Expect(k8sClient.Delete(ctx, &pod)).Should(Succeed()) + + Eventually(func() bool { + newPod := corev1.Pod{} + err := k8sClient.Get(ctx, types.NamespacedName{Name: pod.Name, Namespace: namespace}, &newPod) + if err != nil { + return apierrors.IsNotFound(err) + } + return newPod.UID != originalUID + }, Timeout, Interval).Should(BeTrue(), fmt.Sprintf("Pod %s should be recreated with a new UID", pod.Name)) + + Eventually(func() bool { + newPod := corev1.Pod{} + err := k8sClient.Get(ctx, types.NamespacedName{Name: pod.Name, Namespace: namespace}, &newPod) + if err != nil { + return false + } + return newPod.Status.Phase == corev1.PodRunning + }, Timeout, Interval).Should(BeTrue(), fmt.Sprintf("Pod %s should be running", pod.Name)) + + time.Sleep(120 * time.Second) + } +} diff --git a/tests/data/database.crt b/tests/data/database.crt new file mode 100644 index 00000000..5dbc3481 --- /dev/null +++ b/tests/data/database.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDhDCCAmygAwIBAgIUUQQsk4wdGfrawpygX64aFtR6/1IwDQYJKoZIhvcNAQEL +BQAwFzEVMBMGA1UEAwwMdGVzdC1yb290LWNhMB4XDTI0MTIwNTEzMjEwMVoXDTM5 +MTIwMjEzMjEwMVowDzENMAsGA1UECgwEdGVzdDCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAMU+EoeP6971G2uFgo2Sm2Ela8rjZSmivZZ3Xg//rj9gcfle +KNoJ5EAHdwyTfapLoSVvgy1QLun15ibWeRgbBuUt2+DiHnEpaeriUqmktki9UIzl +pAjytDwCmsjbOoLXRhCIa02tkU6rF8JjpwitZnwhTXjJTAkuJiuNvN2EEdacTlx1 +ZPdcHQveJTVJy4eOoSA8yc72XG9CWPY8mhLMTOzoZqbRX7MRoZoyYaV8TNAyQmh4 +tX045h4u1ZmMkWC06z2n+8Le3wTpu6mccOhS2ETw0j3Jefx78Zafc2s+jX0lCP71 +qiQXeEx1vuYQ5+nop2wh2nTFeFrjH+zZ4eyKduUCAwEAAaOBzzCBzDBdBgNVHREE +VjBUgiNkYXRhYmFzZS1ncnBjLnlkYi5zdmMuY2x1c3Rlci5sb2NhbIItKi5kYXRh +YmFzZS1pbnRlcmNvbm5lY3QueWRiLnN2Yy5jbHVzdGVyLmxvY2FsMB0GA1UdJQQW +MBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBRe +hFiyRdaUYUiw6KnHiuTcqwh0CjAfBgNVHSMEGDAWgBRPTY3GM3OCesbsHOf9zDIu +T6ubJTANBgkqhkiG9w0BAQsFAAOCAQEAkYb1N40MGhxw07vVDPHrBfuMSgPqSqef +myPtwAIuwPIOILIAIek0yUogeMKF7kv/C5fyRnac3iHz59M7V4PetW7YhLB6G20n +bOpvq1Bp8Lw7WwRviULWHHIsS9OZlekvikEs3jS9H7XZGgmKC4mN3GbCZkpUvRjU +BBsdyKkQsDupofrzbFPaWfgRjUPGuQ27vUrZkPlmQPrZmowJpTIYwMyJxL8qFtip +JWX8qsKRle58L/K64Nx7AbW2LFjey8txJtkkROwpy9Zt7Dn0kvLcjZC2H8Nqdx8o +bPJqXdMlbGEUFDo1W6W/6zYCRUuDVvtM26Yua5DOm+6wJW+sSqlv4Q== +-----END CERTIFICATE----- diff --git a/tests/data/database.key b/tests/data/database.key new file mode 100644 index 00000000..274d72b9 --- /dev/null +++ b/tests/data/database.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDFPhKHj+ve9Rtr +hYKNkpthJWvK42Upor2Wd14P/64/YHH5XijaCeRAB3cMk32qS6Elb4MtUC7p9eYm +1nkYGwblLdvg4h5xKWnq4lKppLZIvVCM5aQI8rQ8AprI2zqC10YQiGtNrZFOqxfC +Y6cIrWZ8IU14yUwJLiYrjbzdhBHWnE5cdWT3XB0L3iU1ScuHjqEgPMnO9lxvQlj2 +PJoSzEzs6Gam0V+zEaGaMmGlfEzQMkJoeLV9OOYeLtWZjJFgtOs9p/vC3t8E6bup +nHDoUthE8NI9yXn8e/GWn3NrPo19JQj+9aokF3hMdb7mEOfp6KdsIdp0xXha4x/s +2eHsinblAgMBAAECggEALgJQ8bDDcTZlD0NtJOd8GaDQQFsjO59T0I+nEB3Q0EVH +yMarSlMQ3FOxdCxKXak3HYOhynXf/6Clr00LobEaPmbgWZh9R+HEbG8fH6XFhHmu +mrMtfI3at33XC7/BqggbtpsPxqaUVNCpoeU7bxV9qLpe9ywjcafDbRjqo5RdUd0q +J29OtBD/tfEFU17Bv0VlYW/IXmGhJp686ZDvUpybrc2qGiWJo5wnGgUpL0OLNk0L +piK7TThjDzBNLCSzq6DOZOwIoNBmGINLK1Q3SjC77zWH3YzZv/u3EjE3v61phQlj +hy2tR3yimFYGxX6ZJduockJgOC4WJznkR2G85HjggQKBgQD5+JB1o5rfo7J7Txgl +afL7EL2v/+VZ7DSs7Zh+zlIbGGr2vNnW5SgOOfpnjAY+8E91D3BzfmWdIb7/BGwB +6VAq6aH4a1xhOfWRmUgHL1vDfMfxO8hFN2Ixo2QCt+mQv09lZrExpr1RmlHPPija +XWJ0yE85cJHZlfywLQrG85F+gQKBgQDJ//ArSt4idZ4uRyslMj2ntnsBaD8DwVzl +jie1+ohMW26Fsw3059JplmmiPAvQXFzl3oZcOpJjxjHdGP7al3mdzGHbBSLDtW/h +bREUX78RZm9WHpc2K8ZkPxp36EAysZpmKCdkWH7lB/pt7926BUyqhHXk7thrkTeU +PylzE/iOZQKBgE4oHKrbg5IHMcgCO+9+x/0eB+EepoxOIU4sX7DOO7fDE7af55Cc +R8Di+dskWdOV+ZIFSMijrYvKwFgl/ss+MtWoBP+SOekgYRqsDWxJr2xY+H8BjSWv +ImGYz61V6Y5bcqymxiJbGviHwqqEqetUpXMUKkkwXDnm/oHrI2J/R2+BAoGAYlzv +7ZTqcGtH2I8tUlKRtV5lrXy+2qxI+Tts2O+jeVM4kYBsdmqAiowE6kxFEHQ5hHIE +iVq4OD+lvl1SlM0YGqAQsp9gm155mZMLsxkgqG9yHcSNq4JLfDtCP0toH4degQpi +jDmPqSVmbCxWkyPLfmk8I3uvBUpUfyr2myQJcAUCgYEA+b+ovH8gh3PGfuXtj4zW +6IjGXnmt4u2YUssF9sBklbTq9Ev8M4h58TlNh1oHWQ6yyXnpsP8vZMFU0iMYybvi +WGfPMtigyiLASjTV7Ws60uQlZ8raHqtb7QN5wJrvGqVxJe6aw/gQmxY8ejNjjWyM +1QkHQGyLaWJWFUy3blpUBsA= +-----END PRIVATE KEY----- diff --git a/tests/data/generate-crts/README.md b/tests/data/generate-crts/README.md new file mode 100644 index 00000000..ad58d965 --- /dev/null +++ b/tests/data/generate-crts/README.md @@ -0,0 +1,13 @@ +## Certificates for testing + +`ca.crt` and `ca.key` are just a self-signed CA created like this: + + +``` +openssl genrsa -out ca.key 2048 +openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt -subj "/CN=test-root-ca" +``` + +Then use `generate-test-certs.sh` to generate storage and database certs, which then are used in tests. + +`ca.srl` is a file created by the script as well. diff --git a/tests/data/generate-crts/ca.crt b/tests/data/generate-crts/ca.crt new file mode 100644 index 00000000..b8bf3192 --- /dev/null +++ b/tests/data/generate-crts/ca.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDzCCAfegAwIBAgIUPG5Ffwh8I/zAtqSePmlBTGsP2eEwDQYJKoZIhvcNAQEL +BQAwFzEVMBMGA1UEAwwMdGVzdC1yb290LWNhMB4XDTI0MTIwNTExMjk1MFoXDTM0 +MTIwMzExMjk1MFowFzEVMBMGA1UEAwwMdGVzdC1yb290LWNhMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA45Y8h+mKX0//0H6B+KUcmhyis2dlfI8MlQNo +1qRpsQQKkqY+n6J8mzFPO+XOC/kLia6SShgpGZF79xhC9+Iq+2ARulIbPH3PiUdf +gwnLD/wfFgCmPaFFfJ93v9AY+eWeq00IKkRVp2gfb159C9BZQmoiyPCPOlWuLN/B +ZPMFHZUWPbL+4mvy4BBrcS/+FncUf7dA5ND7lb26G/sXUGWpYPLclhNnu7Hvapi4 +pIx60d8Z3+5eOVHEVECqgIU8wUqTrUbg1YMUHSZxdnsIPnL985sa7a66x/GAgMAi +xuAhUBMyxTUXOXqW+GWIlrmOHmiYRp7ARA3dPbYJJ1kdDfJRswIDAQABo1MwUTAd +BgNVHQ4EFgQUT02NxjNzgnrG7Bzn/cwyLk+rmyUwHwYDVR0jBBgwFoAUT02NxjNz +gnrG7Bzn/cwyLk+rmyUwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AQEAfpqusEPmGoL/Hzkui/xs20k+JKFQ90e5iZPQLyuES7BKQp1iajMOytAIXlhY +dtt4oSOYmBfl2bs8OU0U2mjGetx0AHWINY7bNzg7wxd4H46iiCitC4qlUlGG23bF +GVQt7/SddmwKoOJBaasnRTBPqVTlreqAF4Ni8bY0kqO3GK5QWZ2sL+Btn9dML8aK +wLb6sW0h7rAjik0l3NcsrKE8UoViWjAgB3Oe9L00GSXaMnfD6V65XnzkXvLOpCdd +wjZHPoWinhqM8ZHm/iFSe2UcL1KG0rdrMg8oBY6zMNrgENEdhqEXNJJrioT9bzKE +FyNQDOxpeql/GJl2MGxj0FXy+Q== +-----END CERTIFICATE----- diff --git a/tests/data/generate-crts/ca.key b/tests/data/generate-crts/ca.key new file mode 100644 index 00000000..df26c211 --- /dev/null +++ b/tests/data/generate-crts/ca.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDjljyH6YpfT//Q +foH4pRyaHKKzZ2V8jwyVA2jWpGmxBAqSpj6fonybMU875c4L+QuJrpJKGCkZkXv3 +GEL34ir7YBG6Uhs8fc+JR1+DCcsP/B8WAKY9oUV8n3e/0Bj55Z6rTQgqRFWnaB9v +Xn0L0FlCaiLI8I86Va4s38Fk8wUdlRY9sv7ia/LgEGtxL/4WdxR/t0Dk0PuVvbob ++xdQZalg8tyWE2e7se9qmLikjHrR3xnf7l45UcRUQKqAhTzBSpOtRuDVgxQdJnF2 +ewg+cv3zmxrtrrrH8YCAwCLG4CFQEzLFNRc5epb4ZYiWuY4eaJhGnsBEDd09tgkn +WR0N8lGzAgMBAAECggEAB/+oZ6EeSzSalGSog2lPf13GR3E42znZLVuN/GKRkbZx ++1l7Fffgp+usZznaa11ODywNhCvOi1GA/obhw6iKmNnK2wuLstfmdWKxc/+MyCZf +nqcDMLim9+GllHOR4nve1GfEA7LxzQ0XHb4/vYHjFox4ZdYz5870bNX9triRKMrw +Ru6FMbdcMf8ClTHtqHIQgARRTOFvizqVFElFgrIo4eh8svseed3+xwX98oeC+O0u +WrLW42RpVWIoai+V6OdYzO+uALr8z0IC3yzw1pqLMVt+SLY0nS/qz8b3eruU4BmL +6i0BQvJF8QFCE+gmtZJSQyCXzOw5jcvlDAm10v/1QQKBgQD+eg13guElgrjvkjT6 +a1ry3hA5LfQ7QyqigydyZlkbPfBcnv0dsWXbL+toyu0RqMwcKBGG3/7bVpGx/0gb +EgtnDWgS/PyWpuW+scwhqryzCKLnbUCor3GIo7CkM+71m5BcOHNTUPoqrMt6/W6a +mQ4z+VNpVQlRrx3YXp2zbO/dgwKBgQDk8vqmioezNNNhnk/7LhFITN7TavsVT3LT +jgs9CTSwEKFLC8eo/sKPaTKTcPxhxrt9eOWhYbNNQ9WYzy/ulA/vKvfkZjvtUaHl +sC35E9FcMW6lSiM8LOQlPnJYq6VqIQOdTgtBp1lsmQvkRbAF7Wq2Fy8BjiwPJfV1 +CJejygI0EQKBgCZs96ucL7MiUhqa0TUfENSrg3ee4MoyEjYH5+T2X24lpC3YNBBP +wTmfusRQIAwSmP+HbV4YZLtqDwX5rkGoL+CXvadgXCPDf92Tq2dKCMRgAXlAngra +syIW1Y116hdcLig+vetOxve6r98adaESi3p9o4K8PHQBJViOsPFu+alRAoGAUtb8 +DIB5Y0VM6rheljLv++ocggDmgqpxkMyHknkfQEl0IvRLNQGhIkTdEO5D05kVw+uX +otH4D4/o3FazMC8QqOgyM8kuC8uKudIKgGJEUYhtUY9GuoI/tp4mv6CzxHfXl/Zi +KkpEGAA0hk8UxsBF6UbwMi7gEEcazlLik1gHfhECgYEA0HyiW3LaWfACD2y7gpYu +GDvF+Oo28tK2QBkPBa1FNtZ4BKBquGqe8V6iNuQ5HsZFwycFum/VU0FWoDOyLS5M +vclQT0fojPxlLTjS0B2PRBEv52cNNFwMrj/I/DerqdDh3saUIe1MeJoVIMDTE/Jl +H5v0FaUgorY35MZdyQ54uw0= +-----END PRIVATE KEY----- diff --git a/tests/data/generate-crts/ca.srl b/tests/data/generate-crts/ca.srl new file mode 100644 index 00000000..63d9a189 --- /dev/null +++ b/tests/data/generate-crts/ca.srl @@ -0,0 +1 @@ +51042C938C1D19FADAC29CA05FAE1A16D47AFF53 diff --git a/tests/data/generate-crts/generate-test-certs.sh b/tests/data/generate-crts/generate-test-certs.sh new file mode 100644 index 00000000..488f76d4 --- /dev/null +++ b/tests/data/generate-crts/generate-test-certs.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +CA_KEY="ca.key" +CA_CERT="ca.crt" + +# Output paths for the database and storage certificates and keys +DATABASE_KEY="../database.key" +DATABASE_CSR="database.csr" +DATABASE_CERT="../database.crt" + +STORAGE_KEY="../storage.key" +STORAGE_CSR="storage.csr" +STORAGE_CERT="../storage.crt" + +generate_certificate() { + local KEY_PATH=$1 + local CSR_PATH=$2 + local CERT_PATH=$3 + local CONFIG_FILE=$4 + + openssl req -new -newkey rsa:2048 -nodes -keyout "$KEY_PATH" -out "$CSR_PATH" -config "$CONFIG_FILE" + openssl x509 -req -in "$CSR_PATH" -CA "$CA_CERT" -CAkey "$CA_KEY" -CAcreateserial -out "$CERT_PATH" -days 5475 -sha256 -extensions req_ext -extfile "$CONFIG_FILE" +} + +# Paths to .cnf files, where we will write certificate settings +DATABASE_CONFIG="database-csr.cnf" +STORAGE_CONFIG="storage-csr.cnf" + +cat > $DATABASE_CONFIG < $STORAGE_CONFIG < Preparing -> Initializing -> Provisioning -> Ready", func() { + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + + By("waiting until Storage is ready...") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("tracking storage state changes...") + events, err := clientset.CoreV1().Events(testobjects.YdbNamespace).List(context.Background(), + metav1.ListOptions{TypeMeta: metav1.TypeMeta{Kind: "Storage"}}) + Expect(err).ShouldNot(HaveOccurred()) + + allowedChanges := map[ClusterState]ClusterState{ + StoragePending: StoragePreparing, + StoragePreparing: StorageInitializing, + StorageInitializing: StorageProvisioning, + StorageProvisioning: StorageReady, + } + + re := regexp.MustCompile(`Storage moved from ([a-zA-Z]+) to ([a-zA-Z]+)`) + for _, event := range events.Items { + if event.Reason == "StatusChanged" { + match := re.FindStringSubmatch(event.Message) + Expect(allowedChanges[ClusterState(match[1])]).Should(BeEquivalentTo(ClusterState(match[2]))) + } + } + }) + + It("using grpcs for storage connection", func() { + By("create storage certificate secret...") + storageCert := testobjects.StorageCertificate() + Expect(k8sClient.Create(ctx, storageCert)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, storageCert)).Should(Succeed()) + }() + By("create database certificate secret...") + databaseCert := testobjects.DatabaseCertificate() + Expect(k8sClient.Create(ctx, databaseCert)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, databaseCert)).Should(Succeed()) + }() + + By("create storage...") + storageSample = testobjects.DefaultStorage(filepath.Join("..", "data", "storage-mirror-3-dc-config-tls.yaml")) + storageSample.Spec.Service.GRPC.TLSConfiguration = testobjects.TLSConfiguration( + testobjects.StorageCertificateSecretName, + ) + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + + By("waiting until Storage is ready...") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("checking that all the storage pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) + + By("create database...") + databaseSample.Spec.Service.GRPC.TLSConfiguration = testobjects.TLSConfiguration( + testobjects.DatabaseCertificateSecretName, + ) + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) + }() + + By("waiting until database is ready...") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By("checking that all the database pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) + + database := v1alpha1.Database{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &database)).Should(Succeed()) + storageEndpoint := database.Spec.StorageEndpoint + + databasePods := corev1.PodList{} + Expect(k8sClient.List(ctx, &databasePods, + client.InNamespace(testobjects.YdbNamespace), + client.MatchingLabels{"ydb-cluster": "kind-database"}), + ).Should(Succeed()) + podName := databasePods.Items[0].Name + + By("bring YDB CLI inside ydb database pod...") + BringYdbCliToPod(podName, testobjects.YdbNamespace) + + By("execute simple query inside ydb database pod...") + databasePath := DatabasePathWithDefaultDomain(databaseSample) + ExecuteSimpleTableE2ETest(podName, testobjects.YdbNamespace, storageEndpoint, databasePath) + }) + + It("Check that Storage deleted after Database...", func() { + By("create storage...") + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + + By("create database...") + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + + By("waiting until Storage is ready...") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("checking that all the storage pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) + + By("waiting until Database is ready...") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By("checking that all the database pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) + + By("delete Storage...") + Expect(k8sClient.Delete(ctx, storageSample)).Should(Succeed()) + + By("checking that Storage deletionTimestamp is not nil...") + Eventually(func() bool { + foundStorage := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage) + if err != nil { + return false + } + return !foundStorage.DeletionTimestamp.IsZero() + }, Timeout, test.Interval).Should(BeTrue()) + + By("checking that Storage is present in cluster...") + Consistently(func() error { + foundStorage := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage) + return err + }, test.Timeout, test.Interval).ShouldNot(HaveOccurred()) + + By("delete Database...") + Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) + + By("checking that Storage deleted from cluster...") + Eventually(func() bool { + foundStorage := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &foundStorage) + return apierrors.IsNotFound(err) + }, Timeout, test.Interval).Should(BeTrue()) + }) + + It("check storage with dynconfig", func() { + By("create storage...") + storageSample = testobjects.DefaultStorage(filepath.Join("..", "data", "storage-mirror-3-dc-dynconfig.yaml")) + + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + + storage := v1alpha1.Storage{} + By("waiting until StorageInitialized condition is true...") + Eventually(func(g Gomega) bool { + g.Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &storage)).Should(Succeed()) + + condition := meta.FindStatusCondition(storage.Status.Conditions, StorageInitializedCondition) + if condition != nil { + return condition.Status == metav1.ConditionTrue + } + + return false + }, Timeout, Interval).Should(BeTrue()) + + By("waiting until ReplaceConfig condition is true...") + Eventually(func(g Gomega) bool { + g.Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &storage)).Should(Succeed()) + + condition := meta.FindStatusCondition(storage.Status.Conditions, ReplaceConfigOperationCondition) + if condition != nil && condition.ObservedGeneration == storage.Generation { + return condition.Status == metav1.ConditionTrue + } + + return false + }, Timeout, Interval).Should(BeTrue()) + + By("waiting until ConfigurationSynced condition is true...") + Eventually(func(g Gomega) bool { + g.Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: storageSample.Name, + Namespace: testobjects.YdbNamespace, + }, &storage)).Should(Succeed()) + + condition := meta.FindStatusCondition(storage.Status.Conditions, ConfigurationSyncedCondition) + if condition != nil && condition.ObservedGeneration == storage.Generation { + return condition.Status == metav1.ConditionTrue + } + + return false + }, Timeout, Interval).Should(BeTrue()) + }) + + It("TLS for status service", func() { + tlsHTTPCheck := func(port int, serverName string) error { + url := fmt.Sprintf("https://localhost:%d/", port) + cert, err := os.ReadFile(testobjects.TestCAPath) + Expect(err).ShouldNot(HaveOccurred()) + + certPool := x509.NewCertPool() + ok := certPool.AppendCertsFromPEM(cert) + Expect(ok).To(BeTrue()) + + tlsConfig := &tls.Config{ + MinVersion: tls.VersionTLS12, + RootCAs: certPool, + ServerName: serverName, + } + + transport := &http.Transport{TLSClientConfig: tlsConfig} + client := &http.Client{ + Transport: transport, + Timeout: test.Timeout, + } + resp, err := client.Get(url) + if err != nil { + var netError net.Error + var opError *net.OpError + + // for database: operator sets database ready status before the database is actually can server requests. + if errors.As(err, &netError) && netError.Timeout() || errors.As(err, &opError) || errors.Is(err, io.EOF) { + return err + } + + Expect(err).ShouldNot(HaveOccurred()) + + } + + Expect(resp).To(HaveHTTPStatus(http.StatusOK)) + + return nil + } + + By("create storage certificate secret...") + storageCert := testobjects.StorageCertificate() + Expect(k8sClient.Create(ctx, storageCert)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, storageCert)).Should(Succeed()) + }() + By("create database certificate secret...") + databaseCert := testobjects.DatabaseCertificate() + Expect(k8sClient.Create(ctx, databaseCert)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, databaseCert)).Should(Succeed()) + }() + + By("create storage...") + storageSample.Spec.Service.Status.TLSConfiguration = testobjects.TLSConfiguration( + testobjects.StorageCertificateSecretName, + ) + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + + By("create database...") + databaseSample.Spec.Nodes = 1 + databaseSample.Spec.Service.Status.TLSConfiguration = testobjects.TLSConfiguration( + testobjects.DatabaseCertificateSecretName, + ) + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) + }() + + By("waiting until Storage is ready...") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("checking that all the storage pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) + + By("forward storage status port and check that we can check TLS response") + PortForward(ctx, + fmt.Sprintf(resources.StatusServiceNameFormat, storageSample.Name), storageSample.Namespace, + "storage-grpc.ydb.svc.cluster.local", v1alpha1.StatusPort, tlsHTTPCheck, + ) + + By("waiting until database is ready...") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By("checking that all the database pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) + + By("forward database status port and check that we can check TLS response") + PortForward(ctx, + fmt.Sprintf(resources.StatusServiceNameFormat, databaseSample.Name), databaseSample.Namespace, + "database-grpc.ydb.svc.cluster.local", v1alpha1.StatusPort, tlsHTTPCheck, + ) + }) + + It("Check encryption for Database", func() { + By("create storage...") + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + By("create database...") + databaseSample.Spec.Encryption = &v1alpha1.EncryptionConfig{ + Enabled: true, + } + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) + }() + + By("waiting until Storage is ready...") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("checking that all the storage pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) + + By("waiting until database is ready...") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By("checking that all the database pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) + + database := v1alpha1.Database{} + Expect(k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseSample.Name, + Namespace: testobjects.YdbNamespace, + }, &database)).Should(Succeed()) + storageEndpoint := database.Spec.StorageEndpoint + + databasePods := corev1.PodList{} + Expect(k8sClient.List(ctx, &databasePods, + client.InNamespace(testobjects.YdbNamespace), + client.MatchingLabels{"ydb-cluster": "kind-database"}), + ).Should(Succeed()) + podName := databasePods.Items[0].Name + + By("bring YDB CLI inside ydb database pod...") + BringYdbCliToPod(podName, testobjects.YdbNamespace) + + By("execute simple query inside ydb database pod...") + databasePath := DatabasePathWithDefaultDomain(databaseSample) + ExecuteSimpleTableE2ETest(podName, testobjects.YdbNamespace, storageEndpoint, databasePath) + }) + + It("Check externalPort for Database", func() { + By("create storage...") + Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storageSample) + By("create database...") + databaseSample.Spec.Nodes = 1 + databaseSample.Spec.NodeSelector = map[string]string{ + "topology.kubernetes.io/zone": "az-1", + } + databaseSample.Annotations = map[string]string{ + v1alpha1.AnnotationGRPCPublicHost: "localhost", + } + databaseSample.Spec.Service.GRPC.ExternalPort = 30001 + Expect(k8sClient.Create(ctx, databaseSample)).Should(Succeed()) + defer func() { + Expect(k8sClient.Delete(ctx, databaseSample)).Should(Succeed()) + }() + + By("waiting until Storage is ready...") + WaitUntilStorageReady(ctx, k8sClient, storageSample.Name, testobjects.YdbNamespace) + + By("checking that all the storage pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-storage", storageSample.Spec.Nodes) + + By("waiting until database is ready...") + WaitUntilDatabaseReady(ctx, k8sClient, databaseSample.Name, testobjects.YdbNamespace) + + By("checking that all the database pods are running and ready...") + CheckPodsRunningAndReady(ctx, k8sClient, "ydb-cluster", "kind-database", databaseSample.Spec.Nodes) + + By("execute simple query with ydb-go-sdk...") + databasePath := DatabasePathWithDefaultDomain(databaseSample) + ExecuteSimpleTableE2ETestWithSDK(databaseSample.Name, testobjects.YdbNamespace, databasePath) + }) + + It("Check init job with additional volumes and GRPCS enabled", func() { + By("create stls secrets...") + storageCert := testobjects.StorageCertificate() + + secret := storageCert.DeepCopy() + secret.Name = "another-secret" + + Expect(k8sClient.Create(ctx, storageCert)).Should(Succeed()) + Expect(k8sClient.Create(ctx, secret)).Should(Succeed()) + + By("create storage...") + storage := testobjects.DefaultStorage(filepath.Join("..", "data", "storage-mirror-3-dc-config-tls.yaml")) + + storage.Spec.Service.GRPC.TLSConfiguration = testobjects.TLSConfiguration( + testobjects.StorageCertificateSecretName, + ) + + storage.Spec.Secrets = []*corev1.LocalObjectReference{ + { + Name: secret.Name, + }, + } + + mountPath := fmt.Sprintf("%s/%s", v1alpha1.AdditionalSecretsDir, secret.Name) + + storage.Spec.InitContainers = []corev1.Container{ + { + Name: "init-container", + Image: storage.Spec.Image.Name, + Command: []string{"bash", "-xc"}, + Args: []string{fmt.Sprintf("ls -la %s", mountPath)}, + VolumeMounts: []corev1.VolumeMount{ + { + Name: secret.Name, + MountPath: mountPath, + ReadOnly: true, + }, + }, + }, + } + + Expect(k8sClient.Create(ctx, storage)).Should(Succeed()) + defer DeleteStorageSafely(ctx, k8sClient, storage) + + By("waiting until Storage is ready ...") + WaitUntilStorageReady(ctx, k8sClient, storage.Name, testobjects.YdbNamespace) + }) + + AfterEach(func() { + UninstallOperatorWithHelm(testobjects.YdbNamespace) + Expect(k8sClient.Delete(ctx, &namespace)).Should(Succeed()) + Eventually(func(g Gomega) bool { + namespaceList := corev1.NamespaceList{} + g.Expect(k8sClient.List(ctx, &namespaceList)).Should(Succeed()) + for _, namespace := range namespaceList.Items { + if namespace.GetName() == testobjects.YdbNamespace { + return false + } + } + return true + }, Timeout, Interval).Should(BeTrue()) + }) +}) diff --git a/e2e/tests/test-objects/objects.go b/tests/test-k8s-objects/objects.go similarity index 61% rename from e2e/tests/test-objects/objects.go rename to tests/test-k8s-objects/objects.go index db78278a..b4c1394c 100644 --- a/e2e/tests/test-objects/objects.go +++ b/tests/test-k8s-objects/objects.go @@ -2,8 +2,9 @@ package testobjects import ( "os" + "path/filepath" - . "github.com/onsi/gomega" //nolint:all + . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -11,13 +12,26 @@ import ( ) const ( - YdbImage = "cr.yandex/crptqonuodf51kdj7a7d/ydb:22.4.44" - YdbNamespace = "ydb" - YdbHome = "/home/ydb" - StorageName = "storage" - DatabaseName = "database" - DefaultDomain = "Root" - ReadyStatus = "Ready" + YdbImage = "cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7" // anchor_for_fetching_image_from_workflow + YdbNamespace = "ydb" + StorageName = "storage" + DatabaseName = "database" + StorageCertificateSecretName = "storage-crt" + DatabaseCertificateSecretName = "database-crt" + DefaultDomain = "Root" + ReadyStatus = "Ready" + StorageGRPCService = "storage-grpc.ydb.svc.cluster.local" + StorageGRPCPort = 2135 +) + +var ( + TestCAPath = filepath.Join("..", "data", "generate-crts", "ca.crt") + + StorageTLSKeyPath = filepath.Join("..", "data", "storage.key") + StorageTLSCrtPath = filepath.Join("..", "data", "storage.crt") + + DatabaseTLSKeyPath = filepath.Join("..", "data", "database.key") + DatabaseTLSCrtPath = filepath.Join("..", "data", "database.crt") ) func constructAntiAffinityFor(key, value string) *corev1.Affinity { @@ -57,7 +71,7 @@ func DefaultStorage(storageYamlConfigPath string) *v1alpha1.Storage { StorageClusterSpec: v1alpha1.StorageClusterSpec{ Domain: DefaultDomain, OperatorSync: true, - Erasure: "block-4-2", + Erasure: "mirror-3-dc", Image: &v1alpha1.PodImage{ Name: YdbImage, PullPolicyName: &defaultPolicy, @@ -78,6 +92,9 @@ func DefaultStorage(storageYamlConfigPath string) *v1alpha1.Storage { }, Status: v1alpha1.StatusService{ Service: v1alpha1.Service{IPFamilies: []corev1.IPFamily{"IPv4"}}, + TLSConfiguration: &v1alpha1.TLSConfiguration{ + Enabled: false, + }, }, }, Monitoring: &v1alpha1.MonitoringOptions{ @@ -85,13 +102,16 @@ func DefaultStorage(storageYamlConfigPath string) *v1alpha1.Storage { }, }, StorageNodeSpec: v1alpha1.StorageNodeSpec{ - Nodes: 8, + Nodes: 3, DataStore: []corev1.PersistentVolumeClaimSpec{}, Resources: &corev1.ResourceRequirements{}, AdditionalLabels: map[string]string{"ydb-cluster": "kind-storage"}, Affinity: storageAntiAffinity, }, + InitJob: &v1alpha1.StorageInitJobSpec{ + AdditionalLabels: map[string]string{"ydb-cluster": "kind-storage-init"}, + }, }, } } @@ -138,6 +158,9 @@ func DefaultDatabase() *v1alpha1.Database { }, Status: v1alpha1.StatusService{ Service: v1alpha1.Service{IPFamilies: []corev1.IPFamily{"IPv4"}}, + TLSConfiguration: &v1alpha1.TLSConfiguration{ + Enabled: false, + }, }, }, Datastreams: &v1alpha1.DatastreamsConfig{ @@ -148,7 +171,7 @@ func DefaultDatabase() *v1alpha1.Database { }, }, DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{ - Nodes: 8, + Nodes: 3, Resources: &v1alpha1.DatabaseResources{ StorageUnits: []v1alpha1.StorageUnit{ { @@ -163,3 +186,61 @@ func DefaultDatabase() *v1alpha1.Database { }, } } + +func StorageCertificate() *corev1.Secret { + return DefaultCertificate( + StorageCertificateSecretName, + StorageTLSCrtPath, + StorageTLSKeyPath, + TestCAPath, + ) +} + +func DatabaseCertificate() *corev1.Secret { + return DefaultCertificate( + DatabaseCertificateSecretName, + DatabaseTLSCrtPath, + DatabaseTLSKeyPath, + TestCAPath, + ) +} + +func DefaultCertificate(secretName, certPath, keyPath, caPath string) *corev1.Secret { + cert, err := os.ReadFile(certPath) + Expect(err).To(BeNil()) + key, err := os.ReadFile(keyPath) + Expect(err).To(BeNil()) + ca, err := os.ReadFile(caPath) + Expect(err).To(BeNil()) + + return &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: secretName, + Namespace: YdbNamespace, + }, + Type: corev1.SecretTypeOpaque, + Data: map[string][]byte{ + "ca.crt": ca, + "tls.crt": cert, + "tls.key": key, + }, + } +} + +func TLSConfiguration(secretName string) *v1alpha1.TLSConfiguration { + return &v1alpha1.TLSConfiguration{ + Enabled: true, + Certificate: corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{Name: secretName}, + Key: "tls.crt", + }, + Key: corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{Name: secretName}, + Key: "tls.key", + }, + CertificateAuthority: corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{Name: secretName}, + Key: "ca.crt", + }, + } +} diff --git a/tests/test-utils/test-utils.go b/tests/test-utils/test-utils.go new file mode 100644 index 00000000..d06d013b --- /dev/null +++ b/tests/test-utils/test-utils.go @@ -0,0 +1,441 @@ +package testutils + +import ( + "bufio" + "context" + "database/sql" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "regexp" + "strconv" + "strings" + "time" + + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + ydb "github.com/ydb-platform/ydb-go-sdk/v3" + "github.com/ydb-platform/ydb-go-sdk/v3/retry" + + v1alpha1 "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1" + . "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" + testobjects "github.com/ydb-platform/ydb-kubernetes-operator/tests/test-k8s-objects" +) + +const ( + ConsistentConditionTimeout = time.Second * 30 + Timeout = time.Second * 600 + Interval = time.Second * 2 + YdbOperatorRemoteChart = "ydb/ydb-operator" + YdbOperatorReleaseName = "ydb-operator" + TestTablePath = "testfolder/testtable" +) + +var ( + pathToHelmValuesInLocalInstall = filepath.Join("..", "cfg", "operator-local-values.yaml") + pathToHelmValuesInRemoteInstall = filepath.Join("..", "cfg", "operator-values.yaml") + + createTableQuery = fmt.Sprintf("CREATE TABLE `%s` (testColumnA Utf8, testColumnB Utf8, PRIMARY KEY (testColumnA));", TestTablePath) + insertQuery = fmt.Sprintf("INSERT INTO `%s` (testColumnA, testColumnB) VALUES ('valueA', 'valueB');", TestTablePath) + selectQuery = fmt.Sprintf("SELECT testColumnA, testColumnB FROM `%s`;", TestTablePath) + dropTableQuery = fmt.Sprintf("DROP TABLE `%s`;", TestTablePath) +) + +func InstallLocalOperatorWithHelm(namespace string) { + args := []string{ + "-n", namespace, + "install", + "--wait", + "ydb-operator", + filepath.Join("..", "..", "deploy", "ydb-operator"), + "-f", pathToHelmValuesInLocalInstall, + } + + result := exec.Command("helm", args...) + stdout, err := result.Output() + Expect(err).To(BeNil()) + Expect(stdout).To(ContainSubstring("deployed")) +} + +func InstallOperatorWithHelm(namespace, version string) { + args := []string{ + "-n", namespace, + "install", + "--wait", + "ydb-operator", + YdbOperatorRemoteChart, + "-f", pathToHelmValuesInRemoteInstall, + "--version", version, + } + + Expect(exec.Command("helm", "repo", "add", "ydb", "https://charts.ydb.tech/").Run()).To(Succeed()) + Expect(exec.Command("helm", "repo", "update").Run()).To(Succeed()) + + installCommand := exec.Command("helm", args...) + output, err := installCommand.CombinedOutput() + Expect(err).To(BeNil()) + Expect(string(output)).To(ContainSubstring("deployed")) +} + +func UninstallOperatorWithHelm(namespace string) { + args := []string{ + "-n", namespace, + "uninstall", + "--wait", + "ydb-operator", + } + result := exec.Command("helm", args...) + stdout, err := result.Output() + Expect(err).To(BeNil()) + Expect(stdout).To(ContainSubstring("uninstalled")) +} + +func UpgradeOperatorWithHelm(namespace, version string) { + args := []string{ + "-n", namespace, + "upgrade", + "--wait", + "ydb-operator", + YdbOperatorRemoteChart, + "--version", version, + "-f", pathToHelmValuesInRemoteInstall, + } + + cmd := exec.Command("helm", args...) + cmd.Stdout = GinkgoWriter + cmd.Stderr = GinkgoWriter + + Expect(cmd.Run()).Should(Succeed()) +} + +func WaitUntilStorageReady(ctx context.Context, k8sClient client.Client, storageName, namespace string) { + Eventually(func() bool { + storage := &v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storageName, + Namespace: namespace, + }, storage) + if err != nil { + return false + } + + return meta.IsStatusConditionPresentAndEqual( + storage.Status.Conditions, + StorageInitializedCondition, + metav1.ConditionTrue, + ) && storage.Status.State == testobjects.ReadyStatus + }, Timeout, Interval).Should(BeTrue()) +} + +func WaitUntilDatabaseReady(ctx context.Context, k8sClient client.Client, databaseName, namespace string) { + Eventually(func() bool { + database := &v1alpha1.Database{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: databaseName, + Namespace: namespace, + }, database) + if err != nil { + return false + } + + return meta.IsStatusConditionPresentAndEqual( + database.Status.Conditions, + DatabaseInitializedCondition, + metav1.ConditionTrue, + ) && database.Status.State == testobjects.ReadyStatus + }, Timeout, Interval).Should(BeTrue()) +} + +func CheckPodsRunningAndReady(ctx context.Context, k8sClient client.Client, podLabelKey, podLabelValue string, nPods int32) { + Eventually(func(g Gomega) bool { + pods := corev1.PodList{} + g.Expect(k8sClient.List(ctx, &pods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ + podLabelKey: podLabelValue, + })).Should(Succeed()) + g.Expect(len(pods.Items)).Should(BeEquivalentTo(nPods)) + for _, pod := range pods.Items { + g.Expect(pod.Status.Phase).Should(BeEquivalentTo("Running")) + g.Expect(podIsReady(pod.Status.Conditions)).Should(BeTrue()) + } + return true + }, Timeout, Interval).Should(BeTrue()) + + Consistently(func(g Gomega) bool { + pods := corev1.PodList{} + g.Expect(k8sClient.List(ctx, &pods, client.InNamespace(testobjects.YdbNamespace), client.MatchingLabels{ + podLabelKey: podLabelValue, + })).Should(Succeed()) + g.Expect(len(pods.Items)).Should(BeEquivalentTo(nPods)) + for _, pod := range pods.Items { + g.Expect(pod.Status.Phase).Should(BeEquivalentTo("Running")) + g.Expect(podIsReady(pod.Status.Conditions)).Should(BeTrue()) + } + return true + }, ConsistentConditionTimeout, Interval).Should(BeTrue()) +} + +func podIsReady(conditions []corev1.PodCondition) bool { + for _, condition := range conditions { + if condition.Type == corev1.PodReady && condition.Status == corev1.ConditionTrue { + return true + } + } + return false +} + +func BringYdbCliToPod(podName, podNamespace string) { + expectedCliLocation := fmt.Sprintf("%v/ydb/bin/ydb", os.ExpandEnv("$HOME")) + + _, err := os.Stat(expectedCliLocation) + Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Expected YDB CLI at path %s to exist", expectedCliLocation)) + + Eventually(func(g Gomega) error { + args := []string{ + "-n", + podNamespace, + "cp", + expectedCliLocation, + fmt.Sprintf("%v:/tmp/ydb", podName), + } + cmd := exec.Command("kubectl", args...) + return cmd.Run() + }, Timeout, Interval).Should(BeNil()) +} + +func ExecuteSimpleTableE2ETest(podName, podNamespace, storageEndpoint string, databasePath string) { + tableCreatingInterval := time.Second * 10 + + Eventually(func(g Gomega) { + args := []string{ + "-n", podNamespace, + "exec", podName, + "--", + "/tmp/ydb", + "-d", databasePath, + "-e", storageEndpoint, + "yql", + "-s", + createTableQuery, + } + output, _ := exec.Command("kubectl", args...).CombinedOutput() + fmt.Println(string(output)) + }, Timeout, tableCreatingInterval).Should(Succeed()) + + argsInsert := []string{ + "-n", podNamespace, + "exec", podName, + "--", + "/tmp/ydb", + "-d", databasePath, + "-e", storageEndpoint, + "yql", + "-s", + insertQuery, + } + output, err := exec.Command("kubectl", argsInsert...).CombinedOutput() + Expect(err).ShouldNot(HaveOccurred(), string(output)) + + argsSelect := []string{ + "-n", podNamespace, + "exec", podName, + "--", + "/tmp/ydb", + "-d", databasePath, + "-e", storageEndpoint, + "yql", + "--format", "csv", + "-s", + selectQuery, + } + output, err = exec.Command("kubectl", argsSelect...).CombinedOutput() + Expect(err).ShouldNot(HaveOccurred(), string(output)) + Expect(strings.TrimSpace(string(output))).To(ContainSubstring("\"valueA\",\"valueB\"")) + + argsDrop := []string{ + "-n", podNamespace, + "exec", podName, + "--", + "/tmp/ydb", + "-d", databasePath, + "-e", storageEndpoint, + "yql", + "-s", + dropTableQuery, + } + output, err = exec.Command("kubectl", argsDrop...).CombinedOutput() + Expect(err).ShouldNot(HaveOccurred(), string(output)) +} + +func ExecuteSimpleTableE2ETestWithSDK(databaseName, databaseNamespace, databasePath string) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + + cc, err := ydb.Open( + ctx, + fmt.Sprintf("grpc://localhost:30001/%s", databasePath), + ) + Expect(err).ShouldNot(HaveOccurred()) + defer func() { _ = cc.Close(ctx) }() + + c, err := ydb.Connector(cc, + ydb.WithAutoDeclare(), + ydb.WithTablePathPrefix(fmt.Sprintf("%s/%s", databasePath, TestTablePath)), + ) + Expect(err).ShouldNot(HaveOccurred()) + defer func() { _ = c.Close() }() + + db := sql.OpenDB(c) + defer func() { _ = db.Close() }() + + err = retry.Do(ctx, db, func(ctx context.Context, cc *sql.Conn) error { + _, err = cc.ExecContext(ydb.WithQueryMode(ctx, ydb.SchemeQueryMode), createTableQuery) + if err != nil { + return err + } + return nil + }, retry.WithIdempotent(true)) + Expect(err).ShouldNot(HaveOccurred()) + + err = retry.DoTx(ctx, db, func(ctx context.Context, tx *sql.Tx) error { + if _, err = tx.ExecContext(ctx, insertQuery); err != nil { + return err + } + return nil + }, retry.WithIdempotent(true)) + Expect(err).ShouldNot(HaveOccurred()) + + var ( + testColumnA string + testColumnB string + ) + err = retry.Do(ctx, db, func(ctx context.Context, cc *sql.Conn) (err error) { + row := cc.QueryRowContext(ctx, selectQuery) + if err = row.Scan(&testColumnA, &testColumnB); err != nil { + return err + } + + return nil + }, retry.WithIdempotent(true)) + Expect(err).ShouldNot(HaveOccurred()) + Expect(testColumnA).To(BeEquivalentTo("valueA")) + Expect(testColumnB).To(BeEquivalentTo("valueB")) + + err = retry.Do(ctx, db, func(ctx context.Context, cc *sql.Conn) error { + _, err = cc.ExecContext(ydb.WithQueryMode(ctx, ydb.SchemeQueryMode), dropTableQuery) + if err != nil { + return err + } + + return nil + }, retry.WithIdempotent(true)) + Expect(err).ShouldNot(HaveOccurred()) +} + +func PortForward( + ctx context.Context, + svcName, svcNamespace, serverName string, + port int, + f func(int, string) error, +) { + Eventually(func(g Gomega) error { + args := []string{ + "-n", svcNamespace, + "port-forward", + fmt.Sprintf("svc/%s", svcName), + fmt.Sprintf(":%d", port), + } + + cmd := exec.CommandContext(ctx, "kubectl", args...) + stdout, err := cmd.StdoutPipe() + if err != nil { + return err + } + + stderr, err := cmd.StderrPipe() + if err != nil { + return err + } + + if err = cmd.Start(); err != nil { + return err + } + + defer func() { + err := cmd.Process.Kill() + if err != nil { + _, _ = fmt.Fprintf(GinkgoWriter, "Unable to kill process: %s", err) + } + }() + + localPort := 0 + + scanner := bufio.NewScanner(stdout) + portForwardRegex := regexp.MustCompile(`Forwarding from 127.0.0.1:(\d+) ->`) + + for scanner.Scan() { + line := scanner.Text() + + matches := portForwardRegex.FindStringSubmatch(line) + if matches != nil { + localPort, err = strconv.Atoi(matches[1]) + if err != nil { + return err + } + break + } + } + + if localPort != 0 { + if err = f(localPort, serverName); err != nil { + return err + } + } else { + content, _ := io.ReadAll(stderr) + return fmt.Errorf("kubectl port-forward stderr: %s", content) + } + return nil + }, Timeout, Interval).Should(BeNil()) +} + +func DeleteStorageSafely(ctx context.Context, k8sClient client.Client, storage *v1alpha1.Storage) { + // not checking that deletion completed successfully + // because some tests delete storage themselves and + // it may already be deleted. + _ = k8sClient.Delete(ctx, storage) + + Eventually(func() bool { + fetched := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: storage.Name, + Namespace: testobjects.YdbNamespace, + }, &fetched) + return apierrors.IsNotFound(err) + }, Timeout, Interval).Should(BeTrue()) +} + +func DeleteDatabase(ctx context.Context, k8sClient client.Client, database *v1alpha1.Database) { + Expect(k8sClient.Delete(ctx, database)).To(Succeed()) + + Eventually(func() bool { + fetched := v1alpha1.Storage{} + err := k8sClient.Get(ctx, types.NamespacedName{ + Name: database.Name, + Namespace: testobjects.YdbNamespace, + }, &fetched) + return apierrors.IsNotFound(err) + }, Timeout, Interval).Should(BeTrue()) +} + +func DatabasePathWithDefaultDomain(database *v1alpha1.Database) string { + return fmt.Sprintf("/%s/%s", testobjects.DefaultDomain, database.Name) +}