diff --git a/.commitsar.yml b/.commitsar.yml new file mode 100644 index 000000000..c97c73b03 --- /dev/null +++ b/.commitsar.yml @@ -0,0 +1,5 @@ +commits: + disabled: false + strict: false + limit: 100 + all: false diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..94f1557aa --- /dev/null +++ b/.dockerignore @@ -0,0 +1,29 @@ +# Files +.DS_Store +*.lock +*.test +*.out +*.swp +*.swo +# *.db +*.exe +*.exe~ +*.dll +*.so +*.dylib +*.log + +# Dirs +/.idea +/.vscode +/.kube +/.terraform +/.vagrant +/.bundle +/.cache +/.docker +/.entc +# /.sbin +# /.dist +/log +/certs diff --git a/.gitattributes b/.gitattributes index ddd81454e..8cec9508d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,4 +3,3 @@ **/*.pb.go linguist-generated=true **/go.sum linguist-generated=true **/zz_generated.*.go linguist-generated=true -clients linguist-generated=true diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.md b/.github/ISSUE_TEMPLATE/1_bug_report.md new file mode 100644 index 000000000..7a1e92956 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Create a bug report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** + + +**Steps to reproduce** +1. Go to '...' + +**Result** + + +**Expected behavior** + + +**Environment** +- Walrus version: + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/2_enhancement.md b/.github/ISSUE_TEMPLATE/2_enhancement.md new file mode 100644 index 000000000..c0fe3ab69 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_enhancement.md @@ -0,0 +1,20 @@ +--- +name: Enhancement request +about: Issues that improve or augment existing functionality +title: '' +labels: 'enhancement' +assignees: '' + +--- + +**Is your enhancement related to a problem? Please describe.** + + +**Describe the solution you'd like** + + +**Describe alternatives you've considered** + + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/3_question.md b/.github/ISSUE_TEMPLATE/3_question.md new file mode 100644 index 000000000..588efa57c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3_question.md @@ -0,0 +1,10 @@ +--- +name: Question +about: Question about Walrus +title: '' +labels: 'question' +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/4_doc.md b/.github/ISSUE_TEMPLATE/4_doc.md new file mode 100644 index 000000000..435ea5484 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4_doc.md @@ -0,0 +1,12 @@ +--- +name: Documentation update +about: Request to make a documentation update +title: '' +labels: 'documentation' +assignees: '' +--- + +**Is your doc request related to a problem? Please describe or add related issue ID.** + +**Describe the update you'd like** + diff --git a/.github/ISSUE_TEMPLATE/5_other.md b/.github/ISSUE_TEMPLATE/5_other.md new file mode 100644 index 000000000..a8df4f136 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/5_other.md @@ -0,0 +1,7 @@ +--- +name: Other +about: Anything else +title: '' +labels: '' +assignees: '' +--- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..db866797c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,9 @@ + +**Problem:** + + +**Solution:** + + +**Related Issue:** + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..576c0b425 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,199 @@ +name: CI + +permissions: + contents: read + pull-requests: read + actions: read + +env: + REPO: "sealio" + VERSION: "${{ github.ref_name }}" + PARALLELIZE: "false" + GO_VERSION: "1.21.7" + +defaults: + run: + shell: bash + +on: + workflow_dispatch: { } + push: + tags: + - "v*.*.*" + branches: + - "main" + paths-ignore: + - "docs/**" + - "**.md" + - "**.mdx" + - "**.png" + - "**.jpg" + pull_request: + branches: + - "main" + paths-ignore: + - "docs/**" + - "**.md" + - "**.mdx" + - "**.png" + - "**.jpg" + +jobs: + build: + timeout-minutes: 60 + runs-on: ubuntu-22.04 + steps: + # Clean up unused tools to have more disk space in the GitHub hosted runner. + - name: Free disk space + run: + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + - name: Checkout + uses: actions/checkout@v4 + with: + # checkout the whole histories for commitsar, + # currently commitsar needs full git objects to work correctly. + fetch-depth: 0 + persist-credentials: false + - name: Setup Go + timeout-minutes: 15 + uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + cache-dependency-path: | + **/go.sum + - name: Setup Toolbox + timeout-minutes: 5 + uses: actions/cache@v3 + with: + # restore/save service binaries, e.g. goimports, golangci-lint, commitsar. + key: toolbox-${{ runner.os }} + path: | + ${{ github.workspace }}/.sbin + - name: Build + run: make ci + env: + LINT_DIRTY: "true" + PACKAGE_BUILD: "false" + WALRUS_TELEMETRY_API_KEY: "${{ github.event_name != 'pull_request' && secrets.CI_TELEMETRY_API_KEY || '' }}" + - name: Archive Publish Result + uses: actions/cache/save@v3 + with: + # save package resources, e.g. go build result, downloaded UI, entrypoint script. + key: archive-${{ runner.os }}-${{ github.sha }} + path: | + ${{ github.workspace }}/.dist/package + + publish: + needs: + - build + permissions: + contents: write + actions: read + id-token: write + timeout-minutes: 60 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + persist-credentials: false + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + with: + image: tonistiigi/binfmt:qemu-v7.0.0 + platforms: "arm64" + - name: Setup Buildx + uses: docker/setup-buildx-action@v3 + - name: Login DockerHub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + username: ${{ secrets.CI_DOCKERHUB_USERNAME }} + password: ${{ secrets.CI_DOCKERHUB_PASSWORD }} + - name: Unarchive Publish Result + timeout-minutes: 5 + uses: actions/cache/restore@v3 + with: + # restore package resources, e.g. go build result, downloaded UI, entrypoint script. + key: archive-${{ runner.os }}-${{ github.sha }} + path: | + ${{ github.workspace }}/.dist/package + - name: Get Metadata + id: metadata + uses: docker/metadata-action@v5 + with: + images: ${{ env.REPO }}/${{ matrix.target }} + - name: Package + uses: docker/build-push-action@v5 + id: package + with: + push: ${{ github.event_name != 'pull_request' }} + file: .dist/package/${{ matrix.target }}/${{ matrix.task }}/image/Dockerfile + context: .dist/package/${{ matrix.target }}/${{ matrix.task }}/ + platforms: "linux/amd64,linux/arm64" + tags: ${{ steps.metadata.outputs.tags }} + labels: ${{ steps.metadata.outputs.labels }} + # configure build cache, + # ref to https://github.com/moby/buildkit/tree/v0.11.5#registry-push-image-and-cache-separately. + cache-from: | + type=registry,ref=${{ env.REPO }}/build-cache:${{ matrix.target }}-${{ matrix.task }} + cache-to: | + ${{ github.event_name != 'pull_request' && format('type=registry,mode=max,oci-mediatypes=false,compression=gzip,ref={0}/build-cache:{1}-{2},ignore-error=true', env.REPO, matrix.target, matrix.task) || '' }} + build-args: | + SERVE_UI_INDEX=${{ startsWith(github.ref, 'refs/tags/') && 'file:///var/lib/walrus/ui' || 'https://walrus-ui-1303613262.cos.ap-guangzhou.myqcloud.com/latest/index.html' }} + - name: Setup Cosign + if: ${{ github.event_name != 'pull_request' }} + uses: sigstore/cosign-installer@v3.3.0 + with: + cosign-release: v2.0.0 + - name: Prove + if: ${{ github.event_name != 'pull_request' }} + run: | + set -euo pipefail + + # login + cosign login "docker.io" -u "${DOCKERHUB_USERNAME}" -p "${DOCKERHUB_PASSWORD}" + + # prove + curl -o slsa-generator --retry 3 --retry-all-errors --retry-delay 3 -sSfL \ + "https://github.com/slsa-framework/slsa-github-generator/releases/download/${SLSA_GITHUB_GENERATOR_VERSION}/${SLSA_GITHUB_GENERATOR}" + chmod a+x slsa-generator + predicate_name="predicate.json" + ./slsa-generator generate --predicate="${predicate_name}" + cosign attest --predicate="${predicate_name}" \ + --type slsaprovenance \ + --yes \ + "${UNTRUSTED_IMAGE}@${UNTRUSTED_DIGEST}" + env: + COSIGN_EXPERIMENTAL: "1" + SLSA_GITHUB_GENERATOR: "slsa-generator-container-linux-amd64" + SLSA_GITHUB_GENERATOR_VERSION: "v1.5.0" + GITHUB_CONTEXT: "${{ toJSON(github) }}" + UNTRUSTED_IMAGE: "${{ env.REPO }}/${{ matrix.target }}" + UNTRUSTED_DIGEST: "${{ steps.package.outputs.digest }}" + DOCKERHUB_USERNAME: "${{ secrets.CI_DOCKERHUB_USERNAME }}" + DOCKERHUB_PASSWORD: "${{ secrets.CI_DOCKERHUB_PASSWORD }}" + continue-on-error: true + # FIXME(thxCode): remove this step after we adjust the walrus-catalog CI. + - name: Upload Assets(CLI) + uses: TencentCloud/cos-action@b0aa648235fb35a1bdd6a77f529eb0ac4c2f1c25 + if: ${{ github.event_name != 'pull_request' }} + with: + secret_id: ${{ secrets.CI_TECENTCOS_SECRET_ID }} + secret_key: ${{ secrets.CI_TECENTCOS_SECRET_KEY }} + cos_bucket: ${{ secrets.COS_BUCKET }} + cos_region: ${{ secrets.COS_REGION }} + local_path: .dist/package/${{ matrix.target }}/${{ matrix.task }}/release + remote_path: releases/${{ steps.metadata.outputs.version == 'main' && 'latest' || steps.metadata.outputs.version }} + accelerate: true + clean: false + - name: Release Assets + uses: softprops/action-gh-release@v1 + if: ${{ startsWith(github.ref, 'refs/tags/') }} + with: + fail_on_unmatched_files: true + tag_name: ${{ steps.metadata.outputs.version }} + prerelease: ${{ contains(github.ref, 'rc') }} + files: .dist/package/${{ matrix.target }}/${{ matrix.task }}/release/* diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 000000000..82034e9fe --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,82 @@ +name: Clean + +permissions: + contents: write + pull-requests: read + actions: write + +defaults: + run: + shell: bash + +on: + schedule: + - cron: '0 */12 * * *' + workflow_dispatch: { } + +jobs: + clean: + timeout-minutes: 5 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + persist-credentials: false + - name: Remove Cache + uses: actions/github-script@v7 + with: + # clean up caches, + # ref to https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries, + # and https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache. + script: | + const owner = context.repo.owner + const repo = context.repo.repo + var deleteCaches = new Array() + + // get candidate items. + const { data: cs } = await github.rest.actions.getActionsCacheList({ + owner: owner, + repo: repo, + }); + for (const c of cs.actions_caches) { + // clean closed pull request's caches. + if (c.ref.match(/^refs\/pull\/.*$/)) { + var prNum = c.ref.replace(/[^\d]/g, "") + const { data: pr } = await github.rest.pulls.get({ + owner: owner, + repo: repo, + pull_number: prNum, + }) + if (pr.state === 'closed') { + deleteCaches.push(c) + } + continue + } + // do not clean toolbox caches. + if (c.key.match(/^toolbox-.*$/)) { + continue + } + // clean push archived caches. + if (c.key.match(/^archive-.*$/)) { + deleteCaches.push(c) + continue + } + // clean stale built caches. + if (!c.key.match(/^setup-go-.*-${{ hashFiles('**/go.sum') }}$/)) { + deleteCaches.push(c) + continue + } + } + + // delete + for (const c of deleteCaches) { + await github.rest.actions.deleteActionsCacheById({ + owner: owner, + repo: repo, + cache_id: c.id, + }) + console.log(`cleaned cache "${c.key}"`) + } + continue-on-error: true diff --git a/.github/workflows/mirror_images.yml b/.github/workflows/mirror_images.yml new file mode 100644 index 000000000..d2df66199 --- /dev/null +++ b/.github/workflows/mirror_images.yml @@ -0,0 +1,50 @@ +name: Mirror images + +permissions: + contents: write + pull-requests: read + actions: write + +defaults: + run: + shell: bash + +on: + push: + paths: + - "hack/mirror/mirror-images.txt" + workflow_dispatch: {} + +jobs: + mirror-images: + timeout-minutes: 10 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + persist-credentials: false + - uses: imjasonh/setup-crane@v0.3 + with: + version: v0.16.1 + - name: Mirror images + shell: bash + run: | + set -euo pipefail + + # login to dockerhub + crane auth login docker.io -u ${{ secrets.CI_DOCKERHUB_USERNAME }} -p ${{ secrets.CI_DOCKERHUB_PASSWORD }} + + # mirror images + while IFS= read -r line || [[ -n "$line" ]]; do + if [[ "$line" == \#* ]]; then + continue + fi + + source_image=$(echo "$line" | awk '{print $1}') + target_image=$(echo "$line" | awk '{print $2}') + + echo "Mirror image $source_image to $target_image" + crane copy $source_image $target_image + done < ${{ github.workspace }}/hack/mirror/mirror-images.txt diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 000000000..f4d829787 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,182 @@ +run: + timeout: 10m + tests: true + skip-files: + - "doc.go" + - "zz_generated.*.go" + - "generated.*.go" + modules-download-mode: readonly + +# output configuration options +output: + format: colored-line-number + print-issued-lines: true + print-linter-name: true + uniq-by-line: true + path-prefix: "" + sort-results: true + +linters: + disable-all: true + enable: + - asciicheck + - bidichk + - decorder + - durationcheck + - errcheck + - errname + - errorlint + - exportloopref + - godot + - goconst + - gocritic + - gosimple + - gosec + - govet + - gofumpt + - gofmt + - ineffassign + - importas + - lll + - makezero + - misspell + - nakedret + - nilerr + - prealloc + - predeclared + - revive + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - usestdlibvars + - whitespace + + # enable complexity linters + # - dupl + # - gocognit + # - gocyclo + # - funlen + +linters-settings: + decorder: + dec-order: + - const + - var + - func + disable-init-func-first-check: false + disable-dec-order-check: true + errorlint: + errorf: true + asserts: true + comparison: true + godot: + scope: all + exclude: + - "(?i)^ FIXME:" + - "(?i)^ TODO:" + - "(?i)^ SPDX\\-License\\-Identifier:" + - "(?i)^ +" + period: true + capital: false + goconst: + min-len: 3 + min-occurrences: 10 + gosimple: + go: "1.21" + checks: [ "all" ] + gosec: + severity: "low" + confidence: "low" + excludes: + - G101 + - G107 + - G112 + - G404 + gofumpt: + extra-rules: true + gofmt: + simplify: true + rewrite-rules: + - pattern: 'interface{}' + replacement: 'any' + - pattern: 'a[b:len(a)]' + replacement: 'a[b:]' + importas: + no-unaliased: true + alias: + # Kubernetes + - pkg: k8s.io/apimachinery/pkg/api/meta + alias: kmeta + - pkg: k8s.io/apimachinery/pkg/api/errors + alias: kerrors + - pkg: k8s.io/apimachinery/pkg/util/errors + alias: utilerrors + # Controller Runtime + - pkg: sigs.k8s.io/controller-runtime + alias: ctrl + - pkg: sigs.k8s.io/controller-runtime/pkg/log + alias: ctrllog + - pkg: sigs.k8s.io/controller-runtime/pkg/reconcile + alias: ctrlreconcile + - pkg: sigs.k8s.io/controller-runtime/pkg/webhook + alias: ctrlwebhook + - pkg: sigs.k8s.io/controller-runtime/pkg/webhook/admission + alias: ctrladmission + - pkg: sigs.k8s.io/controller-runtime/pkg/cache + alias: ctrlcache + - pkg: sigs.k8s.io/controller-runtime/pkg/client + alias: ctrlcli + - pkg: sigs.k8s.io/controller-runtime/pkg/metrics/server + alias: ctrlmetricsrv + - pkg: sigs.k8s.io/controller-runtime/pkg/metrics + alias: ctrlmetrics + - pkg: sigs.k8s.io/controller-runtime/pkg/controller/controllerutil + alias: ctrlutil + lll: + line-length: 150 + tab-width: 1 + makezero: + always: false + misspell: + locale: US + nakedret: + max-func-lines: 60 + revive: + rules: + - name: var-naming + disabled: true + arguments: + - [ "HTTP", "ID", "TLS", "TCP", "UDP", "API", "CA", "URL", "DNS" ] + staticcheck: + checks: [ "all", "-SA1019", "-SA2002", "-SA5008" ] + stylecheck: + checks: [ "all", "-ST1003" ] + unparam: + check-exported: false + unused: + field-writes-are-uses: true + post-statements-are-reads: true + exported-is-used: true + exported-fields-are-used: true + parameters-are-used: true + local-variables-are-used: true + generated-is-used: true + usestdlibvars: + http-method: true + http-status-code: true + time-weekday: true + time-month: true + time-layout: true + crypto-hash: true + +issues: + exclude-rules: + - path: _test\.go + linters: + - errcheck + - gosec + - makezero + - lll diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..53eeabd08 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +SHELL := /bin/bash + +# Borrowed from https://stackoverflow.com/questions/18136918/how-to-get-current-relative-directory-of-your-makefile +curr_dir := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) + +# Borrowed from https://stackoverflow.com/questions/2214575/passing-arguments-to-make-run +rest_args := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS)) +$(eval $(rest_args):;@:) + +targets := $(shell ls $(curr_dir)/hack | grep '.sh' | sed 's/\.sh//g') +$(targets): + @$(curr_dir)/hack/$@.sh $(rest_args) + +help: + # + # Usage: + # + # * [dev] `make deps`, get dependencies. + # - `make deps update`, update dependencies. + # + # * [dev] `make generate`, generate something. + # + # * [dev] `make lint`, check style. + # - `BUILD_TAGS="jsoniter" make lint` check with specified tags. + # - `LINT_DIRTY=true make lint` verify whether the code tree is dirty. + # + # * [dev] `make test`, execute unit testing. + # - `BUILD_TAGS="jsoniter" make test` test with specified tags. + # + # * [dev] `make build`, execute cross building. + # - `VERSION=vX.y.z+l.m make build` build all targets with vX.y.z+l.m version. + # - `OS=linux ARCH=arm64 make build` build all targets run on linux/arm64 arch. + # - `BUILD_TAGS="jsoniter" make build` build with specified tags. + # - `BUILD_PLATFORMS="linux/amd64,linux/arm64" make build` do multiple platforms go build. + # - `WALRUS_TELEMETRY_API_KEY="phc_xxx" make build` build with telemetry api key. + # + # * [dev] `make package`, embed running resources into a Docker image on one platform. + # - `REPO=xyz make package` package all targets named with xyz repository. + # - `VERSION=vX.y.z+l.m make package` package all targets named with vX.y.z-l.m tag. + # - `TAG=main make package` package all targets named with main tag. + # - `OS=linux ARCH=arm64 make package` package all targets run on linux/arm64 arch. + # - `PACKAGE_BUILD=false make package` prepare build resource but disable docker build. + # - `DOCKER_USERNAME=... DOCKER_PASSWORD=... PACKAGE_PUSH=true make package` execute docker push after build. + # + # * [ci] `make ci`, execute `make deps`, `make lint`, `make test`, `make build` and `make package`. + # - `CI_CHECK=false make ci` only execute `make build` and `make package`. + # - `CI_PUBLISH=false make ci` only execute `make deps`, `make lint` and `make test`. + # + @echo + +.DEFAULT_GOAL := build +.PHONY: $(targets) cmd client docs gen hack manager server staging diff --git a/cmd/cli/main.go b/cmd/cli/main.go new file mode 100644 index 000000000..39bf13a84 --- /dev/null +++ b/cmd/cli/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "github.com/seal-io/utils/signalx" + "github.com/seal-io/utils/stringx" +) + +var ( + Name = "cli" + Brief = stringx.Title(Name) + " is a CLI to operate the Walrus." +) + +func main() { + _ = signalx.Handler() +} diff --git a/cmd/helper.go b/cmd/helper.go new file mode 100644 index 000000000..6c903c9dc --- /dev/null +++ b/cmd/helper.go @@ -0,0 +1,56 @@ +package cmd + +import ( + "flag" + "os" + "strings" + + "github.com/seal-io/utils/osx" + "github.com/seal-io/utils/version" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "k8s.io/klog/v2" +) + +func Init(c *cobra.Command) *cobra.Command { + gcl, pcl := flag.CommandLine, pflag.CommandLine + + // Support klog configuration. + klog.InitFlags(gcl) + { // Default klog configuration. + _ = gcl.Set("logtostderr", "true") + _ = gcl.Set("v", "4") + } + pcl.AddGoFlag(gcl.Lookup("v")) // --v + pcl.AddGoFlag(gcl.Lookup("vmodule")) // --vmodule + pcl.AddGoFlag(gcl.Lookup("logtostderr")) // --logtostderr + { // Hide klog flags. + _ = pcl.MarkHidden("logtostderr") + } + + // Support printing command line. + printCmdline := pcl.Bool("print-cmdline", false, + "print cmdline, which includes the arguments retrieved from environment.") + c.PersistentPreRunE = func(c *cobra.Command, args []string) error { + if *printCmdline { + c.Printf("%s\n\n", strings.Join(os.Args, " ")) + } + return nil + } + + // Silence usage/errors, + // and return help message if flag error occurs. + c.SilenceUsage = true + c.SetFlagErrorFunc(func(c *cobra.Command, err error) error { + _ = c.Help() + return err + }) + + // Append version. + c.Version = version.Get() + + // Retrieve args from environment variables. + osx.RetrieveArgsFromEnvInto(c) + + return c +} diff --git a/cmd/manager/main.go b/cmd/manager/main.go new file mode 100644 index 000000000..d8bd24cdc --- /dev/null +++ b/cmd/manager/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "os" + + "github.com/seal-io/utils/signalx" + "github.com/seal-io/utils/stringx" + + "github.com/seal-io/walrus/cmd" + "github.com/seal-io/walrus/pkg/manager" +) + +var ( + Name = "manager" + Brief = stringx.Title(Name) + " is a Kubernetes Controller implementation to manage Walrus Kubernetes resources." +) + +func main() { + c := cmd.Init(manager.NewCommand(Name, Brief)) + + if err := c.ExecuteContext(signalx.Handler()); err != nil { + os.Exit(1) + } +} diff --git a/cmd/server/main.go b/cmd/server/main.go new file mode 100644 index 000000000..05c95aa09 --- /dev/null +++ b/cmd/server/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "os" + + "github.com/seal-io/utils/signalx" + "github.com/seal-io/utils/stringx" + + "github.com/seal-io/walrus/cmd" + "github.com/seal-io/walrus/pkg/server" +) + +var ( + Name = "server" + Brief = stringx.Title(Name) + " is a Kubernetes Extension API Server to manage Walrus Kubernetes resources." +) + +func main() { + c := cmd.Init(server.NewCommand(Name, Brief)) + + if err := c.ExecuteContext(signalx.Handler()); err != nil { + os.Exit(1) + } +} diff --git a/deploy/manifests/kubernetes.yaml b/deploy/manifests/kubernetes.yaml new file mode 100644 index 000000000..72bdd92ef --- /dev/null +++ b/deploy/manifests/kubernetes.yaml @@ -0,0 +1,152 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: walrus-system +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + namespace: walrus-system + name: walrus + labels: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: walrus + labels: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" +subjects: + - kind: ServiceAccount + name: walrus + namespace: walrus-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: walrus-system + name: walrus + labels: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" +spec: + # When a PVC does not specify a storageClassName, + # the default StorageClass is used. + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 500Mi +--- +apiVersion: v1 +kind: Service +metadata: + namespace: walrus-system + name: walrus +spec: + selector: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" + sessionAffinity: ClientIP + ports: + - name: https + port: 443 + targetPort: https +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: walrus-system + name: walrus + labels: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" + "app.kubernetes.io/name": "walrus-server" +spec: + replicas: 1 + selector: + matchLabels: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" + "app.kubernetes.io/name": "walrus-server" + template: + metadata: + labels: + "app.kubernetes.io/part-of": "walrus" + "app.kubernetes.io/component": "walrus" + "app.kubernetes.io/name": "walrus-server" + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + topologyKey: "kubernetes.io/hostname" + labelSelector: + matchExpressions: + - key: "app.kubernetes.io/component" + operator: In + values: + - "walrus" + - key: "app.kubernetes.io/part-of" + operator: In + values: + - "walrus" + - key: "app.kubernetes.io/name" + operator: In + values: + - "walrus-server" + restartPolicy: Always + serviceAccountName: walrus + containers: + - name: walrus + image: sealio/walrus:main + imagePullPolicy: IfNotPresent + resources: + limits: + cpu: '4' + memory: '8Gi' + requests: + cpu: '500m' + memory: '512Mi' + ports: + - name: https + containerPort: 443 + startupProbe: + failureThreshold: 10 + periodSeconds: 5 + httpGet: + scheme: HTTPS + port: 443 + path: /readyz + readinessProbe: + failureThreshold: 3 + timeoutSeconds: 5 + periodSeconds: 5 + httpGet: + scheme: HTTPS + port: 443 + path: /readyz + livenessProbe: + failureThreshold: 10 + timeoutSeconds: 5 + periodSeconds: 10 + httpGet: + scheme: HTTPS + port: 443 + path: /livez + volumeMounts: + - name: data + mountPath: /var/run/walrus + volumes: + - name: data + persistentVolumeClaim: + claimName: walrus diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..f8279e59a --- /dev/null +++ b/docs/CODE_OF_CONDUCT.md @@ -0,0 +1,119 @@ +# Contributor Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), +version 2.1, available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 000000000..010ac6d8e --- /dev/null +++ b/docs/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing to Walrus + +Thanks for taking the time to contribute to Walrus! + +Please review and follow the [Code of Conduct](./CODE_OF_CONDUCT.md). + +## Filing Issues + +If you find any bugs or are having any trouble, please search the reported issue as someone may have experienced the same issue, or we are actively working on a solution. + +If you can't find anything related to your issue, contact us by filing an issue. To help us diagnose and resolve, please include as much information as possible, including: + +- Walrus: What version of Walrus are you using, what deployment method, etc. +- Hosts: What specifications does the host have, like CPU/memory/disk. +- Environment: Are you in a proxy environment, are you using recognized CA/self signed certificates, etc. +- Steps to reproduce: Provide as much detail on how you got into the reported situation. +- Logs: Please include any relevant logs, such as Walrus server logs, service deployment logs, etc. + +## Contributing Code + +For setting up development environment, please refer to [Development Guide](./DEVELOPMENT.md). + +If you're fixing a small issue, you can simply submit a PR. However, if you're planning to submit a bigger PR to implement a new feature or fix a relatively complex bug, please open an issue that explains the change and the motivation for it. If you're addressing a bug, please explain how to reproduce it. + +## Updating Documentation + +If you have any updates to our documentation, please make a pull request to the [docs](https://github.com/seal-io/docs) repo. \ No newline at end of file diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md new file mode 100644 index 000000000..e09ebca54 --- /dev/null +++ b/docs/DEVELOPMENT.md @@ -0,0 +1,80 @@ +# Development Guide + +## Setup Development Environment + +### Local Kubernetes via [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installing-with-a-package-manager) + +```bash +$ kind create cluster --name local + +``` + +### Go Run + +```bash +$ # default. +$ go run cmd/server/main.go --log-verbosity=4 + +$ # with specified kubernetes cluster. +$ go run cmd/server/main.go --log-verbosity=4 --kubeconfig=/path/to/kubeconfig +``` + +#### Interact with [HTTPie](https://httpie.io/docs/cli/macos) + +```bash +$ # get init password from console: !!! Bootstrap Admin Password: !!! +$ https --verify=no POST :/account/login username=admin password= + +$ # access with login session. +$ https --verify=no GET :/settings Cookie:walrus_session= + +``` + +#### Interact with [Swagger UI](https://github.com/swagger-api/swagger-ui) + +```bash +$ open http://127.0.0.1/swagger + +``` + +## Development Commands + +The Makefile includes some useful commands for development. You can build locally using the `make` command. You can run `make help` for details. The output is shown as below. + +```bash +$ make help +# +# Usage: +# +# * [dev] `make deps`, get dependencies. +# - `make deps update`, update dependencies. +# +# * [dev] `make generate`, generate something. +# +# * [dev] `make lint`, check style. +# - `BUILD_TAGS="jsoniter" make lint` check with specified tags. +# - `LINT_DIRTY=true make lint` verify whether the code tree is dirty. +# +# * [dev] `make test`, execute unit testing. +# - `BUILD_TAGS="jsoniter" make test` test with specified tags. +# +# * [dev] `make build`, execute cross building. +# - `VERSION=vX.y.z+l.m make build` build all targets with vX.y.z+l.m version. +# - `OS=linux ARCH=arm64 make build` build all targets run on linux/arm64 arch. +# - `BUILD_TAGS="jsoniter" make build` build with specified tags. +# - `BUILD_PLATFORMS="linux/amd64,linux/arm64" make build` do multiple platforms go build. +# - `WALRUS_TELEMETRY_API_KEY="phc_xxx" make build` build with telemetry api key. +# +# * [dev] `make package`, embed running resources into a Docker image on one platform. +# - `REPO=xyz make package` package all targets named with xyz repository. +# - `VERSION=vX.y.z+l.m make package` package all targets named with vX.y.z-l.m tag. +# - `TAG=main make package` package all targets named with main tag. +# - `OS=linux ARCH=arm64 make package` package all targets run on linux/arm64 arch. +# - `PACKAGE_BUILD=false make package` prepare build resource but disable docker build. +# - `DOCKER_USERNAME=... DOCKER_PASSWORD=... PACKAGE_PUSH=true make package` execute docker push after build. +# +# * [ci] `make ci`, execute `make deps`, `make lint`, `make test`, `make build` and `make package`. +# - `CI_CHECK=false make ci` only execute `make build` and `make package`. +# - `CI_PUBLISH=false make ci` only execute `make deps`, `make lint` and `make test`. +# +``` \ No newline at end of file diff --git a/docs/README_CN.md b/docs/README_CN.md new file mode 100644 index 000000000..9b21785a4 --- /dev/null +++ b/docs/README_CN.md @@ -0,0 +1,66 @@ +
+ +

Walrus

+ +

+ English  |  中文  +

+
+ +Walrus是一个开源的应用管理平台,可以简化在任意基础设施之上应用服务和基础设施资源的部署和管理。它帮助平台工程师为开发人员构建黄金路径,并赋予开发人员自服务的能力。 + +# Why Walrus + +- 一个企业级的XaC(一切即代码)平台,赋能DevOps协作与自服务。 +- 利用现有的开源工具和生态,包括Terraform和OpenTofu,提供更强大、更灵活的编排和面向应用的抽象。 +- 开发人员不需要学习复杂的Kubernetes或基础设施知识,就可以在任意基础设施之上交付和管理整个应用系统。 + + +# 关键特性 + +- 统一编排:云原生应用不仅仅是Kubernetes。Walrus提供应用系统从上到下的完整编排,包括应用服务和资源依赖项(如数据库、中间件、负载均衡器和网络等等)。 +- 关注点分离:Dev团队可以声明资源类型的需求,通过Ops团队提供的[资源定义](https://seal-io.github.io/docs/zh/operation/resource-definition)进行规则匹配并自动化置备资源,实现Dev团队的自助服务。 +- 多态资源管理:单一的资源类型可以根据实际从开发到生产中不同的运行模式和运行环境,转换为多态运行的资源。 +- 应用系统全局视图:Walrus通过[依赖图](https://seal-io.github.io/docs/zh/application/graph)提供了整个应用系统的统一视图,包括所有应用服务、基础设施资源及它们的底层组件。 +- 动态环境管理:Walrus允许您按需启动或停止应用资源或整个应用环境,从而提高资源利用率和成本效益。 +- UI Schema:通过[UI Schema](https://seal-io.github.io/docs/zh/operation/template#自定义模板-ui-样式)定义展示给最终用户如何部署资源的UI表单交互,而不需要修改代码。 +- 工作流引擎:Walrus内置了工作流引擎和可扩展的步骤模板,可以满足各种复杂的编排和部署需求。 +- AI辅助:通过与[Appilot](https://github.com/seal-io/appilot)集成,您可以通过自然语言交互来管理应用程序与进行故障排查诊断。 + +# 快速入门 + +```shell +sudo docker run -d --privileged --restart=unless-stopped -p 80:80 -p 443:443 sealio/walrus +``` + +在浏览器中打开 `https://<服务器IP或域名>` + +# 文档 + +请参阅[官方文档站点](https://seal-io.github.io/docs/zh/)获取完整的文档。 + +# 社区与支持 + +如果您需要任何帮助,请加入以下社区: +- [Discord(英文)](https://discord.gg/fXZUKK2baF) +- [微信群](WECHAT_CN.md) + +如果您有任何反馈意见或问题,欢迎通过Github Issues[提交问题](https://github.com/seal-io/walrus/issues/new)。 + +对于安全问题,请通过发送电子邮件至 进行报告。 + +# 贡献 + +如果您有兴趣为Walrus做出贡献,请阅读我们的[贡献指南](./CONTRIBUTING.md)。 + +# 许可证 + +版权所有 (c) 2023 [数澈软件](https://seal.io) + +根据 Apache 许可证 2.0 版(“许可证”)进行许可; +除非符合许可证,否则您不得使用此文件。 +您可以在 [LICENSE](../LICENSE) 文件中获取许可证的详细信息。 + +除非适用法律要求或书面同意,否则在许可下分发的软件是基于“按原样”分发的, +不提供任何形式的保证或条件,无论是明示的还是隐含的。 +有关特定语言下的权限和限制,请参阅许可证。 diff --git a/docs/WECHAT_CN.md b/docs/WECHAT_CN.md new file mode 100644 index 000000000..f76767ff9 --- /dev/null +++ b/docs/WECHAT_CN.md @@ -0,0 +1,3 @@ +扫描以下二维码添加小助手微信,即可加入微信群一起交流。 + +小助手微信 \ No newline at end of file diff --git a/docs/assets/logo.png b/docs/assets/logo.png new file mode 100644 index 000000000..9011b4973 Binary files /dev/null and b/docs/assets/logo.png differ diff --git a/docs/assets/wechat.png b/docs/assets/wechat.png new file mode 100644 index 000000000..fbdaeb634 Binary files /dev/null and b/docs/assets/wechat.png differ diff --git a/gen/kube/builder/config.go b/gen/kube/builder/config.go new file mode 100644 index 000000000..28261ed21 --- /dev/null +++ b/gen/kube/builder/config.go @@ -0,0 +1,87 @@ +package builder + +import ( + "errors" + "fmt" + "os" + "path/filepath" + + "golang.org/x/mod/modfile" +) + +const generatedHeader = "// Code generated by \"walrus\", DO NOT EDIT." + +type Config struct { + // ProjectDir is the root path of the Go project. + ProjectDir string + + // Project gains from the go.mod file of ProjectDir if blank. + Project string + + // Header allows users to provide an optional header signature for + // the generated files. + // format: '// Code generated by "walrus", DO NOT EDIT.'. + Header string + + // Domain specifies the domain to place the API groups, + // defaults to "walrus.seal.io". + Domain string + + // APIs specifies the paths to execute deepcopy-gen, crd-gen, openapi-gen .etc. + APIs []string + + // ExtensionAPIs specifies the paths to execute apireg-gen .etc. + ExtensionAPIs []string + + // Webhooks specifies the paths to execute webhook-gen .etc. + Webhooks []string + + // ExternalAPIs specifies the external apis to integrate. + ExternalAPIs []string + + // PluralExceptions specifies the plural form exceptions. + PluralExceptions map[string]string + + // ProtoImports specifies the proto package for imports. + ProtoImports []string +} + +func (c *Config) ValidateAndDefault() error { + if c.ProjectDir == "" { + return errors.New("invalid config: project dir is blank") + } + + if c.Project == "" { + project, err := getProject(c.ProjectDir) + if err != nil { + return fmt.Errorf("invalid config: error project getting %w", err) + } + c.Project = project + } + + if c.Header == "" { + c.Header = generatedHeader + } + + if c.Domain == "" { + c.Domain = "walrus.seal.io" + } + + return nil +} + +func getProject(projectDir string) (string, error) { + mfn := filepath.Join(projectDir, "go.mod") + + mfb, err := os.ReadFile(mfn) + if err != nil { + return "", fmt.Errorf("read the go.mod: %w", err) + } + + mf, err := modfile.Parse(mfn, mfb, nil) + if err != nil { + return "", fmt.Errorf("parse the go.mod: %w", err) + } + + return mf.Module.Mod.Path, nil +} diff --git a/gen/kube/builder/generate.go b/gen/kube/builder/generate.go new file mode 100644 index 000000000..be7269f78 --- /dev/null +++ b/gen/kube/builder/generate.go @@ -0,0 +1,342 @@ +package builder + +import ( + "context" + "fmt" + "os" + "path" + "path/filepath" + "slices" + "strings" + + apireggenargs "github.com/seal-io/code-generator/cmd/apireg-gen/args" + apireggen "github.com/seal-io/code-generator/cmd/apireg-gen/generators" + crdgenargs "github.com/seal-io/code-generator/cmd/crd-gen/args" + crdgen "github.com/seal-io/code-generator/cmd/crd-gen/generators" + webhookgenargs "github.com/seal-io/code-generator/cmd/webhook-gen/args" + webhookgen "github.com/seal-io/code-generator/cmd/webhook-gen/generators" + "github.com/seal-io/utils/osx" + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" + applygenargs "k8s.io/code-generator/cmd/applyconfiguration-gen/args" + applygen "k8s.io/code-generator/cmd/applyconfiguration-gen/generators" + clientgenargs "k8s.io/code-generator/cmd/client-gen/args" + clientgen "k8s.io/code-generator/cmd/client-gen/generators" + clientgentypes "k8s.io/code-generator/cmd/client-gen/types" + protobufgen "k8s.io/code-generator/cmd/go-to-protobuf/protobuf" + informergenargs "k8s.io/code-generator/cmd/informer-gen/args" + informergen "k8s.io/code-generator/cmd/informer-gen/generators" + listergenargs "k8s.io/code-generator/cmd/lister-gen/args" + listergen "k8s.io/code-generator/cmd/lister-gen/generators" + registergen "k8s.io/code-generator/cmd/register-gen/generators" + "k8s.io/gengo/args" + deepcopygen "k8s.io/gengo/examples/deepcopy-gen/generators" + "k8s.io/gengo/generator" + "k8s.io/gengo/types" + openapigenargs "k8s.io/kube-openapi/cmd/openapi-gen/args" + openapigen "k8s.io/kube-openapi/pkg/generators" + "k8s.io/utils/ptr" + + _ "embed" +) + +func Generate(c Config) error { + tempHeaderFile := osx.TempFile("") + defer func() { _ = os.Remove(tempHeaderFile) }() + _ = os.WriteFile(tempHeaderFile, stringx.ToBytes(ptr.To(stringx.Join("\n\n", c.Header, generatedHeader, ""))), 0o600) + + internalAPIs := append(slices.Clone(c.APIs), c.ExtensionAPIs...) + + // Execute deepcopy-gen. + { + deepcopyGen := args.GeneratorArgs{ + InputDirs: slices.Clone(internalAPIs), + OutputBase: c.ProjectDir, + OutputFileBaseName: "zz_generated.deepcopy", + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &deepcopygen.CustomArgs{}, + } + if err := deepcopyGen.Execute( + deepcopygen.NameSystems(), + deepcopygen.DefaultNameSystem(), + align(c.Project, deepcopygen.Packages)); err != nil { + return fmt.Errorf("execute deepcopy-gen: %w", err) + } + } + + // Execute register-gen. + { + registerGen := args.GeneratorArgs{ + InputDirs: slices.Clone(internalAPIs), + OutputBase: c.ProjectDir, + OutputFileBaseName: "zz_generated.register", + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + } + if err := registerGen.Execute( + registergen.NameSystems(), + registergen.DefaultNameSystem(), + align(c.Project, registergen.Packages)); err != nil { + return fmt.Errorf("execute register-gen: %w", err) + } + } + + // Execute go-to-protobuf. + { + protoGenAPIMachineryPackages := []string{ + "-k8s.io/apimachinery/pkg/api/resource", + "-k8s.io/apimachinery/pkg/types", + "-k8s.io/apimachinery/pkg/util/intstr", + "-k8s.io/apimachinery/pkg/runtime/schema", + "-k8s.io/apimachinery/pkg/runtime", + "-k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", + "-k8s.io/apimachinery/pkg/apis/meta/v1", + } + protoGenDropEmbeddedFields := []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta", + } + + protocGen := protobufgen.Generator{ + Common: args.GeneratorArgs{GoHeaderFilePath: tempHeaderFile}, + TrimPathPrefix: c.Project, + Packages: strings.Join(internalAPIs, ","), + ProtoImport: c.ProtoImports, + APIMachineryPackages: strings.Join(protoGenAPIMachineryPackages, ","), + DropEmbeddedFields: strings.Join(protoGenDropEmbeddedFields, ","), + } + protobufgen.Run(&protocGen) + } + + // Execute crd-gen/apireg-gen/openapi-gen/webhook-gen. + gp := gopool.GroupWithContextIn(context.Background()) + + gp.Go(func(ctx context.Context) error { + crdGen := args.GeneratorArgs{ + InputDirs: slices.Clone(c.APIs), + OutputBase: c.ProjectDir, + OutputFileBaseName: "zz_generated.crds", + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &crdgenargs.CustomArgs{}, + } + + if err := crdGen.Execute( + crdgen.NameSystems(), + crdgen.DefaultNameSystem(), + align(c.Project, crdgen.Packages)); err != nil { + return fmt.Errorf("execute crd-gen: %w", err) + } + + return nil + }) + + gp.Go(func(ctx context.Context) error { + // Execute apireg-gen. + apiRegGen := args.GeneratorArgs{ + InputDirs: slices.Clone(c.ExtensionAPIs), + OutputBase: c.ProjectDir, + OutputFileBaseName: "zz_generated.apiservice", + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &apireggenargs.CustomArgs{}, + } + + if err := apiRegGen.Execute( + apireggen.NameSystems(), + apireggen.DefaultNameSystem(), + align(c.Project, apireggen.Packages)); err != nil { + return fmt.Errorf("execute apireg-gen: %w", err) + } + + // Execute openapi-gen. + openapiGen := args.GeneratorArgs{ + InputDirs: append(slices.Clone(internalAPIs), + "k8s.io/apimachinery/pkg/api/resource", + "k8s.io/apimachinery/pkg/version", + "k8s.io/apimachinery/pkg/runtime", + "k8s.io/apimachinery/pkg/apis/meta/v1"), + OutputBase: c.ProjectDir, + OutputPackagePath: path.Join(c.Project, "pkg", "apis"), + OutputFileBaseName: "zz_generated.openapi", + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &openapigenargs.CustomArgs{ + ReportFilename: filepath.Join(c.ProjectDir, "pkg", "apis", "zz_generated.openapi.violation_exceptions"), + }, + } + + if err := openapiGen.Execute( + openapigen.NameSystems(), + openapigen.DefaultNameSystem(), + align(c.Project, openapigen.Packages)); err != nil { + return fmt.Errorf("execute openapi-gen: %w", err) + } + + return nil + }) + + gp.Go(func(ctx context.Context) error { + webhookGen := args.GeneratorArgs{ + InputDirs: slices.Clone(c.Webhooks), + OutputBase: c.ProjectDir, + OutputFileBaseName: "zz_generated.webhooks", + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &webhookgenargs.CustomArgs{}, + } + + if err := webhookGen.Execute( + webhookgen.NameSystems(), + webhookgen.DefaultNameSystem(), + align(c.Project, webhookgen.Packages)); err != nil { + return fmt.Errorf("execute webhook-gen: %w", err) + } + + return nil + }) + + err := gp.Wait() + if err != nil { + return err + } + + // Execute applyconfiguration-gen/client-gen/lister-gen/informer-gen. + _ = os.RemoveAll(path.Join(c.ProjectDir, "pkg", "clients")) + + // Execute applyconfiguration-gen. + applyConfigExternal := map[types.Name]string{ // nolint:lll + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "TypeMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ObjectMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "OwnerReference"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "Condition"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "DeleteOptions"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "LabelSelector"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "LabelSelectorRequirement"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ManagedFieldsEntry"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "Preconditions"}: "k8s.io/client-go/applyconfigurations/meta/v1", + } + + applyConfigPkg := path.Join(c.Project, "pkg", "clients", "applyconfiguration") + applyConfigGen := args.GeneratorArgs{ + InputDirs: append(slices.Clone(internalAPIs), c.ExternalAPIs...), + OutputBase: c.ProjectDir, + OutputPackagePath: applyConfigPkg, + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &applygenargs.CustomArgs{ + ExternalApplyConfigurations: applyConfigExternal, + }, + } + + if err := applyConfigGen.Execute( + applygen.NameSystems(), + applygen.DefaultNameSystem(), + align(c.Project, applygen.Packages)); err != nil { + return fmt.Errorf("execute applyconfiguration-gen: %w", err) + } + + // Execute client-gen. + clientsetGrpVers := make([]clientgentypes.GroupVersions, 0, len(internalAPIs)+len(c.ExternalAPIs)) + for _, grpVerPkg := range append(slices.Clone(internalAPIs), c.ExternalAPIs...) { + gn := path.Base(path.Dir(grpVerPkg)) + vn := path.Base(grpVerPkg) + grpVer := clientgentypes.GroupVersions{ + PackageName: gn, + Group: clientgentypes.Group(gn), + Versions: []clientgentypes.PackageVersion{ + { + Package: grpVerPkg, + Version: clientgentypes.Version(vn), + }, + }, + } + clientsetGrpVers = append(clientsetGrpVers, grpVer) + } + + clientsetPkg := path.Join(c.Project, "pkg", "clients", "clientset") + clientsetGen := args.GeneratorArgs{ + InputDirs: append(slices.Clone(internalAPIs), c.ExternalAPIs...), + OutputBase: c.ProjectDir, + OutputPackagePath: path.Dir(clientsetPkg), + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &clientgenargs.CustomArgs{ + Groups: clientsetGrpVers, + ClientsetName: path.Base(clientsetPkg), + ClientsetAPIPath: "/apis", + ClientsetOnly: false, + FakeClient: true, + ApplyConfigurationPackage: applyConfigPkg, + }, + } + + if err := clientsetGen.Execute( + clientgen.NameSystems(c.PluralExceptions), + clientgen.DefaultNameSystem(), + align(c.Project, clientgen.Packages)); err != nil { + return fmt.Errorf("execute client-gen: %w", err) + } + + // Execute lister-gen. + listerPkg := path.Join(c.Project, "pkg", "clients", "listers") + listerGen := args.GeneratorArgs{ + InputDirs: append(slices.Clone(internalAPIs), c.ExternalAPIs...), + OutputBase: c.ProjectDir, + OutputPackagePath: listerPkg, + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &listergenargs.CustomArgs{}, + } + + if err := listerGen.Execute( + listergen.NameSystems(c.PluralExceptions), + listergen.DefaultNameSystem(), + align(c.Project, listergen.Packages)); err != nil { + return fmt.Errorf("execute lister-gen: %w", err) + } + + // Execute informer-gen. + informerPkg := path.Join(c.Project, "pkg", "clients", "informers") + informerGen := args.GeneratorArgs{ + InputDirs: append(slices.Clone(internalAPIs), c.ExternalAPIs...), + OutputBase: c.ProjectDir, + OutputPackagePath: informerPkg, + GoHeaderFilePath: tempHeaderFile, + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &informergenargs.CustomArgs{ + VersionedClientSetPackage: clientsetPkg, + ListersPackage: listerPkg, + SingleDirectory: true, + }, + } + + if err := informerGen.Execute( + informergen.NameSystems(c.PluralExceptions), + informergen.DefaultNameSystem(), + align(c.Project, informergen.Packages)); err != nil { + return fmt.Errorf("execute informer-gen: %w", err) + } + + return nil +} + +type pkgsFunc func(ctx *generator.Context, args *args.GeneratorArgs) generator.Packages + +func align(p string, f pkgsFunc) pkgsFunc { + return func(ctx *generator.Context, args *args.GeneratorArgs) generator.Packages { + pkgs := f(ctx, args) + + for i := range pkgs { + pkg, ok := pkgs[i].(*generator.DefaultPackage) + if !ok { + continue + } + + pkg.PackagePath = strings.TrimPrefix(pkg.PackagePath, p+"/") + pkgs[i] = pkg + } + + return pkgs + } +} diff --git a/gen/kube/main.go b/gen/kube/main.go new file mode 100644 index 000000000..9f6dcc694 --- /dev/null +++ b/gen/kube/main.go @@ -0,0 +1,84 @@ +package main + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + + "github.com/seal-io/utils/stringx" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + + "github.com/seal-io/walrus/gen/kube/builder" +) + +func main() { + err := generate() + if err != nil { + klog.Fatalf("error generating: %v", err) + } +} + +func generate() error { + // Prepare. + pwd, err := os.Getwd() + if err != nil { + return fmt.Errorf("get working directory: %w", err) + } + + header, err := os.ReadFile(filepath.Join(pwd, "/hack/boilerplate/go.txt")) + if err != nil { + return err + } + + // Generate. + cfg := builder.Config{ + ProjectDir: pwd, + Project: "github.com/seal-io/walrus", + Header: stringx.FromBytes(ptr.To(bytes.TrimSpace(header))), + APIs: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1", + }, + ExtensionAPIs: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1", + }, + Webhooks: []string{ + "github.com/seal-io/walrus/pkg/webhooks/walruscore", + }, + ExternalAPIs: []string{ + "k8s.io/api/admission/v1", + "k8s.io/api/admissionregistration/v1", + "k8s.io/api/apps/v1", + "k8s.io/api/authentication/v1", + "k8s.io/api/authorization/v1", + "k8s.io/api/autoscaling/v1", + "k8s.io/api/autoscaling/v2", + "k8s.io/api/batch/v1", + "k8s.io/api/certificates/v1", + "k8s.io/api/coordination/v1", + "k8s.io/api/core/v1", + "k8s.io/api/discovery/v1", + "k8s.io/api/events/v1", + "k8s.io/api/rbac/v1", + "k8s.io/api/scheduling/v1", + "k8s.io/api/storage/v1", + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1", + "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1", + }, + PluralExceptions: map[string]string{ + "Endpoints": "Endpoints", + }, + ProtoImports: []string{ + // NB(thxCode): the go-to-protobuf under code-generator relies on a deprecated project, + // https://github.com/gogo/protobuf. + // The upstream already filed an issue about this, + // https://github.com/kubernetes/kubernetes/issues/96564. + // In order to support generating protobuf code for extension APIs, + // we need to tell protoc where to find the gogo/protobuf. + filepath.Join(pwd, "staging"), + }, + } + + return builder.Generate(cfg) +} diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..ecca33639 --- /dev/null +++ b/go.mod @@ -0,0 +1,154 @@ +module github.com/seal-io/walrus + +go 1.21 + +replace ( + github.com/drone/go-scm => ./staging/github.com/drone/go-scm + github.com/go-logr/logr => ./staging/github.com/go-logr/logr + github.com/gogo/protobuf => ./staging/github.com/gogo/protobuf + github.com/seal-io/code-generator => ./staging/github.com/seal-io/code-generator + github.com/seal-io/utils => ./staging/github.com/seal-io/utils + k8s.io/apimachinery => ./staging/k8s.io/apimachinery + k8s.io/code-generator => ./staging/k8s.io/code-generator + k8s.io/klog/v2 => ./staging/k8s.io/klog +) + +require ( + github.com/davecgh/go-spew v1.1.1 + github.com/go-git/go-billy/v5 v5.5.0 + github.com/go-git/go-git/v5 v5.11.0 + github.com/gogo/protobuf v1.3.2 + github.com/google/go-containerregistry v0.19.1 + github.com/google/uuid v1.6.0 + github.com/prometheus/client_golang v1.18.0 + github.com/robfig/cron/v3 v3.0.1 + github.com/seal-io/code-generator v0.0.0-00010101000000-000000000000 + github.com/seal-io/utils v0.0.0-00010101000000-000000000000 + github.com/spf13/cobra v1.8.0 + github.com/spf13/pflag v1.0.5 + go.uber.org/atomic v1.10.0 + go.uber.org/automaxprocs v1.5.3 + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 + golang.org/x/mod v0.15.0 + k8s.io/api v0.29.2 + k8s.io/apiextensions-apiserver v0.29.2 + k8s.io/apimachinery v0.29.2 + k8s.io/apiserver v0.29.2 + k8s.io/client-go v0.29.2 + k8s.io/code-generator v0.29.2 + k8s.io/component-base v0.29.2 + k8s.io/gengo v0.0.0-20240228010128-51d4e06bde70 + k8s.io/klog/v2 v2.120.1 + k8s.io/kube-aggregator v0.29.2 + k8s.io/kube-openapi v0.0.0-20240224005224-582cce78233b + k8s.io/utils v0.0.0-20240102154912-e7106e64919e + sigs.k8s.io/controller-runtime v0.17.2 + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 +) + +require ( + dario.cat/mergo v1.0.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/NYTimes/gziphandler v1.1.1 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect + github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6 // indirect + github.com/akerl/timber v0.0.3 // indirect + github.com/alitto/pond v1.8.3 // indirect + github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect + github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/emicklei/go-restful/v3 v3.11.3 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/evanphx/json-patch v5.9.0+incompatible // indirect + github.com/evanphx/json-patch/v5 v5.9.0 // indirect + github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/inflect v0.19.0 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/jsonreference v0.20.4 // indirect + github.com/go-openapi/swag v0.22.9 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/cel-go v0.17.7 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/henvic/httpretty v0.1.3 // indirect + github.com/imdario/mergo v0.3.16 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/common v0.47.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/sergi/go-diff v1.1.0 // indirect + github.com/skeema/knownhosts v1.2.1 // indirect + github.com/stoewer/go-strcase v1.2.0 // indirect + github.com/tidwall/gjson v1.17.1 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.1 // indirect + github.com/tidwall/sjson v1.2.5 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + go.etcd.io/etcd/api/v3 v3.5.10 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect + go.etcd.io/etcd/client/v3 v3.5.10 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 // indirect + go.opentelemetry.io/otel v1.19.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.26.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + golang.org/x/tools v0.18.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.58.3 // indirect + google.golang.org/protobuf v1.32.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/kms v0.29.2 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..c6166a364 --- /dev/null +++ b/go.sum @@ -0,0 +1,463 @@ +cloud.google.com/go v0.110.6 h1:8uYAkj3YHTP/1iwReuHPxLSbdcyc+dSBbzFMrVwDR6Q= +cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6 h1:NKu3y+J/UECHXXEPB+PBg1faCb+BFzt0prciWSjPzXk= +github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6/go.mod h1:c7XTNx5sTF0If/3zNvYXQe6NE2ufAfeS6V6/HorfQcA= +github.com/akerl/timber v0.0.3 h1:xTqH54vCSLjDlAsHkDL5+sZuO8xPdqsamTUk9ense/w= +github.com/akerl/timber v0.0.3/go.mod h1:LFiUpCR4BAfk6HMg6t45XIfmXcNJubA+wnw4uq2MHJg= +github.com/alitto/pond v1.8.3 h1:ydIqygCLVPqIX/USe5EaV/aSRXTRXDEI9JwuDdu+/xs= +github.com/alitto/pond v1.8.3/go.mod h1:CmvIIGd5jKLasGI3D87qDkQxjzChdKMmnXMg3fG6M6Q= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= +github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= +github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/emicklei/go-restful/v3 v3.11.3 h1:yagOQz/38xJmcNeZJtrUcKjkHRltIaIFXKWeG1SkWGE= +github.com/emicklei/go-restful/v3 v3.11.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= +github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= +github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= +github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= +github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= +github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= +github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= +github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= +github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= +github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= +github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= +github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +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/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/cel-go v0.17.7 h1:6ebJFzu1xO2n7TLtN+UBqShGBhlD85bhvglh5DpcfqQ= +github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.4.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.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/go-containerregistry v0.19.1 h1:yMQ62Al6/V0Z7CqIrrS1iYoA5/oQCm88DeNujc7C1KY= +github.com/google/go-containerregistry v0.19.1/go.mod h1:YCMFNQeeXeLF+dnhhWkqDItx/JSkH01j1Kis4PsjzFI= +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= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/henvic/httpretty v0.1.3 h1:4A6vigjz6Q/+yAfTD4wqipCv+Px69C7Th/NhT0ApuU8= +github.com/henvic/httpretty v0.1.3/go.mod h1:UUEv7c2kHZ5SPQ51uS3wBpzPDibg2U3Y+IaXyHy5GBg= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= +github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= +github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= +github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.1 h1:Ou41VVR3nMWWmTiEUnj0OlsgOSCUFgsPAOl6jRIcVtQ= +github.com/sirupsen/logrus v1.9.1/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= +github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= +github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= +github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= +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/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k= +go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI= +go.etcd.io/etcd/client/pkg/v3 v3.5.10 h1:kfYIdQftBnbAq8pUWFXfpuuxFSKzlmM5cSn76JByiT0= +go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U= +go.etcd.io/etcd/client/v2 v2.305.10 h1:MrmRktzv/XF8CvtQt+P6wLUlURaNpSDJHFZhe//2QE4= +go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA= +go.etcd.io/etcd/client/v3 v3.5.10 h1:W9TXNZ+oB3MCd/8UjxHTWK5J9Nquw9fQBLJd5ne5/Ao= +go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc= +go.etcd.io/etcd/pkg/v3 v3.5.10 h1:WPR8K0e9kWl1gAhB5A7gEa5ZBTNkT9NdNWrR8Qpo1CM= +go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs= +go.etcd.io/etcd/raft/v3 v3.5.10 h1:cgNAYe7xrsrn/5kXMSaH8kM/Ky8mAdMqGOxyYwpP0LA= +go.etcd.io/etcd/raft/v3 v3.5.10/go.mod h1:odD6kr8XQXTy9oQnyMPBOr0TVe+gT0neQhElQ6jbGRc= +go.etcd.io/etcd/server/v3 v3.5.10 h1:4NOGyOwD5sUZ22PiWYKmfxqoeh72z6EhYjNosKGLmZg= +go.etcd.io/etcd/server/v3 v3.5.10/go.mod h1:gBplPHfs6YI0L+RpGkTQO7buDbHv5HJGG/Bst0/zIPo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 h1:ZOLJc06r4CB42laIXg/7udr0pbZyuAihN10A/XuiQRY= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 h1:3d+S281UTjM+AbF31XSOYn1qXn3BgIdWl8HNEpx08Jk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= +go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +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.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +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.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.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.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +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.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.2 h1:hBC7B9+MU+ptchxEqTNW2DkUosJpp1P+Wn6YncZ474A= +k8s.io/api v0.29.2/go.mod h1:sdIaaKuU7P44aoyyLlikSLayT6Vb7bvJNCX105xZXY0= +k8s.io/apiextensions-apiserver v0.29.2 h1:UK3xB5lOWSnhaCk0RFZ0LUacPZz9RY4wi/yt2Iu+btg= +k8s.io/apiextensions-apiserver v0.29.2/go.mod h1:aLfYjpA5p3OwtqNXQFkhJ56TB+spV8Gc4wfMhUA3/b8= +k8s.io/apiserver v0.29.2 h1:+Z9S0dSNr+CjnVXQePG8TcBWHr3Q7BmAr7NraHvsMiQ= +k8s.io/apiserver v0.29.2/go.mod h1:B0LieKVoyU7ykQvPFm7XSdIHaCHSzCzQWPFa5bqbeMQ= +k8s.io/client-go v0.29.2 h1:FEg85el1TeZp+/vYJM7hkDlSTFZ+c5nnK44DJ4FyoRg= +k8s.io/client-go v0.29.2/go.mod h1:knlvFZE58VpqbQpJNbCbctTVXcd35mMyAAwBdpt4jrA= +k8s.io/component-base v0.29.2 h1:lpiLyuvPA9yV1aQwGLENYyK7n/8t6l3nn3zAtFTJYe8= +k8s.io/component-base v0.29.2/go.mod h1:BfB3SLrefbZXiBfbM+2H1dlat21Uewg/5qtKOl8degM= +k8s.io/gengo v0.0.0-20240228010128-51d4e06bde70 h1:D9H6wq7PAmub2g4XUrekNWMFVI0JIz7s0F64HBPsPOw= +k8s.io/gengo v0.0.0-20240228010128-51d4e06bde70/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/kms v0.29.2 h1:MDsbp98gSlEQs7K7dqLKNNTwKFQRYYvO4UOlBOjNy6Y= +k8s.io/kms v0.29.2/go.mod h1:s/9RC4sYRZ/6Tn6yhNjbfJuZdb8LzlXhdlBnKizeFDo= +k8s.io/kube-aggregator v0.29.2 h1:z9qJn5wlGmGaX6EfM7OEhr6fq6SBjDKR6tPRZ/qgxeY= +k8s.io/kube-aggregator v0.29.2/go.mod h1:QEuwzmMJJsg0eg1Gv+u4cWcYeJG2+8vN8/nTXBzopUo= +k8s.io/kube-openapi v0.0.0-20240224005224-582cce78233b h1:1dzw/KqgSPod72SUp2tuTOmK33TlY2fHlrVU2M9VrOM= +k8s.io/kube-openapi v0.0.0-20240224005224-582cce78233b/go.mod h1:Pa1PvrP7ACSkuX6I7KYomY6cmMA0Tx86waBhDUgoKPw= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= +sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= +sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/hack/boilerplate/go.txt b/hack/boilerplate/go.txt new file mode 100644 index 000000000..16bce6d74 --- /dev/null +++ b/hack/boilerplate/go.txt @@ -0,0 +1,2 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 diff --git a/hack/build.sh b/hack/build.sh new file mode 100755 index 000000000..84d232a0d --- /dev/null +++ b/hack/build.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +BUILD_DIR="${ROOT_DIR}/.dist/build" +mkdir -p "${BUILD_DIR}" + +# +# util +# + +function build() { + local target="$1" + local task="$2" + local path="$3" + shift 3 + + local ldflags=( + "-X main.Name=${target}-${task}" # Inject the binary name. + "-X github.com/seal-io/utils/version.Version=${GIT_VERSION}" # Inject the git version. + "-X github.com/seal-io/utils/version.GitCommit=${GIT_COMMIT}" # Inject the git commit. + "-X github.com/seal-io/walrus/server/telemetry.APIKey=${WALRUS_TELEMETRY_API_KEY:-}" + "-w -s" + "-extldflags '-static'" + ) + + local tags=() + IFS=" " read -r -a tags <<<"$(seal::target::build_tags "${target}")" + + local platforms=() + IFS=" " read -r -a platforms <<<"$(seal::target::build_platforms "${target}" "${task}")" + + for platform in "${platforms[@]}"; do + local os_arch + IFS="/" read -r -a os_arch <<<"${platform}" + local os="${os_arch[0]}" + local arch="${os_arch[1]}" + GOOS=${os} GOARCH=${arch} CGO_ENABLED=0 go build \ + -trimpath \ + -ldflags="${ldflags[*]}" \ + -tags="${os} ${tags[*]}" \ + -o="${BUILD_DIR}/${target}/${target}-${task}-${os}-${arch}" \ + "${path}" + done +} + +# +# lifecycle +# + +function dispatch() { + local target="$1" + local path="$2" + shift 2 + + local tasks=() + IFS=" " read -r -a tasks <<<"$(seal::util::find_subdirs "${path}/cmd")" + + for task in "${tasks[@]}"; do + seal::log::debug "building ${target} ${task}" + if [[ "${PARALLELIZE:-true}" == "false" ]]; then + build "${target}" "${task}" "${path}/cmd/${task}" + else + build "${target}" "${task}" "${path}/cmd/${task}" & + fi + done +} + +# +# main +# + +seal::log::info "+++ BUILD +++" "info: ${GIT_VERSION},${GIT_COMMIT:0:7},${GIT_TREE_STATE},${BUILD_DATE}" + +dispatch "walrus" "${ROOT_DIR}" "$@" + +if [[ "${PARALLELIZE:-true}" == "true" ]]; then + seal::util::wait_jobs || seal::log::fatal "--- BUILD ---" +fi +seal::log::info "--- BUILD ---" diff --git a/hack/ci.sh b/hack/ci.sh new file mode 100755 index 000000000..e810938f4 --- /dev/null +++ b/hack/ci.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +pushd "${ROOT_DIR}" >/dev/null 2>&1 + +# check phase +if [[ "${CI_CHECK:-true}" == "true" ]]; then + make deps "$@" + make lint "$@" + make test "$@" +fi + +# publish phase +if [[ "${CI_PUBLISH:-true}" == "true" ]]; then + make build "$@" + make package "$@" +fi + +popd >/dev/null 2>&1 diff --git a/hack/deps.sh b/hack/deps.sh new file mode 100755 index 000000000..8cd660f9e --- /dev/null +++ b/hack/deps.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +# +# util +# + +function mod() { + local path="$1" + shift 1 + + [[ "${path}" == "${ROOT_DIR}" ]] || pushd "${path}" >/dev/null 2>&1 + + if [[ -n "$*" ]] && [[ "$*" =~ update$ ]]; then + go get -u ./... + fi + + go mod tidy + go mod download + + [[ "${path}" == "${ROOT_DIR}" ]] || popd >/dev/null 2>&1 +} + +# +# lifecycle +# + +function dispatch() { + local target="$1" + local path="$2" + shift 2 + + seal::log::debug "modding ${target}" + if [[ "${PARALLELIZE:-true}" == "false" ]]; then + mod "${path}" "$@" + else + mod "${path}" "$@" & + fi +} + +# +# main +# + +seal::log::info "+++ MOD +++" + +dispatch "utils" "${ROOT_DIR}/staging/github.com/seal-io/utils" "$@" +dispatch "code-generator" "${ROOT_DIR}/staging/github.com/seal-io/code-generator" "$@" +dispatch "walrus" "${ROOT_DIR}" "$@" + +if [[ "${PARALLELIZE:-true}" == "true" ]]; then + seal::util::wait_jobs || seal::log::fatal "--- MOD ---" +fi +seal::log::info "--- MOD ---" diff --git a/hack/generate.sh b/hack/generate.sh new file mode 100755 index 000000000..cf592e79c --- /dev/null +++ b/hack/generate.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +# +# util +# + +function generate() { + local target="$1" + local task="$2" + local path="$3" + shift 3 + + PATH="${ROOT_DIR}/.sbin:${ROOT_DIR}/.sbin/protoc/bin:${PATH}" \ + go run -mod=mod "${path}" "$@" +} + +# +# lifecycle +# + +function before() { + if ! seal::protoc::protoc::validate; then + seal::log::fatal "protoc hasn't installed" + fi + + # NB(thxCode): install protoc-gen-gogo, + # and trace the issue https://github.com/kubernetes/kubernetes/issues/96564. + if [[ ! -f "${ROOT_DIR}/.sbin/protoc/bin/protoc-gen-gogo" ]]; then + GOBIN="${ROOT_DIR}/.sbin/protoc/bin" \ + go install -mod=mod k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo@latest + fi + + if [[ ! -f "${ROOT_DIR}/.sbin/goimports" ]]; then + GOBIN="${ROOT_DIR}/.sbin/protoc/bin" \ + go install golang.org/x/tools/cmd/goimports@latest + fi +} + +function dispatch() { + local target="$1" + local path="$2" + shift 2 + + local tasks=() + IFS=" " read -r -a tasks <<<"$(seal::util::find_subdirs "${path}/gen")" + + for task in "${tasks[@]}"; do + seal::log::debug "generating ${target} ${task}" + if [[ "${PARALLELIZE:-true}" == "false" ]]; then + generate "${target}" "${task}" "${path}/gen/${task}" + else + generate "${target}" "${task}" "${path}/gen/${task}" & + fi + done +} + +# +# main +# + +seal::log::info "+++ GENERATE +++" + +before + +dispatch "walrus" "${ROOT_DIR}" "$@" + +if [[ "${PARALLELIZE:-true}" == "true" ]]; then + seal::util::wait_jobs || seal::log::fatal "--- GENERATE ---" +fi +seal::log::info "--- GENERATE ---" diff --git a/hack/lib/cgo.sh b/hack/lib/cgo.sh new file mode 100644 index 000000000..05ab80410 --- /dev/null +++ b/hack/lib/cgo.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env bash + +function seal::cgo::musl_libc::install() { + local build_os + build_os="$(seal::util::get_raw_os)" + if [[ "${build_os}" == "darwin" ]]; then + seal::util::warn "please run 'xcode-select --install' to install xcode compiler," + seal::util::warn "or run 'softwareupdate --all --install --force' to update xcode software," + seal::util::warn "finally, run 'brew install filosottile/musl-cross/musl-cross --with-aarch64' to install musl cross build chain" + return 1 + fi + + if [[ "${build_os}" != "linux" ]]; then + seal::util::error "cannot execute cgo build via musl gcc without linux platform" + return 1 + fi + local platform + platform="$(go env GOOS)/$(go env GOARCH)" + local src + case "${platform}" in + linux/amd64) + src="/musl-cross/x86_64-linux-musl-cross.tgz" + ;; + linux/arm64) + src="/musl-cross/aarch64-linux-musl-cross.tgz" + ;; + windows/amd64) + src="/musl-cross/x86_64-w64-mingw32-cross.tgz" + ;; + *) + return 1 + ;; + esac + local directory="${ROOT_DIR}/.sbin/musl-${platform////-}" + mkdir -p "${directory}" + docker run \ + --rm \ + --pull=always \ + --interactive \ + --volume /tmp:/host \ + sealio/meta:hamal cp -f "${src}" "/host/$(basename "${src}")" + tar -xvf "/tmp/$(basename "${src}")" \ + --directory "${directory}" \ + --strip-components 1 \ + --no-same-owner \ + --exclude ./*/usr +} + +function seal::cgo::musl_libc::validate() { + # shellcheck disable=SC2046 + if seal::cgo::musl_libc::bin; then + return 0 + fi + + seal::log::info "installing musl libc" + if seal::cgo::musl_libc::install; then + return 0 + fi + seal::log::error "no musl libc available" + return 1 +} + +function seal::cgo::musl_libc::bin() { + local platform + platform="$(go env GOOS)/$(go env GOARCH)" + + PATH="${PATH}:${ROOT_DIR}/.sbin/musl-${platform////-}/bin" + case "${platform}" in + linux/amd64) + if [[ -n "$(command -v x86_64-linux-musl-gcc)" ]] && + [[ -n "$(command -v x86_64-linux-musl-g++)" ]] && + [[ -n "$(command -v x86_64-linux-musl-ar)" ]]; then + return 0 + fi + ;; + linux/arm64) + if [[ -n "$(command -v aarch64-linux-musl-gcc)" ]] && + [[ -n "$(command -v aarch64-linux-musl-g++)" ]] && + [[ -n "$(command -v aarch64-linux-musl-ar)" ]]; then + return 0 + fi + ;; + windows/amd64) + if [[ -n "$(command -v x86_64-w64-mingw32-gcc)" ]] && + [[ -n "$(command -v x86_64-w64-mingw32-g++)" ]] && + [[ -n "$(command -v x86_64-w64-mingw32-ar)" ]]; then + return 0 + fi + ;; + esac + + return 1 +} + +function seal::cgo::musl_libc::build() { + local platform + platform="$(go env GOOS)/$(go env GOARCH)" + + if seal::cgo::musl_libc::validate; then + case "${platform}" in + linux/amd64) + CC="x86_64-linux-musl-gcc" CXX="x86_64-linux-musl-g++" AR="x86_64-linux-musl-ar" CGO_ENABLED=1 \ + go build "$@" + return 0 + ;; + linux/arm64) + CC="aarch64-linux-musl-gcc" CXX="aarch64-linux-musl-g++" AR="aarch64-linux-musl-ar" CGO_ENABLED=1 \ + go build "$@" + return 0 + ;; + windows/amd64) + CC="x86_64-w64-mingw32-gcc" CXX="x86_64-w64-mingw32-g++" AR="x86_64-w64-mingw32-ar" CGO_ENABLED=1 \ + go build "$@" + return 0 + ;; + esac + fi + + seal::log::fatal "cannot execute cgo build ${platform} via musl libc" +} diff --git a/hack/lib/image.sh b/hack/lib/image.sh new file mode 100644 index 000000000..84b9b3af8 --- /dev/null +++ b/hack/lib/image.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------- +# Image variables helpers. These functions need the +# following variables: +# +# DOCKER_VERSION - The Docker version for running, default is 20.10. +# DOCKER_USERNAME - The username of image registry. +# DOCKER_PASSWORD - The password of image registry. + +docker_version=${DOCKER_VERSION:-"20.10"} +docker_username=${DOCKER_USERNAME:-} +docker_password=${DOCKER_PASSWORD:-} + +function seal::image::docker::install() { + curl --retry 3 --retry-all-errors --retry-delay 3 \ + -sSfL "https://get.docker.com" | sh -s VERSION="${docker_version}" +} + +function seal::image::docker::validate() { + # shellcheck disable=SC2046 + if [[ -n "$(command -v $(seal::image::docker::bin))" ]]; then + return 0 + fi + + seal::log::info "installing docker" + if seal::image::docker::install; then + seal::log::info "docker: $($(seal::image::docker::bin) version --format '{{.Server.Version}}' 2>&1)" + return 0 + fi + seal::log::error "no docker available" + return 1 +} + +function seal::image::docker::bin() { + echo -n "docker" +} + +function seal::image::name() { + if [[ -n "${IMAGE:-}" ]]; then + echo -n "${IMAGE}" + else + echo -n "$(basename "${ROOT_DIR}")" 2>/dev/null + fi +} + +function seal::image::tag() { + echo -n "${TAG:-${GIT_VERSION}}" | sed -E 's/[^a-zA-Z0-9\.]+/-/g' 2>/dev/null +} + +function seal::image::login() { + if seal::image::docker::validate; then + if [[ -n ${docker_username} ]] && [[ -n ${docker_password} ]]; then + seal::log::debug "docker login ${*:-} -u ${docker_username} -p ***" + if ! docker login "${*:-}" -u "${docker_username}" -p "${docker_password}" >/dev/null 2>&1; then + seal::log::fatal "failed: docker login ${*:-} -u ${docker_username} -p ***" + fi + fi + return 0 + fi + + seal::log::fatal "cannot execute image login as client is not found" +} + +function seal::image::build::within_container() { + if seal::image::docker::validate; then + if ! $(seal::image::docker::bin) buildx inspect --builder="seal"; then + seal::log::debug "setting up qemu" + $(seal::image::docker::bin) run \ + --rm \ + --privileged \ + tonistiigi/binfmt:qemu-v7.0.0 --install all + seal::log::debug "setting up buildx" + $(seal::image::docker::bin) buildx create \ + --name="seal" \ + --driver="docker-container" \ + --buildkitd-flags="--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host" \ + --use \ + --bootstrap + fi + + return 0 + fi + + seal::log::fatal "cannot execute image build as client is not found" +} + +function seal::image::build() { + if seal::image::docker::validate; then + seal::log::debug "docker buildx build $*" + $(seal::image::docker::bin) buildx build "$@" + + return 0 + fi + + seal::log::fatal "cannot execute image build as client is not found" +} diff --git a/hack/lib/init.sh b/hack/lib/init.sh new file mode 100644 index 000000000..07260efb6 --- /dev/null +++ b/hack/lib/init.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +unset CDPATH + +# Set no_proxy for localhost if behind a proxy, otherwise, +# the connections to localhost in scripts will time out. +export no_proxy=127.0.0.1,localhost + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)" +mkdir -p "${ROOT_DIR}/.sbin" +mkdir -p "${ROOT_DIR}/.dist" + +for file in "${ROOT_DIR}/hack/lib/"*; do + if [[ -f "${file}" ]] && [[ "${file}" != *"init.sh" ]]; then + # shellcheck disable=SC1090 + source "${file}" + fi +done + +seal::log::install_errexit +seal::version::get_version_vars diff --git a/hack/lib/log.sh b/hack/lib/log.sh new file mode 100644 index 000000000..989f8fbee --- /dev/null +++ b/hack/lib/log.sh @@ -0,0 +1,161 @@ +#!/usr/bin/env bash + +## +# Borrowed from github.com/kubernetes/kubernetes/hack/lib/logging.sh +## + +# ----------------------------------------------------------------------------- +# Logger variables helpers. These functions need the +# following variables: +# +# LOG_LEVEL - The level of logger, default is "debug". + +log_level="${LOG_LEVEL:-"debug"}" +log_colorful="${LOG_COLORFUL:-"true"}" + +# Handler for when we exit automatically on an error. +seal::log::errexit() { + local err="${PIPESTATUS[*]}" + + # if the shell we are in doesn't have errexit set (common in subshells) then + # don't dump stacks. + set +o | grep -qe "-o errexit" || return + + set +o xtrace + seal::log::panic "${BASH_SOURCE[1]}:${BASH_LINENO[0]} '${BASH_COMMAND}' exited with status ${err}" "${1:-1}" +} + +seal::log::install_errexit() { + # trap ERR to provide an error handler whenever a command exits nonzero, this + # is a more verbose version of set -o errexit + trap 'seal::log::errexit' ERR + + # setting errtrace allows our ERR trap handler to be propagated to functions, + # expansions and subshells + set -o errtrace +} + +# Debug level logging. +seal::log::debug() { + [[ ${log_level} == "debug" ]] || return 0 + local message="${2:-}" + + local timestamp + timestamp="$(date +"[%m%d %H:%M:%S]")" + echo -e "[DEBG] ${timestamp} ${1-}" >&2 + shift 1 + for message; do + echo -e " ${message}" >&2 + done +} + +# Info level logging. +seal::log::info() { + [[ ${log_level} == "debug" ]] || [[ ${log_level} == "info" ]] || return 0 + local message="${2:-}" + + local timestamp + timestamp="$(date +"[%m%d %H:%M:%S]")" + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[34m[INFO]\033[0m ${timestamp} ${1-}" >&2 + else + echo -e "[INFO] ${timestamp} ${1-}" >&2 + fi + shift 1 + for message; do + echo -e " ${message}" >&2 + done +} + +# Warn level logging. +seal::log::warn() { + local message="${2:-}" + + local timestamp + timestamp="$(date +"[%m%d %H:%M:%S]")" + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[33m[WARN]\033[0m ${timestamp} ${1-}" >&2 + else + echo -e "[WARN] ${timestamp} ${1-}" >&2 + fi + shift 1 + for message; do + echo -e " ${message}" >&2 + done +} + +# Error level logging, log an error but keep going, don't dump the stack or exit. +seal::log::error() { + local message="${2:-}" + + local timestamp + timestamp="$(date +"[%m%d %H:%M:%S]")" + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[31m[ERRO]\033[0m ${timestamp} ${1-}" >&2 + else + echo -e "[ERRO] ${timestamp} ${1-}" >&2 + fi + shift 1 + for message; do + echo -e " ${message}" >&2 + done +} + +# Fatal level logging, log an error but exit with 1, don't dump the stack or exit. +seal::log::fatal() { + local message="${2:-}" + + local timestamp + timestamp="$(date +"[%m%d %H:%M:%S]")" + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[41;33m[FATA]\033[0m ${timestamp} ${1-}" >&2 + else + echo -e "[FATA] ${timestamp} ${1-}" >&2 + fi + shift 1 + for message; do + echo -e " ${message}" >&2 + done + + exit 1 +} + +# Panic level logging, dump the error stack and exit. +# Args: +# $1 Message to log with the error +# $2 The error code to return +# $3 The number of stack frames to skip when printing. +seal::log::panic() { + local message="${1:-}" + local code="${2:-1}" + + local timestamp + timestamp="$(date +"[%m%d %H:%M:%S]")" + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[41;33m[FATA]\033[0m ${timestamp} ${message}" >&2 + else + echo -e "[FATA] ${timestamp} ${message}" >&2 + fi + + # print out the stack trace described by $function_stack + if [[ ${#FUNCNAME[@]} -gt 2 ]]; then + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[31m call stack:\033[0m" >&2 + else + echo -e " call stack:" >&2 + fi + local i + for ((i = 1; i < ${#FUNCNAME[@]} - 2; i++)); do + echo -e " ${i}: ${BASH_SOURCE[${i} + 2]}:${BASH_LINENO[${i} + 1]} ${FUNCNAME[${i} + 1]}(...)" >&2 + done + fi + + if [[ ${log_colorful} == "true" ]]; then + echo -e "\033[41;33m[FATA]\033[0m ${timestamp} exiting with status ${code}" >&2 + else + echo -e "[FATA] ${timestamp} exiting with status ${code}" >&2 + fi + + popd >/dev/null 2>&1 || exit "${code}" + exit "${code}" +} diff --git a/hack/lib/proto.sh b/hack/lib/proto.sh new file mode 100644 index 000000000..04c96e0b5 --- /dev/null +++ b/hack/lib/proto.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------- +# Protoc variables helpers. These functions need the +# following variables: +# +# PROTOC_VERSION - The protoc version, default is v23.4. +# PROTOC_GEN_GOGO_VERSION - The protoc version, default is master. +# PROTOC_GEN_GO_VERSION - The protoc-gen-go version, default is v1.5.4. +# PROTOC_GEN_GO_GRPC_VERSION - The protoc-gen-go-grpc version, default is v1.62.1. +# +# Refs: +# - https://grpc.io/docs/protoc-installation/ +# - https://grpc.io/docs/languages/go/quickstart/ + +protoc_version=${PROTOC_VERSION:-"v23.4"} +protoc_gen_go_version=${PROTOC_GEN_GO_VERSION:-"v1.5.4"} +protoc_gen_go_grpc_version=${PROTOC_GEN_GO_GRPC_VERSION:-"v1.62.1"} + +function seal::protoc::protoc::install() { + local os + os=$(echo -n "$(uname -s)" | tr '[:upper:]' '[:lower:]') + if [[ "${os}" == "darwin" ]]; then + os="osx" + fi + local arch + arch=$(uname -m) + if [[ "${arch}" == "arm64" ]]; then + arch="aarch_64" + fi + curl --retry 3 --retry-all-errors --retry-delay 3 \ + -o /tmp/protoc.zip \ + -sSfL "https://github.com/protocolbuffers/protobuf/releases/download/${protoc_version}/protoc-${protoc_version#v}-${os}-${arch}.zip" + unzip -qu /tmp/protoc.zip -d "${ROOT_DIR}/.sbin/protoc" +} + +function seal::protoc::protoc::validate() { + # shellcheck disable=SC2046 + if [[ -n "$(command -v $(seal::protoc::bin))" ]]; then + if [[ "$($(seal::protoc::bin) --version 2>&1)" == "libprotoc ${protoc_version#v}" ]]; then + return 0 + fi + fi + + seal::log::info "installing protoc ${protoc_version}" + if seal::protoc::protoc::install; then + seal::log::info "protoc $($(seal::protoc::bin) --version 2>&1 | cut -d " " -f 2 2>&1 | head -n 1)" + return 0 + fi + seal::log::error "no protoc available" + return 1 +} + +function seal::protoc::protoc_gen_go::install() { + local bin="${ROOT_DIR}/.sbin/protoc/bin" + mkdir -p "${bin}" + GOBIN="${bin}" go install "google.golang.org/protobuf/cmd/protoc-gen-go@${protoc_gen_go_version}" +} + +function seal::protoc::protoc_gen_go::validate() { + PATH="${PATH}:${ROOT_DIR}/.sbin/protoc/bin" + if [[ -f "${ROOT_DIR}/.sbin/protoc/bin/protoc-gen-go" ]]; then + return 0 + fi + + seal::log::info "installing protoc-gen-go ${protoc_gen_go_version}" + if seal::protoc::protoc_gen_go::install; then + seal::log::info "protoc-gen-go installed" + return 0 + fi + seal::log::error "no protoc-gen-go available" + return 1 +} + +function seal::protoc::protoc_gen_go_grpc::install() { + local bin="${ROOT_DIR}/.sbin/protoc/bin" + mkdir -p "${bin}" + GOBIN="${bin}" go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@${protoc_gen_go_grpc_version}" +} + +function seal::protoc::protoc_gen_go_grpc::validate() { + PATH="${PATH}:${ROOT_DIR}/.sbin/protoc/bin" + if [[ -f "${ROOT_DIR}/.sbin/protoc/bin/protoc-gen-go-grpc" ]]; then + return 0 + fi + + seal::log::info "installing protoc-gen-go-grpc ${protoc_gen_go_grpc_version}" + if seal::protoc::protoc_gen_go_grpc::install; then + seal::log::info "protoc-gen-go-grpc installed" + return 0 + fi + seal::log::error "no protoc-gen-go-grpc available" + return 1 +} + +function seal::protoc::bin() { + local bin="protoc" + if [[ -f "${ROOT_DIR}/.sbin/protoc/bin/protoc" ]]; then + bin="${ROOT_DIR}/.sbin/protoc/bin/protoc" + fi + echo -n "${bin}" +} + +function seal::protoc::generate() { + if ! seal::protoc::protoc::validate; then + seal::log::error "cannot execute protoc as it hasn't installed" + return 1 + fi + + if ! seal::protoc::protoc_gen::validate; then + seal::log::error "cannot execute protoc-gen as it hasn't installed" + return 1 + fi + + if ! seal::protoc::protoc_gen_grpc::validate; then + seal::log::error "cannot execute protoc-gen-grpc as it hasn't installed" + return 1 + fi + + local filepath="${1:-}" + if [[ ! -f ${filepath} ]]; then + seal::log::warn "${filepath} isn't existed" + return 1 + fi + local filedir + filedir=$(dirname "${filepath}") + local filename + filename=$(basename "${filepath}" ".proto") + + # generate + $(seal::protoc::bin) \ + --proto_path="${filedir}" \ + --proto_path="${ROOT_DIR}/.sbin/protoc/include" \ + --go_out="${filedir}" \ + --go_opt=paths=source_relative \ + --go-grpc_out="${filedir}" \ + --go-grpc_opt=paths=source_relative \ + "${filepath}" + + # format + local tmpfile + tmpfile=$(mktemp) + local generated_files=( + "${filedir}/${filename}.pb.go" + "${filedir}/${filename}_grpc.pb.go" + ) + for generated_file in "${generated_files[@]}"; do + if [[ -f "${generated_file}" ]]; then + sed "2d" "${generated_file}" >"${tmpfile}" && + mv "${tmpfile}" "${generated_file}" + cat "${ROOT_DIR}/hack/boilerplate/go.txt" "${generated_file}" >"${tmpfile}" && + mv "${tmpfile}" "${generated_file}" + go fmt "${generated_file}" >/dev/null 2>&1 + fi + done +} diff --git a/hack/lib/style.sh b/hack/lib/style.sh new file mode 100644 index 000000000..1a1ce5b5a --- /dev/null +++ b/hack/lib/style.sh @@ -0,0 +1,179 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------- +# Lint variables helpers. These functions need the +# following variables: +# +# GOIMPORT_REVISER_VERSION - The Goimports-reviser version, default is v3.6.4. +# GOLANGCI_LINT_VERSION - The Golangci-lint version, default is v1.56.2. +# COMMITSAR_VERSION - The Commitsar version, default is v0.20.2. + +goimports_reviser_version=${GOIMPORT_REVISER_VERSION:-"v3.6.4"} +golangci_lint_version=${GOLANGCI_LINT_VERSION:-"v1.56.2"} +commitsar_version=${COMMITSAR_VERSION:-"v0.20.2"} + +function seal::lint::golangci_lint::install() { + curl --retry 3 --retry-all-errors --retry-delay 3 -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${ROOT_DIR}/.sbin" "${golangci_lint_version}" +} + +function seal::lint::golangci_lint::validate() { + # shellcheck disable=SC2046 + if [[ -n "$(command -v $(seal::lint::golangci_lint::bin))" ]]; then + if [[ $($(seal::lint::golangci_lint::bin) --version 2>&1 | cut -d " " -f 4 2>&1 | head -n 1) == "${golangci_lint_version#v}" ]]; then + return 0 + fi + fi + + seal::log::info "installing golangci-lint ${golangci_lint_version}" + if seal::lint::golangci_lint::install; then + seal::log::info "golangci-lint $($(seal::lint::golangci_lint::bin) --version 2>&1 | cut -d " " -f 4 2>&1 | head -n 1)" + return 0 + fi + seal::log::error "no golangci-lint available" + return 1 +} + +function seal::lint::golangci_lint::bin() { + local bin="golangci-lint" + if [[ -f "${ROOT_DIR}/.sbin/golangci-lint" ]]; then + bin="${ROOT_DIR}/.sbin/golangci-lint" + fi + echo -n "${bin}" +} + +function seal::lint::goimports_reviser::install() { + local os + os="$(seal::util::get_raw_os)" + local arch + arch="$(seal::util::get_raw_arch)" + curl --retry 3 --retry-all-errors --retry-delay 3 \ + -o /tmp/commitsar.tar.gz \ + -sSfL "https://github.com/incu6us/goimports-reviser/releases/download/${goimports_reviser_version}/goimports-reviser_${goimports_reviser_version#v}_${os}_${arch}.tar.gz" + tar -zxvf /tmp/commitsar.tar.gz \ + --directory "${ROOT_DIR}/.sbin" \ + --no-same-owner \ + --exclude ./LICENSE \ + --exclude ./README.md + chmod a+x "${ROOT_DIR}/.sbin/goimports-reviser" +} + +function seal::lint::goimports_reviser::validate() { + # shellcheck disable=SC2046 + if [[ -n "$(command -v $(seal::lint::goimports_reviser::bin))" ]]; then + if [[ $($(seal::lint::goimports_reviser::bin) -version | grep tag | cut -d " " -f 2 2>&1 | head -n 1) == "${goimports_reviser_version}" ]]; then + return 0 + fi + fi + + seal::log::info "installing goimports-reviser" + if seal::lint::goimports_reviser::install; then + seal::log::info "goimports-reviser $($(seal::lint::goimports_reviser::bin) -version | grep tag | cut -d " " -f 2 2>&1 | head -n 1)" + return 0 + fi + seal::log::error "no goimports-reviser available" + return 1 +} + +function seal::lint::goimports_reviser::bin() { + local bin="goimports-reviser" + if [[ -f "${ROOT_DIR}/.sbin/goimports-reviser" ]]; then + bin="${ROOT_DIR}/.sbin/goimports-reviser" + fi + echo -n "${bin}" +} + +function seal::lint::run() { + if ! seal::lint::goimports_reviser::validate; then + seal::log::fatal "cannot execute goimports-reviser as client is not found" + fi + + local goimport_target="${*:$#}" + goimport_target="${goimport_target//\/.../}" + local goimports_opts=( + "-rm-unused" + "-use-cache" + "-imports-order=std,general,company,project,blanked,dotted" + "-output=file" + ) + local goimports_excludes=() + for arg in "$@"; do + if [[ "${arg}" == "--skip-dirs="* ]]; then + arg="${arg//--skip-dirs=/}" + goimports_excludes+=("${arg}") + fi + done + if [[ -n "${goimports_excludes[*]}" ]]; then + goimports_opts+=("-excludes=$(seal::util::join_array "," "${goimports_excludes[@]}")") + fi + if [[ "${goimport_target}" == "${ROOT_DIR}" ]]; then + seal::log::debug "go list -f \"{{.Dir}}\" ./... | xargs -I {} find {} -maxdepth 1 -type f -name '*.go' | xargs -I {} goimports-reviser ${goimports_opts[*]} {}" + go list -f "{{.Dir}}" ./... | xargs -I {} find {} -maxdepth 1 -type f -name '*.go' | xargs -I {} "$(seal::lint::goimports_reviser::bin)" "${goimports_opts[@]}" {} + else + seal::log::debug "pushd \"${goimport_target}\" >/dev/null 2>&1; go list -f \"{{.Dir}}\" ./... | xargs -I {} find {} -maxdepth 1 -type f -name '*.go' | xargs -I {} goimports-reviser ${goimports_opts[*]} {}; popd" + # shellcheck disable=SC2164 + pushd "${goimport_target}" >/dev/null 2>&1 + go list -f "{{.Dir}}" ./... | xargs -I {} find {} -maxdepth 1 -type f -name '*.go' | xargs -I {} "$(seal::lint::goimports_reviser::bin)" "${goimports_opts[@]}" {} + # shellcheck disable=SC2164 + popd >/dev/null 2>&1 + fi + + if ! seal::lint::golangci_lint::validate; then + seal::log::fatal "cannot execute golangci-lint as client is not found" + fi + + local golangci_lint_opts=( + "--fix" + ) + seal::log::debug "golangci-lint run ${golangci_lint_opts[*]} $*" + $(seal::lint::golangci_lint::bin) run "${golangci_lint_opts[@]}" "$@" +} + +function seal::commit::commitsar::install() { + local os + os="$(seal::util::get_raw_os)" + local arch + arch="$(seal::util::get_raw_arch)" + curl --retry 3 --retry-all-errors --retry-delay 3 \ + -o /tmp/commitsar.tar.gz \ + -sSfL "https://github.com/aevea/commitsar/releases/download/${commitsar_version}/commitsar_${commitsar_version#v}_${os}_${arch}.tar.gz" + tar -zxvf /tmp/commitsar.tar.gz \ + --directory "${ROOT_DIR}/.sbin" \ + --no-same-owner \ + --exclude ./LICENSE \ + --exclude ./README.md + chmod a+x "${ROOT_DIR}/.sbin/commitsar" +} + +function seal::commit::commitsar::validate() { + # shellcheck disable=SC2046 + if [[ -n "$(command -v $(seal::commit::commitsar::bin))" ]]; then + if [[ $($(seal::commit::commitsar::bin) version 2>&1 | cut -d " " -f 7 2>&1 | head -n 1 | xargs echo -n) == "${commitsar_version#v}" ]]; then + return 0 + fi + fi + + seal::log::info "installing commitsar ${commitsar_version}" + if seal::commit::commitsar::install; then + seal::log::info "commitsar $($(seal::commit::commitsar::bin) version 2>&1 | cut -d " " -f 7 2>&1 | head -n 1 | xargs echo -n)" + return 0 + fi + seal::log::error "no commitsar available" + return 1 +} + +function seal::commit::commitsar::bin() { + local bin="commitsar" + if [[ -f "${ROOT_DIR}/.sbin/commitsar" ]]; then + bin="${ROOT_DIR}/.sbin/commitsar" + fi + echo -n "${bin}" +} + +function seal::commit::lint() { + if ! seal::commit::commitsar::validate; then + seal::log::fatal "cannot execute commitsar as client is not found" + fi + + seal::log::debug "commitsar $*" + $(seal::commit::commitsar::bin) "$@" +} diff --git a/hack/lib/target.sh b/hack/lib/target.sh new file mode 100644 index 000000000..8c91125d9 --- /dev/null +++ b/hack/lib/target.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +function seal::target::build_prefix() { + local prefix + prefix="$(basename "${ROOT_DIR}")" + + if [[ -n "${BUILD_PREFIX:-}" ]]; then + echo -n "${BUILD_PREFIX}" + else + echo -n "${prefix}" + fi +} + +readonly DEFAULT_BUILD_TAGS=( + "netgo" + "jsoniter" + "!ignore_autogenerated" +) + +function seal::target::build_tags() { + local target="${1:-}" + + local tags + if [[ -n "${BUILD_TAGS:-}" ]]; then + IFS="," read -r -a tags <<<"${BUILD_TAGS}" + else + case "${target}" in + utils) + tags=() + ;; + code-generator) + tags=() + ;; + *) + tags=("${DEFAULT_BUILD_TAGS[@]}") + ;; + esac + fi + + if [[ ${#tags[@]} -ne 0 ]]; then + echo -n "${tags[@]}" + fi +} + +readonly DEFAULT_BUILD_PLATFORMS=( + linux/amd64 + linux/arm64 + darwin/amd64 + darwin/arm64 +) + +readonly DEFAULT_BUILD_CLI_PLATFORMS=( + linux/amd64 + linux/arm64 + darwin/amd64 + darwin/arm64 + windows/amd64 + windows/arm64 +) + +function seal::target::build_platforms() { + local target="${1:-}" + local task="${2:-}" + + local platforms + if [[ -z "${OS:-}" ]] && [[ -z "${ARCH:-}" ]]; then + if [[ -n "${BUILD_PLATFORMS:-}" ]]; then + IFS="," read -r -a platforms <<<"${BUILD_PLATFORMS}" + else + case "${target}" in + walrus) + case "${task}" in + cli) + platforms=("${DEFAULT_BUILD_CLI_PLATFORMS[@]}") + ;; + *) + platforms=("${DEFAULT_BUILD_PLATFORMS[@]}") + ;; + esac + ;; + *) + platforms=() + ;; + esac + fi + else + local os="${OS:-$(seal::util::get_raw_os)}" + local arch="${ARCH:-$(seal::util::get_raw_arch)}" + platforms=("${os}/${arch}") + fi + + if [[ ${#platforms[@]} -ne 0 ]]; then + echo -n "${platforms[@]}" + fi +} + +function seal::target::package_platform() { + if [[ -z "${OS:-}" ]] && [[ -z "${ARCH:-}" ]]; then + echo -n "linux/$(seal::util::get_raw_arch)" + else + echo -n "${OS}/${ARCH}" + fi +} diff --git a/hack/lib/util.sh b/hack/lib/util.sh new file mode 100644 index 000000000..4700a122a --- /dev/null +++ b/hack/lib/util.sh @@ -0,0 +1,179 @@ +#!/usr/bin/env bash + +function seal::util::find_subdirs() { + local path="$1" + if [[ -z "$path" ]]; then + path="./" + fi + # shellcheck disable=SC2010 + ls -l "$path" | grep "^d" | awk '{print $NF}' | xargs echo +} + +function seal::util::is_empty_dir() { + local path="$1" + if [[ ! -d "${path}" ]]; then + return 0 + fi + + # shellcheck disable=SC2012 + if [[ $(ls "${path}" | wc -l) -eq 0 ]]; then + return 0 + fi + return 1 +} + +function seal::util::join_array() { + local IFS="$1" + shift 1 + echo "$*" +} + +function seal::util::get_os() { + local os + if go env GOOS >/dev/null 2>&1; then + os=$(go env GOOS) + else + os=$(echo -n "$(uname -s)" | tr '[:upper:]' '[:lower:]') + fi + + case ${os} in + cygwin_nt*) os="windows" ;; + mingw*) os="windows" ;; + msys_nt*) os="windows" ;; + esac + + echo -n "${os}" +} + +function seal::util::get_raw_os() { + local os + os=$(echo -n "$(uname -s)" | tr '[:upper:]' '[:lower:]') + + case ${os} in + cygwin_nt*) os="windows" ;; + mingw*) os="windows" ;; + msys_nt*) os="windows" ;; + esac + + echo -n "${os}" +} + +function seal::util::get_arch() { + local arch + if go env GOARCH >/dev/null 2>&1; then + arch=$(go env GOARCH) + if [[ "${arch}" == "arm" ]]; then + arch="${arch}v$(go env GOARM)" + fi + else + arch=$(uname -m) + fi + + case ${arch} in + armv5*) arch="armv5" ;; + armv6*) arch="armv6" ;; + armv7*) + if [[ "${1:-}" == "--full-name" ]]; then + arch="armv7" + else + arch="arm" + fi + ;; + aarch64) arch="arm64" ;; + x86) arch="386" ;; + i686) arch="386" ;; + i386) arch="386" ;; + x86_64) arch="amd64" ;; + esac + + echo -n "${arch}" +} + +function seal::util::get_raw_arch() { + local arch + arch=$(uname -m) + + case ${arch} in + armv5*) arch="armv5" ;; + armv6*) arch="armv6" ;; + armv7*) + if [[ "${1:-}" == "--full-name" ]]; then + arch="armv7" + else + arch="arm" + fi + ;; + aarch64) arch="arm64" ;; + x86) arch="386" ;; + i686) arch="386" ;; + i386) arch="386" ;; + x86_64) arch="amd64" ;; + esac + + echo -n "${arch}" +} + +function seal::util::get_random_port_start() { + local offset="${1:-1}" + if [[ ${offset} -le 0 ]]; then + offset=1 + fi + + while true; do + random_port=$((RANDOM % 10000 + 50000)) + for ((i = 0; i < offset; i++)); do + if nc -z 127.0.0.1 $((random_port + i)); then + random_port=0 + break + fi + done + + if [[ ${random_port} -ne 0 ]]; then + echo -n "${random_port}" + break + fi + done +} + +function seal::util::sed() { + if ! sed -i "$@" >/dev/null 2>&1; then + # back off none GNU sed + sed -i "" "$@" + fi +} + +function seal::util::decode64() { + if [[ $# -eq 0 ]]; then + cat | base64 --decode + else + printf '%s' "$1" | base64 --decode + fi +} + +function seal::util::encode64() { + if [[ $# -eq 0 ]]; then + cat | base64 + else + printf '%s' "$1" | base64 + fi +} + +function seal::util::kill_jobs() { + for job in $(jobs -p); do + kill -9 "$job" + done +} + +function seal::util::wait_jobs() { + trap seal::util::kill_jobs TERM INT + local fail=0 + local job + for job in $(jobs -p); do + wait "${job}" || fail=$((fail + 1)) + done + return ${fail} +} + +function seal::util::dismiss() { + echo "" 1>/dev/null 2>&1 +} diff --git a/hack/lib/version.sh b/hack/lib/version.sh new file mode 100644 index 000000000..30c709950 --- /dev/null +++ b/hack/lib/version.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +## +# Inspired by github.com/kubernetes/kubernetes/hack/lib/version.sh +## + +# ----------------------------------------------------------------------------- +# Version management helpers. These functions help to set the +# following variables: +# +# GIT_TREE_STATE - "clean" indicates no changes since the git commit id. +# "dirty" indicates source code changes after the git commit id. +# "archive" indicates the tree was produced by 'git archive'. +# "unknown" indicates cannot find out the git tree. +# GIT_COMMIT - The git commit id corresponding to this +# source code. +# GIT_VERSION - "vX.Y" used to indicate the last release version, +# it can be specified via "VERSION". +# BUILD_DATE - The build date of the version. + +function seal::version::get_version_vars() { + BUILD_DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ') + GIT_TREE_STATE="unknown" + GIT_COMMIT="unknown" + GIT_VERSION="unknown" + + # get the git tree state if the source was exported through git archive. + # shellcheck disable=SC2016,SC2050 + if [[ '$Format:%%$' == "%" ]]; then + GIT_TREE_STATE="archive" + GIT_COMMIT='$Format:%H$' + # when a 'git archive' is exported, the '$Format:%D$' below will look + # something like 'HEAD -> release-1.8, tag: v1.8.3' where then 'tag: ' + # can be extracted from it. + if [[ '$Format:%D$' =~ tag:\ (v[^ ,]+) ]]; then + GIT_VERSION="${BASH_REMATCH[1]}" + else + GIT_VERSION="${GIT_COMMIT:0:7}" + fi + # respect specified version. + GIT_VERSION="${VERSION:-${GIT_VERSION}}" + return + fi + + # return directly if not found git client. + if [[ -z "$(command -v git)" ]]; then + # respect specified version. + GIT_VERSION=${VERSION:-${GIT_VERSION}} + return + fi + + # find out git info via git client. + if GIT_COMMIT=$(git rev-parse "HEAD^{commit}" 2>/dev/null); then + # specify as dirty if the tree is not clean. + if git_status=$(git status --porcelain 2>/dev/null) && [[ -n ${git_status} ]]; then + GIT_TREE_STATE="dirty" + else + GIT_TREE_STATE="clean" + fi + + # specify with the tag if the head is tagged. + if GIT_VERSION="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"; then + if git_tag=$(git tag -l --contains HEAD 2>/dev/null | head -n 1 2>/dev/null) && [[ -n ${git_tag} ]]; then + GIT_VERSION="${git_tag}" + fi + fi + + # specify to dev if the tree is dirty. + if [[ "${GIT_TREE_STATE:-dirty}" == "dirty" ]]; then + GIT_VERSION="dev" + elif ! [[ "${GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then + GIT_VERSION="dev" + fi + + # respect specified version + GIT_VERSION=${VERSION:-${GIT_VERSION}} + fi +} diff --git a/hack/lint.sh b/hack/lint.sh new file mode 100755 index 000000000..767d6c128 --- /dev/null +++ b/hack/lint.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +# +# util +# + +function lint() { + local target="$1" + local path="$2" + local path_ignored="$3" + shift 3 + + [[ "${path}" == "${ROOT_DIR}" ]] || pushd "${path}" >/dev/null 2>&1 + + local tags=() + IFS=" " read -r -a tags <<<"$(seal::target::build_tags "${target}")" + + local ignored_path=() + IFS=" " read -r -a ignored_path <<<"${path_ignored}" + + local opts=() + if [[ ${#tags[@]} -gt 0 ]]; then + opts+=("--build-tags=\"${tags[*]}\"") + fi + for ig in "${ignored_path[@]}"; do + opts+=("--skip-dirs=${ig}") + done + opts+=("${path}/...") + GOLANGCI_LINT_CACHE="$(go env GOCACHE)/golangci-lint" seal::lint::run "${opts[@]}" + + [[ "${path}" == "${ROOT_DIR}" ]] || popd >/dev/null 2>&1 +} + +# +# lifecycle +# + +function dispatch() { + local target="$1" + local path="$2" + local path_ignored="$3" + shift 3 + + seal::log::debug "linting ${target}" + if [[ "${PARALLELIZE:-false}" != "true" ]]; then + lint "${target}" "${path}" "${path_ignored}" + else + lint "${target}" "${path}" "${path_ignored}" & + fi +} + +function after() { + [[ "${LINT_DIRTY:-false}" == "true" ]] || return 0 + + if [[ -n "$(command -v git)" ]]; then + if git_status=$(git status --porcelain 2>/dev/null) && [[ -n ${git_status} ]]; then + seal::log::fatal "the git tree is dirty:\n$(git status --porcelain)" + fi + fi +} + +# +# main +# + +seal::log::info "+++ LINT +++" + +seal::commit::lint "${ROOT_DIR}" + +dispatch "utils" "${ROOT_DIR}/staging/github.com/seal-io/utils" "" "$@" +dispatch "code-generator" "${ROOT_DIR}/staging/github.com/seal-io/code-generator" "" "$@" +dispatch "walrus" "${ROOT_DIR}" "staging pkg/clients" "$@" + +after + +if [[ "${PARALLELIZE:-false}" == "true" ]]; then + seal::util::wait_jobs || seal::log::fatal "--- LINT ---" +fi +seal::log::info "--- LINT ---" diff --git a/hack/mirror/mirror-images.txt b/hack/mirror/mirror-images.txt new file mode 100644 index 000000000..6ae82c0c3 --- /dev/null +++ b/hack/mirror/mirror-images.txt @@ -0,0 +1,3 @@ +# Mirrored images format /sealio/mirrored-: +quay.io/argoproj/workflow-controller:v3.5.0 docker.io/sealio/mirrored-workflow-controller:v3.5.0 +quay.io/argoproj/argoexec:v3.5.0 docker.io/sealio/mirrored-argoexec:v3.5.0 diff --git a/hack/mirror/walrus-images.txt b/hack/mirror/walrus-images.txt new file mode 100644 index 000000000..f8063405b --- /dev/null +++ b/hack/mirror/walrus-images.txt @@ -0,0 +1,7 @@ +docker.io/sealio/mirrored-workflow-controller:v3.5.0 +docker.io/sealio/mirrored-argoexec:v3.5.0 +docker.io/sealio/curl-jq:v0.0.1 +docker.io/sealio/terraform-deployer:v1.5.7-seal.1 +docker.io/sealio/opentofu-deployer:v1.6.0-seal.1 +docker.io/sealio/hermitcrab:v0.1.3 +docker.io/sealio/walrus:main diff --git a/hack/mirror/walrus-load-images.sh b/hack/mirror/walrus-load-images.sh new file mode 100755 index 000000000..9d3816c20 --- /dev/null +++ b/hack/mirror/walrus-load-images.sh @@ -0,0 +1,192 @@ +#!/usr/bin/env bash + +list="walrus-images.txt" +images="walrus-images.tar.gz" +repository_type="harbor" +harbor_https="true" +harbor_versions="v2.0" +harbor_user="" +harbor_password="" + +usage () { + echo "USAGE: $0 [--images walrus-images.tar.gz] --registry my.registry.com:5000" + echo " [-l|--image-list path] text file with list of images; one image per line." + echo " [-i|--images path] tar.gz generated by docker save." + echo " [-r|--registry registry:port] target private registry in the registry:port format." + echo " [--repository-type type] Repository type. enum. e.g \"harbor\". (Default \"\")" + echo " [--harbor-https type] Use https by default when create harbor project. enum. e.g \"true\" || \"false\". (Default \"true\")" + echo " [--harbor-versions version] Harbor Version. enum. e.g \"v2.0\" || \"v1.0\". (Default \"v2.0\")" + echo " [--harbor-user string] Harbor User. (Default \"\")" + echo " [--harbor-password string] Harbor Password. (Default \"\")" + echo " [-h|--help] Usage message" +} + +push_manifest () { + export DOCKER_CLI_EXPERIMENTAL=enabled + manifest_list=() + for i in "${arch_list[@]}" + do + manifest_list+=("$1-${i}") + done + + echo "Preparing manifest $1, list[${arch_list[@]}]" + docker manifest create "$1" "${manifest_list[@]}" --amend + docker manifest push "$1" --purge +} + +create_harbor_project () { + if [[ -n "${harbor_user}" && -n "${harbor_password}" ]]; then + project="sealio" + echo "Creating harbor project ${project}" + url="${target_registry}/api/v2.0/projects" + if [[ "${harbor_versions}" == "v1.0" ]]; then + url="${target_registry}/api/projects" + fi + if [[ "${harbor_https}" == "true" ]]; then + url="https://${url}" + fi + result_code=$(curl -k -s -u "${harbor_user}:${harbor_password}" -X POST -H "Content-type:application/json" -d '{"project_name":"'"${project}"'","metadata":{"public":"true"}}' $url) + + if [[ -z "${result_code}" ]]; then + echo "Created porject ${project}." + elif [[ "${result_code}" =~ "already exists" || "${result_code}" =~ "conflict project" ]]; then + echo "Porject ${project} already exists." + else + echo "Failed to create Porject ${project}." + fi + fi +} + +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -r|--registry) + target_registry="$2" + shift # past argument + shift # past value + ;; + -l|--image-list) + list="$2" + shift # past argument + shift # past value + ;; + -i|--images) + images="$2" + shift # past argument + shift # past value + ;; + --windows-image-list) + windows_image_list="$2" + shift # past argument + shift # past value + ;; + --windows-versions) + windows_versions="$2" + shift # past argument + shift # past value + ;; + --harbor-versions) + harbor_versions="$2" + shift # past argument + shift # past value + ;; + --harbor-user) + harbor_user="$2" + shift # past argument + shift # past value + ;; + --harbor-password) + harbor_password="$2" + shift # past argument + shift # past value + ;; + --repository-type) + repository_type="$2" + shift # past argument + shift # past value + ;; + --harbor-https) + harbor_https="$2" + shift # past argument + shift # past value + ;; + -h|--help) + help="true" + shift + ;; + *) + usage + exit 1 + ;; + esac +done +if [[ -z "${target_registry}" ]]; then + usage + exit 1 +fi +if [[ $help ]]; then + usage + exit 0 +fi + +docker load --input ${images} + +linux_images=() +linux_err_images=() +while IFS= read -r i; do + [ -z "${i}" ] && continue + linux_images+=("${i}"); +done < "${list}" + +if [[ "${repository_type}" == "harbor" ]]; then + create_harbor_project +elif [[ -n "${repository_type}" && "${repository_type}" != "harbor" ]]; then + echo "Repository type error" +fi + +arch_list=() +arch_list+=("linux-amd64") +for i in "${linux_images[@]}"; do + [ -z "${i}" ] && continue + target_image_name="${i#docker.io/}" + arch_suffix="" + use_manifest=false + + case $target_image_name in + */*) + image_name="${target_registry}/${target_image_name}" + ;; + *) + image_name="${target_registry}/sealio/${target_image_name}" + ;; + esac + + docker tag "${i}" "${image_name}${arch_suffix}" + docker push "${image_name}${arch_suffix}" + + if [ $? -ne 0 ]; then + linux_err_images+=("${image_name}"); + fi + + if $use_manifest; then + push_manifest "${image_name}" + fi +done + +if [[ "${#linux_err_images[@]}" -gt 0 ]]; then + echo "Some images failed to upload. Generate failed-upload-images.txt to log the failed images" + if [ -f "./failed-upload-images.txt" ]; then + rm -rf ./failed-upload-images.txt + fi + touch "failed-upload-images.txt" + + for i in "${linux_err_images[@]}"; do + echo "docker push ${i} error" + echo "${i}" >> "failed-upload-images.txt" + done +else + echo "Successfully push all images" + if [ -f "./failed-upload-images.txt" ]; then + rm -rf ./failed-upload-images.txt + fi +fi diff --git a/hack/mirror/walrus-save-images.sh b/hack/mirror/walrus-save-images.sh new file mode 100755 index 000000000..4860ea5ac --- /dev/null +++ b/hack/mirror/walrus-save-images.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +list="walrus-images.txt" +images="walrus-images.tar.gz" +source_registry="" + +usage () { + echo "USAGE: $0 [--image-list walrus-images.txt] [--images walrus-images.tar.gz]" + echo " [-s|--source-registry] source registry to pull images from in registry:port format." + echo " [-l|--image-list path] text file with list of images; one image per line." + echo " [-i|--images path] tar.gz generated by docker save." + echo " [-h|--help] Usage message" +} + +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -i|--images) + images="$2" + shift # past argument + shift # past value + ;; + -l|--image-list) + list="$2" + shift # past argument + shift # past value + ;; + -s|--source-registry) + source_registry="$2" + shift # past argument + shift # past value + ;; + -h|--help) + help="true" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +if [[ $help ]]; then + usage + exit 0 +fi + +source_registry="${source_registry%!/(MISSING)}" +if [ ! -z "${source_registry}" ]; then + source_registry="${source_registry}/" +fi + +pulled="" +while IFS= read -r i; do + [ -z "${i}" ] && continue + i="${source_registry}${i}" + if docker pull "${i}" > /dev/null 2>&1; then + echo "Image pull success: ${i}" + pulled="${pulled} ${i}" + else + if docker inspect "${i}" > /dev/null 2>&1; then + pulled="${pulled} ${i}" + else + echo "Image pull failed: ${i}" + fi + fi +done < "${list}" + +echo "Creating ${images} with $(echo "${pulled}" | wc -w | tr -d '[:space:]') images" +docker save "${pulled}" | gzip --stdout > "${images}" diff --git a/hack/package.sh b/hack/package.sh new file mode 100755 index 000000000..ecfbac0bf --- /dev/null +++ b/hack/package.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +PACKAGE_DIR="${ROOT_DIR}/.dist/package" +mkdir -p "${PACKAGE_DIR}" +PACKAGE_TMP_DIR="${PACKAGE_DIR}/tmp" +mkdir -p "${PACKAGE_TMP_DIR}" + +# +# util +# + +function get_ui() { + local default_tag="latest" + local path="${1}" + local tag="${2}" + + mkdir -p "${PACKAGE_TMP_DIR}/ui" + + mkdir -p "${path}" + if ! curl --retry 3 --retry-all-errors --retry-delay 3 -sSfL "https://walrus-ui-1303613262.cos.accelerate.myqcloud.com/releases/${tag}.tar.gz" 2>/dev/null | + tar -xzf - --directory "${PACKAGE_TMP_DIR}/ui" 2>/dev/null; then + + if [[ "${tag:-}" =~ ^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then + seal::log::fatal "failed to download '${tag}' ui archive" + fi + + seal::log::warn "failed to download '${tag}' ui archive, fallback to '${default_tag}' ui archive" + if ! curl --retry 3 --retry-all-errors --retry-delay 3 -sSfL "https://walrus-ui-1303613262.cos.accelerate.myqcloud.com/releases/${default_tag}.tar.gz" | + tar -xzf - --directory "${PACKAGE_TMP_DIR}/ui" 2>/dev/null; then + seal::log::fatal "failed to download '${default_tag}' ui archive" + fi + fi + cp -a "${PACKAGE_TMP_DIR}/ui/dist/." "${path}" + + rm -rf "${PACKAGE_TMP_DIR}/ui" +} + +function get_files() { + local path="${1}" + + mkdir -p "${path}" + if ! git clone --depth 1 https://github.com/seal-io/walrus-file-hub "${path}"; then + seal::log::fatal "failed to download walrus-file-hub" + fi +} + +function pack_image() { + local target="$1" + local task="$2" + local path="$3" + local context="$4" + shift 4 + + mkdir -p "${context}/image" + + if [[ "${target}" == "walrus" ]]; then + # get ui + get_ui "${context}/image/var/lib/walrus/ui" "${TAG:-${GIT_VERSION}}" + # get files + get_files "${context}/image/var/lib/walrus/files" + fi + + local name="${target}-${task}" + if [[ "${target}" == "${task}" ]]; then + name="${target}" + fi + local tag + tag="${REPO:-sealio}/${name}:$(seal::image::tag)" + local platform + platform="$(seal::target::package_platform)" + + [[ "${PACKAGE_BUILD:-true}" == "true" ]] || return 0 + + # shellcheck disable=SC2086 + local cache="type=registry,ref=sealio/build-cache:${target}-${task}" + local output="type=image,push=${PACKAGE_PUSH:-false}" + + seal::image::build \ + --tag="${tag}" \ + --platform="${platform}" \ + --cache-from="${cache}" \ + --output="${output}" \ + --progress="plain" \ + --file="${context}/image/Dockerfile" \ + "${context}" +} + +function pack_release() { + local target="$1" + local task="$2" + local path="$3" + local context="$4" + shift 4 + + mkdir -p "${context}/release" + + # copy shell script. + cp -f "${ROOT_DIR}/hack/mirror/"walrus-* "${context}/release" + # mutate walrus-images.txt. + seal::util::sed "s/docker.io\/sealio\/walrus:.*$/docker.io\/sealio\/walrus:$(seal::image::tag)/g" "${context}/release/walrus-images.txt" + # copy cli. + cp -f "${context}/build/"walrus-cli-* "${context}/release" + # create checksum. + find "${context}/release" -type f -exec shasum -a 256 {} \; | grep -v -E "sha256sums" | sed -e "s#${context}/release/##g" >"${context}/release/sha256sums.txt" +} + +function package() { + local target="$1" + local task="$2" + local path="$3" + shift 3 + + local actions=() + IFS=" " read -r -a actions <<<"$(seal::util::find_subdirs "${path}")" + + for action in "${actions[@]}"; do + # prepare context. + local context="${PACKAGE_DIR}/${target}/${task}" + rm -rf "${context}" + mkdir -p "${context}" + + # copy build result to "${context}/build/". + cp -rf "${ROOT_DIR}/.dist/build/${target}" "${context}/build" + + case "${action}" in + image) + # copy image assets to "${context}/image/". + cp -a "${path}/image" "${context}/image" + pack_image "${target}" "${task}" "${path}" "${context}" "$@" + ;; + release) + pack_release "${target}" "${task}" "${path}" "${context}" "$@" + ;; + esac + done +} + +# +# lifecycle +# + +function before() { + [[ "${PACKAGE_PUSH:-false}" == "true" ]] || return 0 + + seal::image::login +} + +function dispatch() { + local target="$1" + local path="$2" + shift 2 + + local specified_targets="$*" + if [[ -n ${specified_targets} ]] && [[ ! ${specified_targets} =~ ${target} ]]; then + return + fi + + local tasks=() + IFS=" " read -r -a tasks <<<"$(seal::util::find_subdirs "${path}"/pack)" + + for task in "${tasks[@]}"; do + seal::log::debug "packaging ${target} ${task}" + if [[ "${PARALLELIZE:-true}" == "false" ]]; then + package "${target}" "${task}" "${path}/pack/${task}" + else + package "${target}" "${task}" "${path}/pack/${task}" & + fi + done +} + +# +# main +# + +seal::log::info "+++ PACKAGE +++" "tag: $(seal::image::tag)" + +before + +dispatch "walrus" "${ROOT_DIR}" "$@" + +if [[ "${PARALLELIZE:-true}" == "true" ]]; then + seal::util::wait_jobs || seal::log::fatal "--- PACKAGE ---" +fi +seal::log::info "--- PACKAGE ---" diff --git a/hack/test.sh b/hack/test.sh new file mode 100755 index 000000000..64ed829e4 --- /dev/null +++ b/hack/test.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +source "${ROOT_DIR}/hack/lib/init.sh" + +TEST_DIR="${ROOT_DIR}/.dist/test" +mkdir -p "${TEST_DIR}" + +# +# util +# + +function test() { + local target="$1" + local path="$2" + local path_ignored="$3" + shift 3 + + [[ "${path}" == "${ROOT_DIR}" ]] || pushd "${path}" >/dev/null 2>&1 + + local tags=() + IFS=" " read -r -a tags <<<"$(seal::target::build_tags "${target}")" + + local ignored_path=() + IFS=" " read -r -a ignored_path <<<"${path_ignored}" + + if [[ ${#ignored_path[@]} -gt 0 ]]; then + CGO_ENABLED=1 go list ./... | grep -v -E "$(seal::util::join_array "|" "${ignored_path[@]}")" | xargs -I {} \ + go test \ + -v \ + -failfast \ + -race \ + -cover \ + -timeout=30m \ + -tags="${tags[*]}" \ + -coverprofile="${TEST_DIR}/${target}-coverage.out" \ + {}"/..." + else + CGO_ENABLED=1 go test \ + -v \ + -failfast \ + -race \ + -cover \ + -timeout=30m \ + -tags="${tags[*]}" \ + -coverprofile="${TEST_DIR}/${target}-coverage.out" \ + ./... + fi + + [[ "${path}" == "${ROOT_DIR}" ]] || popd >/dev/null 2>&1 +} + +# +# lifecycle +# + +function dispatch() { + local target="$1" + local path="$2" + local path_ignored="$3" + shift 3 + + seal::log::debug "testing ${target}" + if [[ "${PARALLELIZE:-true}" == "false" ]]; then + test "${target}" "${path}" "${path_ignored}" + else + test "${target}" "${path}" "${path_ignored}" & + fi +} + +# +# main +# + +seal::log::info "+++ TEST +++" + +dispatch "utils" "${ROOT_DIR}/staging/github.com/seal-io/utils" "" "$@" +dispatch "code-generator" "${ROOT_DIR}/staging/github.com/seal-io/code-generator" "" "$@" +dispatch "walrus" "${ROOT_DIR}" "staging pkg/clients" "$@" + +if [[ "${PARALLELIZE:-true}" == "true" ]]; then + seal::util::wait_jobs || seal::log::fatal "--- TEST ---" +fi +seal::log::info "--- TEST ---" diff --git a/pack/walrus/image/Dockerfile b/pack/walrus/image/Dockerfile new file mode 100644 index 000000000..d42c6e911 --- /dev/null +++ b/pack/walrus/image/Dockerfile @@ -0,0 +1,153 @@ +FROM --platform=$TARGETPLATFORM ubuntu:24.04 +SHELL ["/bin/bash", "-c"] + +ARG TARGETPLATFORM +ARG TARGETOS +ARG TARGETARCH + +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + git-lfs git \ + unzip xz-utils \ + curl axel wget \ + vim \ + gosu \ + ; \ + rm -rf /var/lib/apt/lists/* + +# get stats tool +RUN set -eux; \ + apt-get update && apt-get install -y --no-install-recommends \ + procps sysstat dstat \ + ifstat net-tools dnsutils \ + ; \ + rm -rf /var/lib/apt/lists/* + +# get image tool +RUN set -exo pipefail; \ + case "${TARGETARCH}" in \ + amd64|x86_64) \ + CRANE_URL='https://github.com/google/go-containerregistry/releases/download/v0.19.0/go-containerregistry_Linux_x86_64.tar.gz'; \ + ;; \ + aarch64|arm64) \ + CRANE_URL='https://github.com/google/go-containerregistry/releases/download/v0.19.0/go-containerregistry_Linux_arm64.tar.gz'; \ + ;; \ + *) \ + echo "Unsupported arch: ${TARGETARCH}"; \ + exit 1; \ + ;; \ + esac; \ + \ + axel -n 16 -o /tmp/crane.tar.gz ${CRANE_URL} && \ + tar -xzf /tmp/crane.tar.gz --directory /usr/bin/ crane && \ + chmod a+x /usr/bin/crane && \ + rm -f /tmp/crane.tar.gz + +# set locale +RUN set -eux; \ + apt-get update && apt-get install -y --no-install-recommends \ + locales \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +ENV LANG='en_US.UTF-8' \ + LANGUAGE='en_US:en' \ + LC_ALL='en_US.UTF-8' + +# get k3s +VOLUME /var/lib/k3s +ENV K3S_DATA_DIR=/var/lib/k3s \ + K3S_RESOLV_CONF=/etc/resolv.conf \ + ETCDCTL_API=3 +COPY --from=rancher/k3s:v1.27.11-k3s1 \ + /bin/blkid \ + /bin/cni \ + /bin/conntrack \ + /bin/containerd \ + /bin/containerd-shim-runc-v2 \ + /bin/ethtool \ + /bin/ip \ + /bin/ipset \ + /bin/k3s \ + /bin/losetup \ + /bin/pigz \ + /bin/runc \ + /bin/which \ + /bin/aux/xtables-legacy-multi \ + /usr/bin/ +RUN set -eux; \ + ln -s /usr/bin/cni /usr/bin/bridge && \ + ln -s /usr/bin/cni /usr/bin/flannel && \ + ln -s /usr/bin/cni /usr/bin/host-local && \ + ln -s /usr/bin/cni /usr/bin/loopback && \ + ln -s /usr/bin/cni /usr/bin/portmap && \ + ln -s /usr/bin/k3s /usr/bin/crictl && \ + ln -s /usr/bin/k3s /usr/bin/ctr && \ + ln -s /usr/bin/k3s /usr/bin/k3s-agent && \ + ln -s /usr/bin/k3s /usr/bin/k3s-etcd-snapshot && \ + ln -s /usr/bin/k3s /usr/bin/k3s-server && \ + ln -s /usr/bin/k3s /usr/bin/kubectl && \ + ln -s /usr/bin/pigz /usr/bin/unpigz && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables-save && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables-restore && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables-translate && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables-save && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables-restore && \ + ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables-translate; \ + \ + IMAGE_URL="https://github.com/k3s-io/k3s/releases/download/v1.27.11%2Bk3s1/k3s-airgap-images-${TARGETARCH}.tar.zst"; \ + mkdir -p ${K3S_DATA_DIR}/agent/images && \ + axel -n 16 -o ${K3S_DATA_DIR}/agent/images/k3s-images.tar.zst ${IMAGE_URL}; \ + \ + ETCDCTL_VER="v3.5.11"; \ + ETCDCTL_URL="https://github.com/etcd-io/etcd/releases/download/${ETCDCTL_VER}/etcd-${ETCDCTL_VER}-linux-${TARGETARCH}.tar.gz"; \ + axel -n 16 -o /tmp/etcdctl.tar.gz ${ETCDCTL_URL} && \ + tar -xzvf /tmp/etcdctl.tar.gz --directory /usr/bin/ --strip-components=1 --no-same-owner etcd-${ETCDCTL_VER}-linux-${TARGETARCH}/etcdctl + +ENV CHARTS_DIR="/var/lib/walrus/manifests/charts" \ + CLI_DIR="/var/lib/walrus/cli" + +# get workflow tools +## NB: Please update walrus-images.txt if change the following images. +ENV WORKFLOW_CONTROLLER_IMAGE="sealio/mirrored-workflow-controller:v3.5.0" \ + WORKFLOW_EXECUTOR_IMAGE="sealio/mirrored-argoexec:v3.5.0" \ + WORKFLOW_STEP_IMAGE="sealio/curl-jq:v0.0.1" +RUN set -exo pipefail; \ + crane pull --platform=${TARGETPLATFORM} ${WORKFLOW_CONTROLLER_IMAGE} ${K3S_DATA_DIR}/agent/images/workflow-controller.tar; \ + crane pull --platform=${TARGETPLATFORM} ${WORKFLOW_EXECUTOR_IMAGE} ${K3S_DATA_DIR}/agent/images/workflow-executor.tar; \ + crane pull --platform=${TARGETPLATFORM} ${WORKFLOW_STEP_IMAGE} ${K3S_DATA_DIR}/agent/images/workflow-step.tar +ENV WORKFLOW_ARGO_WORKFLOWS_CHART_PATH="${CHARTS_DIR}/argo-workflows.tgz" +ADD https://github.com/argoproj/argo-helm/releases/download/argo-workflows-0.36.1/argo-workflows-0.36.1.tgz ${WORKFLOW_ARGO_WORKFLOWS_CHART_PATH} + +# get deployer tools +## NB: Please update walrus-images.txt if change the following images. +ENV DEPLOYER_TERRAFORM_IMAGE="sealio/terraform-deployer:v1.5.7-seal.1" \ + DEPLOYER_OPENTOFU_IMAGE="sealio/opentofu-deployer:v1.6.0-seal.1" \ + DEPLOYER_TERRAFORM_NETWORK_MIRROR_IMAGE="sealio/hermitcrab:v0.1.3" +RUN set -exo pipefail; \ + crane pull --platform=${TARGETPLATFORM} ${DEPLOYER_TERRAFORM_IMAGE} ${K3S_DATA_DIR}/agent/images/deployer-terraform.tar; \ + crane pull --platform=${TARGETPLATFORM} ${DEPLOYER_OPENTOFU_IMAGE} ${K3S_DATA_DIR}/agent/images/deployer-opentofu.tar; \ + crane pull --platform=${TARGETPLATFORM} ${DEPLOYER_TERRAFORM_NETWORK_MIRROR_IMAGE} ${K3S_DATA_DIR}/agent/images/deployer-terraform-network-mirror.tar +ENV DEPLOYER_TERRAFORM_HERMITCRAB_CHART_PATH="${CHARTS_DIR}/hermitcrab.tgz" +ADD https://github.com/seal-io/helm-charts/releases/download/hermitcrab-0.1.3/hermitcrab-0.1.3.tgz ${DEPLOYER_TERRAFORM_HERMITCRAB_CHART_PATH} + +# get cli +COPY /build/walrus-cli* ${CLI_DIR}/ + +ARG SERVE_UI_INDEX="file:///var/lib/walrus/ui" +ENV WALRUS_SETTING_SERVE_URL="" \ + WALRUS_SETTING_SERVE_UI_INDEX="${SERVE_UI_INDEX}" \ + WALRUS_SETTING_DEPLOYER_IMAGE="${DEPLOYER_TERRAFORM_IMAGE}" \ + WALRUS_SETTING_WALRUS_FILE_HUB_URL="file:///var/lib/walrus/files" +EXPOSE 80 443 +VOLUME /var/run/walrus +COPY /image/ / +COPY /build/walrus-manager-${TARGETOS}-${TARGETARCH} /usr/bin/walrus-manager +COPY /build/walrus-server-${TARGETOS}-${TARGETARCH} /usr/bin/walrus-server +ENV _RUNNING_INSIDE_CONTAINER_="true" +CMD ["walrus-server"] diff --git a/pack/walrus/release/.gitkeep b/pack/walrus/release/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/apis/doc.go b/pkg/apis/doc.go new file mode 100644 index 000000000..eaf034981 --- /dev/null +++ b/pkg/apis/doc.go @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package apis holds the API definitions for the seal.io domain. +// +// +domain=seal.io +package apis diff --git a/pkg/apis/setup.go b/pkg/apis/setup.go new file mode 100644 index 000000000..7626b78c8 --- /dev/null +++ b/pkg/apis/setup.go @@ -0,0 +1,165 @@ +package apis + +import ( + "context" + "fmt" + "time" + + "github.com/seal-io/utils/waitx" + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + apireg "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" +) + +// NB(thxCode): Register APIs below. +var ( + crdGetters = []_CustomResourceDefinitionsGetter{ + walruscore.GetCustomResourceDefinitions, + } + apiSvcGetters = []_APIServiceGetter{ + walrus.GetAPIService, + } +) + +type _CustomResourceDefinitionsGetter func() map[string]*apiext.CustomResourceDefinition + +// GetCustomResourceDefinitions returns the registered custom resource definitions. +func GetCustomResourceDefinitions() []*apiext.CustomResourceDefinition { + // Merge all the CRDs from the getters. + var ( + ret = make([]map[string]*apiext.CustomResourceDefinition, len(crdGetters)) + csc int + ) + for i, get := range crdGetters { + ret[i] = get() + csc += len(ret[i]) + } + + crds := make([]*apiext.CustomResourceDefinition, 0, csc) + for i := range ret { + if ret[i] == nil { + continue + } + for _, n := range sets.List(sets.KeySet(ret[i])) { + crds = append(crds, ret[i][n]) + } + } + + return crds +} + +// InstallCustomResourceDefinitions installs the custom resource definitions. +func InstallCustomResourceDefinitions(ctx context.Context, cli clientset.Interface) error { + err := review.CanDoUpdate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: apiext.SchemeGroupVersion.Group, + Version: apiext.SchemeGroupVersion.Version, + Resource: "customresourcedefinitions", + }, + }, + review.WithCreateIfNotExisted(), + ) + if err != nil { + return err + } + + crdCli := cli.ApiextensionsV1().CustomResourceDefinitions() + + crds := GetCustomResourceDefinitions() + for i := range crds { + _, err = kubeclientset.Update(ctx, crdCli, crds[i], + kubeclientset.WithCreateIfNotExisted[*apiext.CustomResourceDefinition]()) + if err != nil { + return fmt.Errorf("install custom resource definition %q: %w", + crds[i].GetName(), err) + } + } + + return nil +} + +type _APIServiceGetter func(apireg.ServiceReference, []byte) *apireg.APIService + +// GetAPIServices returns the registered api services. +func GetAPIServices(svc apireg.ServiceReference, ca []byte) []*apireg.APIService { + ret := make([]*apireg.APIService, 0, len(apiSvcGetters)) + for i := range apiSvcGetters { + r := apiSvcGetters[i](svc, ca) + if r != nil { + ret = append(ret, r) + } + } + return ret +} + +// InstallAPIServices installs the api services. +func InstallAPIServices(ctx context.Context, cli clientset.Interface, svc apireg.ServiceReference, ca []byte) error { + err := review.CanDoUpdate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: apireg.SchemeGroupVersion.Group, + Version: apireg.SchemeGroupVersion.Version, + Resource: "apiservices", + }, + }, + review.WithCreateIfNotExisted(), + ) + if err != nil { + return err + } + + svcCli := cli.ApiregistrationV1().APIServices() + + svcs := GetAPIServices(svc, ca) + for i := range svcs { + _, err = kubeclientset.Update(ctx, svcCli, svcs[i], + kubeclientset.WithCreateIfNotExisted[*apireg.APIService]()) + if err != nil { + return fmt.Errorf("install api service %q: %w", + svcs[i].Name, err) + } + } + + return nil +} + +// WaitForAPIServicesReady waits for the api services to be ready. +func WaitForAPIServicesReady(ctx context.Context, cli clientset.Interface) error { + svcCli := cli.ApiregistrationV1().APIServices() + svcs := GetAPIServices(apireg.ServiceReference{}, nil) + + return waitx.PollUntilContextTimeout(ctx, 2*time.Second, 30*time.Second, true, + func(ctx context.Context) error { + for i := range svcs { + svc, err := svcCli.Get(ctx, svcs[i].Name, meta.GetOptions{ResourceVersion: "0"}) + if err != nil { + return err + } + + ready := false + for j := range svc.Status.Conditions { + if svc.Status.Conditions[j].Type != apireg.Available { + continue + } + ready = svc.Status.Conditions[j].Status == apireg.ConditionTrue + break + } + + if !ready { + return fmt.Errorf("api service %q is not ready", svc.Name) + } + } + + return nil + }) +} diff --git a/pkg/apis/walrus/doc.go b/pkg/apis/walrus/doc.go new file mode 100644 index 000000000..eda1b497c --- /dev/null +++ b/pkg/apis/walrus/doc.go @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package manager is the manager API group of the API definitions +// +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +domain=seal.io +// +groupName=walrus.seal.io +package walrus diff --git a/pkg/apis/walrus/v1/catalog.go b/pkg/apis/walrus/v1/catalog.go new file mode 100644 index 000000000..d2b3f491c --- /dev/null +++ b/pkg/apis/walrus/v1/catalog.go @@ -0,0 +1,23 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" +) + +// Catalog is the schema for the catalogs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],subResources=["status"] +type Catalog walruscore.Catalog + +var _ runtime.Object = (*Catalog)(nil) + +// CatalogList holds the list of Catalog. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type CatalogList walruscore.CatalogList + +var _ runtime.Object = (*CatalogList)(nil) diff --git a/pkg/apis/walrus/v1/connector.go b/pkg/apis/walrus/v1/connector.go new file mode 100644 index 000000000..0af954fd2 --- /dev/null +++ b/pkg/apis/walrus/v1/connector.go @@ -0,0 +1,23 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" +) + +// Connector is the schema for the connectors API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["conn"],subResources=["status"] +type Connector walruscore.Connector + +var _ runtime.Object = (*Connector)(nil) + +// ConnectorList holds the list of Connector. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ConnectorList walruscore.ConnectorList + +var _ runtime.Object = (*ConnectorList)(nil) diff --git a/pkg/apis/walrus/v1/doc.go b/pkg/apis/walrus/v1/doc.go new file mode 100644 index 000000000..136c636f0 --- /dev/null +++ b/pkg/apis/walrus/v1/doc.go @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package v1 is the v1 version of the API definitions for manager group. +// +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:apireg-gen:service:insecureSkipTLSVerify=true +// +domain=seal.io +// +groupName=walrus.seal.io +// +versionName=v1 +package v1 diff --git a/pkg/apis/walrus/v1/environment.go b/pkg/apis/walrus/v1/environment.go new file mode 100644 index 000000000..c558986b9 --- /dev/null +++ b/pkg/apis/walrus/v1/environment.go @@ -0,0 +1,92 @@ +package v1 + +import ( + "errors" + "reflect" + + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Environment is the schema for the environments API. +// +// +genclient +// +genclient:onlyVerbs=create,get,list,watch,apply,update,patch,delete,deleteCollection +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["env"] +type Environment struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec EnvironmentSpec `json:"spec,omitempty"` + Status EnvironmentStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Environment)(nil) + +// EnvironmentType describes the type of environment. +// +enum +type EnvironmentType string + +const ( + // EnvironmentTypeDevelopment means the environment is for development. + EnvironmentTypeDevelopment EnvironmentType = "development" + // EnvironmentTypeStaging means the environment is for staging. + EnvironmentTypeStaging EnvironmentType = "staging" + // EnvironmentTypeProduction means the environment is for production. + EnvironmentTypeProduction EnvironmentType = "production" +) + +func (in EnvironmentType) String() string { + return string(in) +} + +func (in EnvironmentType) Validate() error { + switch in { + case EnvironmentTypeDevelopment, EnvironmentTypeStaging, EnvironmentTypeProduction: + return nil + default: + return errors.New("invalid environment type") + } +} + +// EnvironmentSpec defines the desired state of Environment. +type EnvironmentSpec struct { + // Type is the type of the environment. + // + // +k8s:validation:enum=["development","staging","production"] + Type EnvironmentType `json:"type"` + + // DisplayName is the display name of the environment. + DisplayName string `json:"displayName,omitempty"` + + // Description is the description of the environment. + Description string `json:"description,omitempty"` +} + +// EnvironmentStatus defines the observed state of Environment. +type EnvironmentStatus struct { + // Project is the project that the environment belongs to. + Project string `json:"project"` + + // Phase is the current phase of the environment. + Phase core.NamespacePhase `json:"phase"` +} + +func (in *Environment) Equal(in2 *Environment) bool { + return reflect.DeepEqual(in.Spec, in2.Spec) && + in.Status.Phase == in2.Status.Phase +} + +// EnvironmentList holds the list of Environment. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EnvironmentList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Environment `json:"items"` +} + +var _ runtime.Object = (*EnvironmentList)(nil) diff --git a/pkg/apis/walrus/v1/file_example.go b/pkg/apis/walrus/v1/file_example.go new file mode 100644 index 000000000..cbf0bc603 --- /dev/null +++ b/pkg/apis/walrus/v1/file_example.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// FileExample is the schema for the file example API. +// +// +genclient +// +genclient:onlyVerbs=get,list +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"] +type FileExample struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Status FileExampleStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*FileExample)(nil) + +// FileExampleStatus defines the observed state of FileExample. +type FileExampleStatus struct { + // Icon is the icon of the file example. + Icon string `json:"icon,omitempty"` + // Readme is the readme of the file example. + Readme string `json:"readme,omitempty"` + // Content is the content of the file example. + Content string `json:"content,omitempty"` +} + +// FileExampleList holds the list of FileExample. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type FileExampleList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []FileExample `json:"items"` +} + +var _ runtime.Object = (*FileExampleList)(nil) diff --git a/pkg/apis/walrus/v1/generated.pb.go b/pkg/apis/walrus/v1/generated.pb.go new file mode 100644 index 000000000..c07bb60d4 --- /dev/null +++ b/pkg/apis/walrus/v1/generated.pb.go @@ -0,0 +1,8301 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/apis/walrus/v1/generated.proto + +package v1 + +import ( + fmt "fmt" + + io "io" + + proto "github.com/gogo/protobuf/proto" + v11 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func (m *Catalog) Reset() { *m = Catalog{} } +func (*Catalog) ProtoMessage() {} +func (*Catalog) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{0} +} +func (m *Catalog) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Catalog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Catalog) XXX_Merge(src proto.Message) { + xxx_messageInfo_Catalog.Merge(m, src) +} +func (m *Catalog) XXX_Size() int { + return m.Size() +} +func (m *Catalog) XXX_DiscardUnknown() { + xxx_messageInfo_Catalog.DiscardUnknown(m) +} + +var xxx_messageInfo_Catalog proto.InternalMessageInfo + +func (m *CatalogList) Reset() { *m = CatalogList{} } +func (*CatalogList) ProtoMessage() {} +func (*CatalogList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{1} +} +func (m *CatalogList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CatalogList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CatalogList) XXX_Merge(src proto.Message) { + xxx_messageInfo_CatalogList.Merge(m, src) +} +func (m *CatalogList) XXX_Size() int { + return m.Size() +} +func (m *CatalogList) XXX_DiscardUnknown() { + xxx_messageInfo_CatalogList.DiscardUnknown(m) +} + +var xxx_messageInfo_CatalogList proto.InternalMessageInfo + +func (m *Connector) Reset() { *m = Connector{} } +func (*Connector) ProtoMessage() {} +func (*Connector) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{2} +} +func (m *Connector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Connector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Connector) XXX_Merge(src proto.Message) { + xxx_messageInfo_Connector.Merge(m, src) +} +func (m *Connector) XXX_Size() int { + return m.Size() +} +func (m *Connector) XXX_DiscardUnknown() { + xxx_messageInfo_Connector.DiscardUnknown(m) +} + +var xxx_messageInfo_Connector proto.InternalMessageInfo + +func (m *ConnectorList) Reset() { *m = ConnectorList{} } +func (*ConnectorList) ProtoMessage() {} +func (*ConnectorList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{3} +} +func (m *ConnectorList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConnectorList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ConnectorList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectorList.Merge(m, src) +} +func (m *ConnectorList) XXX_Size() int { + return m.Size() +} +func (m *ConnectorList) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectorList.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectorList proto.InternalMessageInfo + +func (m *Environment) Reset() { *m = Environment{} } +func (*Environment) ProtoMessage() {} +func (*Environment) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{4} +} +func (m *Environment) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Environment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Environment) XXX_Merge(src proto.Message) { + xxx_messageInfo_Environment.Merge(m, src) +} +func (m *Environment) XXX_Size() int { + return m.Size() +} +func (m *Environment) XXX_DiscardUnknown() { + xxx_messageInfo_Environment.DiscardUnknown(m) +} + +var xxx_messageInfo_Environment proto.InternalMessageInfo + +func (m *EnvironmentList) Reset() { *m = EnvironmentList{} } +func (*EnvironmentList) ProtoMessage() {} +func (*EnvironmentList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{5} +} +func (m *EnvironmentList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EnvironmentList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EnvironmentList) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnvironmentList.Merge(m, src) +} +func (m *EnvironmentList) XXX_Size() int { + return m.Size() +} +func (m *EnvironmentList) XXX_DiscardUnknown() { + xxx_messageInfo_EnvironmentList.DiscardUnknown(m) +} + +var xxx_messageInfo_EnvironmentList proto.InternalMessageInfo + +func (m *EnvironmentSpec) Reset() { *m = EnvironmentSpec{} } +func (*EnvironmentSpec) ProtoMessage() {} +func (*EnvironmentSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{6} +} +func (m *EnvironmentSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EnvironmentSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EnvironmentSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnvironmentSpec.Merge(m, src) +} +func (m *EnvironmentSpec) XXX_Size() int { + return m.Size() +} +func (m *EnvironmentSpec) XXX_DiscardUnknown() { + xxx_messageInfo_EnvironmentSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_EnvironmentSpec proto.InternalMessageInfo + +func (m *EnvironmentStatus) Reset() { *m = EnvironmentStatus{} } +func (*EnvironmentStatus) ProtoMessage() {} +func (*EnvironmentStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{7} +} +func (m *EnvironmentStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EnvironmentStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EnvironmentStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnvironmentStatus.Merge(m, src) +} +func (m *EnvironmentStatus) XXX_Size() int { + return m.Size() +} +func (m *EnvironmentStatus) XXX_DiscardUnknown() { + xxx_messageInfo_EnvironmentStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_EnvironmentStatus proto.InternalMessageInfo + +func (m *FileExample) Reset() { *m = FileExample{} } +func (*FileExample) ProtoMessage() {} +func (*FileExample) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{8} +} +func (m *FileExample) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FileExample) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *FileExample) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileExample.Merge(m, src) +} +func (m *FileExample) XXX_Size() int { + return m.Size() +} +func (m *FileExample) XXX_DiscardUnknown() { + xxx_messageInfo_FileExample.DiscardUnknown(m) +} + +var xxx_messageInfo_FileExample proto.InternalMessageInfo + +func (m *FileExampleList) Reset() { *m = FileExampleList{} } +func (*FileExampleList) ProtoMessage() {} +func (*FileExampleList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{9} +} +func (m *FileExampleList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FileExampleList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *FileExampleList) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileExampleList.Merge(m, src) +} +func (m *FileExampleList) XXX_Size() int { + return m.Size() +} +func (m *FileExampleList) XXX_DiscardUnknown() { + xxx_messageInfo_FileExampleList.DiscardUnknown(m) +} + +var xxx_messageInfo_FileExampleList proto.InternalMessageInfo + +func (m *FileExampleStatus) Reset() { *m = FileExampleStatus{} } +func (*FileExampleStatus) ProtoMessage() {} +func (*FileExampleStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{10} +} +func (m *FileExampleStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FileExampleStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *FileExampleStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileExampleStatus.Merge(m, src) +} +func (m *FileExampleStatus) XXX_Size() int { + return m.Size() +} +func (m *FileExampleStatus) XXX_DiscardUnknown() { + xxx_messageInfo_FileExampleStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_FileExampleStatus proto.InternalMessageInfo + +func (m *Project) Reset() { *m = Project{} } +func (*Project) ProtoMessage() {} +func (*Project) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{11} +} +func (m *Project) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Project) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Project) XXX_Merge(src proto.Message) { + xxx_messageInfo_Project.Merge(m, src) +} +func (m *Project) XXX_Size() int { + return m.Size() +} +func (m *Project) XXX_DiscardUnknown() { + xxx_messageInfo_Project.DiscardUnknown(m) +} + +var xxx_messageInfo_Project proto.InternalMessageInfo + +func (m *ProjectList) Reset() { *m = ProjectList{} } +func (*ProjectList) ProtoMessage() {} +func (*ProjectList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{12} +} +func (m *ProjectList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProjectList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ProjectList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProjectList.Merge(m, src) +} +func (m *ProjectList) XXX_Size() int { + return m.Size() +} +func (m *ProjectList) XXX_DiscardUnknown() { + xxx_messageInfo_ProjectList.DiscardUnknown(m) +} + +var xxx_messageInfo_ProjectList proto.InternalMessageInfo + +func (m *ProjectSpec) Reset() { *m = ProjectSpec{} } +func (*ProjectSpec) ProtoMessage() {} +func (*ProjectSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{13} +} +func (m *ProjectSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProjectSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ProjectSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProjectSpec.Merge(m, src) +} +func (m *ProjectSpec) XXX_Size() int { + return m.Size() +} +func (m *ProjectSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ProjectSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ProjectSpec proto.InternalMessageInfo + +func (m *ProjectStatus) Reset() { *m = ProjectStatus{} } +func (*ProjectStatus) ProtoMessage() {} +func (*ProjectStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{14} +} +func (m *ProjectStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProjectStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ProjectStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProjectStatus.Merge(m, src) +} +func (m *ProjectStatus) XXX_Size() int { + return m.Size() +} +func (m *ProjectStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ProjectStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ProjectStatus proto.InternalMessageInfo + +func (m *ProjectSubject) Reset() { *m = ProjectSubject{} } +func (*ProjectSubject) ProtoMessage() {} +func (*ProjectSubject) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{15} +} +func (m *ProjectSubject) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProjectSubject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ProjectSubject) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProjectSubject.Merge(m, src) +} +func (m *ProjectSubject) XXX_Size() int { + return m.Size() +} +func (m *ProjectSubject) XXX_DiscardUnknown() { + xxx_messageInfo_ProjectSubject.DiscardUnknown(m) +} + +var xxx_messageInfo_ProjectSubject proto.InternalMessageInfo + +func (m *ProjectSubjects) Reset() { *m = ProjectSubjects{} } +func (*ProjectSubjects) ProtoMessage() {} +func (*ProjectSubjects) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{16} +} +func (m *ProjectSubjects) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProjectSubjects) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ProjectSubjects) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProjectSubjects.Merge(m, src) +} +func (m *ProjectSubjects) XXX_Size() int { + return m.Size() +} +func (m *ProjectSubjects) XXX_DiscardUnknown() { + xxx_messageInfo_ProjectSubjects.DiscardUnknown(m) +} + +var xxx_messageInfo_ProjectSubjects proto.InternalMessageInfo + +func (m *Resource) Reset() { *m = Resource{} } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{17} +} +func (m *Resource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return m.Size() +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *ResourceComponent) Reset() { *m = ResourceComponent{} } +func (*ResourceComponent) ProtoMessage() {} +func (*ResourceComponent) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{18} +} +func (m *ResourceComponent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceComponent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceComponent) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceComponent.Merge(m, src) +} +func (m *ResourceComponent) XXX_Size() int { + return m.Size() +} +func (m *ResourceComponent) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceComponent.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceComponent proto.InternalMessageInfo + +func (m *ResourceComponents) Reset() { *m = ResourceComponents{} } +func (*ResourceComponents) ProtoMessage() {} +func (*ResourceComponents) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{19} +} +func (m *ResourceComponents) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceComponents) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceComponents) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceComponents.Merge(m, src) +} +func (m *ResourceComponents) XXX_Size() int { + return m.Size() +} +func (m *ResourceComponents) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceComponents.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceComponents proto.InternalMessageInfo + +func (m *ResourceDefinition) Reset() { *m = ResourceDefinition{} } +func (*ResourceDefinition) ProtoMessage() {} +func (*ResourceDefinition) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{20} +} +func (m *ResourceDefinition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceDefinition) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDefinition.Merge(m, src) +} +func (m *ResourceDefinition) XXX_Size() int { + return m.Size() +} +func (m *ResourceDefinition) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceDefinition.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceDefinition proto.InternalMessageInfo + +func (m *ResourceDefinitionList) Reset() { *m = ResourceDefinitionList{} } +func (*ResourceDefinitionList) ProtoMessage() {} +func (*ResourceDefinitionList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{21} +} +func (m *ResourceDefinitionList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceDefinitionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceDefinitionList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDefinitionList.Merge(m, src) +} +func (m *ResourceDefinitionList) XXX_Size() int { + return m.Size() +} +func (m *ResourceDefinitionList) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceDefinitionList.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceDefinitionList proto.InternalMessageInfo + +func (m *ResourceList) Reset() { *m = ResourceList{} } +func (*ResourceList) ProtoMessage() {} +func (*ResourceList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{22} +} +func (m *ResourceList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceList.Merge(m, src) +} +func (m *ResourceList) XXX_Size() int { + return m.Size() +} +func (m *ResourceList) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceList.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceList proto.InternalMessageInfo + +func (m *ResourceRun) Reset() { *m = ResourceRun{} } +func (*ResourceRun) ProtoMessage() {} +func (*ResourceRun) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{23} +} +func (m *ResourceRun) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceRun) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceRun) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceRun.Merge(m, src) +} +func (m *ResourceRun) XXX_Size() int { + return m.Size() +} +func (m *ResourceRun) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceRun.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceRun proto.InternalMessageInfo + +func (m *ResourceRunList) Reset() { *m = ResourceRunList{} } +func (*ResourceRunList) ProtoMessage() {} +func (*ResourceRunList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{24} +} +func (m *ResourceRunList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceRunList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceRunList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceRunList.Merge(m, src) +} +func (m *ResourceRunList) XXX_Size() int { + return m.Size() +} +func (m *ResourceRunList) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceRunList.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceRunList proto.InternalMessageInfo + +func (m *Setting) Reset() { *m = Setting{} } +func (*Setting) ProtoMessage() {} +func (*Setting) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{25} +} +func (m *Setting) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Setting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Setting) XXX_Merge(src proto.Message) { + xxx_messageInfo_Setting.Merge(m, src) +} +func (m *Setting) XXX_Size() int { + return m.Size() +} +func (m *Setting) XXX_DiscardUnknown() { + xxx_messageInfo_Setting.DiscardUnknown(m) +} + +var xxx_messageInfo_Setting proto.InternalMessageInfo + +func (m *SettingList) Reset() { *m = SettingList{} } +func (*SettingList) ProtoMessage() {} +func (*SettingList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{26} +} +func (m *SettingList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SettingList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SettingList) XXX_Merge(src proto.Message) { + xxx_messageInfo_SettingList.Merge(m, src) +} +func (m *SettingList) XXX_Size() int { + return m.Size() +} +func (m *SettingList) XXX_DiscardUnknown() { + xxx_messageInfo_SettingList.DiscardUnknown(m) +} + +var xxx_messageInfo_SettingList proto.InternalMessageInfo + +func (m *SettingSpec) Reset() { *m = SettingSpec{} } +func (*SettingSpec) ProtoMessage() {} +func (*SettingSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{27} +} +func (m *SettingSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SettingSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SettingSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_SettingSpec.Merge(m, src) +} +func (m *SettingSpec) XXX_Size() int { + return m.Size() +} +func (m *SettingSpec) XXX_DiscardUnknown() { + xxx_messageInfo_SettingSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_SettingSpec proto.InternalMessageInfo + +func (m *SettingStatus) Reset() { *m = SettingStatus{} } +func (*SettingStatus) ProtoMessage() {} +func (*SettingStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{28} +} +func (m *SettingStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SettingStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SettingStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_SettingStatus.Merge(m, src) +} +func (m *SettingStatus) XXX_Size() int { + return m.Size() +} +func (m *SettingStatus) XXX_DiscardUnknown() { + xxx_messageInfo_SettingStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_SettingStatus proto.InternalMessageInfo + +func (m *Template) Reset() { *m = Template{} } +func (*Template) ProtoMessage() {} +func (*Template) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{29} +} +func (m *Template) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Template) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Template) XXX_Merge(src proto.Message) { + xxx_messageInfo_Template.Merge(m, src) +} +func (m *Template) XXX_Size() int { + return m.Size() +} +func (m *Template) XXX_DiscardUnknown() { + xxx_messageInfo_Template.DiscardUnknown(m) +} + +var xxx_messageInfo_Template proto.InternalMessageInfo + +func (m *TemplateList) Reset() { *m = TemplateList{} } +func (*TemplateList) ProtoMessage() {} +func (*TemplateList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{30} +} +func (m *TemplateList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TemplateList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TemplateList) XXX_Merge(src proto.Message) { + xxx_messageInfo_TemplateList.Merge(m, src) +} +func (m *TemplateList) XXX_Size() int { + return m.Size() +} +func (m *TemplateList) XXX_DiscardUnknown() { + xxx_messageInfo_TemplateList.DiscardUnknown(m) +} + +var xxx_messageInfo_TemplateList proto.InternalMessageInfo + +func (m *Variable) Reset() { *m = Variable{} } +func (*Variable) ProtoMessage() {} +func (*Variable) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{31} +} +func (m *Variable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Variable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Variable) XXX_Merge(src proto.Message) { + xxx_messageInfo_Variable.Merge(m, src) +} +func (m *Variable) XXX_Size() int { + return m.Size() +} +func (m *Variable) XXX_DiscardUnknown() { + xxx_messageInfo_Variable.DiscardUnknown(m) +} + +var xxx_messageInfo_Variable proto.InternalMessageInfo + +func (m *VariableList) Reset() { *m = VariableList{} } +func (*VariableList) ProtoMessage() {} +func (*VariableList) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{32} +} +func (m *VariableList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VariableList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *VariableList) XXX_Merge(src proto.Message) { + xxx_messageInfo_VariableList.Merge(m, src) +} +func (m *VariableList) XXX_Size() int { + return m.Size() +} +func (m *VariableList) XXX_DiscardUnknown() { + xxx_messageInfo_VariableList.DiscardUnknown(m) +} + +var xxx_messageInfo_VariableList proto.InternalMessageInfo + +func (m *VariableSpec) Reset() { *m = VariableSpec{} } +func (*VariableSpec) ProtoMessage() {} +func (*VariableSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{33} +} +func (m *VariableSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VariableSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *VariableSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_VariableSpec.Merge(m, src) +} +func (m *VariableSpec) XXX_Size() int { + return m.Size() +} +func (m *VariableSpec) XXX_DiscardUnknown() { + xxx_messageInfo_VariableSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_VariableSpec proto.InternalMessageInfo + +func (m *VariableStatus) Reset() { *m = VariableStatus{} } +func (*VariableStatus) ProtoMessage() {} +func (*VariableStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_213d995534ce8f7e, []int{34} +} +func (m *VariableStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VariableStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *VariableStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_VariableStatus.Merge(m, src) +} +func (m *VariableStatus) XXX_Size() int { + return m.Size() +} +func (m *VariableStatus) XXX_DiscardUnknown() { + xxx_messageInfo_VariableStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_VariableStatus proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Catalog)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Catalog") + proto.RegisterType((*CatalogList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.CatalogList") + proto.RegisterType((*Connector)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Connector") + proto.RegisterType((*ConnectorList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ConnectorList") + proto.RegisterType((*Environment)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Environment") + proto.RegisterType((*EnvironmentList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.EnvironmentList") + proto.RegisterType((*EnvironmentSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.EnvironmentSpec") + proto.RegisterType((*EnvironmentStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.EnvironmentStatus") + proto.RegisterType((*FileExample)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.FileExample") + proto.RegisterType((*FileExampleList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.FileExampleList") + proto.RegisterType((*FileExampleStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.FileExampleStatus") + proto.RegisterType((*Project)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Project") + proto.RegisterType((*ProjectList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ProjectList") + proto.RegisterType((*ProjectSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ProjectSpec") + proto.RegisterType((*ProjectStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ProjectStatus") + proto.RegisterType((*ProjectSubject)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ProjectSubject") + proto.RegisterType((*ProjectSubjects)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ProjectSubjects") + proto.RegisterType((*Resource)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Resource") + proto.RegisterType((*ResourceComponent)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceComponent") + proto.RegisterType((*ResourceComponents)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceComponents") + proto.RegisterType((*ResourceDefinition)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceDefinition") + proto.RegisterType((*ResourceDefinitionList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceDefinitionList") + proto.RegisterType((*ResourceList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceList") + proto.RegisterType((*ResourceRun)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceRun") + proto.RegisterType((*ResourceRunList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.ResourceRunList") + proto.RegisterType((*Setting)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Setting") + proto.RegisterType((*SettingList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.SettingList") + proto.RegisterType((*SettingSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.SettingSpec") + proto.RegisterType((*SettingStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.SettingStatus") + proto.RegisterType((*Template)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Template") + proto.RegisterType((*TemplateList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.TemplateList") + proto.RegisterType((*Variable)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.Variable") + proto.RegisterType((*VariableList)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.VariableList") + proto.RegisterType((*VariableSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.VariableSpec") + proto.RegisterType((*VariableStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walrus.v1.VariableStatus") +} + +func init() { + proto.RegisterFile("pkg/apis/walrus/v1/generated.proto", fileDescriptor_213d995534ce8f7e) +} + +var fileDescriptor_213d995534ce8f7e = []byte{ + // 1353 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x99, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0x33, 0x5b, 0xa7, 0xb5, 0xc7, 0x4d, 0x43, 0x17, 0x09, 0x45, 0x3d, 0xd8, 0x65, 0x91, + 0x50, 0x91, 0xda, 0x35, 0x29, 0x24, 0x82, 0xfe, 0x80, 0xe2, 0x24, 0x28, 0xe5, 0x67, 0x35, 0xa9, + 0x2a, 0xd1, 0x56, 0x24, 0x93, 0xf5, 0xd4, 0x9e, 0xc6, 0xde, 0x5d, 0xed, 0x8e, 0x0d, 0x11, 0x17, + 0x8e, 0x1c, 0x38, 0x70, 0xe3, 0xaf, 0x40, 0xe2, 0x00, 0x12, 0x88, 0x3f, 0x80, 0x20, 0x84, 0x5a, + 0x09, 0xa9, 0xca, 0x01, 0x45, 0xc4, 0xfc, 0x07, 0x1c, 0x7b, 0x42, 0x33, 0x9e, 0xd9, 0x5f, 0xee, + 0x3a, 0xce, 0xa6, 0x59, 0xa5, 0x12, 0xb7, 0xee, 0xcc, 0x77, 0xde, 0xbc, 0xf7, 0xe6, 0x33, 0x6f, + 0x5e, 0x1d, 0x68, 0xb8, 0x1b, 0xcd, 0x1a, 0x76, 0xa9, 0x5f, 0xfb, 0x0c, 0xb7, 0xbd, 0xae, 0x5f, + 0xeb, 0xcd, 0xd6, 0x9a, 0xc4, 0x26, 0x1e, 0x66, 0xa4, 0x61, 0xba, 0x9e, 0xc3, 0x1c, 0xfd, 0x7c, + 0x93, 0xb2, 0x56, 0x77, 0xdd, 0xb4, 0x9c, 0x8e, 0xe9, 0x13, 0xdc, 0x5e, 0xa5, 0x8e, 0x39, 0x50, + 0x9b, 0xee, 0x46, 0xd3, 0xe4, 0xab, 0xd5, 0x77, 0x6f, 0xf6, 0xcc, 0x85, 0x50, 0x5d, 0x6b, 0x3a, + 0x4d, 0xa7, 0x26, 0x8c, 0xac, 0x77, 0xef, 0x89, 0x2f, 0xf1, 0x21, 0xfe, 0x35, 0x30, 0x7e, 0xe6, + 0x5a, 0x44, 0xce, 0x8d, 0x5f, 0xa0, 0x8e, 0x72, 0x25, 0xe1, 0x9a, 0xe5, 0x78, 0xe4, 0x09, 0xee, + 0x9d, 0x79, 0x7d, 0xe3, 0x0d, 0xdf, 0xa4, 0x0e, 0x97, 0x76, 0xb0, 0xd5, 0xa2, 0x36, 0xf1, 0x36, + 0xc3, 0xb5, 0x1d, 0xc2, 0xf0, 0x93, 0x56, 0xd5, 0xd2, 0x56, 0x79, 0x5d, 0x9b, 0xd1, 0x0e, 0x19, + 0x5a, 0x30, 0xbf, 0xd7, 0x02, 0xdf, 0x6a, 0x91, 0x0e, 0x4e, 0xae, 0x33, 0x7e, 0xd4, 0xe0, 0x89, + 0x05, 0xcc, 0x70, 0xdb, 0x69, 0xea, 0x6b, 0xb0, 0xc8, 0xfd, 0x69, 0x60, 0x86, 0x67, 0xc0, 0x59, + 0x70, 0xae, 0x7c, 0xf1, 0x55, 0x73, 0x60, 0xd6, 0x8c, 0x9a, 0x0d, 0xd3, 0xca, 0xd5, 0x66, 0x6f, + 0xd6, 0xfc, 0x78, 0xfd, 0x3e, 0xb1, 0xd8, 0x87, 0x84, 0xe1, 0xba, 0xbe, 0xb5, 0x53, 0x9d, 0xe8, + 0xef, 0x54, 0x61, 0x38, 0x86, 0x02, 0xab, 0xfa, 0x2a, 0x2c, 0xf8, 0x2e, 0xb1, 0x66, 0x34, 0x61, + 0xfd, 0xaa, 0x39, 0xf6, 0xd1, 0xf1, 0xec, 0xf2, 0x9d, 0xa4, 0xab, 0x2b, 0x2e, 0xb1, 0xea, 0x27, + 0xe5, 0x56, 0x05, 0xfe, 0x85, 0x84, 0x61, 0xbd, 0x09, 0x8f, 0xfb, 0x0c, 0xb3, 0xae, 0x3f, 0x73, + 0x4c, 0x6c, 0xf1, 0x76, 0xf6, 0x2d, 0x84, 0x99, 0xfa, 0x29, 0xb9, 0xc9, 0xf1, 0xc1, 0x37, 0x92, + 0xe6, 0x8d, 0xdf, 0x01, 0x2c, 0x4b, 0xe5, 0x07, 0xd4, 0x67, 0xfa, 0xdd, 0xa1, 0xdc, 0x99, 0xe3, + 0xe5, 0x8e, 0xaf, 0x16, 0x99, 0x7b, 0x4e, 0xee, 0x54, 0x54, 0x23, 0x91, 0xbc, 0x7d, 0x0a, 0x27, + 0x29, 0x23, 0x1d, 0x7f, 0x46, 0x3b, 0x7b, 0xec, 0x5c, 0xf9, 0xe2, 0x9b, 0x99, 0xa3, 0xaa, 0x4f, + 0xc9, 0x5d, 0x26, 0xaf, 0x73, 0x7b, 0x68, 0x60, 0xd6, 0xf8, 0x45, 0x83, 0xa5, 0x05, 0xc7, 0xb6, + 0x89, 0xc5, 0x1c, 0x2f, 0x07, 0x0e, 0x70, 0x8c, 0x83, 0x2c, 0x87, 0xa4, 0x9c, 0x4d, 0x25, 0x81, + 0x26, 0x48, 0x78, 0xe7, 0x20, 0x9b, 0x8c, 0x66, 0xe1, 0x01, 0x80, 0x53, 0x81, 0x36, 0x07, 0x1a, + 0xd6, 0xe2, 0x34, 0x5c, 0x3e, 0x40, 0x64, 0x29, 0x3c, 0xfc, 0xac, 0xc1, 0xf2, 0x92, 0xdd, 0xa3, + 0x9e, 0x63, 0x77, 0x88, 0xcd, 0x8e, 0x72, 0x65, 0xe0, 0xbb, 0x44, 0x5c, 0x3d, 0x8c, 0xca, 0x90, + 0xdc, 0x62, 0x4f, 0x1a, 0xa6, 0x23, 0xea, 0x23, 0x5d, 0x1d, 0x12, 0x91, 0xa5, 0xd0, 0xf0, 0x43, + 0x3c, 0x22, 0x9e, 0x54, 0xfd, 0x35, 0x58, 0x60, 0x9b, 0x2e, 0x11, 0xd1, 0x94, 0xea, 0x55, 0x95, + 0xf0, 0x9b, 0x9b, 0x2e, 0x79, 0xbc, 0x53, 0x8d, 0xca, 0xf9, 0x10, 0x12, 0x62, 0x7d, 0x0e, 0x96, + 0x1b, 0xd4, 0x77, 0xdb, 0x78, 0xf3, 0x23, 0xdc, 0x21, 0xe2, 0xac, 0x4b, 0xf5, 0xe7, 0xe5, 0xda, + 0xf2, 0x62, 0x38, 0x85, 0xa2, 0x3a, 0xb1, 0x8c, 0xf8, 0x96, 0x47, 0x5d, 0x46, 0x1d, 0x5b, 0x9c, + 0x5f, 0x74, 0x59, 0x38, 0x85, 0xa2, 0x3a, 0xe3, 0x2b, 0x00, 0x4f, 0x0f, 0x1d, 0x9b, 0xfe, 0x0a, + 0x3c, 0xe1, 0x7a, 0x0e, 0x27, 0x50, 0xfa, 0x3e, 0x2d, 0x0d, 0x9d, 0xb8, 0x31, 0x18, 0x46, 0x6a, + 0x5e, 0x5f, 0x86, 0x93, 0x6e, 0x0b, 0xfb, 0xca, 0xd1, 0x8b, 0x2a, 0x39, 0x37, 0xf8, 0xe0, 0xe3, + 0x9d, 0xea, 0x8b, 0xe1, 0x9b, 0x5b, 0x93, 0xcf, 0xbf, 0xc9, 0x1d, 0xf6, 0x5d, 0x6c, 0x11, 0x21, + 0x42, 0x03, 0x03, 0xc6, 0x36, 0x80, 0xe5, 0x77, 0x69, 0x9b, 0x2c, 0x7d, 0x8e, 0x3b, 0x6e, 0x9b, + 0xe4, 0x70, 0x9f, 0x42, 0xdc, 0xb5, 0x2c, 0xb8, 0x47, 0x9c, 0x1d, 0x03, 0xf7, 0x88, 0xfa, 0xc8, + 0xe3, 0x1e, 0xf1, 0x35, 0x05, 0x77, 0xce, 0xcd, 0x50, 0xfc, 0xfa, 0x59, 0x58, 0xa0, 0x96, 0x63, + 0x4b, 0x68, 0x82, 0x0a, 0x73, 0xdd, 0x72, 0x6c, 0x24, 0x66, 0xf4, 0x97, 0xe1, 0x71, 0x8f, 0xe0, + 0x46, 0x00, 0x76, 0x90, 0x31, 0x24, 0x46, 0x91, 0x9c, 0xe5, 0x04, 0x5a, 0x8e, 0xcd, 0x88, 0xcd, + 0x24, 0xca, 0x01, 0x81, 0x0b, 0x83, 0x61, 0xa4, 0xe6, 0x8d, 0xef, 0x34, 0xa8, 0xb0, 0xcc, 0x81, + 0x99, 0x3b, 0xb1, 0x1a, 0xbc, 0xcf, 0xbc, 0x4a, 0x37, 0x53, 0xeb, 0xaf, 0x95, 0xa8, 0xbf, 0x97, + 0xb3, 0x99, 0x1f, 0x0d, 0xe3, 0xaf, 0x00, 0x96, 0xa5, 0x32, 0x07, 0x10, 0x6f, 0xc7, 0x41, 0x9c, + 0xcb, 0x14, 0x51, 0x0a, 0x84, 0x5f, 0x04, 0x81, 0x88, 0x72, 0x9b, 0xa8, 0x9c, 0x20, 0x5b, 0xe5, + 0xd4, 0xc6, 0xac, 0x9c, 0x9f, 0xc0, 0xa9, 0x58, 0xbe, 0xc3, 0x4a, 0x08, 0x0e, 0x5a, 0x09, 0xbf, + 0x06, 0xf0, 0x94, 0xb2, 0xdd, 0x15, 0x10, 0xf2, 0x9b, 0x65, 0x87, 0x41, 0x05, 0xec, 0x88, 0x68, + 0xc4, 0x0c, 0x57, 0x6c, 0x50, 0xbb, 0x21, 0xfd, 0x0f, 0x14, 0xef, 0x53, 0xbb, 0x81, 0xc4, 0x8c, + 0x3e, 0x0f, 0x0b, 0x9e, 0xd3, 0x26, 0xf2, 0x42, 0x19, 0x4a, 0x81, 0x9c, 0x36, 0x77, 0x4f, 0x8f, + 0xef, 0xc8, 0x47, 0x91, 0xd0, 0x1b, 0x8f, 0x00, 0x9c, 0x8e, 0x4f, 0xfa, 0xb9, 0xb4, 0xbf, 0x31, + 0x70, 0xae, 0x64, 0xbb, 0x0a, 0x03, 0x7f, 0x53, 0xf8, 0xf9, 0x49, 0x83, 0x45, 0x44, 0x7c, 0xa7, + 0xeb, 0x59, 0x79, 0x3c, 0x37, 0x6b, 0xb1, 0xd2, 0xf1, 0xd6, 0xfe, 0x3b, 0x52, 0xe5, 0x6b, 0x6a, + 0xfd, 0x68, 0x25, 0xea, 0xc7, 0xb5, 0x03, 0xec, 0x31, 0xba, 0x88, 0xcc, 0xc1, 0xd3, 0x4a, 0xb9, + 0xe0, 0x74, 0x5c, 0xc7, 0xe6, 0x1d, 0xf0, 0x9e, 0x90, 0x1a, 0x7f, 0x01, 0xa8, 0x0f, 0xad, 0xcb, + 0x83, 0xa6, 0x46, 0x9c, 0xa6, 0x7d, 0xbe, 0xf4, 0x43, 0x2e, 0xa7, 0x00, 0xf5, 0x48, 0x0b, 0xc3, + 0x5b, 0x24, 0xf7, 0xa8, 0x4d, 0x79, 0xa9, 0xc8, 0x21, 0xbc, 0xfb, 0x31, 0xb4, 0x96, 0xb3, 0x1f, + 0x7b, 0xe8, 0x75, 0x2a, 0x64, 0x5e, 0x02, 0xb2, 0xf7, 0x9e, 0xca, 0x6e, 0xa3, 0x71, 0xdb, 0x05, + 0xf0, 0x85, 0xe1, 0x45, 0x39, 0x3c, 0x5f, 0x34, 0xce, 0xcd, 0xe2, 0xd3, 0x88, 0x35, 0x05, 0x9e, + 0x3f, 0x00, 0x3c, 0xa9, 0xc4, 0x39, 0x44, 0xb6, 0x1a, 0x8f, 0xec, 0x52, 0xf6, 0xc8, 0x52, 0xe2, + 0x79, 0xa0, 0xc1, 0xb2, 0x92, 0xa0, 0xee, 0xff, 0xb7, 0xe0, 0xe0, 0xb7, 0xe0, 0x4f, 0x00, 0xa7, + 0x23, 0x19, 0xcd, 0x01, 0x92, 0xf5, 0x38, 0x24, 0x57, 0xb3, 0x07, 0x89, 0xba, 0x69, 0xdc, 0xf3, + 0xfe, 0x7d, 0x85, 0x30, 0x46, 0xed, 0xe6, 0x51, 0xef, 0xdf, 0xa5, 0x9b, 0x87, 0xd5, 0xbf, 0x2b, + 0xf3, 0x7b, 0xf7, 0xef, 0x52, 0x79, 0xe4, 0xfb, 0x77, 0xe9, 0x67, 0xca, 0xc9, 0x9b, 0x41, 0x20, + 0xa2, 0x7f, 0xaf, 0xc2, 0xc9, 0x1e, 0x6e, 0x77, 0x55, 0xff, 0x50, 0xe2, 0xfa, 0x5b, 0x7c, 0x00, + 0x0d, 0xc6, 0x8d, 0x7f, 0x01, 0x9c, 0x8a, 0xe5, 0x28, 0xd9, 0xbb, 0x83, 0xf1, 0x7a, 0x77, 0xfe, + 0xbf, 0xd0, 0x16, 0x6d, 0x34, 0xc8, 0xa0, 0xdb, 0x2f, 0x86, 0xa9, 0x5e, 0x16, 0xa3, 0x48, 0xce, + 0xea, 0xe7, 0x61, 0x91, 0x34, 0x28, 0xc3, 0xeb, 0xb2, 0x6b, 0x2e, 0x86, 0xa9, 0x5a, 0x92, 0xe3, + 0x28, 0x50, 0xe8, 0x35, 0x58, 0xf2, 0x89, 0xed, 0x53, 0x46, 0x7b, 0x64, 0xa6, 0x20, 0xe4, 0xa7, + 0xa5, 0xbc, 0xb4, 0xa2, 0x26, 0x50, 0xa8, 0xd1, 0x5f, 0x52, 0x01, 0x4f, 0x0a, 0xbf, 0x83, 0x24, + 0xc5, 0x82, 0xe6, 0x4d, 0xea, 0x4d, 0xd2, 0x71, 0xdb, 0x98, 0x3d, 0x13, 0x4d, 0xaa, 0xf2, 0xf5, + 0x30, 0x9b, 0xd4, 0x60, 0x8f, 0xd1, 0x37, 0x85, 0xbf, 0xa8, 0x4a, 0xfa, 0x4c, 0xbc, 0xa8, 0xca, + 0xd9, 0x94, 0xfb, 0xf2, 0xbd, 0x06, 0x8b, 0xb7, 0xb0, 0x47, 0x05, 0x6d, 0x87, 0x8f, 0xc2, 0xdd, + 0x18, 0x0a, 0x97, 0xf6, 0x77, 0xf3, 0x95, 0x9f, 0xa9, 0x18, 0x34, 0x12, 0x18, 0x5c, 0xc9, 0x68, + 0x7f, 0x34, 0x02, 0xbf, 0x01, 0x78, 0x52, 0x49, 0x73, 0x40, 0xe0, 0x4e, 0x1c, 0x81, 0xf9, 0x6c, + 0x31, 0xa5, 0x1c, 0xff, 0x5a, 0x18, 0xca, 0x58, 0xf5, 0x32, 0x5e, 0x90, 0xb4, 0xbd, 0x0b, 0x92, + 0xf1, 0x2d, 0x80, 0xa7, 0xe2, 0x89, 0xdd, 0xcf, 0x4f, 0xc1, 0x73, 0xb0, 0x4c, 0xc2, 0x9f, 0x92, + 0x93, 0x3f, 0xa4, 0x44, 0x7e, 0x65, 0x46, 0x51, 0x5d, 0x58, 0x05, 0x8f, 0xa5, 0x57, 0xc1, 0x3a, + 0xda, 0xda, 0xad, 0x4c, 0x3c, 0xdc, 0xad, 0x4c, 0x6c, 0xef, 0x56, 0x26, 0xbe, 0xec, 0x57, 0xc0, + 0x56, 0xbf, 0x02, 0x1e, 0xf6, 0x2b, 0x60, 0xbb, 0x5f, 0x01, 0x7f, 0xf7, 0x2b, 0xe0, 0x9b, 0x7f, + 0x2a, 0x13, 0xb7, 0xcf, 0x8f, 0xfd, 0x97, 0xe8, 0x5a, 0x6f, 0xf6, 0xbf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xb9, 0x8b, 0x96, 0x83, 0x39, 0x1f, 0x00, 0x00, +} + +func (m *Catalog) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Catalog) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Catalog) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CatalogList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CatalogList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CatalogList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Connector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Connector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Connector) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ConnectorList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConnectorList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConnectorList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Environment) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Environment) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Environment) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EnvironmentList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EnvironmentList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EnvironmentList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EnvironmentSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EnvironmentSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EnvironmentSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + i -= len(m.DisplayName) + copy(dAtA[i:], m.DisplayName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.DisplayName))) + i-- + dAtA[i] = 0x12 + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EnvironmentStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EnvironmentStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EnvironmentStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Phase) + copy(dAtA[i:], m.Phase) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Phase))) + i-- + dAtA[i] = 0x12 + i -= len(m.Project) + copy(dAtA[i:], m.Project) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Project))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *FileExample) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FileExample) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FileExample) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *FileExampleList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FileExampleList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FileExampleList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *FileExampleStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FileExampleStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FileExampleStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Content) + copy(dAtA[i:], m.Content) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Content))) + i-- + dAtA[i] = 0x1a + i -= len(m.Readme) + copy(dAtA[i:], m.Readme) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Readme))) + i-- + dAtA[i] = 0x12 + i -= len(m.Icon) + copy(dAtA[i:], m.Icon) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Icon))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Project) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Project) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Project) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProjectList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProjectList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProjectList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProjectSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProjectSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProjectSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + i -= len(m.DisplayName) + copy(dAtA[i:], m.DisplayName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.DisplayName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProjectStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProjectStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProjectStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Phase) + copy(dAtA[i:], m.Phase) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Phase))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProjectSubject) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProjectSubject) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProjectSubject) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Role) + copy(dAtA[i:], m.Role) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Role))) + i-- + dAtA[i] = 0x1a + i -= len(m.Kind) + copy(dAtA[i:], m.Kind) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProjectSubjects) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProjectSubjects) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProjectSubjects) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Resource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Resource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceComponent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceComponent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceComponent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceComponents) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceComponents) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceComponents) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceDefinition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceDefinition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceDefinitionList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceDefinitionList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceDefinitionList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceRun) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceRun) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceRun) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceRunList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceRunList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceRunList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Setting) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Setting) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Setting) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SettingList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SettingList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SettingList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SettingSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SettingSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SettingSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + i -= len(*m.Value) + copy(dAtA[i:], *m.Value) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SettingStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SettingStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SettingStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x2a + i-- + if m.Sensitive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + i-- + if m.Editable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + i-- + if m.Hidden { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Template) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Template) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Template) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TemplateList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TemplateList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TemplateList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Variable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Variable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Variable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *VariableList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VariableList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VariableList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *VariableSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VariableSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VariableSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i-- + if m.Sensitive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + if m.Value != nil { + i -= len(*m.Value) + copy(dAtA[i:], *m.Value) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Value))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VariableStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VariableStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VariableStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + i -= len(m.Environment) + copy(dAtA[i:], m.Environment) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Environment))) + i-- + dAtA[i] = 0x12 + i -= len(m.Project) + copy(dAtA[i:], m.Project) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Project))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Catalog) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *CatalogList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Connector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ConnectorList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Environment) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *EnvironmentList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *EnvironmentSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.DisplayName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Description) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *EnvironmentStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Project) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Phase) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *FileExample) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *FileExampleList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *FileExampleStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Icon) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Readme) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Content) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Project) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ProjectList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ProjectSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DisplayName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Description) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ProjectStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Phase) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ProjectSubject) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Kind) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Role) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ProjectSubjects) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Resource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceComponent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceComponents) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourceDefinition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceDefinitionList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourceList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourceRun) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceRunList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Setting) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *SettingList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *SettingSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + l = len(*m.Value) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *SettingStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Description) + n += 1 + l + sovGenerated(uint64(l)) + n += 2 + n += 2 + n += 2 + l = len(m.Value) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Template) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TemplateList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Variable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *VariableList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *VariableSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + l = len(*m.Value) + n += 1 + l + sovGenerated(uint64(l)) + } + n += 2 + return n +} + +func (m *VariableStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Project) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Environment) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Value) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Catalog) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Catalog{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Spec), "CatalogSpec", "v11.CatalogSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Status), "CatalogStatus", "v11.CatalogStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CatalogList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Catalog{" + for _, f := range this.Items { + repeatedStringForItems += fmt.Sprintf("%v", f) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&CatalogList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Connector) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Connector{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Spec), "ConnectorSpec", "v11.ConnectorSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Status), "ConnectorStatus", "v11.ConnectorStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ConnectorList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Connector{" + for _, f := range this.Items { + repeatedStringForItems += fmt.Sprintf("%v", f) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ConnectorList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Environment) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Environment{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "EnvironmentSpec", "EnvironmentSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "EnvironmentStatus", "EnvironmentStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *EnvironmentList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Environment{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Environment", "Environment", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&EnvironmentList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *EnvironmentSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EnvironmentSpec{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `DisplayName:` + fmt.Sprintf("%v", this.DisplayName) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `}`, + }, "") + return s +} +func (this *EnvironmentStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EnvironmentStatus{`, + `Project:` + fmt.Sprintf("%v", this.Project) + `,`, + `Phase:` + fmt.Sprintf("%v", this.Phase) + `,`, + `}`, + }, "") + return s +} +func (this *FileExample) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FileExample{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "FileExampleStatus", "FileExampleStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *FileExampleList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]FileExample{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "FileExample", "FileExample", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&FileExampleList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *FileExampleStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FileExampleStatus{`, + `Icon:` + fmt.Sprintf("%v", this.Icon) + `,`, + `Readme:` + fmt.Sprintf("%v", this.Readme) + `,`, + `Content:` + fmt.Sprintf("%v", this.Content) + `,`, + `}`, + }, "") + return s +} +func (this *Project) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Project{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ProjectSpec", "ProjectSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ProjectStatus", "ProjectStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ProjectList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Project{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Project", "Project", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ProjectList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ProjectSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ProjectSpec{`, + `DisplayName:` + fmt.Sprintf("%v", this.DisplayName) + `,`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `}`, + }, "") + return s +} +func (this *ProjectStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ProjectStatus{`, + `Phase:` + fmt.Sprintf("%v", this.Phase) + `,`, + `}`, + }, "") + return s +} +func (this *ProjectSubject) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ProjectSubject{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Role:` + fmt.Sprintf("%v", this.Role) + `,`, + `}`, + }, "") + return s +} +func (this *ProjectSubjects) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ProjectSubject{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ProjectSubject", "ProjectSubject", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ProjectSubjects{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Resource) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Resource{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Spec), "ResourceSpec", "v11.ResourceSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Status), "ResourceStatus", "v11.ResourceStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceComponent) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceComponent{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceComponents) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ResourceComponent{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ResourceComponent", "ResourceComponent", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceComponents{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourceDefinition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceDefinition{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Spec), "ResourceDefinitionSpec", "v11.ResourceDefinitionSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Status), "ResourceDefinitionStatus", "v11.ResourceDefinitionStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceDefinitionList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ResourceDefinition{" + for _, f := range this.Items { + repeatedStringForItems += fmt.Sprintf("%v", f) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceDefinitionList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourceList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Resource{" + for _, f := range this.Items { + repeatedStringForItems += fmt.Sprintf("%v", f) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourceRun) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceRun{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Spec), "ResourceDefinitionSpec", "v11.ResourceDefinitionSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Status), "ResourceDefinitionStatus", "v11.ResourceDefinitionStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceRunList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ResourceRun{" + for _, f := range this.Items { + repeatedStringForItems += fmt.Sprintf("%v", f) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceRunList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Setting) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Setting{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "SettingSpec", "SettingSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "SettingStatus", "SettingStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *SettingList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Setting{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Setting", "Setting", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&SettingList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *SettingSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SettingSpec{`, + `Value:` + valueToStringGenerated(this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *SettingStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SettingStatus{`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `Hidden:` + fmt.Sprintf("%v", this.Hidden) + `,`, + `Editable:` + fmt.Sprintf("%v", this.Editable) + `,`, + `Sensitive:` + fmt.Sprintf("%v", this.Sensitive) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *Template) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Template{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Spec), "TemplateSpec", "v11.TemplateSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Status), "TemplateStatus", "v11.TemplateStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Template{" + for _, f := range this.Items { + repeatedStringForItems += fmt.Sprintf("%v", f) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&TemplateList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Variable) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Variable{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VariableSpec", "VariableSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VariableStatus", "VariableStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *VariableList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Variable{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Variable", "Variable", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&VariableList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *VariableSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&VariableSpec{`, + `Value:` + valueToStringGenerated(this.Value) + `,`, + `Sensitive:` + fmt.Sprintf("%v", this.Sensitive) + `,`, + `}`, + }, "") + return s +} +func (this *VariableStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&VariableStatus{`, + `Project:` + fmt.Sprintf("%v", this.Project) + `,`, + `Environment:` + fmt.Sprintf("%v", this.Environment) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Catalog) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Catalog: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Catalog: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CatalogList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CatalogList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CatalogList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, v11.Catalog{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Connector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Connector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Connector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConnectorList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConnectorList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConnectorList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, v11.Connector{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Environment) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Environment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Environment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EnvironmentList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EnvironmentList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnvironmentList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Environment{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EnvironmentSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EnvironmentSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnvironmentSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = EnvironmentType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EnvironmentStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EnvironmentStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EnvironmentStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Project", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Project = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Phase = k8s_io_api_core_v1.NamespacePhase(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FileExample) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FileExample: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FileExample: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FileExampleList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FileExampleList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FileExampleList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, FileExample{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FileExampleStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FileExampleStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FileExampleStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Icon", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Icon = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Readme", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Readme = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Content = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Project) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Project: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Project: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProjectList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProjectList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProjectList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Project{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProjectSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProjectSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProjectSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProjectStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProjectStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProjectStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Phase", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Phase = k8s_io_api_core_v1.NamespacePhase(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProjectSubject) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProjectSubject: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProjectSubject: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Role = ProjectSubjectRole(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProjectSubjects) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProjectSubjects: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProjectSubjects: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, ProjectSubject{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Resource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Resource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceComponent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceComponent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceComponent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceComponents) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceComponents: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceComponents: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, ResourceComponent{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceDefinition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceDefinition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceDefinition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceDefinitionList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceDefinitionList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceDefinitionList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, v11.ResourceDefinition{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, v11.Resource{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceRun) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceRun: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceRun: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceRunList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceRunList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceRunList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, v11.ResourceRun{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Setting) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Setting: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Setting: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SettingList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SettingList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SettingList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Setting{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SettingSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SettingSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SettingSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Value = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SettingStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SettingStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SettingStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hidden", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Hidden = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Editable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Editable = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sensitive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sensitive = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Template) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Template: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Template: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, v11.Template{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Variable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Variable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Variable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VariableList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VariableList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VariableList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Variable{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VariableSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VariableSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VariableSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Value = &s + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sensitive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sensitive = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VariableStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VariableStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VariableStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Project", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Project = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Environment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Environment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/pkg/apis/walrus/v1/generated.proto b/pkg/apis/walrus/v1/generated.proto new file mode 100644 index 000000000..89109b4c5 --- /dev/null +++ b/pkg/apis/walrus/v1/generated.proto @@ -0,0 +1,428 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package github.com.seal_io.walrus.pkg.apis.walrus.v1; + +import "github.com/seal-io/walrus/pkg/apis/walruscore/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "github.com/seal-io/walrus/pkg/apis/walrus/v1"; + +// Catalog is the schema for the catalogs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],subResources=["status"] +message Catalog { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.CatalogSpec spec = 2; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.CatalogStatus status = 3; +} + +// CatalogList holds the list of Catalog. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message CatalogList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated github.com.seal_io.walrus.pkg.apis.walruscore.v1.Catalog items = 2; +} + +// Connector is the schema for the connectors API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["conn"],subResources=["status"] +message Connector { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ConnectorSpec spec = 2; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ConnectorStatus status = 3; +} + +// ConnectorList holds the list of Connector. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ConnectorList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated github.com.seal_io.walrus.pkg.apis.walruscore.v1.Connector items = 2; +} + +// Environment is the schema for the environments API. +// +// +genclient +// +genclient:onlyVerbs=create,get,list,watch,apply,update,patch,delete,deleteCollection +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["env"] +message Environment { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional EnvironmentSpec spec = 2; + + optional EnvironmentStatus status = 3; +} + +// EnvironmentList holds the list of Environment. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message EnvironmentList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Environment items = 2; +} + +// EnvironmentSpec defines the desired state of Environment. +message EnvironmentSpec { + // Type is the type of the environment. + // + // +k8s:validation:enum=["development","staging","production"] + optional string type = 1; + + // DisplayName is the display name of the environment. + optional string displayName = 2; + + // Description is the description of the environment. + optional string description = 3; +} + +// EnvironmentStatus defines the observed state of Environment. +message EnvironmentStatus { + // Project is the project that the environment belongs to. + optional string project = 1; + + // Phase is the current phase of the environment. + optional string phase = 2; +} + +// FileExample is the schema for the file example API. +// +// +genclient +// +genclient:onlyVerbs=get,list +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"] +message FileExample { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional FileExampleStatus status = 2; +} + +// FileExampleList holds the list of FileExample. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message FileExampleList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated FileExample items = 2; +} + +// FileExampleStatus defines the observed state of FileExample. +message FileExampleStatus { + // Icon is the icon of the file example. + optional string icon = 1; + + // Readme is the readme of the file example. + optional string readme = 2; + + // Content is the content of the file example. + optional string content = 3; +} + +// Project is the schema for the projects API. +// +// +genclient +// +genclient:onlyVerbs=create,get,list,watch,apply,update,patch,delete,deleteCollection +// +genclient:method=GetSubjects,verb=get,subresource=subjects,result=ProjectSubjects +// +genclient:method=UpdateSubjects,verb=update,subresource=subjects,input=ProjectSubjects,result=ProjectSubjects +// +genclient:method=PatchSubjects,verb=update,subresource=subjects,input=ProjectSubjects,result=ProjectSubjects +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["proj"] +message Project { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // +optional + optional ProjectSpec spec = 2; + + optional ProjectStatus status = 3; +} + +// ProjectList holds the list of Project. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ProjectList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Project items = 2; +} + +// ProjectSpec defines the desired state of Project. +message ProjectSpec { + // DisplayName is the display name of the project. + optional string displayName = 1; + + // Description is the description of the project. + optional string description = 2; +} + +// ProjectStatus defines the observed state of Project. +message ProjectStatus { + // Phase is the current phase of the project. + optional string phase = 1; +} + +// ProjectSubject is the schema for the project subject API. +message ProjectSubject { + // Name is the name of the subject. + optional string name = 1; + + // Kind is the kind of the subject. + optional string kind = 2; + + // Role is the role of the subject. + // + // +k8s:validation:enum=["walrus-project-viewer","walrus-project-member","walrus-project-owner"] + optional string role = 3; +} + +// ProjectSubjects holds the list of ProjectSubject. +// +// ProjectSubjects is the subresource of Project. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["projsub"] +message ProjectSubjects { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + repeated ProjectSubject items = 2; +} + +// Resource is the schema for the resources API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["res"],subResources=["status"] +message Resource { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceSpec spec = 2; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceStatus status = 3; +} + +// ResourceComponent is the schema for the resource component API. +message ResourceComponent { + // Name is the name of the component. + optional string name = 1; +} + +// ResourceComponents holds the list of ResourceComponent. +// +// ResourceComponents is the subresource of Resource. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["rescomp"] +message ResourceComponents { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + repeated ResourceComponent items = 2; +} + +// ResourceDefinition is the schema for the resource definitions API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["resdef"],subResources=["status"] +message ResourceDefinition { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionSpec spec = 2; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionStatus status = 3; +} + +// ResourceDefinitionList holds the list of ResourceDefinition. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ResourceDefinitionList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinition items = 2; +} + +// ResourceList holds the list of Resource. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ResourceList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated github.com.seal_io.walrus.pkg.apis.walruscore.v1.Resource items = 2; +} + +// ResourceRun is the schema for the resource runs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["resrun"],subResources=["status"] +message ResourceRun { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionSpec spec = 2; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionStatus status = 3; +} + +// ResourceRunList holds the list of ResourceRun. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ResourceRunList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceRun items = 2; +} + +// Setting is the schema for the settings API. +// +// +genclient +// +genclient:onlyVerbs=get,list,watch,apply,update,patch +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["set"] +message Setting { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional SettingSpec spec = 2; + + optional SettingStatus status = 3; +} + +// SettingList holds the list of Setting. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message SettingList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Setting items = 2; +} + +// SettingSpec defines the desired state of Setting. +message SettingSpec { + // Value contains the configuration data, + // it is provided as a write-only input field. + optional string value = 1; +} + +// SettingStatus defines the observed state of Setting. +message SettingStatus { + // Description is the description of the settings, + // it is readonly. + optional string description = 1; + + // Hidden indicates whether the setting is hidden on UI, + // it is readonly. + optional bool hidden = 2; + + // Editable indicates whether the setting is editable on UI, + // it is readonly. + optional bool editable = 3; + + // Sensitive indicates whether the setting is sensitive, + // it is readonly. + optional bool sensitive = 4; + + // Value is the current value of the setting, + // it is provided as a read-only output field. + // + // "(sensitive)" returns if the setting is sensitive. + optional string value = 5; +} + +// Template is the schema for the templates API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["tpl"],subResources=["status"] +message Template { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.TemplateSpec spec = 2; + + optional github.com.seal_io.walrus.pkg.apis.walruscore.v1.TemplateStatus status = 3; +} + +// TemplateList holds the list of Template. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message TemplateList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated github.com.seal_io.walrus.pkg.apis.walruscore.v1.Template items = 2; +} + +// Variable is the schema for the variables API. +// +// +genclient +// +genclient:onlyVerbs=create,get,list,watch,apply,update,patch,delete,deleteCollection +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["var"] +message Variable { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional VariableSpec spec = 2; + + optional VariableStatus status = 3; +} + +// VariableList holds the list of Variable. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message VariableList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Variable items = 2; +} + +// VariableSpec defines the desired state of Variable. +message VariableSpec { + // Value contains the configuration data, + // it is provided as a write-only input field. + optional string value = 1; + + // Sensitive indicates whether the variable is sensitive. + optional bool sensitive = 2; +} + +// VariableStatus defines the observed state of Variable. +message VariableStatus { + // Project is the project that the variable belongs to. + optional string project = 1; + + // Environment is the environment that the variable belongs to. + optional string environment = 2; + + // Value is the current value of the setting, + // it is provided as a read-only output field. + // + // "(sensitive)" returns if the variable is sensitive. + optional string value = 3; +} + diff --git a/pkg/apis/walrus/v1/project.go b/pkg/apis/walrus/v1/project.go new file mode 100644 index 000000000..a3bc2db80 --- /dev/null +++ b/pkg/apis/walrus/v1/project.go @@ -0,0 +1,61 @@ +package v1 + +import ( + "reflect" + + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Project is the schema for the projects API. +// +// +genclient +// +genclient:onlyVerbs=create,get,list,watch,apply,update,patch,delete,deleteCollection +// +genclient:method=GetSubjects,verb=get,subresource=subjects,result=ProjectSubjects +// +genclient:method=UpdateSubjects,verb=update,subresource=subjects,input=ProjectSubjects,result=ProjectSubjects +// +genclient:method=PatchSubjects,verb=update,subresource=subjects,input=ProjectSubjects,result=ProjectSubjects +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["proj"] +type Project struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec ProjectSpec `json:"spec,omitempty"` + Status ProjectStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Project)(nil) + +// ProjectSpec defines the desired state of Project. +type ProjectSpec struct { + // DisplayName is the display name of the project. + DisplayName string `json:"displayName,omitempty"` + + // Description is the description of the project. + Description string `json:"description,omitempty"` +} + +// ProjectStatus defines the observed state of Project. +type ProjectStatus struct { + // Phase is the current phase of the project. + Phase core.NamespacePhase `json:"phase"` +} + +func (in *Project) Equal(in2 *Project) bool { + return reflect.DeepEqual(in.Spec, in2.Spec) && + in.Status.Phase == in2.Status.Phase +} + +// ProjectList holds the list of Project. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProjectList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Project `json:"items"` +} + +var _ runtime.Object = (*ProjectList)(nil) diff --git a/pkg/apis/walrus/v1/project.subjects.go b/pkg/apis/walrus/v1/project.subjects.go new file mode 100644 index 000000000..908e57103 --- /dev/null +++ b/pkg/apis/walrus/v1/project.subjects.go @@ -0,0 +1,69 @@ +package v1 + +import ( + "errors" + + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ProjectSubjects holds the list of ProjectSubject. +// +// ProjectSubjects is the subresource of Project. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["projsub"] +type ProjectSubjects struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + Items []ProjectSubject `json:"items,omitempty" patchStrategy:"merge" patchMergeKey:"name"` +} + +var _ runtime.Object = (*ProjectSubjects)(nil) + +// ProjectSubjectRole describes the role of project subject. +// +enum +type ProjectSubjectRole string + +const ( + // ProjectSubjectRoleViewer is the subject role for project viewer. + ProjectSubjectRoleViewer ProjectSubjectRole = "walrus-project-viewer" + // ProjectSubjectRoleMember is the subject role for project member. + ProjectSubjectRoleMember ProjectSubjectRole = "walrus-project-member" + // ProjectSubjectRoleOwner is the subject role for project owner. + ProjectSubjectRoleOwner ProjectSubjectRole = "walrus-project-owner" +) + +func (in ProjectSubjectRole) String() string { + return string(in) +} + +func (in ProjectSubjectRole) Validate() error { + switch in { + case ProjectSubjectRoleViewer, ProjectSubjectRoleMember, ProjectSubjectRoleOwner: + return nil + default: + return errors.New("invalid project subject role") + } +} + +// ProjectSubject is the schema for the project subject API. +type ProjectSubject struct { + /* NB(thxCode): All attributes must be comparable. */ + + // Name is the name of the subject. + Name string `json:"name"` + + // Kind is the kind of the subject. + Kind string `json:"kind,omitempty"` + + // Role is the role of the subject. + // + // +k8s:validation:enum=["walrus-project-viewer","walrus-project-member","walrus-project-owner"] + Role ProjectSubjectRole `json:"role"` +} diff --git a/pkg/apis/walrus/v1/resource.components.go b/pkg/apis/walrus/v1/resource.components.go new file mode 100644 index 000000000..4f0a58b4b --- /dev/null +++ b/pkg/apis/walrus/v1/resource.components.go @@ -0,0 +1,33 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ResourceComponents holds the list of ResourceComponent. +// +// ResourceComponents is the subresource of Resource. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["rescomp"] +type ResourceComponents struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + // +patchStrategy=merge + // +patchMergeKey=name + // +listType=map + // +listMapKey=name + Items []ResourceComponent `json:"items,omitempty" patchStrategy:"merge" patchMergeKey:"name"` +} + +var _ runtime.Object = (*ResourceComponents)(nil) + +// ResourceComponent is the schema for the resource component API. +type ResourceComponent struct { + /* NB(thxCode): All attributes must be comparable. */ + + // Name is the name of the component. + Name string `json:"name"` +} diff --git a/pkg/apis/walrus/v1/resource.go b/pkg/apis/walrus/v1/resource.go new file mode 100644 index 000000000..6ad5c5c5a --- /dev/null +++ b/pkg/apis/walrus/v1/resource.go @@ -0,0 +1,23 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" +) + +// Resource is the schema for the resources API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["res"],subResources=["status"] +type Resource walruscore.Resource + +var _ runtime.Object = (*Resource)(nil) + +// ResourceList holds the list of Resource. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceList walruscore.ResourceList + +var _ runtime.Object = (*ResourceList)(nil) diff --git a/pkg/apis/walrus/v1/resource_definition.go b/pkg/apis/walrus/v1/resource_definition.go new file mode 100644 index 000000000..9e2feb4c5 --- /dev/null +++ b/pkg/apis/walrus/v1/resource_definition.go @@ -0,0 +1,23 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" +) + +// ResourceDefinition is the schema for the resource definitions API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["resdef"],subResources=["status"] +type ResourceDefinition walruscore.ResourceDefinition + +var _ runtime.Object = (*ResourceDefinition)(nil) + +// ResourceDefinitionList holds the list of ResourceDefinition. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceDefinitionList walruscore.ResourceDefinitionList + +var _ runtime.Object = (*ResourceDefinitionList)(nil) diff --git a/pkg/apis/walrus/v1/resource_run.go b/pkg/apis/walrus/v1/resource_run.go new file mode 100644 index 000000000..59166f63f --- /dev/null +++ b/pkg/apis/walrus/v1/resource_run.go @@ -0,0 +1,23 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" +) + +// ResourceRun is the schema for the resource runs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["resrun"],subResources=["status"] +type ResourceRun walruscore.ResourceRun + +var _ runtime.Object = (*ResourceRun)(nil) + +// ResourceRunList holds the list of ResourceRun. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceRunList walruscore.ResourceRunList + +var _ runtime.Object = (*ResourceRunList)(nil) diff --git a/pkg/apis/walrus/v1/setting.go b/pkg/apis/walrus/v1/setting.go new file mode 100644 index 000000000..26535d571 --- /dev/null +++ b/pkg/apis/walrus/v1/setting.go @@ -0,0 +1,75 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Setting is the schema for the settings API. +// +// +genclient +// +genclient:onlyVerbs=get,list,watch,apply,update,patch +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["set"] +type Setting struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec SettingSpec `json:"spec,omitempty"` + Status SettingStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Setting)(nil) + +// SettingSpec defines the desired state of Setting. +type SettingSpec struct { + // Value contains the configuration data, + // it is provided as a write-only input field. + Value *string `json:"value,omitempty"` +} + +// SettingStatus defines the observed state of Setting. +type SettingStatus struct { + // Description is the description of the settings, + // it is readonly. + Description string `json:"description,omitempty"` + + // Hidden indicates whether the setting is hidden on UI, + // it is readonly. + Hidden bool `json:"hidden"` + + // Editable indicates whether the setting is editable on UI, + // it is readonly. + Editable bool `json:"editable"` + + // Sensitive indicates whether the setting is sensitive, + // it is readonly. + Sensitive bool `json:"sensitive"` + + // Value is the current value of the setting, + // it is provided as a read-only output field. + // + // "(sensitive)" returns if the setting is sensitive. + Value string `json:"value"` + // Value_ is the shadow of the Value, + // it is provided for system processing only. + // + // DO NOT EXPOSE AND STORE IT. + Value_ string `json:"-"` +} + +func (in *Setting) Equal(in2 *Setting) bool { + return in.Status.Value_ == in2.Status.Value_ +} + +// SettingList holds the list of Setting. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SettingList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Setting `json:"items"` +} + +var _ runtime.Object = (*SettingList)(nil) diff --git a/pkg/apis/walrus/v1/template.go b/pkg/apis/walrus/v1/template.go new file mode 100644 index 000000000..e352f7a16 --- /dev/null +++ b/pkg/apis/walrus/v1/template.go @@ -0,0 +1,23 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" +) + +// Template is the schema for the templates API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["tpl"],subResources=["status"] +type Template walruscore.Template + +var _ runtime.Object = (*Template)(nil) + +// TemplateList holds the list of Template. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TemplateList walruscore.TemplateList + +var _ runtime.Object = (*TemplateList)(nil) diff --git a/pkg/apis/walrus/v1/variable.go b/pkg/apis/walrus/v1/variable.go new file mode 100644 index 000000000..edb007fec --- /dev/null +++ b/pkg/apis/walrus/v1/variable.go @@ -0,0 +1,71 @@ +package v1 + +import ( + "reflect" + + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Variable is the schema for the variables API. +// +// +genclient +// +genclient:onlyVerbs=create,get,list,watch,apply,update,patch,delete,deleteCollection +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:apireg-gen:resource:scope="Namespaced",categories=["walrus"],shortName=["var"] +type Variable struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec VariableSpec `json:"spec,omitempty"` + Status VariableStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Variable)(nil) + +// VariableSpec defines the desired state of Variable. +type VariableSpec struct { + // Value contains the configuration data, + // it is provided as a write-only input field. + Value *string `json:"value,omitempty"` + + // Sensitive indicates whether the variable is sensitive. + Sensitive bool `json:"sensitive"` +} + +// VariableStatus defines the observed state of Variable. +type VariableStatus struct { + // Project is the project that the variable belongs to. + Project string `json:"project"` + + // Environment is the environment that the variable belongs to. + Environment string `json:"environment"` + + // Value is the current value of the setting, + // it is provided as a read-only output field. + // + // "(sensitive)" returns if the variable is sensitive. + Value string `json:"value"` + // Value_ is the shadow of the Value, + // it is provided for system processing only. + // + // DO NOT EXPOSE AND STORE IT. + Value_ string `json:"-"` +} + +func (in *Variable) Equal(in2 *Variable) bool { + return reflect.DeepEqual(in.Spec, in2.Spec) && + in.Status.Value_ == in2.Status.Value_ +} + +// VariableList holds the list of Variable. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type VariableList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Variable `json:"items"` +} + +var _ runtime.Object = (*VariableList)(nil) diff --git a/pkg/apis/walrus/v1/zz_generated.apiservice.go b/pkg/apis/walrus/v1/zz_generated.apiservice.go new file mode 100644 index 000000000..12910764a --- /dev/null +++ b/pkg/apis/walrus/v1/zz_generated.apiservice.go @@ -0,0 +1,529 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "bytes" + + autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + rest "k8s.io/apiserver/pkg/registry/rest" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +type ( + WithStatusSubResource interface { + v1.ObjectMetaAccessor + runtime.Object + CopyStatusTo(runtime.Object) + } + + WithScaleSubResource interface { + v1.ObjectMetaAccessor + runtime.Object + GetScale() *autoscalingv1.Scale // TODO: Main struct needs to implement this. + SetScale(*autoscalingv1.Scale) // TODO: Main struct needs to implement this. + } +) + +func GetAPIService(svc apiregistrationv1.ServiceReference, ca []byte) *apiregistrationv1.APIService { + return &apiregistrationv1.APIService{ + TypeMeta: v1.TypeMeta{ + APIVersion: "apiregistration.k8s.io/v1", + Kind: "APIService", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "v1.walrus.seal.io", + }, + Spec: apiregistrationv1.APIServiceSpec{ + Service: svc.DeepCopy(), + Group: "walrus.seal.io", + Version: "v1", + InsecureSkipTLSVerify: true, + CABundle: bytes.Clone(ca), + GroupPriorityMinimum: 100, + VersionPriority: 100, + }, + } +} + +var _ rest.Scoper = (*Catalog)(nil) + +func (*Catalog) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Catalog)(nil) + +func (*Catalog) Kind() string { + return "Catalog" +} + +var _ rest.SingularNameProvider = (*Catalog)(nil) + +func (*Catalog) GetSingularName() string { + return "catalog" +} + +var _ rest.ShortNamesProvider = (*Catalog)(nil) + +func (*Catalog) ShortNames() []string { + return []string{} +} + +var _ rest.CategoriesProvider = (*Catalog)(nil) + +func (*Catalog) Categories() []string { + return []string{ + "walrus", + } +} + +var _ WithStatusSubResource = (*Catalog)(nil) + +func (in *Catalog) CopyStatusTo(out runtime.Object) { + out.(*Catalog).Status = in.Status +} + +var _ rest.Scoper = (*Connector)(nil) + +func (*Connector) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Connector)(nil) + +func (*Connector) Kind() string { + return "Connector" +} + +var _ rest.SingularNameProvider = (*Connector)(nil) + +func (*Connector) GetSingularName() string { + return "connector" +} + +var _ rest.ShortNamesProvider = (*Connector)(nil) + +func (*Connector) ShortNames() []string { + return []string{ + "conn", + } +} + +var _ rest.CategoriesProvider = (*Connector)(nil) + +func (*Connector) Categories() []string { + return []string{ + "walrus", + } +} + +var _ WithStatusSubResource = (*Connector)(nil) + +func (in *Connector) CopyStatusTo(out runtime.Object) { + out.(*Connector).Status = in.Status +} + +var _ rest.Scoper = (*Environment)(nil) + +func (*Environment) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Environment)(nil) + +func (*Environment) Kind() string { + return "Environment" +} + +var _ rest.SingularNameProvider = (*Environment)(nil) + +func (*Environment) GetSingularName() string { + return "environment" +} + +var _ rest.ShortNamesProvider = (*Environment)(nil) + +func (*Environment) ShortNames() []string { + return []string{ + "env", + } +} + +var _ rest.CategoriesProvider = (*Environment)(nil) + +func (*Environment) Categories() []string { + return []string{ + "walrus", + } +} + +var _ rest.Scoper = (*FileExample)(nil) + +func (*FileExample) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*FileExample)(nil) + +func (*FileExample) Kind() string { + return "FileExample" +} + +var _ rest.SingularNameProvider = (*FileExample)(nil) + +func (*FileExample) GetSingularName() string { + return "fileexample" +} + +var _ rest.ShortNamesProvider = (*FileExample)(nil) + +func (*FileExample) ShortNames() []string { + return []string{} +} + +var _ rest.CategoriesProvider = (*FileExample)(nil) + +func (*FileExample) Categories() []string { + return []string{ + "walrus", + } +} + +var _ rest.Scoper = (*Project)(nil) + +func (*Project) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Project)(nil) + +func (*Project) Kind() string { + return "Project" +} + +var _ rest.SingularNameProvider = (*Project)(nil) + +func (*Project) GetSingularName() string { + return "project" +} + +var _ rest.ShortNamesProvider = (*Project)(nil) + +func (*Project) ShortNames() []string { + return []string{ + "proj", + } +} + +var _ rest.CategoriesProvider = (*Project)(nil) + +func (*Project) Categories() []string { + return []string{ + "walrus", + } +} + +var _ rest.Scoper = (*ProjectSubjects)(nil) + +func (*ProjectSubjects) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*ProjectSubjects)(nil) + +func (*ProjectSubjects) Kind() string { + return "ProjectSubjects" +} + +var _ rest.SingularNameProvider = (*ProjectSubjects)(nil) + +func (*ProjectSubjects) GetSingularName() string { + return "projectsubjects" +} + +var _ rest.ShortNamesProvider = (*ProjectSubjects)(nil) + +func (*ProjectSubjects) ShortNames() []string { + return []string{ + "projsub", + } +} + +var _ rest.CategoriesProvider = (*ProjectSubjects)(nil) + +func (*ProjectSubjects) Categories() []string { + return []string{ + "walrus", + } +} + +var _ rest.Scoper = (*Resource)(nil) + +func (*Resource) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Resource)(nil) + +func (*Resource) Kind() string { + return "Resource" +} + +var _ rest.SingularNameProvider = (*Resource)(nil) + +func (*Resource) GetSingularName() string { + return "resource" +} + +var _ rest.ShortNamesProvider = (*Resource)(nil) + +func (*Resource) ShortNames() []string { + return []string{ + "res", + } +} + +var _ rest.CategoriesProvider = (*Resource)(nil) + +func (*Resource) Categories() []string { + return []string{ + "walrus", + } +} + +var _ WithStatusSubResource = (*Resource)(nil) + +func (in *Resource) CopyStatusTo(out runtime.Object) { + out.(*Resource).Status = in.Status +} + +var _ rest.Scoper = (*ResourceComponents)(nil) + +func (*ResourceComponents) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*ResourceComponents)(nil) + +func (*ResourceComponents) Kind() string { + return "ResourceComponents" +} + +var _ rest.SingularNameProvider = (*ResourceComponents)(nil) + +func (*ResourceComponents) GetSingularName() string { + return "resourcecomponents" +} + +var _ rest.ShortNamesProvider = (*ResourceComponents)(nil) + +func (*ResourceComponents) ShortNames() []string { + return []string{ + "rescomp", + } +} + +var _ rest.CategoriesProvider = (*ResourceComponents)(nil) + +func (*ResourceComponents) Categories() []string { + return []string{ + "walrus", + } +} + +var _ rest.Scoper = (*ResourceDefinition)(nil) + +func (*ResourceDefinition) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*ResourceDefinition)(nil) + +func (*ResourceDefinition) Kind() string { + return "ResourceDefinition" +} + +var _ rest.SingularNameProvider = (*ResourceDefinition)(nil) + +func (*ResourceDefinition) GetSingularName() string { + return "resourcedefinition" +} + +var _ rest.ShortNamesProvider = (*ResourceDefinition)(nil) + +func (*ResourceDefinition) ShortNames() []string { + return []string{ + "resdef", + } +} + +var _ rest.CategoriesProvider = (*ResourceDefinition)(nil) + +func (*ResourceDefinition) Categories() []string { + return []string{ + "walrus", + } +} + +var _ WithStatusSubResource = (*ResourceDefinition)(nil) + +func (in *ResourceDefinition) CopyStatusTo(out runtime.Object) { + out.(*ResourceDefinition).Status = in.Status +} + +var _ rest.Scoper = (*ResourceRun)(nil) + +func (*ResourceRun) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*ResourceRun)(nil) + +func (*ResourceRun) Kind() string { + return "ResourceRun" +} + +var _ rest.SingularNameProvider = (*ResourceRun)(nil) + +func (*ResourceRun) GetSingularName() string { + return "resourcerun" +} + +var _ rest.ShortNamesProvider = (*ResourceRun)(nil) + +func (*ResourceRun) ShortNames() []string { + return []string{ + "resrun", + } +} + +var _ rest.CategoriesProvider = (*ResourceRun)(nil) + +func (*ResourceRun) Categories() []string { + return []string{ + "walrus", + } +} + +var _ WithStatusSubResource = (*ResourceRun)(nil) + +func (in *ResourceRun) CopyStatusTo(out runtime.Object) { + out.(*ResourceRun).Status = in.Status +} + +var _ rest.Scoper = (*Setting)(nil) + +func (*Setting) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Setting)(nil) + +func (*Setting) Kind() string { + return "Setting" +} + +var _ rest.SingularNameProvider = (*Setting)(nil) + +func (*Setting) GetSingularName() string { + return "setting" +} + +var _ rest.ShortNamesProvider = (*Setting)(nil) + +func (*Setting) ShortNames() []string { + return []string{ + "set", + } +} + +var _ rest.CategoriesProvider = (*Setting)(nil) + +func (*Setting) Categories() []string { + return []string{ + "walrus", + } +} + +var _ rest.Scoper = (*Template)(nil) + +func (*Template) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Template)(nil) + +func (*Template) Kind() string { + return "Template" +} + +var _ rest.SingularNameProvider = (*Template)(nil) + +func (*Template) GetSingularName() string { + return "template" +} + +var _ rest.ShortNamesProvider = (*Template)(nil) + +func (*Template) ShortNames() []string { + return []string{ + "tpl", + } +} + +var _ rest.CategoriesProvider = (*Template)(nil) + +func (*Template) Categories() []string { + return []string{ + "walrus", + } +} + +var _ WithStatusSubResource = (*Template)(nil) + +func (in *Template) CopyStatusTo(out runtime.Object) { + out.(*Template).Status = in.Status +} + +var _ rest.Scoper = (*Variable)(nil) + +func (*Variable) NamespaceScoped() bool { + return true +} + +var _ rest.KindProvider = (*Variable)(nil) + +func (*Variable) Kind() string { + return "Variable" +} + +var _ rest.SingularNameProvider = (*Variable)(nil) + +func (*Variable) GetSingularName() string { + return "variable" +} + +var _ rest.ShortNamesProvider = (*Variable)(nil) + +func (*Variable) ShortNames() []string { + return []string{ + "var", + } +} + +var _ rest.CategoriesProvider = (*Variable)(nil) + +func (*Variable) Categories() []string { + return []string{ + "walrus", + } +} diff --git a/pkg/apis/walrus/v1/zz_generated.deepcopy.go b/pkg/apis/walrus/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..655708ce9 --- /dev/null +++ b/pkg/apis/walrus/v1/zz_generated.deepcopy.go @@ -0,0 +1,932 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Catalog) DeepCopyInto(out *Catalog) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Catalog. +func (in *Catalog) DeepCopy() *Catalog { + if in == nil { + return nil + } + out := new(Catalog) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Catalog) 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 *CatalogList) DeepCopyInto(out *CatalogList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]walruscorev1.Catalog, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogList. +func (in *CatalogList) DeepCopy() *CatalogList { + if in == nil { + return nil + } + out := new(CatalogList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogList) 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 *Connector) DeepCopyInto(out *Connector) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Connector. +func (in *Connector) DeepCopy() *Connector { + if in == nil { + return nil + } + out := new(Connector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Connector) 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 *ConnectorList) DeepCopyInto(out *ConnectorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]walruscorev1.Connector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectorList. +func (in *ConnectorList) DeepCopy() *ConnectorList { + if in == nil { + return nil + } + out := new(ConnectorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConnectorList) 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 *Environment) DeepCopyInto(out *Environment) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Environment. +func (in *Environment) DeepCopy() *Environment { + if in == nil { + return nil + } + out := new(Environment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Environment) 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 *EnvironmentList) DeepCopyInto(out *EnvironmentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Environment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentList. +func (in *EnvironmentList) DeepCopy() *EnvironmentList { + if in == nil { + return nil + } + out := new(EnvironmentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EnvironmentList) 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 *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentSpec. +func (in *EnvironmentSpec) DeepCopy() *EnvironmentSpec { + if in == nil { + return nil + } + out := new(EnvironmentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvironmentStatus) DeepCopyInto(out *EnvironmentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvironmentStatus. +func (in *EnvironmentStatus) DeepCopy() *EnvironmentStatus { + if in == nil { + return nil + } + out := new(EnvironmentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileExample) DeepCopyInto(out *FileExample) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileExample. +func (in *FileExample) DeepCopy() *FileExample { + if in == nil { + return nil + } + out := new(FileExample) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FileExample) 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 *FileExampleList) DeepCopyInto(out *FileExampleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FileExample, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileExampleList. +func (in *FileExampleList) DeepCopy() *FileExampleList { + if in == nil { + return nil + } + out := new(FileExampleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FileExampleList) 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 *FileExampleStatus) DeepCopyInto(out *FileExampleStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileExampleStatus. +func (in *FileExampleStatus) DeepCopy() *FileExampleStatus { + if in == nil { + return nil + } + out := new(FileExampleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Project) DeepCopyInto(out *Project) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Project. +func (in *Project) DeepCopy() *Project { + if in == nil { + return nil + } + out := new(Project) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Project) 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 *ProjectList) DeepCopyInto(out *ProjectList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Project, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectList. +func (in *ProjectList) DeepCopy() *ProjectList { + if in == nil { + return nil + } + out := new(ProjectList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectList) 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 *ProjectSpec) DeepCopyInto(out *ProjectSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectSpec. +func (in *ProjectSpec) DeepCopy() *ProjectSpec { + if in == nil { + return nil + } + out := new(ProjectSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectStatus) DeepCopyInto(out *ProjectStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectStatus. +func (in *ProjectStatus) DeepCopy() *ProjectStatus { + if in == nil { + return nil + } + out := new(ProjectStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectSubject) DeepCopyInto(out *ProjectSubject) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectSubject. +func (in *ProjectSubject) DeepCopy() *ProjectSubject { + if in == nil { + return nil + } + out := new(ProjectSubject) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectSubjects) DeepCopyInto(out *ProjectSubjects) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectSubject, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectSubjects. +func (in *ProjectSubjects) DeepCopy() *ProjectSubjects { + if in == nil { + return nil + } + out := new(ProjectSubjects) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectSubjects) 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 *Resource) DeepCopyInto(out *Resource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource. +func (in *Resource) DeepCopy() *Resource { + if in == nil { + return nil + } + out := new(Resource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Resource) 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 *ResourceComponent) DeepCopyInto(out *ResourceComponent) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceComponent. +func (in *ResourceComponent) DeepCopy() *ResourceComponent { + if in == nil { + return nil + } + out := new(ResourceComponent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceComponents) DeepCopyInto(out *ResourceComponents) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceComponent, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceComponents. +func (in *ResourceComponents) DeepCopy() *ResourceComponents { + if in == nil { + return nil + } + out := new(ResourceComponents) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceComponents) 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 *ResourceDefinition) DeepCopyInto(out *ResourceDefinition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDefinition. +func (in *ResourceDefinition) DeepCopy() *ResourceDefinition { + if in == nil { + return nil + } + out := new(ResourceDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceDefinition) 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 *ResourceDefinitionList) DeepCopyInto(out *ResourceDefinitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]walruscorev1.ResourceDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDefinitionList. +func (in *ResourceDefinitionList) DeepCopy() *ResourceDefinitionList { + if in == nil { + return nil + } + out := new(ResourceDefinitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceDefinitionList) 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 *ResourceList) DeepCopyInto(out *ResourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]walruscorev1.Resource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceList. +func (in *ResourceList) DeepCopy() *ResourceList { + if in == nil { + return nil + } + out := new(ResourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceList) 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 *ResourceRun) DeepCopyInto(out *ResourceRun) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRun. +func (in *ResourceRun) DeepCopy() *ResourceRun { + if in == nil { + return nil + } + out := new(ResourceRun) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceRun) 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 *ResourceRunList) DeepCopyInto(out *ResourceRunList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]walruscorev1.ResourceRun, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRunList. +func (in *ResourceRunList) DeepCopy() *ResourceRunList { + if in == nil { + return nil + } + out := new(ResourceRunList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceRunList) 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 *Setting) DeepCopyInto(out *Setting) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Setting. +func (in *Setting) DeepCopy() *Setting { + if in == nil { + return nil + } + out := new(Setting) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Setting) 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 *SettingList) DeepCopyInto(out *SettingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Setting, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingList. +func (in *SettingList) DeepCopy() *SettingList { + if in == nil { + return nil + } + out := new(SettingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SettingList) 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 *SettingSpec) DeepCopyInto(out *SettingSpec) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingSpec. +func (in *SettingSpec) DeepCopy() *SettingSpec { + if in == nil { + return nil + } + out := new(SettingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SettingStatus) DeepCopyInto(out *SettingStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingStatus. +func (in *SettingStatus) DeepCopy() *SettingStatus { + if in == nil { + return nil + } + out := new(SettingStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Template) DeepCopyInto(out *Template) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template. +func (in *Template) DeepCopy() *Template { + if in == nil { + return nil + } + out := new(Template) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Template) 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 *TemplateList) DeepCopyInto(out *TemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]walruscorev1.Template, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateList. +func (in *TemplateList) DeepCopy() *TemplateList { + if in == nil { + return nil + } + out := new(TemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateList) 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 *Variable) DeepCopyInto(out *Variable) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Variable. +func (in *Variable) DeepCopy() *Variable { + if in == nil { + return nil + } + out := new(Variable) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Variable) 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 *VariableList) DeepCopyInto(out *VariableList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Variable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VariableList. +func (in *VariableList) DeepCopy() *VariableList { + if in == nil { + return nil + } + out := new(VariableList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VariableList) 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 *VariableSpec) DeepCopyInto(out *VariableSpec) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VariableSpec. +func (in *VariableSpec) DeepCopy() *VariableSpec { + if in == nil { + return nil + } + out := new(VariableSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VariableStatus) DeepCopyInto(out *VariableStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VariableStatus. +func (in *VariableStatus) DeepCopy() *VariableStatus { + if in == nil { + return nil + } + out := new(VariableStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/walrus/v1/zz_generated.register.go b/pkg/apis/walrus/v1/zz_generated.register.go new file mode 100644 index 000000000..79690b1aa --- /dev/null +++ b/pkg/apis/walrus/v1/zz_generated.register.go @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "walrus.seal.io" + +// SchemeGroupVersion is group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// SchemeGroupVersionResource is a convenience method to return the GroupVersionResource for a resource. +func SchemeGroupVersionResource(resource string) schema.GroupVersionResource { + return SchemeGroupVersion.WithResource(resource) +} + +// SchemeResource takes an unqualified resource and returns a Group qualified GroupResource. +func SchemeResource(resource string) schema.GroupResource { + return SchemeGroupVersionResource(resource).GroupResource() +} + +// SchemeGroupVersionKind is a convenience method to return the GroupVersionKind for a kind. +func SchemeGroupVersionKind(kind string) schema.GroupVersionKind { + return SchemeGroupVersion.WithKind(kind) +} + +// SchemeKind takes an unqualified kind and returns a Group qualified GroupKind. +func SchemeKind(kind string) schema.GroupKind { + return SchemeGroupVersionKind(kind).GroupKind() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Catalog{}, + &CatalogList{}, + &Connector{}, + &ConnectorList{}, + &Environment{}, + &EnvironmentList{}, + &FileExample{}, + &FileExampleList{}, + &Project{}, + &ProjectList{}, + &ProjectSubjects{}, + &Resource{}, + &ResourceComponents{}, + &ResourceDefinition{}, + &ResourceDefinitionList{}, + &ResourceList{}, + &ResourceRun{}, + &ResourceRunList{}, + &Setting{}, + &SettingList{}, + &Template{}, + &TemplateList{}, + &Variable{}, + &VariableList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/walruscore/doc.go b/pkg/apis/walruscore/doc.go new file mode 100644 index 000000000..800fdee17 --- /dev/null +++ b/pkg/apis/walruscore/doc.go @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package core is the core API group of the API definitions +// +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +domain=seal.io +// +groupName=walruscore.seal.io +package walruscore diff --git a/pkg/apis/walruscore/v1/catalog.go b/pkg/apis/walruscore/v1/catalog.go new file mode 100644 index 000000000..794ec2895 --- /dev/null +++ b/pkg/apis/walruscore/v1/catalog.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Catalog is the schema for the catalogs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +type Catalog struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec CatalogSpec `json:"spec,omitempty"` + Status CatalogStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Catalog)(nil) + +// CatalogSpec defines the desired state of Catalog. +type CatalogSpec struct { + // TODO: your spec here +} + +// CatalogStatus defines the observed state of Catalog. +type CatalogStatus struct { + // TODO: your status here +} + +// CatalogList holds the list of Catalog. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type CatalogList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Catalog `json:"items"` +} + +var _ runtime.Object = (*CatalogList)(nil) diff --git a/pkg/apis/walruscore/v1/connector.go b/pkg/apis/walruscore/v1/connector.go new file mode 100644 index 000000000..207c03099 --- /dev/null +++ b/pkg/apis/walruscore/v1/connector.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Connector is the schema for the connectors API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +type Connector struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec ConnectorSpec `json:"spec,omitempty"` + Status ConnectorStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Connector)(nil) + +// ConnectorSpec defines the desired state of Connector. +type ConnectorSpec struct { + // TODO: your spec here +} + +// ConnectorStatus defines the observed state of Connector. +type ConnectorStatus struct { + // TODO: your status here +} + +// ConnectorList holds the list of Connector. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ConnectorList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Connector `json:"items"` +} + +var _ runtime.Object = (*ConnectorList)(nil) diff --git a/pkg/apis/walruscore/v1/doc.go b/pkg/apis/walruscore/v1/doc.go new file mode 100644 index 000000000..596f3679f --- /dev/null +++ b/pkg/apis/walruscore/v1/doc.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package v1 is the v1 version of the API definitions for walruscore group. +// +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +domain=seal.io +// +groupName=walruscore.seal.io +// +versionName=v1 +package v1 diff --git a/pkg/apis/walruscore/v1/generated.pb.go b/pkg/apis/walruscore/v1/generated.pb.go new file mode 100644 index 000000000..adbcec08e --- /dev/null +++ b/pkg/apis/walruscore/v1/generated.pb.go @@ -0,0 +1,4544 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/apis/walruscore/v1/generated.proto + +package v1 + +import ( + fmt "fmt" + + io "io" + + proto "github.com/gogo/protobuf/proto" + + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func (m *Catalog) Reset() { *m = Catalog{} } +func (*Catalog) ProtoMessage() {} +func (*Catalog) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{0} +} +func (m *Catalog) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Catalog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Catalog) XXX_Merge(src proto.Message) { + xxx_messageInfo_Catalog.Merge(m, src) +} +func (m *Catalog) XXX_Size() int { + return m.Size() +} +func (m *Catalog) XXX_DiscardUnknown() { + xxx_messageInfo_Catalog.DiscardUnknown(m) +} + +var xxx_messageInfo_Catalog proto.InternalMessageInfo + +func (m *CatalogList) Reset() { *m = CatalogList{} } +func (*CatalogList) ProtoMessage() {} +func (*CatalogList) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{1} +} +func (m *CatalogList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CatalogList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CatalogList) XXX_Merge(src proto.Message) { + xxx_messageInfo_CatalogList.Merge(m, src) +} +func (m *CatalogList) XXX_Size() int { + return m.Size() +} +func (m *CatalogList) XXX_DiscardUnknown() { + xxx_messageInfo_CatalogList.DiscardUnknown(m) +} + +var xxx_messageInfo_CatalogList proto.InternalMessageInfo + +func (m *CatalogSpec) Reset() { *m = CatalogSpec{} } +func (*CatalogSpec) ProtoMessage() {} +func (*CatalogSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{2} +} +func (m *CatalogSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CatalogSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CatalogSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_CatalogSpec.Merge(m, src) +} +func (m *CatalogSpec) XXX_Size() int { + return m.Size() +} +func (m *CatalogSpec) XXX_DiscardUnknown() { + xxx_messageInfo_CatalogSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_CatalogSpec proto.InternalMessageInfo + +func (m *CatalogStatus) Reset() { *m = CatalogStatus{} } +func (*CatalogStatus) ProtoMessage() {} +func (*CatalogStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{3} +} +func (m *CatalogStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CatalogStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *CatalogStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_CatalogStatus.Merge(m, src) +} +func (m *CatalogStatus) XXX_Size() int { + return m.Size() +} +func (m *CatalogStatus) XXX_DiscardUnknown() { + xxx_messageInfo_CatalogStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_CatalogStatus proto.InternalMessageInfo + +func (m *Connector) Reset() { *m = Connector{} } +func (*Connector) ProtoMessage() {} +func (*Connector) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{4} +} +func (m *Connector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Connector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Connector) XXX_Merge(src proto.Message) { + xxx_messageInfo_Connector.Merge(m, src) +} +func (m *Connector) XXX_Size() int { + return m.Size() +} +func (m *Connector) XXX_DiscardUnknown() { + xxx_messageInfo_Connector.DiscardUnknown(m) +} + +var xxx_messageInfo_Connector proto.InternalMessageInfo + +func (m *ConnectorList) Reset() { *m = ConnectorList{} } +func (*ConnectorList) ProtoMessage() {} +func (*ConnectorList) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{5} +} +func (m *ConnectorList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConnectorList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ConnectorList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectorList.Merge(m, src) +} +func (m *ConnectorList) XXX_Size() int { + return m.Size() +} +func (m *ConnectorList) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectorList.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectorList proto.InternalMessageInfo + +func (m *ConnectorSpec) Reset() { *m = ConnectorSpec{} } +func (*ConnectorSpec) ProtoMessage() {} +func (*ConnectorSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{6} +} +func (m *ConnectorSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConnectorSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ConnectorSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectorSpec.Merge(m, src) +} +func (m *ConnectorSpec) XXX_Size() int { + return m.Size() +} +func (m *ConnectorSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectorSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectorSpec proto.InternalMessageInfo + +func (m *ConnectorStatus) Reset() { *m = ConnectorStatus{} } +func (*ConnectorStatus) ProtoMessage() {} +func (*ConnectorStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{7} +} +func (m *ConnectorStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConnectorStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ConnectorStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectorStatus.Merge(m, src) +} +func (m *ConnectorStatus) XXX_Size() int { + return m.Size() +} +func (m *ConnectorStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectorStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectorStatus proto.InternalMessageInfo + +func (m *Resource) Reset() { *m = Resource{} } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{8} +} +func (m *Resource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return m.Size() +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *ResourceDefinition) Reset() { *m = ResourceDefinition{} } +func (*ResourceDefinition) ProtoMessage() {} +func (*ResourceDefinition) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{9} +} +func (m *ResourceDefinition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceDefinition) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDefinition.Merge(m, src) +} +func (m *ResourceDefinition) XXX_Size() int { + return m.Size() +} +func (m *ResourceDefinition) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceDefinition.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceDefinition proto.InternalMessageInfo + +func (m *ResourceDefinitionList) Reset() { *m = ResourceDefinitionList{} } +func (*ResourceDefinitionList) ProtoMessage() {} +func (*ResourceDefinitionList) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{10} +} +func (m *ResourceDefinitionList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceDefinitionList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceDefinitionList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDefinitionList.Merge(m, src) +} +func (m *ResourceDefinitionList) XXX_Size() int { + return m.Size() +} +func (m *ResourceDefinitionList) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceDefinitionList.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceDefinitionList proto.InternalMessageInfo + +func (m *ResourceDefinitionSpec) Reset() { *m = ResourceDefinitionSpec{} } +func (*ResourceDefinitionSpec) ProtoMessage() {} +func (*ResourceDefinitionSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{11} +} +func (m *ResourceDefinitionSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceDefinitionSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceDefinitionSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDefinitionSpec.Merge(m, src) +} +func (m *ResourceDefinitionSpec) XXX_Size() int { + return m.Size() +} +func (m *ResourceDefinitionSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceDefinitionSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceDefinitionSpec proto.InternalMessageInfo + +func (m *ResourceDefinitionStatus) Reset() { *m = ResourceDefinitionStatus{} } +func (*ResourceDefinitionStatus) ProtoMessage() {} +func (*ResourceDefinitionStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{12} +} +func (m *ResourceDefinitionStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceDefinitionStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceDefinitionStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDefinitionStatus.Merge(m, src) +} +func (m *ResourceDefinitionStatus) XXX_Size() int { + return m.Size() +} +func (m *ResourceDefinitionStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceDefinitionStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceDefinitionStatus proto.InternalMessageInfo + +func (m *ResourceList) Reset() { *m = ResourceList{} } +func (*ResourceList) ProtoMessage() {} +func (*ResourceList) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{13} +} +func (m *ResourceList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceList.Merge(m, src) +} +func (m *ResourceList) XXX_Size() int { + return m.Size() +} +func (m *ResourceList) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceList.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceList proto.InternalMessageInfo + +func (m *ResourceRun) Reset() { *m = ResourceRun{} } +func (*ResourceRun) ProtoMessage() {} +func (*ResourceRun) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{14} +} +func (m *ResourceRun) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceRun) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceRun) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceRun.Merge(m, src) +} +func (m *ResourceRun) XXX_Size() int { + return m.Size() +} +func (m *ResourceRun) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceRun.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceRun proto.InternalMessageInfo + +func (m *ResourceRunList) Reset() { *m = ResourceRunList{} } +func (*ResourceRunList) ProtoMessage() {} +func (*ResourceRunList) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{15} +} +func (m *ResourceRunList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceRunList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceRunList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceRunList.Merge(m, src) +} +func (m *ResourceRunList) XXX_Size() int { + return m.Size() +} +func (m *ResourceRunList) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceRunList.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceRunList proto.InternalMessageInfo + +func (m *ResourceRunSpec) Reset() { *m = ResourceRunSpec{} } +func (*ResourceRunSpec) ProtoMessage() {} +func (*ResourceRunSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{16} +} +func (m *ResourceRunSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceRunSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceRunSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceRunSpec.Merge(m, src) +} +func (m *ResourceRunSpec) XXX_Size() int { + return m.Size() +} +func (m *ResourceRunSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceRunSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceRunSpec proto.InternalMessageInfo + +func (m *ResourceRunStatus) Reset() { *m = ResourceRunStatus{} } +func (*ResourceRunStatus) ProtoMessage() {} +func (*ResourceRunStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{17} +} +func (m *ResourceRunStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceRunStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceRunStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceRunStatus.Merge(m, src) +} +func (m *ResourceRunStatus) XXX_Size() int { + return m.Size() +} +func (m *ResourceRunStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceRunStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceRunStatus proto.InternalMessageInfo + +func (m *ResourceSpec) Reset() { *m = ResourceSpec{} } +func (*ResourceSpec) ProtoMessage() {} +func (*ResourceSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{18} +} +func (m *ResourceSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceSpec.Merge(m, src) +} +func (m *ResourceSpec) XXX_Size() int { + return m.Size() +} +func (m *ResourceSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceSpec proto.InternalMessageInfo + +func (m *ResourceStatus) Reset() { *m = ResourceStatus{} } +func (*ResourceStatus) ProtoMessage() {} +func (*ResourceStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{19} +} +func (m *ResourceStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *ResourceStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceStatus.Merge(m, src) +} +func (m *ResourceStatus) XXX_Size() int { + return m.Size() +} +func (m *ResourceStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceStatus proto.InternalMessageInfo + +func (m *Template) Reset() { *m = Template{} } +func (*Template) ProtoMessage() {} +func (*Template) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{20} +} +func (m *Template) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Template) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Template) XXX_Merge(src proto.Message) { + xxx_messageInfo_Template.Merge(m, src) +} +func (m *Template) XXX_Size() int { + return m.Size() +} +func (m *Template) XXX_DiscardUnknown() { + xxx_messageInfo_Template.DiscardUnknown(m) +} + +var xxx_messageInfo_Template proto.InternalMessageInfo + +func (m *TemplateList) Reset() { *m = TemplateList{} } +func (*TemplateList) ProtoMessage() {} +func (*TemplateList) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{21} +} +func (m *TemplateList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TemplateList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TemplateList) XXX_Merge(src proto.Message) { + xxx_messageInfo_TemplateList.Merge(m, src) +} +func (m *TemplateList) XXX_Size() int { + return m.Size() +} +func (m *TemplateList) XXX_DiscardUnknown() { + xxx_messageInfo_TemplateList.DiscardUnknown(m) +} + +var xxx_messageInfo_TemplateList proto.InternalMessageInfo + +func (m *TemplateSpec) Reset() { *m = TemplateSpec{} } +func (*TemplateSpec) ProtoMessage() {} +func (*TemplateSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{22} +} +func (m *TemplateSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TemplateSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TemplateSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_TemplateSpec.Merge(m, src) +} +func (m *TemplateSpec) XXX_Size() int { + return m.Size() +} +func (m *TemplateSpec) XXX_DiscardUnknown() { + xxx_messageInfo_TemplateSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_TemplateSpec proto.InternalMessageInfo + +func (m *TemplateStatus) Reset() { *m = TemplateStatus{} } +func (*TemplateStatus) ProtoMessage() {} +func (*TemplateStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_ae9ec96380e8d097, []int{23} +} +func (m *TemplateStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TemplateStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TemplateStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_TemplateStatus.Merge(m, src) +} +func (m *TemplateStatus) XXX_Size() int { + return m.Size() +} +func (m *TemplateStatus) XXX_DiscardUnknown() { + xxx_messageInfo_TemplateStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_TemplateStatus proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Catalog)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.Catalog") + proto.RegisterType((*CatalogList)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.CatalogList") + proto.RegisterType((*CatalogSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.CatalogSpec") + proto.RegisterType((*CatalogStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.CatalogStatus") + proto.RegisterType((*Connector)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.Connector") + proto.RegisterType((*ConnectorList)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ConnectorList") + proto.RegisterType((*ConnectorSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ConnectorSpec") + proto.RegisterType((*ConnectorStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ConnectorStatus") + proto.RegisterType((*Resource)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.Resource") + proto.RegisterType((*ResourceDefinition)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinition") + proto.RegisterType((*ResourceDefinitionList)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionList") + proto.RegisterType((*ResourceDefinitionSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionSpec") + proto.RegisterType((*ResourceDefinitionStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceDefinitionStatus") + proto.RegisterType((*ResourceList)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceList") + proto.RegisterType((*ResourceRun)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceRun") + proto.RegisterType((*ResourceRunList)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceRunList") + proto.RegisterType((*ResourceRunSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceRunSpec") + proto.RegisterType((*ResourceRunStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceRunStatus") + proto.RegisterType((*ResourceSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceSpec") + proto.RegisterType((*ResourceStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.ResourceStatus") + proto.RegisterType((*Template)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.Template") + proto.RegisterType((*TemplateList)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.TemplateList") + proto.RegisterType((*TemplateSpec)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.TemplateSpec") + proto.RegisterType((*TemplateStatus)(nil), "github.com.seal_io.walrus.pkg.apis.walruscore.v1.TemplateStatus") +} + +func init() { + proto.RegisterFile("pkg/apis/walruscore/v1/generated.proto", fileDescriptor_ae9ec96380e8d097) +} + +var fileDescriptor_ae9ec96380e8d097 = []byte{ + // 722 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0xcd, 0x6a, 0xdb, 0x4c, + 0x14, 0xf5, 0x28, 0x3f, 0x5f, 0xbe, 0x71, 0x6c, 0x27, 0x2a, 0x14, 0xe3, 0x85, 0x12, 0xb4, 0x28, + 0xd9, 0x64, 0x94, 0x84, 0x52, 0xfa, 0x43, 0xfa, 0xe3, 0x64, 0xd1, 0x96, 0x96, 0x82, 0x5a, 0xba, + 0x28, 0xa5, 0xc9, 0x58, 0x99, 0xc8, 0x93, 0x58, 0x1a, 0x21, 0x8d, 0x52, 0xba, 0xeb, 0x23, 0xf4, + 0x65, 0x0a, 0x85, 0xbe, 0x40, 0xa0, 0x94, 0x04, 0x0a, 0x25, 0xab, 0x50, 0xbb, 0x2f, 0x52, 0x34, + 0x96, 0x2c, 0xcb, 0xb1, 0xdc, 0x46, 0x4e, 0x05, 0x81, 0xee, 0x3c, 0xe3, 0x7b, 0xcf, 0xbd, 0xe7, + 0xe8, 0xdc, 0x19, 0x06, 0x5e, 0x73, 0xf6, 0x4d, 0x0d, 0x3b, 0xd4, 0xd3, 0xde, 0xe2, 0x96, 0xeb, + 0x7b, 0x06, 0x73, 0x89, 0x76, 0xb0, 0xaa, 0x99, 0xc4, 0x26, 0x2e, 0xe6, 0x64, 0x07, 0x39, 0x2e, + 0xe3, 0x4c, 0x5e, 0x31, 0x29, 0x6f, 0xfa, 0x0d, 0x64, 0x30, 0x0b, 0x79, 0x04, 0xb7, 0xb6, 0x28, + 0x43, 0xdd, 0x0c, 0xe4, 0xec, 0x9b, 0x28, 0x40, 0x40, 0x31, 0x02, 0x3a, 0x58, 0xad, 0x2d, 0xc7, + 0x19, 0x9a, 0xc9, 0x4c, 0xa6, 0x09, 0xa0, 0x86, 0xbf, 0x2b, 0x56, 0x62, 0x21, 0x7e, 0x75, 0x0b, + 0xd4, 0xae, 0xef, 0xdf, 0xf4, 0x10, 0x65, 0x41, 0x2f, 0x16, 0x36, 0x9a, 0xd4, 0x26, 0xee, 0x3b, + 0xad, 0xd7, 0x9c, 0x45, 0x38, 0x1e, 0xd2, 0x56, 0x4d, 0x4b, 0xcb, 0x72, 0x7d, 0x9b, 0x53, 0x8b, + 0x9c, 0x49, 0xb8, 0xf1, 0xbb, 0x04, 0xcf, 0x68, 0x12, 0x0b, 0x0f, 0xe6, 0xa9, 0x1f, 0x25, 0xf8, + 0xdf, 0x06, 0xe6, 0xb8, 0xc5, 0x4c, 0x79, 0x1b, 0xce, 0x04, 0xfd, 0xec, 0x60, 0x8e, 0xab, 0x60, + 0x11, 0x2c, 0x15, 0xd7, 0x56, 0x50, 0x17, 0x16, 0xf5, 0xc3, 0xc6, 0xc2, 0x04, 0xd1, 0xe8, 0x60, + 0x15, 0x3d, 0x6b, 0xec, 0x11, 0x83, 0x3f, 0x25, 0x1c, 0xd7, 0xe5, 0xc3, 0xd3, 0x85, 0x42, 0xe7, + 0x74, 0x01, 0xc6, 0x7b, 0x7a, 0x0f, 0x55, 0xde, 0x82, 0x93, 0x9e, 0x43, 0x8c, 0xaa, 0x24, 0xd0, + 0xd7, 0xd1, 0x79, 0xc5, 0x47, 0x61, 0xab, 0xcf, 0x1d, 0x62, 0xd4, 0x67, 0xc3, 0x52, 0x93, 0xc1, + 0x4a, 0x17, 0xc0, 0xb2, 0x09, 0xa7, 0x3d, 0x8e, 0xb9, 0xef, 0x55, 0x27, 0x44, 0x89, 0x7b, 0xd9, + 0x4b, 0x08, 0x98, 0x7a, 0x39, 0x2c, 0x32, 0xdd, 0x5d, 0xeb, 0x21, 0xbc, 0xfa, 0x05, 0xc0, 0x62, + 0x18, 0xf9, 0x84, 0x7a, 0x5c, 0x7e, 0x7d, 0x46, 0x3b, 0xf4, 0x67, 0xda, 0x05, 0xd9, 0x42, 0xb9, + 0xb9, 0xb0, 0xd2, 0x4c, 0xb4, 0xd3, 0xa7, 0xdb, 0x1b, 0x38, 0x45, 0x39, 0xb1, 0xbc, 0xaa, 0xb4, + 0x38, 0xb1, 0x54, 0x5c, 0xbb, 0x95, 0x99, 0x55, 0xbd, 0x14, 0x56, 0x99, 0x7a, 0x14, 0xe0, 0xe9, + 0x5d, 0x58, 0xb5, 0xd4, 0x23, 0x13, 0x68, 0xa9, 0x56, 0x60, 0x29, 0xa1, 0x82, 0xfa, 0x59, 0x82, + 0xff, 0x6f, 0x30, 0xdb, 0x26, 0x06, 0x67, 0x6e, 0x0e, 0x3e, 0xc1, 0x09, 0x9f, 0x64, 0xf9, 0x88, + 0x51, 0xb3, 0xa9, 0x4e, 0xa1, 0x03, 0x4e, 0x79, 0x30, 0x4e, 0x91, 0xd1, 0x5e, 0x39, 0x02, 0xb0, + 0xd4, 0x8b, 0xcd, 0xc1, 0x2d, 0xdb, 0x49, 0xb7, 0xdc, 0x19, 0x83, 0x59, 0x8a, 0x5f, 0x2a, 0x7d, + 0x84, 0x84, 0x63, 0xe6, 0x61, 0x65, 0x40, 0x0d, 0xf5, 0x93, 0x04, 0x67, 0x74, 0xe2, 0x31, 0xdf, + 0x35, 0x48, 0x0e, 0x96, 0xd9, 0x4e, 0x58, 0xe6, 0xee, 0xf9, 0x39, 0x47, 0xbd, 0xa6, 0x3a, 0xa6, + 0x39, 0xe0, 0x98, 0xfb, 0x63, 0xd4, 0x18, 0x6d, 0x98, 0xef, 0x12, 0x94, 0xa3, 0xd0, 0x4d, 0xb2, + 0x4b, 0x6d, 0xca, 0x29, 0xb3, 0x73, 0x10, 0x71, 0x2f, 0x21, 0xe2, 0xc3, 0xec, 0x04, 0xe3, 0xae, + 0x53, 0xe5, 0x74, 0x07, 0xe4, 0x7c, 0x7c, 0x21, 0xd5, 0x46, 0x0b, 0xdb, 0x06, 0xf0, 0xea, 0xd9, + 0xa4, 0x1c, 0x46, 0x92, 0x26, 0x47, 0x72, 0xf3, 0x22, 0xb8, 0xa6, 0xcc, 0x66, 0x75, 0x18, 0x45, + 0x31, 0xa4, 0x35, 0x58, 0x4d, 0x53, 0x4c, 0xfd, 0x0a, 0xe0, 0x6c, 0xf4, 0x67, 0x0e, 0x7a, 0x6c, + 0x25, 0xf5, 0xb8, 0x9d, 0x5d, 0x8f, 0x14, 0x15, 0x8e, 0x24, 0x58, 0x8c, 0x42, 0x74, 0xff, 0xdf, + 0xec, 0x8c, 0x3f, 0x3b, 0xdf, 0x00, 0xac, 0xf4, 0x29, 0x9a, 0x83, 0x49, 0x1a, 0x49, 0x93, 0xac, + 0x67, 0x27, 0xa9, 0xfb, 0x69, 0xd3, 0x32, 0x9f, 0x20, 0x25, 0xc6, 0xe4, 0x0a, 0x9c, 0xef, 0xdf, + 0xea, 0xb2, 0x2f, 0xc7, 0xe3, 0x21, 0x82, 0xe6, 0x60, 0x39, 0x79, 0x98, 0x8b, 0xfb, 0xee, 0x05, + 0xb1, 0x9c, 0x16, 0xe6, 0x97, 0xe2, 0xbe, 0x8b, 0x7a, 0xfd, 0x9b, 0xf7, 0x5d, 0xaf, 0xc6, 0x68, + 0x6b, 0x05, 0x87, 0x4f, 0x14, 0x7a, 0x29, 0x0e, 0x9f, 0xa8, 0xd9, 0x14, 0x53, 0x95, 0x63, 0x3a, + 0x91, 0x59, 0x06, 0x94, 0x78, 0x79, 0xd8, 0x56, 0x0a, 0xc7, 0x6d, 0xa5, 0x70, 0xd2, 0x56, 0x0a, + 0xef, 0x3b, 0x0a, 0x38, 0xec, 0x28, 0xe0, 0xb8, 0xa3, 0x80, 0x93, 0x8e, 0x02, 0x7e, 0x74, 0x14, + 0xf0, 0xe1, 0xa7, 0x52, 0x78, 0xd5, 0xf7, 0x38, 0xd5, 0x82, 0xc6, 0x96, 0x29, 0x0b, 0x9f, 0xb3, + 0xda, 0xf0, 0xe7, 0xed, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0xff, 0x76, 0x18, 0xf7, 0x0e, + 0x00, 0x00, +} + +func (m *Catalog) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Catalog) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Catalog) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CatalogList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CatalogList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CatalogList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CatalogSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CatalogSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CatalogSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *CatalogStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CatalogStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CatalogStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *Connector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Connector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Connector) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ConnectorList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConnectorList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConnectorList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ConnectorSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConnectorSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConnectorSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ConnectorStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConnectorStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConnectorStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *Resource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Resource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceDefinition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceDefinition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceDefinitionList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceDefinitionList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceDefinitionList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceDefinitionSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceDefinitionSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceDefinitionSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ResourceDefinitionStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceDefinitionStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceDefinitionStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ResourceList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceRun) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceRun) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceRun) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceRunList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceRunList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceRunList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourceRunSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceRunSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceRunSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ResourceRunStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceRunStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceRunStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ResourceSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ResourceStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *Template) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Template) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Template) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TemplateList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TemplateList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TemplateList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TemplateSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TemplateSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *TemplateStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TemplateStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TemplateStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Catalog) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *CatalogList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *CatalogSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *CatalogStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *Connector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ConnectorList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ConnectorSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ConnectorStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *Resource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceDefinition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceDefinitionList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourceDefinitionSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ResourceDefinitionStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ResourceList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourceRun) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ResourceRunList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourceRunSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ResourceRunStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ResourceSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ResourceStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *Template) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TemplateList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *TemplateSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *TemplateStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Catalog) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Catalog{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CatalogSpec", "CatalogSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "CatalogStatus", "CatalogStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CatalogList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Catalog{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Catalog", "Catalog", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&CatalogList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *CatalogSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CatalogSpec{`, + `}`, + }, "") + return s +} +func (this *CatalogStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CatalogStatus{`, + `}`, + }, "") + return s +} +func (this *Connector) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Connector{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ConnectorSpec", "ConnectorSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ConnectorStatus", "ConnectorStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ConnectorList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Connector{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Connector", "Connector", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ConnectorList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ConnectorSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConnectorSpec{`, + `}`, + }, "") + return s +} +func (this *ConnectorStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConnectorStatus{`, + `}`, + }, "") + return s +} +func (this *Resource) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Resource{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ResourceSpec", "ResourceSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ResourceStatus", "ResourceStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceDefinition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceDefinition{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ResourceDefinitionSpec", "ResourceDefinitionSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ResourceDefinitionStatus", "ResourceDefinitionStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceDefinitionList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ResourceDefinition{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ResourceDefinition", "ResourceDefinition", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceDefinitionList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourceDefinitionSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceDefinitionSpec{`, + `}`, + }, "") + return s +} +func (this *ResourceDefinitionStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceDefinitionStatus{`, + `}`, + }, "") + return s +} +func (this *ResourceList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Resource{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Resource", "Resource", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourceRun) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceRun{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ResourceDefinitionSpec", "ResourceDefinitionSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ResourceDefinitionStatus", "ResourceDefinitionStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourceRunList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ResourceRun{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ResourceRun", "ResourceRun", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourceRunList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourceRunSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceRunSpec{`, + `}`, + }, "") + return s +} +func (this *ResourceRunStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceRunStatus{`, + `}`, + }, "") + return s +} +func (this *ResourceSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceSpec{`, + `}`, + }, "") + return s +} +func (this *ResourceStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourceStatus{`, + `}`, + }, "") + return s +} +func (this *Template) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Template{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "TemplateSpec", "TemplateSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "TemplateStatus", "TemplateStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *TemplateList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Template{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Template", "Template", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&TemplateList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *TemplateSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateSpec{`, + `}`, + }, "") + return s +} +func (this *TemplateStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TemplateStatus{`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Catalog) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Catalog: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Catalog: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CatalogList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CatalogList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CatalogList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Catalog{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CatalogSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CatalogSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CatalogSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CatalogStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CatalogStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CatalogStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Connector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Connector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Connector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConnectorList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConnectorList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConnectorList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Connector{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConnectorSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConnectorSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConnectorSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConnectorStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConnectorStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConnectorStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Resource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Resource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceDefinition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceDefinition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceDefinition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceDefinitionList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceDefinitionList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceDefinitionList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, ResourceDefinition{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceDefinitionSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceDefinitionSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceDefinitionSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceDefinitionStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceDefinitionStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceDefinitionStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Resource{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceRun) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceRun: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceRun: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceRunList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceRunList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceRunList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, ResourceRun{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceRunSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceRunSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceRunSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceRunStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceRunStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceRunStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Template) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Template: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Template: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Template{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TemplateStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TemplateStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TemplateStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/pkg/apis/walruscore/v1/generated.proto b/pkg/apis/walruscore/v1/generated.proto new file mode 100644 index 000000000..3c9cc7f48 --- /dev/null +++ b/pkg/apis/walruscore/v1/generated.proto @@ -0,0 +1,199 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package github.com.seal_io.walrus.pkg.apis.walruscore.v1; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "github.com/seal-io/walrus/pkg/apis/walruscore/v1"; + +// Catalog is the schema for the catalogs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +message Catalog { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional CatalogSpec spec = 2; + + optional CatalogStatus status = 3; +} + +// CatalogList holds the list of Catalog. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message CatalogList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Catalog items = 2; +} + +// CatalogSpec defines the desired state of Catalog. +message CatalogSpec { +} + +// CatalogStatus defines the observed state of Catalog. +message CatalogStatus { +} + +// Connector is the schema for the connectors API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +message Connector { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional ConnectorSpec spec = 2; + + optional ConnectorStatus status = 3; +} + +// ConnectorList holds the list of Connector. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ConnectorList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Connector items = 2; +} + +// ConnectorSpec defines the desired state of Connector. +message ConnectorSpec { +} + +// ConnectorStatus defines the observed state of Connector. +message ConnectorStatus { +} + +// Resource is the schema for the resources API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +message Resource { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional ResourceSpec spec = 2; + + optional ResourceStatus status = 3; +} + +// ResourceDefinition is the schema for the resource definitions API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +message ResourceDefinition { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional ResourceDefinitionSpec spec = 2; + + optional ResourceDefinitionStatus status = 3; +} + +// ResourceDefinitionList holds the list of ResourceDefinition. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ResourceDefinitionList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated ResourceDefinition items = 2; +} + +// ResourceDefinitionSpec defines the desired state of ResourceDefinition. +message ResourceDefinitionSpec { +} + +// ResourceDefinitionStatus defines the observed state of ResourceDefinition. +message ResourceDefinitionStatus { +} + +// ResourceList holds the list of Resource. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ResourceList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Resource items = 2; +} + +// ResourceRun is the schema for the resource runs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +message ResourceRun { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional ResourceDefinitionSpec spec = 2; + + optional ResourceDefinitionStatus status = 3; +} + +// ResourceRunList holds the list of ResourceRun. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message ResourceRunList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated ResourceRun items = 2; +} + +// ResourceRunSpec defines the desired state of ResourceRun. +message ResourceRunSpec { +} + +// ResourceRunStatus defines the observed state of ResourceRun. +message ResourceRunStatus { +} + +// ResourceSpec defines the desired state of Resource. +message ResourceSpec { +} + +// ResourceStatus defines the observed state of Resource. +message ResourceStatus { +} + +// Template is the schema for the templates API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +message Template { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + optional TemplateSpec spec = 2; + + optional TemplateStatus status = 3; +} + +// TemplateList holds the list of Template. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +message TemplateList { + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + repeated Template items = 2; +} + +// TemplateSpec defines the desired state of Template. +message TemplateSpec { +} + +// TemplateStatus defines the observed state of Template. +message TemplateStatus { +} + diff --git a/pkg/apis/walruscore/v1/resource.go b/pkg/apis/walruscore/v1/resource.go new file mode 100644 index 000000000..39e60d664 --- /dev/null +++ b/pkg/apis/walruscore/v1/resource.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Resource is the schema for the resources API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +type Resource struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec ResourceSpec `json:"spec,omitempty"` + Status ResourceStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Resource)(nil) + +// ResourceSpec defines the desired state of Resource. +type ResourceSpec struct { + // TODO: your spec here +} + +// ResourceStatus defines the observed state of Resource. +type ResourceStatus struct { + // TODO: your status here +} + +// ResourceList holds the list of Resource. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Resource `json:"items"` +} + +var _ runtime.Object = (*ResourceList)(nil) diff --git a/pkg/apis/walruscore/v1/resource_definition.go b/pkg/apis/walruscore/v1/resource_definition.go new file mode 100644 index 000000000..74c7c4502 --- /dev/null +++ b/pkg/apis/walruscore/v1/resource_definition.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ResourceDefinition is the schema for the resource definitions API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +type ResourceDefinition struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec ResourceDefinitionSpec `json:"spec,omitempty"` + Status ResourceDefinitionStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*ResourceDefinition)(nil) + +// ResourceDefinitionSpec defines the desired state of ResourceDefinition. +type ResourceDefinitionSpec struct { + // TODO: your spec here +} + +// ResourceDefinitionStatus defines the observed state of ResourceDefinition. +type ResourceDefinitionStatus struct { + // TODO: your status here +} + +// ResourceDefinitionList holds the list of ResourceDefinition. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceDefinitionList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []ResourceDefinition `json:"items"` +} + +var _ runtime.Object = (*ResourceDefinitionList)(nil) diff --git a/pkg/apis/walruscore/v1/resource_run.go b/pkg/apis/walruscore/v1/resource_run.go new file mode 100644 index 000000000..a61392b1e --- /dev/null +++ b/pkg/apis/walruscore/v1/resource_run.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ResourceRun is the schema for the resource runs API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +type ResourceRun struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec ResourceDefinitionSpec `json:"spec,omitempty"` + Status ResourceDefinitionStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*ResourceRun)(nil) + +// ResourceRunSpec defines the desired state of ResourceRun. +type ResourceRunSpec struct { + // TODO: your spec here +} + +// ResourceRunStatus defines the observed state of ResourceRun. +type ResourceRunStatus struct { + // TODO: your status here +} + +// ResourceRunList holds the list of ResourceRun. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceRunList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []ResourceRun `json:"items"` +} + +var _ runtime.Object = (*ResourceRunList)(nil) diff --git a/pkg/apis/walruscore/v1/template.go b/pkg/apis/walruscore/v1/template.go new file mode 100644 index 000000000..8d966d7ab --- /dev/null +++ b/pkg/apis/walruscore/v1/template.go @@ -0,0 +1,43 @@ +package v1 + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Template is the schema for the templates API. +// +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:crd-gen:resource:scope="Namespaced",subResources=["status"] +type Template struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec TemplateSpec `json:"spec,omitempty"` + Status TemplateStatus `json:"status,omitempty"` +} + +var _ runtime.Object = (*Template)(nil) + +// TemplateSpec defines the desired state of Template. +type TemplateSpec struct { + // TODO: your spec here +} + +// TemplateStatus defines the observed state of Template. +type TemplateStatus struct { + // TODO: your status here +} + +// TemplateList holds the list of Template. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TemplateList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Template `json:"items"` +} + +var _ runtime.Object = (*TemplateList)(nil) diff --git a/pkg/apis/walruscore/v1/zz_generated.crds.go b/pkg/apis/walruscore/v1/zz_generated.crds.go new file mode 100644 index 000000000..dec13f935 --- /dev/null +++ b/pkg/apis/walruscore/v1/zz_generated.crds.go @@ -0,0 +1,379 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func GetCustomResourceDefinitions() map[string]*v1.CustomResourceDefinition { + return map[string]*v1.CustomResourceDefinition{ + "Catalog": crd_pkg_apis_walruscore_v1_Catalog(), + "Connector": crd_pkg_apis_walruscore_v1_Connector(), + "Resource": crd_pkg_apis_walruscore_v1_Resource(), + "ResourceDefinition": crd_pkg_apis_walruscore_v1_ResourceDefinition(), + "ResourceRun": crd_pkg_apis_walruscore_v1_ResourceRun(), + "Template": crd_pkg_apis_walruscore_v1_Template(), + } +} + +func crd_pkg_apis_walruscore_v1_Catalog() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "catalogs.walruscore.seal.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "walruscore.seal.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "catalogs", + Singular: "catalog", + Kind: "Catalog", + ListKind: "CatalogList", + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "Catalog is the schema for the catalogs API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} + +func crd_pkg_apis_walruscore_v1_Connector() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "connectors.walruscore.seal.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "walruscore.seal.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "connectors", + Singular: "connector", + Kind: "Connector", + ListKind: "ConnectorList", + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "Connector is the schema for the connectors API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} + +func crd_pkg_apis_walruscore_v1_Resource() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "resources.walruscore.seal.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "walruscore.seal.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "resources", + Singular: "resource", + Kind: "Resource", + ListKind: "ResourceList", + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "Resource is the schema for the resources API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} + +func crd_pkg_apis_walruscore_v1_ResourceDefinition() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "resourcedefinitions.walruscore.seal.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "walruscore.seal.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "resourcedefinitions", + Singular: "resourcedefinition", + Kind: "ResourceDefinition", + ListKind: "ResourceDefinitionList", + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "ResourceDefinition is the schema for the resource definitions API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} + +func crd_pkg_apis_walruscore_v1_ResourceRun() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "resourceruns.walruscore.seal.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "walruscore.seal.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "resourceruns", + Singular: "resourcerun", + Kind: "ResourceRun", + ListKind: "ResourceRunList", + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "ResourceRun is the schema for the resource runs API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} + +func crd_pkg_apis_walruscore_v1_Template() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "templates.walruscore.seal.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "walruscore.seal.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "templates", + Singular: "template", + Kind: "Template", + ListKind: "TemplateList", + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "Template is the schema for the templates API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} diff --git a/pkg/apis/walruscore/v1/zz_generated.deepcopy.go b/pkg/apis/walruscore/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..de9f807e6 --- /dev/null +++ b/pkg/apis/walruscore/v1/zz_generated.deepcopy.go @@ -0,0 +1,571 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Catalog) DeepCopyInto(out *Catalog) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Catalog. +func (in *Catalog) DeepCopy() *Catalog { + if in == nil { + return nil + } + out := new(Catalog) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Catalog) 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 *CatalogList) DeepCopyInto(out *CatalogList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Catalog, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogList. +func (in *CatalogList) DeepCopy() *CatalogList { + if in == nil { + return nil + } + out := new(CatalogList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogList) 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 *CatalogSpec) DeepCopyInto(out *CatalogSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSpec. +func (in *CatalogSpec) DeepCopy() *CatalogSpec { + if in == nil { + return nil + } + out := new(CatalogSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogStatus) DeepCopyInto(out *CatalogStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogStatus. +func (in *CatalogStatus) DeepCopy() *CatalogStatus { + if in == nil { + return nil + } + out := new(CatalogStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Connector) DeepCopyInto(out *Connector) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Connector. +func (in *Connector) DeepCopy() *Connector { + if in == nil { + return nil + } + out := new(Connector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Connector) 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 *ConnectorList) DeepCopyInto(out *ConnectorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Connector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectorList. +func (in *ConnectorList) DeepCopy() *ConnectorList { + if in == nil { + return nil + } + out := new(ConnectorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ConnectorList) 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 *ConnectorSpec) DeepCopyInto(out *ConnectorSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectorSpec. +func (in *ConnectorSpec) DeepCopy() *ConnectorSpec { + if in == nil { + return nil + } + out := new(ConnectorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConnectorStatus) DeepCopyInto(out *ConnectorStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectorStatus. +func (in *ConnectorStatus) DeepCopy() *ConnectorStatus { + if in == nil { + return nil + } + out := new(ConnectorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Resource) DeepCopyInto(out *Resource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource. +func (in *Resource) DeepCopy() *Resource { + if in == nil { + return nil + } + out := new(Resource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Resource) 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 *ResourceDefinition) DeepCopyInto(out *ResourceDefinition) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDefinition. +func (in *ResourceDefinition) DeepCopy() *ResourceDefinition { + if in == nil { + return nil + } + out := new(ResourceDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceDefinition) 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 *ResourceDefinitionList) DeepCopyInto(out *ResourceDefinitionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceDefinition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDefinitionList. +func (in *ResourceDefinitionList) DeepCopy() *ResourceDefinitionList { + if in == nil { + return nil + } + out := new(ResourceDefinitionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceDefinitionList) 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 *ResourceDefinitionSpec) DeepCopyInto(out *ResourceDefinitionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDefinitionSpec. +func (in *ResourceDefinitionSpec) DeepCopy() *ResourceDefinitionSpec { + if in == nil { + return nil + } + out := new(ResourceDefinitionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceDefinitionStatus) DeepCopyInto(out *ResourceDefinitionStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDefinitionStatus. +func (in *ResourceDefinitionStatus) DeepCopy() *ResourceDefinitionStatus { + if in == nil { + return nil + } + out := new(ResourceDefinitionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceList) DeepCopyInto(out *ResourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Resource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceList. +func (in *ResourceList) DeepCopy() *ResourceList { + if in == nil { + return nil + } + out := new(ResourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceList) 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 *ResourceRun) DeepCopyInto(out *ResourceRun) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRun. +func (in *ResourceRun) DeepCopy() *ResourceRun { + if in == nil { + return nil + } + out := new(ResourceRun) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceRun) 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 *ResourceRunList) DeepCopyInto(out *ResourceRunList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceRun, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRunList. +func (in *ResourceRunList) DeepCopy() *ResourceRunList { + if in == nil { + return nil + } + out := new(ResourceRunList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceRunList) 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 *ResourceRunSpec) DeepCopyInto(out *ResourceRunSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRunSpec. +func (in *ResourceRunSpec) DeepCopy() *ResourceRunSpec { + if in == nil { + return nil + } + out := new(ResourceRunSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceRunStatus) DeepCopyInto(out *ResourceRunStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRunStatus. +func (in *ResourceRunStatus) DeepCopy() *ResourceRunStatus { + if in == nil { + return nil + } + out := new(ResourceRunStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSpec) DeepCopyInto(out *ResourceSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSpec. +func (in *ResourceSpec) DeepCopy() *ResourceSpec { + if in == nil { + return nil + } + out := new(ResourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStatus. +func (in *ResourceStatus) DeepCopy() *ResourceStatus { + if in == nil { + return nil + } + out := new(ResourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Template) DeepCopyInto(out *Template) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template. +func (in *Template) DeepCopy() *Template { + if in == nil { + return nil + } + out := new(Template) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Template) 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 *TemplateList) DeepCopyInto(out *TemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Template, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateList. +func (in *TemplateList) DeepCopy() *TemplateList { + if in == nil { + return nil + } + out := new(TemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateList) 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 *TemplateSpec) DeepCopyInto(out *TemplateSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateSpec. +func (in *TemplateSpec) DeepCopy() *TemplateSpec { + if in == nil { + return nil + } + out := new(TemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateStatus) DeepCopyInto(out *TemplateStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateStatus. +func (in *TemplateStatus) DeepCopy() *TemplateStatus { + if in == nil { + return nil + } + out := new(TemplateStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/walruscore/v1/zz_generated.register.go b/pkg/apis/walruscore/v1/zz_generated.register.go new file mode 100644 index 000000000..c654be28e --- /dev/null +++ b/pkg/apis/walruscore/v1/zz_generated.register.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "walruscore.seal.io" + +// SchemeGroupVersion is group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// SchemeGroupVersionResource is a convenience method to return the GroupVersionResource for a resource. +func SchemeGroupVersionResource(resource string) schema.GroupVersionResource { + return SchemeGroupVersion.WithResource(resource) +} + +// SchemeResource takes an unqualified resource and returns a Group qualified GroupResource. +func SchemeResource(resource string) schema.GroupResource { + return SchemeGroupVersionResource(resource).GroupResource() +} + +// SchemeGroupVersionKind is a convenience method to return the GroupVersionKind for a kind. +func SchemeGroupVersionKind(kind string) schema.GroupVersionKind { + return SchemeGroupVersion.WithKind(kind) +} + +// SchemeKind takes an unqualified kind and returns a Group qualified GroupKind. +func SchemeKind(kind string) schema.GroupKind { + return SchemeGroupVersionKind(kind).GroupKind() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Catalog{}, + &CatalogList{}, + &Connector{}, + &ConnectorList{}, + &Resource{}, + &ResourceDefinition{}, + &ResourceDefinitionList{}, + &ResourceList{}, + &ResourceRun{}, + &ResourceRunList{}, + &Template{}, + &TemplateList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/zz_generated.openapi.go b/pkg/apis/zz_generated.openapi.go new file mode 100644 index 000000000..bf73f93fc --- /dev/null +++ b/pkg/apis/zz_generated.openapi.go @@ -0,0 +1,4827 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This file was autogenerated by openapi-gen. Do not edit it manually! + +package apis + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Catalog": schema_pkg_apis_walrus_v1_Catalog(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.CatalogList": schema_pkg_apis_walrus_v1_CatalogList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Connector": schema_pkg_apis_walrus_v1_Connector(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ConnectorList": schema_pkg_apis_walrus_v1_ConnectorList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Environment": schema_pkg_apis_walrus_v1_Environment(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentList": schema_pkg_apis_walrus_v1_EnvironmentList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentSpec": schema_pkg_apis_walrus_v1_EnvironmentSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentStatus": schema_pkg_apis_walrus_v1_EnvironmentStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExample": schema_pkg_apis_walrus_v1_FileExample(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExampleList": schema_pkg_apis_walrus_v1_FileExampleList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExampleStatus": schema_pkg_apis_walrus_v1_FileExampleStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Project": schema_pkg_apis_walrus_v1_Project(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectList": schema_pkg_apis_walrus_v1_ProjectList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSpec": schema_pkg_apis_walrus_v1_ProjectSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectStatus": schema_pkg_apis_walrus_v1_ProjectStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSubject": schema_pkg_apis_walrus_v1_ProjectSubject(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSubjects": schema_pkg_apis_walrus_v1_ProjectSubjects(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Resource": schema_pkg_apis_walrus_v1_Resource(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceComponent": schema_pkg_apis_walrus_v1_ResourceComponent(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceComponents": schema_pkg_apis_walrus_v1_ResourceComponents(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceDefinition": schema_pkg_apis_walrus_v1_ResourceDefinition(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceDefinitionList": schema_pkg_apis_walrus_v1_ResourceDefinitionList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceList": schema_pkg_apis_walrus_v1_ResourceList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceRun": schema_pkg_apis_walrus_v1_ResourceRun(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceRunList": schema_pkg_apis_walrus_v1_ResourceRunList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Setting": schema_pkg_apis_walrus_v1_Setting(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingList": schema_pkg_apis_walrus_v1_SettingList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingSpec": schema_pkg_apis_walrus_v1_SettingSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingStatus": schema_pkg_apis_walrus_v1_SettingStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Template": schema_pkg_apis_walrus_v1_Template(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.TemplateList": schema_pkg_apis_walrus_v1_TemplateList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Variable": schema_pkg_apis_walrus_v1_Variable(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableList": schema_pkg_apis_walrus_v1_VariableList(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableSpec": schema_pkg_apis_walrus_v1_VariableSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableStatus": schema_pkg_apis_walrus_v1_VariableStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Catalog": schema_pkg_apis_walruscore_v1_Catalog(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogList": schema_pkg_apis_walruscore_v1_CatalogList(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogSpec": schema_pkg_apis_walruscore_v1_CatalogSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogStatus": schema_pkg_apis_walruscore_v1_CatalogStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Connector": schema_pkg_apis_walruscore_v1_Connector(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorList": schema_pkg_apis_walruscore_v1_ConnectorList(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorSpec": schema_pkg_apis_walruscore_v1_ConnectorSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorStatus": schema_pkg_apis_walruscore_v1_ConnectorStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Resource": schema_pkg_apis_walruscore_v1_Resource(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinition": schema_pkg_apis_walruscore_v1_ResourceDefinition(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionList": schema_pkg_apis_walruscore_v1_ResourceDefinitionList(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec": schema_pkg_apis_walruscore_v1_ResourceDefinitionSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus": schema_pkg_apis_walruscore_v1_ResourceDefinitionStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceList": schema_pkg_apis_walruscore_v1_ResourceList(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRun": schema_pkg_apis_walruscore_v1_ResourceRun(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRunList": schema_pkg_apis_walruscore_v1_ResourceRunList(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRunSpec": schema_pkg_apis_walruscore_v1_ResourceRunSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRunStatus": schema_pkg_apis_walruscore_v1_ResourceRunStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceSpec": schema_pkg_apis_walruscore_v1_ResourceSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceStatus": schema_pkg_apis_walruscore_v1_ResourceStatus(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Template": schema_pkg_apis_walruscore_v1_Template(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateList": schema_pkg_apis_walruscore_v1_TemplateList(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateSpec": schema_pkg_apis_walruscore_v1_TemplateSpec(ref), + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateStatus": schema_pkg_apis_walruscore_v1_TemplateStatus(ref), + "k8s.io/apimachinery/pkg/api/resource.Quantity": schema_apimachinery_pkg_api_resource_Quantity(ref), + "k8s.io/apimachinery/pkg/api/resource.int64Amount": schema_apimachinery_pkg_api_resource_int64Amount(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), + "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), + "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + } +} + +func schema_pkg_apis_walrus_v1_Catalog(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Catalog is the schema for the catalogs API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_CatalogList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CatalogList holds the list of Catalog.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Catalog"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Catalog", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_Connector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Connector is the schema for the connectors API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ConnectorList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConnectorList holds the list of Connector.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Connector"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Connector", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_Environment(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Environment is the schema for the environments API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentSpec", "github.com/seal-io/walrus/pkg/apis/walrus/v1.EnvironmentStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_EnvironmentList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnvironmentList holds the list of Environment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.Environment"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Environment", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_EnvironmentSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnvironmentSpec defines the desired state of Environment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type is the type of the environment.\n\n\nPossible enum values:\n - `\"development\"` means the environment is for development.\n - `\"production\"` means the environment is for production.\n - `\"staging\"` means the environment is for staging.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"development", "production", "staging"}, + }, + }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is the display name of the environment.", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description is the description of the environment.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_EnvironmentStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EnvironmentStatus defines the observed state of Environment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "project": { + SchemaProps: spec.SchemaProps{ + Description: "Project is the project that the environment belongs to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase is the current phase of the environment.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"project", "phase"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_FileExample(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FileExample is the schema for the file example API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExampleStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExampleStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_FileExampleList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FileExampleList holds the list of FileExample.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExample"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.FileExample", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_FileExampleStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FileExampleStatus defines the observed state of FileExample.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "icon": { + SchemaProps: spec.SchemaProps{ + Description: "Icon is the icon of the file example.", + Type: []string{"string"}, + Format: "", + }, + }, + "readme": { + SchemaProps: spec.SchemaProps{ + Description: "Readme is the readme of the file example.", + Type: []string{"string"}, + Format: "", + }, + }, + "content": { + SchemaProps: spec.SchemaProps{ + Description: "Content is the content of the file example.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_Project(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Project is the schema for the projects API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSpec", "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ProjectList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectList holds the list of Project.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.Project"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Project", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ProjectSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectSpec defines the desired state of Project.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is the display name of the project.", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description is the description of the project.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_ProjectStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectStatus defines the observed state of Project.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase is the current phase of the project.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"phase"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_ProjectSubject(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectSubject is the schema for the project subject API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the subject.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is the kind of the subject.", + Type: []string{"string"}, + Format: "", + }, + }, + "role": { + SchemaProps: spec.SchemaProps{ + Description: "Role is the role of the subject.\n\n\nPossible enum values:\n - `\"walrus-project-member\"` is the subject role for project member.\n - `\"walrus-project-owner\"` is the subject role for project owner.\n - `\"walrus-project-viewer\"` is the subject role for project viewer.", + Default: "", + Type: []string{"string"}, + Format: "", + Enum: []interface{}{"walrus-project-member", "walrus-project-owner", "walrus-project-viewer"}, + }, + }, + }, + Required: []string{"name", "role"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_ProjectSubjects(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProjectSubjects holds the list of ProjectSubject.\n\nProjectSubjects is the subresource of Project.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSubject"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ProjectSubject", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_Resource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Resource is the schema for the resources API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ResourceComponent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceComponent is the schema for the resource component API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name is the name of the component.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_ResourceComponents(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceComponents holds the list of ResourceComponent.\n\nResourceComponents is the subresource of Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceComponent"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.ResourceComponent", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ResourceDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceDefinition is the schema for the resource definitions API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ResourceDefinitionList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceDefinitionList holds the list of ResourceDefinition.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinition"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinition", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceList holds the list of Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Resource"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Resource", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ResourceRun(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRun is the schema for the resource runs API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_ResourceRunList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRunList holds the list of ResourceRun.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRun"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRun", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_Setting(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Setting is the schema for the settings API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingSpec", "github.com/seal-io/walrus/pkg/apis/walrus/v1.SettingStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_SettingList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SettingList holds the list of Setting.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.Setting"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Setting", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_SettingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SettingSpec defines the desired state of Setting.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value contains the configuration data, it is provided as a write-only input field.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_SettingStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SettingStatus defines the observed state of Setting.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description is the description of the settings, it is readonly.", + Type: []string{"string"}, + Format: "", + }, + }, + "hidden": { + SchemaProps: spec.SchemaProps{ + Description: "Hidden indicates whether the setting is hidden on UI, it is readonly.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "editable": { + SchemaProps: spec.SchemaProps{ + Description: "Editable indicates whether the setting is editable on UI, it is readonly.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "sensitive": { + SchemaProps: spec.SchemaProps{ + Description: "Sensitive indicates whether the setting is sensitive, it is readonly.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value is the current value of the setting, it is provided as a read-only output field.\n\n\"(sensitive)\" returns if the setting is sensitive.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"hidden", "editable", "sensitive", "value"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_Template(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Template is the schema for the templates API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_TemplateList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateList holds the list of Template.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Template"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Template", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_Variable(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Variable is the schema for the variables API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableSpec", "github.com/seal-io/walrus/pkg/apis/walrus/v1.VariableStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_VariableList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VariableList holds the list of Variable.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walrus/v1.Variable"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walrus/v1.Variable", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walrus_v1_VariableSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VariableSpec defines the desired state of Variable.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value contains the configuration data, it is provided as a write-only input field.", + Type: []string{"string"}, + Format: "", + }, + }, + "sensitive": { + SchemaProps: spec.SchemaProps{ + Description: "Sensitive indicates whether the variable is sensitive.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"sensitive"}, + }, + }, + } +} + +func schema_pkg_apis_walrus_v1_VariableStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "VariableStatus defines the observed state of Variable.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "project": { + SchemaProps: spec.SchemaProps{ + Description: "Project is the project that the variable belongs to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "environment": { + SchemaProps: spec.SchemaProps{ + Description: "Environment is the environment that the variable belongs to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value is the current value of the setting, it is provided as a read-only output field.\n\n\"(sensitive)\" returns if the variable is sensitive.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"project", "environment", "value"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_Catalog(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Catalog is the schema for the catalogs API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.CatalogStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_CatalogList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CatalogList holds the list of Catalog.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Catalog"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Catalog", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_CatalogSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CatalogSpec defines the desired state of Catalog.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_CatalogStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CatalogStatus defines the observed state of Catalog.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_Connector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Connector is the schema for the connectors API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ConnectorStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ConnectorList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConnectorList holds the list of Connector.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Connector"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Connector", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ConnectorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConnectorSpec defines the desired state of Connector.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_ConnectorStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ConnectorStatus defines the observed state of Connector.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_Resource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Resource is the schema for the resources API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceDefinition is the schema for the resource definitions API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceDefinitionList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceDefinitionList holds the list of ResourceDefinition.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinition"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinition", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceDefinitionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceDefinitionSpec defines the desired state of ResourceDefinition.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceDefinitionStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceDefinitionStatus defines the observed state of ResourceDefinition.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceList holds the list of Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Resource"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Resource", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceRun(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRun is the schema for the resource runs API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceDefinitionStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceRunList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRunList holds the list of ResourceRun.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRun"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.ResourceRun", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceRunSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRunSpec defines the desired state of ResourceRun.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceRunStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceRunStatus defines the observed state of ResourceRun.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceSpec defines the desired state of Resource.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_ResourceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceStatus defines the observed state of Resource.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_Template(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Template is the schema for the templates API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateSpec", "github.com/seal-io/walrus/pkg/apis/walruscore/v1.TemplateStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_TemplateList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateList holds the list of Template.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/seal-io/walrus/pkg/apis/walruscore/v1.Template"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/seal-io/walrus/pkg/apis/walruscore/v1.Template", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_walruscore_v1_TemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateSpec defines the desired state of Template.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_walruscore_v1_TemplateStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TemplateStatus defines the observed state of Template.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", + OneOf: common.GenerateOpenAPIV3OneOfSchema(resource.Quantity{}.OpenAPIV3OneOfTypes()), + Format: resource.Quantity{}.OpenAPISchemaFormat(), + }, + }, + }, common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` ::= \n\n\t(Note that may be empty, from the \"\" case in .)\n\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n ::= \"e\" | \"E\" ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", + Type: resource.Quantity{}.OpenAPISchemaType(), + Format: resource.Quantity{}.OpenAPISchemaFormat(), + }, + }, + }) +} + +func schema_apimachinery_pkg_api_resource_int64Amount(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "int64Amount represents a fixed precision numerator and arbitrary scale exponent. It is faster than operations on inf.Dec for values that can be represented as int64.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "value": { + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "scale": { + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"value", "scale"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_APIGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroup contains the name, the supported versions, and the preferred version of a group.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the group.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "versions": { + SchemaProps: spec.SchemaProps{ + Description: "versions are the versions supported in this group.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + }, + }, + }, + "preferredVersion": { + SchemaProps: spec.SchemaProps{ + Description: "preferredVersion is the version preferred by the API server, which probably is the storage version.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery"), + }, + }, + "serverAddressByClientCIDRs": { + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"name", "versions"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery", "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_APIGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "groups": { + SchemaProps: spec.SchemaProps{ + Description: "groups is a list of APIGroup.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"), + }, + }, + }, + }, + }, + }, + Required: []string{"groups"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup"}, + } +} + +func schema_pkg_apis_meta_v1_APIResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResource specifies the name of a resource and whether it is namespaced.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the plural name of the resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "singularName": { + SchemaProps: spec.SchemaProps{ + Description: "singularName is the singular name of the resource. This allows clients to handle plural and singular opaquely. The singularName is more correct for reporting status on a single item and both singular and plural are allowed from the kubectl CLI interface.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespaced": { + SchemaProps: spec.SchemaProps{ + Description: "namespaced indicates if a resource is namespaced or not.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "group is the preferred group of the resource. Empty implies the group of the containing resource list. For subresources, this may have a different value, for example: Scale\".", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version is the preferred version of the resource. Empty implies the version of the containing resource list For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)\".", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "verbs": { + SchemaProps: spec.SchemaProps{ + Description: "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "shortNames": { + SchemaProps: spec.SchemaProps{ + Description: "shortNames is a list of suggested short names of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "categories": { + SchemaProps: spec.SchemaProps{ + Description: "categories is a list of the grouped resources this resource belongs to (e.g. 'all')", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "storageVersionHash": { + SchemaProps: spec.SchemaProps{ + Description: "The hash value of the storage version, the version this resource is converted to when written to the data store. Value must be treated as opaque by clients. Only equality comparison on the value is valid. This is an alpha feature and may change or be removed in the future. The field is populated by the apiserver only if the StorageVersionHash feature gate is enabled. This field will remain optional even if it graduates.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "singularName", "namespaced", "kind", "verbs"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_APIResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion is the group and version this APIResourceList is for.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resources": { + SchemaProps: spec.SchemaProps{ + Description: "resources contains the name of the resources and if they are namespaced.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"), + }, + }, + }, + }, + }, + }, + Required: []string{"groupVersion", "resources"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource"}, + } +} + +func schema_pkg_apis_meta_v1_APIVersions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "versions": { + SchemaProps: spec.SchemaProps{ + Description: "versions are the api versions that are available.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "serverAddressByClientCIDRs": { + SchemaProps: spec.SchemaProps{ + Description: "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"), + }, + }, + }, + }, + }, + }, + Required: []string{"versions", "serverAddressByClientCIDRs"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR"}, + } +} + +func schema_pkg_apis_meta_v1_ApplyOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ApplyOptions may be provided when applying an API object. FieldManager is required for apply requests. ApplyOptions is equivalent to PatchOptions. It is provided as a convenience with documentation that speaks specifically to how the options fields relate to apply.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "force": { + SchemaProps: spec.SchemaProps{ + Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people.", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"force", "fieldManager"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Condition contains details for one aspect of the current state of this API Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + 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.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + 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.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + 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.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "message is a human readable message indicating details about the transition. This may be an empty string.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CreateOptions may be provided when creating an API object.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_DeleteOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DeleteOptions may be provided when deleting an API object.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "gracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "preconditions": { + SchemaProps: spec.SchemaProps{ + Description: "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"), + }, + }, + "orphanDependents": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "propagationPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", + Type: []string{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions"}, + } +} + +func schema_pkg_apis_meta_v1_Duration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Duration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. In particular, it marshals into strings, which can be used as map keys in json.", + Type: v1.Duration{}.OpenAPISchemaType(), + Format: v1.Duration{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_FieldsV1(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GetOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GetOptions is the standard query options to the standard REST get call.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupKind specifies a Group and a Kind, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "kind"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying concepts during lookup stages without having partially valid types", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "resource"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersion(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group\" and the \"version\", which uniquely identifies the API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "groupVersion": { + SchemaProps: spec.SchemaProps{ + Description: "groupVersion specifies the API group and version in the form \"group/version\"", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"groupVersion", "version"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "kind"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "resource": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"group", "version", "resource"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_InternalEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InternalEvent makes watch.Event versioned", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Type": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "Object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Bookmark: the object (instance of a type being watched) where\n only ResourceVersion field is set. On successful restart of watch from a\n bookmark resourceVersion, client is guaranteed to not get repeat event\n nor miss any events.\n * If Type is Error: *api.Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.Object"), + }, + }, + }, + Required: []string{"Type", "Object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.Object"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "matchLabels": { + SchemaProps: spec.SchemaProps{ + 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: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "matchExpressions": { + SchemaProps: spec.SchemaProps{ + Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"), + }, + }, + }, + }, + }, + }, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement"}, + } +} + +func schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "key is the label key that the selector applies to.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "values": { + SchemaProps: spec.SchemaProps{ + 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.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"key", "operator"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_List(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "List holds a list of objects, which may not be known by the server.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "List of objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.", + Type: []string{"string"}, + Format: "", + }, + }, + "remainingItemCount": { + SchemaProps: spec.SchemaProps{ + Description: "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ListOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ListOptions is the query options to a standard REST list call.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their labels. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A selector to restrict the list of returned objects by their fields. Defaults to everything.", + Type: []string{"string"}, + Format: "", + }, + }, + "watch": { + SchemaProps: spec.SchemaProps{ + Description: "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "allowWatchBookmarks": { + SchemaProps: spec.SchemaProps{ + Description: "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersionMatch": { + SchemaProps: spec.SchemaProps{ + Description: "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + Type: []string{"string"}, + Format: "", + }, + }, + "timeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "limit": { + SchemaProps: spec.SchemaProps{ + Description: "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "continue": { + SchemaProps: spec.SchemaProps{ + Description: "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", + Type: []string{"string"}, + Format: "", + }, + }, + "sendInitialEvents": { + SchemaProps: spec.SchemaProps{ + Description: "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "manager": { + SchemaProps: spec.SchemaProps{ + Description: "Manager is an identifier of the workflow managing these fields.", + Type: []string{"string"}, + Format: "", + }, + }, + "operation": { + SchemaProps: spec.SchemaProps{ + Description: "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.", + Type: []string{"string"}, + Format: "", + }, + }, + "time": { + SchemaProps: spec.SchemaProps{ + Description: "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "fieldsType": { + SchemaProps: spec.SchemaProps{ + Description: "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldsV1": { + SchemaProps: spec.SchemaProps{ + Description: "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1"), + }, + }, + "subresource": { + SchemaProps: spec.SchemaProps{ + Description: "Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_MicroTime(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MicroTime is version of Time with microsecond level precision.", + Type: v1.MicroTime{}.OpenAPISchemaType(), + Format: v1.MicroTime{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", + Type: []string{"string"}, + Format: "", + }, + }, + "generateName": { + SchemaProps: spec.SchemaProps{ + Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces", + Type: []string{"string"}, + Format: "", + }, + }, + "selfLink": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", + Type: []string{"string"}, + Format: "", + }, + }, + "generation": { + SchemaProps: spec.SchemaProps{ + Description: "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "creationTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionTimestamp": { + SchemaProps: spec.SchemaProps{ + Description: "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "deletionGracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "ownerReferences": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "uid", + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference"), + }, + }, + }, + }, + }, + "finalizers": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-strategy": "merge", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "managedFields": { + SchemaProps: spec.SchemaProps{ + Description: "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry", "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API version of the referent.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Description: "If true, this reference points to the managing controller.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "blockOwnerDeletion": { + SchemaProps: spec.SchemaProps{ + Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name", "uid"}, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_PartialObjectMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartialObjectMetadata is a generic representation of any object with ObjectMeta. It allows clients to get access to a particular ObjectMeta schema without knowing the details of the version.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PartialObjectMetadataList contains a list of objects containing only their metadata", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "items contains each of the included items.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata"}, + } +} + +func schema_pkg_apis_meta_v1_Patch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "force": { + SchemaProps: spec.SchemaProps{ + Description: "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Preconditions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target UID.", + Type: []string{"string"}, + Format: "", + }, + }, + "resourceVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target ResourceVersion", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_RootPaths(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RootPaths lists the paths available at root. For example: \"/healthz\", \"/apis\".", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "paths": { + SchemaProps: spec.SchemaProps{ + Description: "paths are the paths available at root.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"paths"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clientCIDR": { + SchemaProps: spec.SchemaProps{ + Description: "The CIDR with which clients can match their IP to figure out the server address that they should use.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "serverAddress": { + SchemaProps: spec.SchemaProps{ + Description: "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"clientCIDR", "serverAddress"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Status is a return value for calls that don't return other objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the status of this operation.", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.", + Type: []string{"string"}, + Format: "", + }, + }, + "details": { + SchemaProps: spec.SchemaProps{ + Description: "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"), + }, + }, + "code": { + SchemaProps: spec.SchemaProps{ + Description: "Suggested HTTP return code for this status, 0 if not set.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails"}, + } +} + +func schema_pkg_apis_meta_v1_StatusCause(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "A machine-readable description of the cause of the error. If this value is empty there is no information available.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human-readable description of the cause of the error. This field may be presented as-is to a reader.", + Type: []string{"string"}, + Format: "", + }, + }, + "field": { + SchemaProps: spec.SchemaProps{ + Description: "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_StatusDetails(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).", + Type: []string{"string"}, + Format: "", + }, + }, + "group": { + SchemaProps: spec.SchemaProps{ + Description: "The group attribute of the resource associated with the status StatusReason.", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids", + Type: []string{"string"}, + Format: "", + }, + }, + "causes": { + SchemaProps: spec.SchemaProps{ + Description: "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"), + }, + }, + }, + }, + }, + "retryAfterSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause"}, + } +} + +func schema_pkg_apis_meta_v1_Table(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Table is a tabular representation of a set of API resources. The server transforms the object into a set of preferred columns for quickly reviewing the objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "columnDefinitions": { + SchemaProps: spec.SchemaProps{ + Description: "columnDefinitions describes each column in the returned items array. The number of cells per row will always match the number of column definitions.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition"), + }, + }, + }, + }, + }, + "rows": { + SchemaProps: spec.SchemaProps{ + Description: "rows is the list of items in the table.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"), + }, + }, + }, + }, + }, + }, + Required: []string{"columnDefinitions", "rows"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition", "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow"}, + } +} + +func schema_pkg_apis_meta_v1_TableColumnDefinition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableColumnDefinition contains information about a column returned in the Table.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is a human readable name for the column.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type is an OpenAPI type definition for this column, such as number, integer, string, or array. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "format": { + SchemaProps: spec.SchemaProps{ + Description: "format is an optional OpenAPI type modifier for this column. A format modifies the type and imposes additional rules, like date or time formatting for a string. The 'name' format is applied to the primary identifier column which has type 'string' to assist in clients identifying column is the resource name. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "description is a human readable description of this column.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "priority": { + SchemaProps: spec.SchemaProps{ + Description: "priority is an integer defining the relative importance of this column compared to others. Lower numbers are considered higher priority. Columns that may be omitted in limited space scenarios should be given a higher priority.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"name", "type", "format", "description", "priority"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TableOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableOptions are used when a Table is requested by the caller.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "includeObject": { + SchemaProps: spec.SchemaProps{ + Description: "includeObject decides whether to include each object along with its columnar information. Specifying \"None\" will return no object, specifying \"Object\" will return the full object contents, and specifying \"Metadata\" (the default) will return the object's metadata in the PartialObjectMetadata kind in version v1beta1 of the meta.k8s.io API group.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TableRow(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableRow is an individual row in a table.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "cells": { + SchemaProps: spec.SchemaProps{ + Description: "cells will be as wide as the column definitions array and may contain strings, numbers (float64 or int64), booleans, simple maps, lists, or null. See the type field of the column definition for a more detailed description.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Format: "", + }, + }, + }, + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "conditions describe additional status of a row that are relevant for a human user. These conditions apply to the row, not to the object, and will be specific to table output. The only defined condition type is 'Completed', for a row that indicates a resource that has run to completion and can be given less visual priority.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition"), + }, + }, + }, + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "This field contains the requested additional information about each object based on the includeObject policy when requesting the Table. If \"None\", this field is empty, if \"Object\" this will be the default serialization of the object for the current API version, and if \"Metadata\" (the default) will contain the object metadata. Check the returned kind and apiVersion of the object before parsing. The media type of the object will always match the enclosing list - if this as a JSON table, these will be JSON encoded objects.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"cells"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_pkg_apis_meta_v1_TableRowCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TableRowCondition allows a row to be marked with additional information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of row condition. The only defined value is 'Completed' indicating that the object this row represents has reached a completed state and may be given less visual priority than other rows. Clients are not required to honor any conditions but should be consistent where possible about handling the conditions.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "(brief) machine readable reason for the condition's last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "Human readable message indicating details about last transition.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Time(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.", + Type: v1.Time{}.OpenAPISchemaType(), + Format: v1.Time{}.OpenAPISchemaFormat(), + }, + }, + } +} + +func schema_pkg_apis_meta_v1_Timestamp(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Timestamp is a struct that is equivalent to Time, but intended for protobuf marshalling/unmarshalling. It is generated into a serialization that matches Time. Do not use in Go structs.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "seconds": { + SchemaProps: spec.SchemaProps{ + Description: "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.", + Default: 0, + Type: []string{"integer"}, + Format: "int64", + }, + }, + "nanos": { + SchemaProps: spec.SchemaProps{ + Description: "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. This field may be limited in precision depending on context.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"seconds", "nanos"}, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "dryRun": { + SchemaProps: spec.SchemaProps{ + Description: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "fieldManager": { + SchemaProps: spec.SchemaProps{ + Description: "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.", + Type: []string{"string"}, + Format: "", + }, + }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_meta_v1_WatchEvent(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Event represents a single event to a watched resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "object": { + SchemaProps: spec.SchemaProps{ + Description: "Object is:\n * If Type is Added or Modified: the new state of the object.\n * If Type is Deleted: the state of the object immediately before deletion.\n * If Type is Error: *Status is recommended; other types may make sense\n depending on context.", + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + Required: []string{"type", "object"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/runtime.RawExtension"}, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.Object `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// External package:\n\n\ttype MyAPIObject struct {\n\t\truntime.TypeMeta `json:\",inline\"`\n\t\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n\t}\n\n\ttype PluginA struct {\n\t\tAOption string `json:\"aOption\"`\n\t}\n\n// On the wire, the JSON will look something like this:\n\n\t{\n\t\t\"kind\":\"MyAPIObject\",\n\t\t\"apiVersion\":\"v1\",\n\t\t\"myPlugin\": {\n\t\t\t\"kind\":\"PluginA\",\n\t\t\t\"aOption\":\"foo\",\n\t\t},\n\t}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)", + Type: []string{"object"}, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this:\n\n\ttype MyAwesomeAPIObject struct {\n\t runtime.TypeMeta `json:\",inline\"`\n\t ... // other fields\n\t}\n\nfunc (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_runtime_Unknown(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Unknown allows api objects with unknown types to be passed-through. This can be used to deal with the API objects from a plug-in. Unknown objects still have functioning TypeMeta features-- kind, version, etc. metadata and field mutatation.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "ContentEncoding": { + SchemaProps: spec.SchemaProps{ + Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "ContentType": { + SchemaProps: spec.SchemaProps{ + Description: "ContentType is serialization method used to serialize 'Raw'. Unspecified means ContentTypeJSON.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"ContentEncoding", "ContentType"}, + }, + }, + } +} + +func schema_k8sio_apimachinery_pkg_version_Info(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Info contains versioning information. how we'll want to distribute that information.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "major": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "minor": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitCommit": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gitTreeState": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "buildDate": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "goVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "compiler": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "platform": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"}, + }, + }, + } +} diff --git a/pkg/apis/zz_generated.openapi.violation_exceptions b/pkg/apis/zz_generated.openapi.violation_exceptions new file mode 100644 index 000000000..1c759de25 --- /dev/null +++ b/pkg/apis/zz_generated.openapi.violation_exceptions @@ -0,0 +1,39 @@ +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIGroup,ServerAddressByClientCIDRs +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIGroup,Versions +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIGroupList,Groups +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIResource,Categories +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIResource,ShortNames +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIResourceList,APIResources +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIVersions,ServerAddressByClientCIDRs +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIVersions,Versions +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,ApplyOptions,DryRun +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,CreateOptions,DryRun +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,DeleteOptions,DryRun +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,LabelSelector,MatchExpressions +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,LabelSelectorRequirement,Values +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,ObjectMeta,Finalizers +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,ObjectMeta,ManagedFields +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,ObjectMeta,OwnerReferences +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,PatchOptions,DryRun +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,RootPaths,Paths +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,StatusDetails,Causes +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,Table,ColumnDefinitions +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,Table,Rows +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,TableRow,Cells +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,TableRow,Conditions +API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,UpdateOptions,DryRun +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,Format +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,d +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,i +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,s +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,int64Amount,scale +API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,int64Amount,value +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,APIResourceList,APIResources +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Duration,Duration +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,InternalEvent,Object +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,InternalEvent,Type +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,MicroTime,Time +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause,Type +API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time +API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding +API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/matchcondition.go b/pkg/clients/applyconfiguration/admissionregistration/v1/matchcondition.go new file mode 100644 index 000000000..62ce97eda --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/matchcondition.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// MatchConditionApplyConfiguration represents an declarative configuration of the MatchCondition type for use +// with apply. +type MatchConditionApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Expression *string `json:"expression,omitempty"` +} + +// MatchConditionApplyConfiguration constructs an declarative configuration of the MatchCondition type for use with +// apply. +func MatchCondition() *MatchConditionApplyConfiguration { + return &MatchConditionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MatchConditionApplyConfiguration) WithName(value string) *MatchConditionApplyConfiguration { + b.Name = &value + return b +} + +// WithExpression sets the Expression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Expression field is set to the value of the last call. +func (b *MatchConditionApplyConfiguration) WithExpression(value string) *MatchConditionApplyConfiguration { + b.Expression = &value + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/mutatingwebhook.go b/pkg/clients/applyconfiguration/admissionregistration/v1/mutatingwebhook.go new file mode 100644 index 000000000..6da13023f --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/mutatingwebhook.go @@ -0,0 +1,142 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MutatingWebhookApplyConfiguration represents an declarative configuration of the MutatingWebhook type for use +// with apply. +type MutatingWebhookApplyConfiguration struct { + Name *string `json:"name,omitempty"` + ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` + Rules []RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` + FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` + MatchPolicy *admissionregistrationv1.MatchPolicyType `json:"matchPolicy,omitempty"` + NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` + ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` + SideEffects *admissionregistrationv1.SideEffectClass `json:"sideEffects,omitempty"` + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty"` + ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` + MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` +} + +// MutatingWebhookApplyConfiguration constructs an declarative configuration of the MutatingWebhook type for use with +// apply. +func MutatingWebhook() *MutatingWebhookApplyConfiguration { + return &MutatingWebhookApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithName(value string) *MutatingWebhookApplyConfiguration { + b.Name = &value + return b +} + +// WithClientConfig sets the ClientConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientConfig field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *MutatingWebhookApplyConfiguration { + b.ClientConfig = value + return b +} + +// WithRules adds the given value to the Rules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Rules field. +func (b *MutatingWebhookApplyConfiguration) WithRules(values ...*RuleWithOperationsApplyConfiguration) *MutatingWebhookApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRules") + } + b.Rules = append(b.Rules, *values[i]) + } + return b +} + +// WithFailurePolicy sets the FailurePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailurePolicy field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *MutatingWebhookApplyConfiguration { + b.FailurePolicy = &value + return b +} + +// WithMatchPolicy sets the MatchPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchPolicy field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1.MatchPolicyType) *MutatingWebhookApplyConfiguration { + b.MatchPolicy = &value + return b +} + +// WithNamespaceSelector sets the NamespaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NamespaceSelector field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration { + b.NamespaceSelector = value + return b +} + +// WithObjectSelector sets the ObjectSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObjectSelector field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *MutatingWebhookApplyConfiguration { + b.ObjectSelector = value + return b +} + +// WithSideEffects sets the SideEffects field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SideEffects field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1.SideEffectClass) *MutatingWebhookApplyConfiguration { + b.SideEffects = &value + return b +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *MutatingWebhookApplyConfiguration { + b.TimeoutSeconds = &value + return b +} + +// WithAdmissionReviewVersions adds the given value to the AdmissionReviewVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AdmissionReviewVersions field. +func (b *MutatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *MutatingWebhookApplyConfiguration { + for i := range values { + b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i]) + } + return b +} + +// WithReinvocationPolicy sets the ReinvocationPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReinvocationPolicy field is set to the value of the last call. +func (b *MutatingWebhookApplyConfiguration) WithReinvocationPolicy(value admissionregistrationv1.ReinvocationPolicyType) *MutatingWebhookApplyConfiguration { + b.ReinvocationPolicy = &value + return b +} + +// WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchConditions field. +func (b *MutatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingWebhookApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchConditions") + } + b.MatchConditions = append(b.MatchConditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/mutatingwebhookconfiguration.go b/pkg/clients/applyconfiguration/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..fc5c0f381 --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,201 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MutatingWebhookConfigurationApplyConfiguration represents an declarative configuration of the MutatingWebhookConfiguration type for use +// with apply. +type MutatingWebhookConfigurationApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Webhooks []MutatingWebhookApplyConfiguration `json:"webhooks,omitempty"` +} + +// MutatingWebhookConfiguration constructs an declarative configuration of the MutatingWebhookConfiguration type for use with +// apply. +func MutatingWebhookConfiguration(name string) *MutatingWebhookConfigurationApplyConfiguration { + b := &MutatingWebhookConfigurationApplyConfiguration{} + b.WithName(name) + b.WithKind("MutatingWebhookConfiguration") + b.WithAPIVersion("admissionregistration.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithKind(value string) *MutatingWebhookConfigurationApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithAPIVersion(value string) *MutatingWebhookConfigurationApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithName(value string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithGenerateName(value string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithNamespace(value string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithUID(value types.UID) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithResourceVersion(value string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithGeneration(value int64) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithLabels(entries map[string]string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithFinalizers(values ...string) *MutatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *MutatingWebhookConfigurationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithWebhooks adds the given value to the Webhooks field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Webhooks field. +func (b *MutatingWebhookConfigurationApplyConfiguration) WithWebhooks(values ...*MutatingWebhookApplyConfiguration) *MutatingWebhookConfigurationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithWebhooks") + } + b.Webhooks = append(b.Webhooks, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/rule.go b/pkg/clients/applyconfiguration/admissionregistration/v1/rule.go new file mode 100644 index 000000000..50d897a14 --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/rule.go @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" +) + +// RuleApplyConfiguration represents an declarative configuration of the Rule type for use +// with apply. +type RuleApplyConfiguration struct { + APIGroups []string `json:"apiGroups,omitempty"` + APIVersions []string `json:"apiVersions,omitempty"` + Resources []string `json:"resources,omitempty"` + Scope *v1.ScopeType `json:"scope,omitempty"` +} + +// RuleApplyConfiguration constructs an declarative configuration of the Rule type for use with +// apply. +func Rule() *RuleApplyConfiguration { + return &RuleApplyConfiguration{} +} + +// WithAPIGroups adds the given value to the APIGroups field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the APIGroups field. +func (b *RuleApplyConfiguration) WithAPIGroups(values ...string) *RuleApplyConfiguration { + for i := range values { + b.APIGroups = append(b.APIGroups, values[i]) + } + return b +} + +// WithAPIVersions adds the given value to the APIVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the APIVersions field. +func (b *RuleApplyConfiguration) WithAPIVersions(values ...string) *RuleApplyConfiguration { + for i := range values { + b.APIVersions = append(b.APIVersions, values[i]) + } + return b +} + +// WithResources adds the given value to the Resources field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Resources field. +func (b *RuleApplyConfiguration) WithResources(values ...string) *RuleApplyConfiguration { + for i := range values { + b.Resources = append(b.Resources, values[i]) + } + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *RuleApplyConfiguration) WithScope(value v1.ScopeType) *RuleApplyConfiguration { + b.Scope = &value + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/rulewithoperations.go b/pkg/clients/applyconfiguration/admissionregistration/v1/rulewithoperations.go new file mode 100644 index 000000000..b6bbd0b44 --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/rulewithoperations.go @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" +) + +// RuleWithOperationsApplyConfiguration represents an declarative configuration of the RuleWithOperations type for use +// with apply. +type RuleWithOperationsApplyConfiguration struct { + Operations []v1.OperationType `json:"operations,omitempty"` + RuleApplyConfiguration `json:",inline"` +} + +// RuleWithOperationsApplyConfiguration constructs an declarative configuration of the RuleWithOperations type for use with +// apply. +func RuleWithOperations() *RuleWithOperationsApplyConfiguration { + return &RuleWithOperationsApplyConfiguration{} +} + +// WithOperations adds the given value to the Operations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Operations field. +func (b *RuleWithOperationsApplyConfiguration) WithOperations(values ...v1.OperationType) *RuleWithOperationsApplyConfiguration { + for i := range values { + b.Operations = append(b.Operations, values[i]) + } + return b +} + +// WithAPIGroups adds the given value to the APIGroups field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the APIGroups field. +func (b *RuleWithOperationsApplyConfiguration) WithAPIGroups(values ...string) *RuleWithOperationsApplyConfiguration { + for i := range values { + b.APIGroups = append(b.APIGroups, values[i]) + } + return b +} + +// WithAPIVersions adds the given value to the APIVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the APIVersions field. +func (b *RuleWithOperationsApplyConfiguration) WithAPIVersions(values ...string) *RuleWithOperationsApplyConfiguration { + for i := range values { + b.APIVersions = append(b.APIVersions, values[i]) + } + return b +} + +// WithResources adds the given value to the Resources field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Resources field. +func (b *RuleWithOperationsApplyConfiguration) WithResources(values ...string) *RuleWithOperationsApplyConfiguration { + for i := range values { + b.Resources = append(b.Resources, values[i]) + } + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *RuleWithOperationsApplyConfiguration) WithScope(value v1.ScopeType) *RuleWithOperationsApplyConfiguration { + b.Scope = &value + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/servicereference.go b/pkg/clients/applyconfiguration/admissionregistration/v1/servicereference.go new file mode 100644 index 000000000..87652d688 --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/servicereference.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ServiceReferenceApplyConfiguration represents an declarative configuration of the ServiceReference type for use +// with apply. +type ServiceReferenceApplyConfiguration struct { + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` + Port *int32 `json:"port,omitempty"` +} + +// ServiceReferenceApplyConfiguration constructs an declarative configuration of the ServiceReference type for use with +// apply. +func ServiceReference() *ServiceReferenceApplyConfiguration { + return &ServiceReferenceApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithNamespace(value string) *ServiceReferenceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithName(value string) *ServiceReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPath(value string) *ServiceReferenceApplyConfiguration { + b.Path = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPort(value int32) *ServiceReferenceApplyConfiguration { + b.Port = &value + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/validatingwebhook.go b/pkg/clients/applyconfiguration/admissionregistration/v1/validatingwebhook.go new file mode 100644 index 000000000..31c82aff7 --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/validatingwebhook.go @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ValidatingWebhookApplyConfiguration represents an declarative configuration of the ValidatingWebhook type for use +// with apply. +type ValidatingWebhookApplyConfiguration struct { + Name *string `json:"name,omitempty"` + ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` + Rules []RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` + FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` + MatchPolicy *admissionregistrationv1.MatchPolicyType `json:"matchPolicy,omitempty"` + NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` + ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` + SideEffects *admissionregistrationv1.SideEffectClass `json:"sideEffects,omitempty"` + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty"` + MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` +} + +// ValidatingWebhookApplyConfiguration constructs an declarative configuration of the ValidatingWebhook type for use with +// apply. +func ValidatingWebhook() *ValidatingWebhookApplyConfiguration { + return &ValidatingWebhookApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithName(value string) *ValidatingWebhookApplyConfiguration { + b.Name = &value + return b +} + +// WithClientConfig sets the ClientConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientConfig field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *ValidatingWebhookApplyConfiguration { + b.ClientConfig = value + return b +} + +// WithRules adds the given value to the Rules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Rules field. +func (b *ValidatingWebhookApplyConfiguration) WithRules(values ...*RuleWithOperationsApplyConfiguration) *ValidatingWebhookApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRules") + } + b.Rules = append(b.Rules, *values[i]) + } + return b +} + +// WithFailurePolicy sets the FailurePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailurePolicy field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *ValidatingWebhookApplyConfiguration { + b.FailurePolicy = &value + return b +} + +// WithMatchPolicy sets the MatchPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchPolicy field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithMatchPolicy(value admissionregistrationv1.MatchPolicyType) *ValidatingWebhookApplyConfiguration { + b.MatchPolicy = &value + return b +} + +// WithNamespaceSelector sets the NamespaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NamespaceSelector field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithNamespaceSelector(value *metav1.LabelSelectorApplyConfiguration) *ValidatingWebhookApplyConfiguration { + b.NamespaceSelector = value + return b +} + +// WithObjectSelector sets the ObjectSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObjectSelector field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithObjectSelector(value *metav1.LabelSelectorApplyConfiguration) *ValidatingWebhookApplyConfiguration { + b.ObjectSelector = value + return b +} + +// WithSideEffects sets the SideEffects field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SideEffects field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithSideEffects(value admissionregistrationv1.SideEffectClass) *ValidatingWebhookApplyConfiguration { + b.SideEffects = &value + return b +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *ValidatingWebhookApplyConfiguration) WithTimeoutSeconds(value int32) *ValidatingWebhookApplyConfiguration { + b.TimeoutSeconds = &value + return b +} + +// WithAdmissionReviewVersions adds the given value to the AdmissionReviewVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AdmissionReviewVersions field. +func (b *ValidatingWebhookApplyConfiguration) WithAdmissionReviewVersions(values ...string) *ValidatingWebhookApplyConfiguration { + for i := range values { + b.AdmissionReviewVersions = append(b.AdmissionReviewVersions, values[i]) + } + return b +} + +// WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchConditions field. +func (b *ValidatingWebhookApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *ValidatingWebhookApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchConditions") + } + b.MatchConditions = append(b.MatchConditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/validatingwebhookconfiguration.go b/pkg/clients/applyconfiguration/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..4e157a48c --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,201 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ValidatingWebhookConfigurationApplyConfiguration represents an declarative configuration of the ValidatingWebhookConfiguration type for use +// with apply. +type ValidatingWebhookConfigurationApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Webhooks []ValidatingWebhookApplyConfiguration `json:"webhooks,omitempty"` +} + +// ValidatingWebhookConfiguration constructs an declarative configuration of the ValidatingWebhookConfiguration type for use with +// apply. +func ValidatingWebhookConfiguration(name string) *ValidatingWebhookConfigurationApplyConfiguration { + b := &ValidatingWebhookConfigurationApplyConfiguration{} + b.WithName(name) + b.WithKind("ValidatingWebhookConfiguration") + b.WithAPIVersion("admissionregistration.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithKind(value string) *ValidatingWebhookConfigurationApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithAPIVersion(value string) *ValidatingWebhookConfigurationApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithName(value string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithGenerateName(value string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithNamespace(value string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithUID(value types.UID) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithResourceVersion(value string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithGeneration(value int64) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithLabels(entries map[string]string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithAnnotations(entries map[string]string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithFinalizers(values ...string) *ValidatingWebhookConfigurationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ValidatingWebhookConfigurationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithWebhooks adds the given value to the Webhooks field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Webhooks field. +func (b *ValidatingWebhookConfigurationApplyConfiguration) WithWebhooks(values ...*ValidatingWebhookApplyConfiguration) *ValidatingWebhookConfigurationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithWebhooks") + } + b.Webhooks = append(b.Webhooks, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/admissionregistration/v1/webhookclientconfig.go b/pkg/clients/applyconfiguration/admissionregistration/v1/webhookclientconfig.go new file mode 100644 index 000000000..bca10b539 --- /dev/null +++ b/pkg/clients/applyconfiguration/admissionregistration/v1/webhookclientconfig.go @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// WebhookClientConfigApplyConfiguration represents an declarative configuration of the WebhookClientConfig type for use +// with apply. +type WebhookClientConfigApplyConfiguration struct { + URL *string `json:"url,omitempty"` + Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` + CABundle []byte `json:"caBundle,omitempty"` +} + +// WebhookClientConfigApplyConfiguration constructs an declarative configuration of the WebhookClientConfig type for use with +// apply. +func WebhookClientConfig() *WebhookClientConfigApplyConfiguration { + return &WebhookClientConfigApplyConfiguration{} +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithURL(value string) *WebhookClientConfigApplyConfiguration { + b.URL = &value + return b +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithService(value *ServiceReferenceApplyConfiguration) *WebhookClientConfigApplyConfiguration { + b.Service = value + return b +} + +// WithCABundle adds the given value to the CABundle field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CABundle field. +func (b *WebhookClientConfigApplyConfiguration) WithCABundle(values ...byte) *WebhookClientConfigApplyConfiguration { + for i := range values { + b.CABundle = append(b.CABundle, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go new file mode 100644 index 000000000..44207c861 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceColumnDefinitionApplyConfiguration represents an declarative configuration of the CustomResourceColumnDefinition type for use +// with apply. +type CustomResourceColumnDefinitionApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Format *string `json:"format,omitempty"` + Description *string `json:"description,omitempty"` + Priority *int32 `json:"priority,omitempty"` + JSONPath *string `json:"jsonPath,omitempty"` +} + +// CustomResourceColumnDefinitionApplyConfiguration constructs an declarative configuration of the CustomResourceColumnDefinition type for use with +// apply. +func CustomResourceColumnDefinition() *CustomResourceColumnDefinitionApplyConfiguration { + return &CustomResourceColumnDefinitionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithName(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Name = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithType(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Type = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithFormat(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Format = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithDescription(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Description = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithPriority(value int32) *CustomResourceColumnDefinitionApplyConfiguration { + b.Priority = &value + return b +} + +// WithJSONPath sets the JSONPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JSONPath field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithJSONPath(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.JSONPath = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourceconversion.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourceconversion.go new file mode 100644 index 000000000..f6ba77011 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourceconversion.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// CustomResourceConversionApplyConfiguration represents an declarative configuration of the CustomResourceConversion type for use +// with apply. +type CustomResourceConversionApplyConfiguration struct { + Strategy *v1.ConversionStrategyType `json:"strategy,omitempty"` + Webhook *WebhookConversionApplyConfiguration `json:"webhook,omitempty"` +} + +// CustomResourceConversionApplyConfiguration constructs an declarative configuration of the CustomResourceConversion type for use with +// apply. +func CustomResourceConversion() *CustomResourceConversionApplyConfiguration { + return &CustomResourceConversionApplyConfiguration{} +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *CustomResourceConversionApplyConfiguration) WithStrategy(value v1.ConversionStrategyType) *CustomResourceConversionApplyConfiguration { + b.Strategy = &value + return b +} + +// WithWebhook sets the Webhook field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Webhook field is set to the value of the last call. +func (b *CustomResourceConversionApplyConfiguration) WithWebhook(value *WebhookConversionApplyConfiguration) *CustomResourceConversionApplyConfiguration { + b.Webhook = value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinition.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 000000000..753f131e5 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CustomResourceDefinitionApplyConfiguration represents an declarative configuration of the CustomResourceDefinition type for use +// with apply. +type CustomResourceDefinitionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *CustomResourceDefinitionSpecApplyConfiguration `json:"spec,omitempty"` + Status *CustomResourceDefinitionStatusApplyConfiguration `json:"status,omitempty"` +} + +// CustomResourceDefinition constructs an declarative configuration of the CustomResourceDefinition type for use with +// apply. +func CustomResourceDefinition(name string) *CustomResourceDefinitionApplyConfiguration { + b := &CustomResourceDefinitionApplyConfiguration{} + b.WithName(name) + b.WithKind("CustomResourceDefinition") + b.WithAPIVersion("apiextensions.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithKind(value string) *CustomResourceDefinitionApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithAPIVersion(value string) *CustomResourceDefinitionApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithName(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithGenerateName(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithNamespace(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithUID(value types.UID) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithResourceVersion(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithGeneration(value int64) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CustomResourceDefinitionApplyConfiguration) WithLabels(entries map[string]string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CustomResourceDefinitionApplyConfiguration) WithAnnotations(entries map[string]string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CustomResourceDefinitionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CustomResourceDefinitionApplyConfiguration) WithFinalizers(values ...string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CustomResourceDefinitionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithSpec(value *CustomResourceDefinitionSpecApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithStatus(value *CustomResourceDefinitionStatusApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go new file mode 100644 index 000000000..1d2346235 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CustomResourceDefinitionConditionApplyConfiguration represents an declarative configuration of the CustomResourceDefinitionCondition type for use +// with apply. +type CustomResourceDefinitionConditionApplyConfiguration struct { + Type *v1.CustomResourceDefinitionConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CustomResourceDefinitionConditionApplyConfiguration constructs an declarative configuration of the CustomResourceDefinitionCondition type for use with +// apply. +func CustomResourceDefinitionCondition() *CustomResourceDefinitionConditionApplyConfiguration { + return &CustomResourceDefinitionConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithType(value v1.CustomResourceDefinitionConditionType) *CustomResourceDefinitionConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *CustomResourceDefinitionConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *CustomResourceDefinitionConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithReason(value string) *CustomResourceDefinitionConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithMessage(value string) *CustomResourceDefinitionConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go new file mode 100644 index 000000000..4f4871dea --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionNamesApplyConfiguration represents an declarative configuration of the CustomResourceDefinitionNames type for use +// with apply. +type CustomResourceDefinitionNamesApplyConfiguration struct { + Plural *string `json:"plural,omitempty"` + Singular *string `json:"singular,omitempty"` + ShortNames []string `json:"shortNames,omitempty"` + Kind *string `json:"kind,omitempty"` + ListKind *string `json:"listKind,omitempty"` + Categories []string `json:"categories,omitempty"` +} + +// CustomResourceDefinitionNamesApplyConfiguration constructs an declarative configuration of the CustomResourceDefinitionNames type for use with +// apply. +func CustomResourceDefinitionNames() *CustomResourceDefinitionNamesApplyConfiguration { + return &CustomResourceDefinitionNamesApplyConfiguration{} +} + +// WithPlural sets the Plural field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Plural field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithPlural(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Plural = &value + return b +} + +// WithSingular sets the Singular field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Singular field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithSingular(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Singular = &value + return b +} + +// WithShortNames adds the given value to the ShortNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ShortNames field. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithShortNames(values ...string) *CustomResourceDefinitionNamesApplyConfiguration { + for i := range values { + b.ShortNames = append(b.ShortNames, values[i]) + } + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithKind(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Kind = &value + return b +} + +// WithListKind sets the ListKind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ListKind field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithListKind(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.ListKind = &value + return b +} + +// WithCategories adds the given value to the Categories field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Categories field. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithCategories(values ...string) *CustomResourceDefinitionNamesApplyConfiguration { + for i := range values { + b.Categories = append(b.Categories, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go new file mode 100644 index 000000000..5850bccba --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go @@ -0,0 +1,80 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// CustomResourceDefinitionSpecApplyConfiguration represents an declarative configuration of the CustomResourceDefinitionSpec type for use +// with apply. +type CustomResourceDefinitionSpecApplyConfiguration struct { + Group *string `json:"group,omitempty"` + Names *CustomResourceDefinitionNamesApplyConfiguration `json:"names,omitempty"` + Scope *apiextensionsv1.ResourceScope `json:"scope,omitempty"` + Versions []CustomResourceDefinitionVersionApplyConfiguration `json:"versions,omitempty"` + Conversion *CustomResourceConversionApplyConfiguration `json:"conversion,omitempty"` + PreserveUnknownFields *bool `json:"preserveUnknownFields,omitempty"` +} + +// CustomResourceDefinitionSpecApplyConfiguration constructs an declarative configuration of the CustomResourceDefinitionSpec type for use with +// apply. +func CustomResourceDefinitionSpec() *CustomResourceDefinitionSpecApplyConfiguration { + return &CustomResourceDefinitionSpecApplyConfiguration{} +} + +// WithGroup sets the Group field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Group field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithGroup(value string) *CustomResourceDefinitionSpecApplyConfiguration { + b.Group = &value + return b +} + +// WithNames sets the Names field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Names field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithNames(value *CustomResourceDefinitionNamesApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Names = value + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithScope(value apiextensionsv1.ResourceScope) *CustomResourceDefinitionSpecApplyConfiguration { + b.Scope = &value + return b +} + +// WithVersions adds the given value to the Versions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Versions field. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithVersions(values ...*CustomResourceDefinitionVersionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVersions") + } + b.Versions = append(b.Versions, *values[i]) + } + return b +} + +// WithConversion sets the Conversion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conversion field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithConversion(value *CustomResourceConversionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Conversion = value + return b +} + +// WithPreserveUnknownFields sets the PreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreserveUnknownFields field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithPreserveUnknownFields(value bool) *CustomResourceDefinitionSpecApplyConfiguration { + b.PreserveUnknownFields = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go new file mode 100644 index 000000000..202a7024e --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionStatusApplyConfiguration represents an declarative configuration of the CustomResourceDefinitionStatus type for use +// with apply. +type CustomResourceDefinitionStatusApplyConfiguration struct { + Conditions []CustomResourceDefinitionConditionApplyConfiguration `json:"conditions,omitempty"` + AcceptedNames *CustomResourceDefinitionNamesApplyConfiguration `json:"acceptedNames,omitempty"` + StoredVersions []string `json:"storedVersions,omitempty"` +} + +// CustomResourceDefinitionStatusApplyConfiguration constructs an declarative configuration of the CustomResourceDefinitionStatus type for use with +// apply. +func CustomResourceDefinitionStatus() *CustomResourceDefinitionStatusApplyConfiguration { + return &CustomResourceDefinitionStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithConditions(values ...*CustomResourceDefinitionConditionApplyConfiguration) *CustomResourceDefinitionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAcceptedNames sets the AcceptedNames field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AcceptedNames field is set to the value of the last call. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithAcceptedNames(value *CustomResourceDefinitionNamesApplyConfiguration) *CustomResourceDefinitionStatusApplyConfiguration { + b.AcceptedNames = value + return b +} + +// WithStoredVersions adds the given value to the StoredVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StoredVersions field. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithStoredVersions(values ...string) *CustomResourceDefinitionStatusApplyConfiguration { + for i := range values { + b.StoredVersions = append(b.StoredVersions, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go new file mode 100644 index 000000000..3ea86a0bc --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionVersionApplyConfiguration represents an declarative configuration of the CustomResourceDefinitionVersion type for use +// with apply. +type CustomResourceDefinitionVersionApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Served *bool `json:"served,omitempty"` + Storage *bool `json:"storage,omitempty"` + Deprecated *bool `json:"deprecated,omitempty"` + DeprecationWarning *string `json:"deprecationWarning,omitempty"` + Schema *CustomResourceValidationApplyConfiguration `json:"schema,omitempty"` + Subresources *CustomResourceSubresourcesApplyConfiguration `json:"subresources,omitempty"` + AdditionalPrinterColumns []CustomResourceColumnDefinitionApplyConfiguration `json:"additionalPrinterColumns,omitempty"` +} + +// CustomResourceDefinitionVersionApplyConfiguration constructs an declarative configuration of the CustomResourceDefinitionVersion type for use with +// apply. +func CustomResourceDefinitionVersion() *CustomResourceDefinitionVersionApplyConfiguration { + return &CustomResourceDefinitionVersionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithName(value string) *CustomResourceDefinitionVersionApplyConfiguration { + b.Name = &value + return b +} + +// WithServed sets the Served field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Served field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithServed(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Served = &value + return b +} + +// WithStorage sets the Storage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Storage field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithStorage(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Storage = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithDeprecated(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Deprecated = &value + return b +} + +// WithDeprecationWarning sets the DeprecationWarning field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecationWarning field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithDeprecationWarning(value string) *CustomResourceDefinitionVersionApplyConfiguration { + b.DeprecationWarning = &value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSchema(value *CustomResourceValidationApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + b.Schema = value + return b +} + +// WithSubresources sets the Subresources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subresources field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSubresources(value *CustomResourceSubresourcesApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + b.Subresources = value + return b +} + +// WithAdditionalPrinterColumns adds the given value to the AdditionalPrinterColumns field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AdditionalPrinterColumns field. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithAdditionalPrinterColumns(values ...*CustomResourceColumnDefinitionApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAdditionalPrinterColumns") + } + b.AdditionalPrinterColumns = append(b.AdditionalPrinterColumns, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcesubresources.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcesubresources.go new file mode 100644 index 000000000..2221c3c05 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcesubresources.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// CustomResourceSubresourcesApplyConfiguration represents an declarative configuration of the CustomResourceSubresources type for use +// with apply. +type CustomResourceSubresourcesApplyConfiguration struct { + Status *v1.CustomResourceSubresourceStatus `json:"status,omitempty"` + Scale *CustomResourceSubresourceScaleApplyConfiguration `json:"scale,omitempty"` +} + +// CustomResourceSubresourcesApplyConfiguration constructs an declarative configuration of the CustomResourceSubresources type for use with +// apply. +func CustomResourceSubresources() *CustomResourceSubresourcesApplyConfiguration { + return &CustomResourceSubresourcesApplyConfiguration{} +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceSubresourcesApplyConfiguration) WithStatus(value v1.CustomResourceSubresourceStatus) *CustomResourceSubresourcesApplyConfiguration { + b.Status = &value + return b +} + +// WithScale sets the Scale field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scale field is set to the value of the last call. +func (b *CustomResourceSubresourcesApplyConfiguration) WithScale(value *CustomResourceSubresourceScaleApplyConfiguration) *CustomResourceSubresourcesApplyConfiguration { + b.Scale = value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go new file mode 100644 index 000000000..abb4ff8cd --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceSubresourceScaleApplyConfiguration represents an declarative configuration of the CustomResourceSubresourceScale type for use +// with apply. +type CustomResourceSubresourceScaleApplyConfiguration struct { + SpecReplicasPath *string `json:"specReplicasPath,omitempty"` + StatusReplicasPath *string `json:"statusReplicasPath,omitempty"` + LabelSelectorPath *string `json:"labelSelectorPath,omitempty"` +} + +// CustomResourceSubresourceScaleApplyConfiguration constructs an declarative configuration of the CustomResourceSubresourceScale type for use with +// apply. +func CustomResourceSubresourceScale() *CustomResourceSubresourceScaleApplyConfiguration { + return &CustomResourceSubresourceScaleApplyConfiguration{} +} + +// WithSpecReplicasPath sets the SpecReplicasPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SpecReplicasPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithSpecReplicasPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.SpecReplicasPath = &value + return b +} + +// WithStatusReplicasPath sets the StatusReplicasPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StatusReplicasPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithStatusReplicasPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.StatusReplicasPath = &value + return b +} + +// WithLabelSelectorPath sets the LabelSelectorPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelectorPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithLabelSelectorPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.LabelSelectorPath = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/customresourcevalidation.go b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcevalidation.go new file mode 100644 index 000000000..73a902f94 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/customresourcevalidation.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceValidationApplyConfiguration represents an declarative configuration of the CustomResourceValidation type for use +// with apply. +type CustomResourceValidationApplyConfiguration struct { + OpenAPIV3Schema *JSONSchemaPropsApplyConfiguration `json:"openAPIV3Schema,omitempty"` +} + +// CustomResourceValidationApplyConfiguration constructs an declarative configuration of the CustomResourceValidation type for use with +// apply. +func CustomResourceValidation() *CustomResourceValidationApplyConfiguration { + return &CustomResourceValidationApplyConfiguration{} +} + +// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. +func (b *CustomResourceValidationApplyConfiguration) WithOpenAPIV3Schema(value *JSONSchemaPropsApplyConfiguration) *CustomResourceValidationApplyConfiguration { + b.OpenAPIV3Schema = value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/externaldocumentation.go b/pkg/clients/applyconfiguration/apiextensions/v1/externaldocumentation.go new file mode 100644 index 000000000..d26b6bfbd --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/externaldocumentation.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ExternalDocumentationApplyConfiguration represents an declarative configuration of the ExternalDocumentation type for use +// with apply. +type ExternalDocumentationApplyConfiguration struct { + Description *string `json:"description,omitempty"` + URL *string `json:"url,omitempty"` +} + +// ExternalDocumentationApplyConfiguration constructs an declarative configuration of the ExternalDocumentation type for use with +// apply. +func ExternalDocumentation() *ExternalDocumentationApplyConfiguration { + return &ExternalDocumentationApplyConfiguration{} +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *ExternalDocumentationApplyConfiguration) WithDescription(value string) *ExternalDocumentationApplyConfiguration { + b.Description = &value + return b +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *ExternalDocumentationApplyConfiguration) WithURL(value string) *ExternalDocumentationApplyConfiguration { + b.URL = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/jsonschemaprops.go b/pkg/clients/applyconfiguration/apiextensions/v1/jsonschemaprops.go new file mode 100644 index 000000000..b3ffd155a --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/jsonschemaprops.go @@ -0,0 +1,450 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// JSONSchemaPropsApplyConfiguration represents an declarative configuration of the JSONSchemaProps type for use +// with apply. +type JSONSchemaPropsApplyConfiguration struct { + ID *string `json:"id,omitempty"` + Schema *v1.JSONSchemaURL `json:"$schema,omitempty"` + Ref *string `json:"$ref,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + Format *string `json:"format,omitempty"` + Title *string `json:"title,omitempty"` + Default *v1.JSON `json:"default,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum *bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum *bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern *string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems *bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []v1.JSON `json:"enum,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` + Required []string `json:"required,omitempty"` + Items *v1.JSONSchemaPropsOrArray `json:"items,omitempty"` + AllOf []JSONSchemaPropsApplyConfiguration `json:"allOf,omitempty"` + OneOf []JSONSchemaPropsApplyConfiguration `json:"oneOf,omitempty"` + AnyOf []JSONSchemaPropsApplyConfiguration `json:"anyOf,omitempty"` + Not *JSONSchemaPropsApplyConfiguration `json:"not,omitempty"` + Properties map[string]JSONSchemaPropsApplyConfiguration `json:"properties,omitempty"` + AdditionalProperties *v1.JSONSchemaPropsOrBool `json:"additionalProperties,omitempty"` + PatternProperties map[string]JSONSchemaPropsApplyConfiguration `json:"patternProperties,omitempty"` + Dependencies *v1.JSONSchemaDependencies `json:"dependencies,omitempty"` + AdditionalItems *v1.JSONSchemaPropsOrBool `json:"additionalItems,omitempty"` + Definitions *v1.JSONSchemaDefinitions `json:"definitions,omitempty"` + ExternalDocs *ExternalDocumentationApplyConfiguration `json:"externalDocs,omitempty"` + Example *v1.JSON `json:"example,omitempty"` + Nullable *bool `json:"nullable,omitempty"` + XPreserveUnknownFields *bool `json:"x-kubernetes-preserve-unknown-fields,omitempty"` + XEmbeddedResource *bool `json:"x-kubernetes-embedded-resource,omitempty"` + XIntOrString *bool `json:"x-kubernetes-int-or-string,omitempty"` + XListMapKeys []string `json:"x-kubernetes-list-map-keys,omitempty"` + XListType *string `json:"x-kubernetes-list-type,omitempty"` + XMapType *string `json:"x-kubernetes-map-type,omitempty"` + XValidations *v1.ValidationRules `json:"x-kubernetes-validations,omitempty"` +} + +// JSONSchemaPropsApplyConfiguration constructs an declarative configuration of the JSONSchemaProps type for use with +// apply. +func JSONSchemaProps() *JSONSchemaPropsApplyConfiguration { + return &JSONSchemaPropsApplyConfiguration{} +} + +// WithID sets the ID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ID field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithID(value string) *JSONSchemaPropsApplyConfiguration { + b.ID = &value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithSchema(value v1.JSONSchemaURL) *JSONSchemaPropsApplyConfiguration { + b.Schema = &value + return b +} + +// WithRef sets the Ref field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ref field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithRef(value string) *JSONSchemaPropsApplyConfiguration { + b.Ref = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDescription(value string) *JSONSchemaPropsApplyConfiguration { + b.Description = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithType(value string) *JSONSchemaPropsApplyConfiguration { + b.Type = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithFormat(value string) *JSONSchemaPropsApplyConfiguration { + b.Format = &value + return b +} + +// WithTitle sets the Title field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Title field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithTitle(value string) *JSONSchemaPropsApplyConfiguration { + b.Title = &value + return b +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefault(value v1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Default = &value + return b +} + +// WithMaximum sets the Maximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Maximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaximum(value float64) *JSONSchemaPropsApplyConfiguration { + b.Maximum = &value + return b +} + +// WithExclusiveMaximum sets the ExclusiveMaximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMaximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMaximum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMaximum = &value + return b +} + +// WithMinimum sets the Minimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Minimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinimum(value float64) *JSONSchemaPropsApplyConfiguration { + b.Minimum = &value + return b +} + +// WithExclusiveMinimum sets the ExclusiveMinimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMinimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMinimum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMinimum = &value + return b +} + +// WithMaxLength sets the MaxLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxLength = &value + return b +} + +// WithMinLength sets the MinLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinLength = &value + return b +} + +// WithPattern sets the Pattern field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pattern field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithPattern(value string) *JSONSchemaPropsApplyConfiguration { + b.Pattern = &value + return b +} + +// WithMaxItems sets the MaxItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxItems = &value + return b +} + +// WithMinItems sets the MinItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinItems = &value + return b +} + +// WithUniqueItems sets the UniqueItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UniqueItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithUniqueItems(value bool) *JSONSchemaPropsApplyConfiguration { + b.UniqueItems = &value + return b +} + +// WithMultipleOf sets the MultipleOf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MultipleOf field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMultipleOf(value float64) *JSONSchemaPropsApplyConfiguration { + b.MultipleOf = &value + return b +} + +// WithEnum adds the given value to the Enum field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Enum field. +func (b *JSONSchemaPropsApplyConfiguration) WithEnum(values ...v1.JSON) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Enum = append(b.Enum, values[i]) + } + return b +} + +// WithMaxProperties sets the MaxProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxProperties = &value + return b +} + +// WithMinProperties sets the MinProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinProperties = &value + return b +} + +// WithRequired adds the given value to the Required field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Required field. +func (b *JSONSchemaPropsApplyConfiguration) WithRequired(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Required = append(b.Required, values[i]) + } + return b +} + +// WithItems sets the Items field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Items field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithItems(value v1.JSONSchemaPropsOrArray) *JSONSchemaPropsApplyConfiguration { + b.Items = &value + return b +} + +// WithAllOf adds the given value to the AllOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AllOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAllOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAllOf") + } + b.AllOf = append(b.AllOf, *values[i]) + } + return b +} + +// WithOneOf adds the given value to the OneOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OneOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithOneOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOneOf") + } + b.OneOf = append(b.OneOf, *values[i]) + } + return b +} + +// WithAnyOf adds the given value to the AnyOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AnyOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAnyOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAnyOf") + } + b.AnyOf = append(b.AnyOf, *values[i]) + } + return b +} + +// WithNot sets the Not field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Not field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNot(value *JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.Not = value + return b +} + +// WithProperties puts the entries into the Properties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Properties field, +// overwriting an existing map entries in Properties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.Properties == nil && len(entries) > 0 { + b.Properties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Properties[k] = v + } + return b +} + +// WithAdditionalProperties sets the AdditionalProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalProperties(value v1.JSONSchemaPropsOrBool) *JSONSchemaPropsApplyConfiguration { + b.AdditionalProperties = &value + return b +} + +// WithPatternProperties puts the entries into the PatternProperties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the PatternProperties field, +// overwriting an existing map entries in PatternProperties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithPatternProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.PatternProperties == nil && len(entries) > 0 { + b.PatternProperties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.PatternProperties[k] = v + } + return b +} + +// WithDependencies sets the Dependencies field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Dependencies field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDependencies(value v1.JSONSchemaDependencies) *JSONSchemaPropsApplyConfiguration { + b.Dependencies = &value + return b +} + +// WithAdditionalItems sets the AdditionalItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalItems(value v1.JSONSchemaPropsOrBool) *JSONSchemaPropsApplyConfiguration { + b.AdditionalItems = &value + return b +} + +// WithDefinitions sets the Definitions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Definitions field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefinitions(value v1.JSONSchemaDefinitions) *JSONSchemaPropsApplyConfiguration { + b.Definitions = &value + return b +} + +// WithExternalDocs sets the ExternalDocs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalDocs field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExternalDocs(value *ExternalDocumentationApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.ExternalDocs = value + return b +} + +// WithExample sets the Example field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Example field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExample(value v1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Example = &value + return b +} + +// WithNullable sets the Nullable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Nullable field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNullable(value bool) *JSONSchemaPropsApplyConfiguration { + b.Nullable = &value + return b +} + +// WithXPreserveUnknownFields sets the XPreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XPreserveUnknownFields field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXPreserveUnknownFields(value bool) *JSONSchemaPropsApplyConfiguration { + b.XPreserveUnknownFields = &value + return b +} + +// WithXEmbeddedResource sets the XEmbeddedResource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XEmbeddedResource field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXEmbeddedResource(value bool) *JSONSchemaPropsApplyConfiguration { + b.XEmbeddedResource = &value + return b +} + +// WithXIntOrString sets the XIntOrString field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XIntOrString field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXIntOrString(value bool) *JSONSchemaPropsApplyConfiguration { + b.XIntOrString = &value + return b +} + +// WithXListMapKeys adds the given value to the XListMapKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the XListMapKeys field. +func (b *JSONSchemaPropsApplyConfiguration) WithXListMapKeys(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.XListMapKeys = append(b.XListMapKeys, values[i]) + } + return b +} + +// WithXListType sets the XListType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XListType field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXListType(value string) *JSONSchemaPropsApplyConfiguration { + b.XListType = &value + return b +} + +// WithXMapType sets the XMapType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XMapType field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXMapType(value string) *JSONSchemaPropsApplyConfiguration { + b.XMapType = &value + return b +} + +// WithXValidations sets the XValidations field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XValidations field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXValidations(value v1.ValidationRules) *JSONSchemaPropsApplyConfiguration { + b.XValidations = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/servicereference.go b/pkg/clients/applyconfiguration/apiextensions/v1/servicereference.go new file mode 100644 index 000000000..87652d688 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/servicereference.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ServiceReferenceApplyConfiguration represents an declarative configuration of the ServiceReference type for use +// with apply. +type ServiceReferenceApplyConfiguration struct { + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` + Port *int32 `json:"port,omitempty"` +} + +// ServiceReferenceApplyConfiguration constructs an declarative configuration of the ServiceReference type for use with +// apply. +func ServiceReference() *ServiceReferenceApplyConfiguration { + return &ServiceReferenceApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithNamespace(value string) *ServiceReferenceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithName(value string) *ServiceReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPath(value string) *ServiceReferenceApplyConfiguration { + b.Path = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPort(value int32) *ServiceReferenceApplyConfiguration { + b.Port = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/validationrule.go b/pkg/clients/applyconfiguration/apiextensions/v1/validationrule.go new file mode 100644 index 000000000..c91b38a2a --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/validationrule.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// ValidationRuleApplyConfiguration represents an declarative configuration of the ValidationRule type for use +// with apply. +type ValidationRuleApplyConfiguration struct { + Rule *string `json:"rule,omitempty"` + Message *string `json:"message,omitempty"` + MessageExpression *string `json:"messageExpression,omitempty"` + Reason *v1.FieldValueErrorReason `json:"reason,omitempty"` + FieldPath *string `json:"fieldPath,omitempty"` + OptionalOldSelf *bool `json:"optionalOldSelf,omitempty"` +} + +// ValidationRuleApplyConfiguration constructs an declarative configuration of the ValidationRule type for use with +// apply. +func ValidationRule() *ValidationRuleApplyConfiguration { + return &ValidationRuleApplyConfiguration{} +} + +// WithRule sets the Rule field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rule field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithRule(value string) *ValidationRuleApplyConfiguration { + b.Rule = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessage(value string) *ValidationRuleApplyConfiguration { + b.Message = &value + return b +} + +// WithMessageExpression sets the MessageExpression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MessageExpression field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessageExpression(value string) *ValidationRuleApplyConfiguration { + b.MessageExpression = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithReason(value v1.FieldValueErrorReason) *ValidationRuleApplyConfiguration { + b.Reason = &value + return b +} + +// WithFieldPath sets the FieldPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldPath field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithFieldPath(value string) *ValidationRuleApplyConfiguration { + b.FieldPath = &value + return b +} + +// WithOptionalOldSelf sets the OptionalOldSelf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OptionalOldSelf field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithOptionalOldSelf(value bool) *ValidationRuleApplyConfiguration { + b.OptionalOldSelf = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/webhookclientconfig.go b/pkg/clients/applyconfiguration/apiextensions/v1/webhookclientconfig.go new file mode 100644 index 000000000..bca10b539 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/webhookclientconfig.go @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// WebhookClientConfigApplyConfiguration represents an declarative configuration of the WebhookClientConfig type for use +// with apply. +type WebhookClientConfigApplyConfiguration struct { + URL *string `json:"url,omitempty"` + Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` + CABundle []byte `json:"caBundle,omitempty"` +} + +// WebhookClientConfigApplyConfiguration constructs an declarative configuration of the WebhookClientConfig type for use with +// apply. +func WebhookClientConfig() *WebhookClientConfigApplyConfiguration { + return &WebhookClientConfigApplyConfiguration{} +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithURL(value string) *WebhookClientConfigApplyConfiguration { + b.URL = &value + return b +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithService(value *ServiceReferenceApplyConfiguration) *WebhookClientConfigApplyConfiguration { + b.Service = value + return b +} + +// WithCABundle adds the given value to the CABundle field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CABundle field. +func (b *WebhookClientConfigApplyConfiguration) WithCABundle(values ...byte) *WebhookClientConfigApplyConfiguration { + for i := range values { + b.CABundle = append(b.CABundle, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiextensions/v1/webhookconversion.go b/pkg/clients/applyconfiguration/apiextensions/v1/webhookconversion.go new file mode 100644 index 000000000..4ad9e9762 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiextensions/v1/webhookconversion.go @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// WebhookConversionApplyConfiguration represents an declarative configuration of the WebhookConversion type for use +// with apply. +type WebhookConversionApplyConfiguration struct { + ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` + ConversionReviewVersions []string `json:"conversionReviewVersions,omitempty"` +} + +// WebhookConversionApplyConfiguration constructs an declarative configuration of the WebhookConversion type for use with +// apply. +func WebhookConversion() *WebhookConversionApplyConfiguration { + return &WebhookConversionApplyConfiguration{} +} + +// WithClientConfig sets the ClientConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientConfig field is set to the value of the last call. +func (b *WebhookConversionApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *WebhookConversionApplyConfiguration { + b.ClientConfig = value + return b +} + +// WithConversionReviewVersions adds the given value to the ConversionReviewVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ConversionReviewVersions field. +func (b *WebhookConversionApplyConfiguration) WithConversionReviewVersions(values ...string) *WebhookConversionApplyConfiguration { + for i := range values { + b.ConversionReviewVersions = append(b.ConversionReviewVersions, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiregistration/v1/apiservice.go b/pkg/clients/applyconfiguration/apiregistration/v1/apiservice.go new file mode 100644 index 000000000..a049530ad --- /dev/null +++ b/pkg/clients/applyconfiguration/apiregistration/v1/apiservice.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// APIServiceApplyConfiguration represents an declarative configuration of the APIService type for use +// with apply. +type APIServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *APIServiceSpecApplyConfiguration `json:"spec,omitempty"` + Status *APIServiceStatusApplyConfiguration `json:"status,omitempty"` +} + +// APIService constructs an declarative configuration of the APIService type for use with +// apply. +func APIService(name string) *APIServiceApplyConfiguration { + b := &APIServiceApplyConfiguration{} + b.WithName(name) + b.WithKind("APIService") + b.WithAPIVersion("apiregistration.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithKind(value string) *APIServiceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithAPIVersion(value string) *APIServiceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithName(value string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithGenerateName(value string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithNamespace(value string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithUID(value types.UID) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithResourceVersion(value string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithGeneration(value int64) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *APIServiceApplyConfiguration) WithLabels(entries map[string]string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *APIServiceApplyConfiguration) WithAnnotations(entries map[string]string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *APIServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *APIServiceApplyConfiguration) WithFinalizers(values ...string) *APIServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *APIServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithSpec(value *APIServiceSpecApplyConfiguration) *APIServiceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *APIServiceApplyConfiguration) WithStatus(value *APIServiceStatusApplyConfiguration) *APIServiceApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/apiregistration/v1/apiservicecondition.go b/pkg/clients/applyconfiguration/apiregistration/v1/apiservicecondition.go new file mode 100644 index 000000000..b1bfff53d --- /dev/null +++ b/pkg/clients/applyconfiguration/apiregistration/v1/apiservicecondition.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// APIServiceConditionApplyConfiguration represents an declarative configuration of the APIServiceCondition type for use +// with apply. +type APIServiceConditionApplyConfiguration struct { + Type *v1.APIServiceConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// APIServiceConditionApplyConfiguration constructs an declarative configuration of the APIServiceCondition type for use with +// apply. +func APIServiceCondition() *APIServiceConditionApplyConfiguration { + return &APIServiceConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *APIServiceConditionApplyConfiguration) WithType(value v1.APIServiceConditionType) *APIServiceConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *APIServiceConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *APIServiceConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *APIServiceConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *APIServiceConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *APIServiceConditionApplyConfiguration) WithReason(value string) *APIServiceConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *APIServiceConditionApplyConfiguration) WithMessage(value string) *APIServiceConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiregistration/v1/apiservicespec.go b/pkg/clients/applyconfiguration/apiregistration/v1/apiservicespec.go new file mode 100644 index 000000000..6fe9952b4 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiregistration/v1/apiservicespec.go @@ -0,0 +1,82 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// APIServiceSpecApplyConfiguration represents an declarative configuration of the APIServiceSpec type for use +// with apply. +type APIServiceSpecApplyConfiguration struct { + Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` + Group *string `json:"group,omitempty"` + Version *string `json:"version,omitempty"` + InsecureSkipTLSVerify *bool `json:"insecureSkipTLSVerify,omitempty"` + CABundle []byte `json:"caBundle,omitempty"` + GroupPriorityMinimum *int32 `json:"groupPriorityMinimum,omitempty"` + VersionPriority *int32 `json:"versionPriority,omitempty"` +} + +// APIServiceSpecApplyConfiguration constructs an declarative configuration of the APIServiceSpec type for use with +// apply. +func APIServiceSpec() *APIServiceSpecApplyConfiguration { + return &APIServiceSpecApplyConfiguration{} +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *APIServiceSpecApplyConfiguration) WithService(value *ServiceReferenceApplyConfiguration) *APIServiceSpecApplyConfiguration { + b.Service = value + return b +} + +// WithGroup sets the Group field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Group field is set to the value of the last call. +func (b *APIServiceSpecApplyConfiguration) WithGroup(value string) *APIServiceSpecApplyConfiguration { + b.Group = &value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *APIServiceSpecApplyConfiguration) WithVersion(value string) *APIServiceSpecApplyConfiguration { + b.Version = &value + return b +} + +// WithInsecureSkipTLSVerify sets the InsecureSkipTLSVerify field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InsecureSkipTLSVerify field is set to the value of the last call. +func (b *APIServiceSpecApplyConfiguration) WithInsecureSkipTLSVerify(value bool) *APIServiceSpecApplyConfiguration { + b.InsecureSkipTLSVerify = &value + return b +} + +// WithCABundle adds the given value to the CABundle field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CABundle field. +func (b *APIServiceSpecApplyConfiguration) WithCABundle(values ...byte) *APIServiceSpecApplyConfiguration { + for i := range values { + b.CABundle = append(b.CABundle, values[i]) + } + return b +} + +// WithGroupPriorityMinimum sets the GroupPriorityMinimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GroupPriorityMinimum field is set to the value of the last call. +func (b *APIServiceSpecApplyConfiguration) WithGroupPriorityMinimum(value int32) *APIServiceSpecApplyConfiguration { + b.GroupPriorityMinimum = &value + return b +} + +// WithVersionPriority sets the VersionPriority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VersionPriority field is set to the value of the last call. +func (b *APIServiceSpecApplyConfiguration) WithVersionPriority(value int32) *APIServiceSpecApplyConfiguration { + b.VersionPriority = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apiregistration/v1/apiservicestatus.go b/pkg/clients/applyconfiguration/apiregistration/v1/apiservicestatus.go new file mode 100644 index 000000000..c41f87470 --- /dev/null +++ b/pkg/clients/applyconfiguration/apiregistration/v1/apiservicestatus.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// APIServiceStatusApplyConfiguration represents an declarative configuration of the APIServiceStatus type for use +// with apply. +type APIServiceStatusApplyConfiguration struct { + Conditions []APIServiceConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// APIServiceStatusApplyConfiguration constructs an declarative configuration of the APIServiceStatus type for use with +// apply. +func APIServiceStatus() *APIServiceStatusApplyConfiguration { + return &APIServiceStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *APIServiceStatusApplyConfiguration) WithConditions(values ...*APIServiceConditionApplyConfiguration) *APIServiceStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apiregistration/v1/servicereference.go b/pkg/clients/applyconfiguration/apiregistration/v1/servicereference.go new file mode 100644 index 000000000..f408635de --- /dev/null +++ b/pkg/clients/applyconfiguration/apiregistration/v1/servicereference.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ServiceReferenceApplyConfiguration represents an declarative configuration of the ServiceReference type for use +// with apply. +type ServiceReferenceApplyConfiguration struct { + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + Port *int32 `json:"port,omitempty"` +} + +// ServiceReferenceApplyConfiguration constructs an declarative configuration of the ServiceReference type for use with +// apply. +func ServiceReference() *ServiceReferenceApplyConfiguration { + return &ServiceReferenceApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithNamespace(value string) *ServiceReferenceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithName(value string) *ServiceReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPort(value int32) *ServiceReferenceApplyConfiguration { + b.Port = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/controllerrevision.go b/pkg/clients/applyconfiguration/apps/v1/controllerrevision.go new file mode 100644 index 000000000..f7360cb26 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/controllerrevision.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ControllerRevisionApplyConfiguration represents an declarative configuration of the ControllerRevision type for use +// with apply. +type ControllerRevisionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Data *runtime.RawExtension `json:"data,omitempty"` + Revision *int64 `json:"revision,omitempty"` +} + +// ControllerRevision constructs an declarative configuration of the ControllerRevision type for use with +// apply. +func ControllerRevision(name, namespace string) *ControllerRevisionApplyConfiguration { + b := &ControllerRevisionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ControllerRevision") + b.WithAPIVersion("apps/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithKind(value string) *ControllerRevisionApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithAPIVersion(value string) *ControllerRevisionApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithName(value string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithGenerateName(value string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithNamespace(value string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithUID(value types.UID) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithResourceVersion(value string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithGeneration(value int64) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ControllerRevisionApplyConfiguration) WithLabels(entries map[string]string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ControllerRevisionApplyConfiguration) WithAnnotations(entries map[string]string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ControllerRevisionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ControllerRevisionApplyConfiguration) WithFinalizers(values ...string) *ControllerRevisionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ControllerRevisionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithData sets the Data field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Data field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithData(value runtime.RawExtension) *ControllerRevisionApplyConfiguration { + b.Data = &value + return b +} + +// WithRevision sets the Revision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Revision field is set to the value of the last call. +func (b *ControllerRevisionApplyConfiguration) WithRevision(value int64) *ControllerRevisionApplyConfiguration { + b.Revision = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/daemonset.go b/pkg/clients/applyconfiguration/apps/v1/daemonset.go new file mode 100644 index 000000000..0d1faa9af --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/daemonset.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DaemonSetApplyConfiguration represents an declarative configuration of the DaemonSet type for use +// with apply. +type DaemonSetApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *DaemonSetSpecApplyConfiguration `json:"spec,omitempty"` + Status *DaemonSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// DaemonSet constructs an declarative configuration of the DaemonSet type for use with +// apply. +func DaemonSet(name, namespace string) *DaemonSetApplyConfiguration { + b := &DaemonSetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("DaemonSet") + b.WithAPIVersion("apps/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithKind(value string) *DaemonSetApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithAPIVersion(value string) *DaemonSetApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithName(value string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithGenerateName(value string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithNamespace(value string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithUID(value types.UID) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithResourceVersion(value string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithGeneration(value int64) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithCreationTimestamp(value metav1.Time) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *DaemonSetApplyConfiguration) WithLabels(entries map[string]string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *DaemonSetApplyConfiguration) WithAnnotations(entries map[string]string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *DaemonSetApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *DaemonSetApplyConfiguration) WithFinalizers(values ...string) *DaemonSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *DaemonSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithSpec(value *DaemonSetSpecApplyConfiguration) *DaemonSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *DaemonSetApplyConfiguration) WithStatus(value *DaemonSetStatusApplyConfiguration) *DaemonSetApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/daemonsetcondition.go b/pkg/clients/applyconfiguration/apps/v1/daemonsetcondition.go new file mode 100644 index 000000000..1d47b28f8 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/daemonsetcondition.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// DaemonSetConditionApplyConfiguration represents an declarative configuration of the DaemonSetCondition type for use +// with apply. +type DaemonSetConditionApplyConfiguration struct { + Type *v1.DaemonSetConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// DaemonSetConditionApplyConfiguration constructs an declarative configuration of the DaemonSetCondition type for use with +// apply. +func DaemonSetCondition() *DaemonSetConditionApplyConfiguration { + return &DaemonSetConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *DaemonSetConditionApplyConfiguration) WithType(value v1.DaemonSetConditionType) *DaemonSetConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *DaemonSetConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *DaemonSetConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *DaemonSetConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *DaemonSetConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *DaemonSetConditionApplyConfiguration) WithReason(value string) *DaemonSetConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *DaemonSetConditionApplyConfiguration) WithMessage(value string) *DaemonSetConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/daemonsetspec.go b/pkg/clients/applyconfiguration/apps/v1/daemonsetspec.go new file mode 100644 index 000000000..f4a06116b --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/daemonsetspec.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DaemonSetSpecApplyConfiguration represents an declarative configuration of the DaemonSetSpec type for use +// with apply. +type DaemonSetSpecApplyConfiguration struct { + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"` + UpdateStrategy *DaemonSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` +} + +// DaemonSetSpecApplyConfiguration constructs an declarative configuration of the DaemonSetSpec type for use with +// apply. +func DaemonSetSpec() *DaemonSetSpecApplyConfiguration { + return &DaemonSetSpecApplyConfiguration{} +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *DaemonSetSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *DaemonSetSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *DaemonSetSpecApplyConfiguration) WithTemplate(value *corev1.PodTemplateSpecApplyConfiguration) *DaemonSetSpecApplyConfiguration { + b.Template = value + return b +} + +// WithUpdateStrategy sets the UpdateStrategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdateStrategy field is set to the value of the last call. +func (b *DaemonSetSpecApplyConfiguration) WithUpdateStrategy(value *DaemonSetUpdateStrategyApplyConfiguration) *DaemonSetSpecApplyConfiguration { + b.UpdateStrategy = value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *DaemonSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *DaemonSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithRevisionHistoryLimit sets the RevisionHistoryLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RevisionHistoryLimit field is set to the value of the last call. +func (b *DaemonSetSpecApplyConfiguration) WithRevisionHistoryLimit(value int32) *DaemonSetSpecApplyConfiguration { + b.RevisionHistoryLimit = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/daemonsetstatus.go b/pkg/clients/applyconfiguration/apps/v1/daemonsetstatus.go new file mode 100644 index 000000000..f41165875 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/daemonsetstatus.go @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// DaemonSetStatusApplyConfiguration represents an declarative configuration of the DaemonSetStatus type for use +// with apply. +type DaemonSetStatusApplyConfiguration struct { + CurrentNumberScheduled *int32 `json:"currentNumberScheduled,omitempty"` + NumberMisscheduled *int32 `json:"numberMisscheduled,omitempty"` + DesiredNumberScheduled *int32 `json:"desiredNumberScheduled,omitempty"` + NumberReady *int32 `json:"numberReady,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + UpdatedNumberScheduled *int32 `json:"updatedNumberScheduled,omitempty"` + NumberAvailable *int32 `json:"numberAvailable,omitempty"` + NumberUnavailable *int32 `json:"numberUnavailable,omitempty"` + CollisionCount *int32 `json:"collisionCount,omitempty"` + Conditions []DaemonSetConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// DaemonSetStatusApplyConfiguration constructs an declarative configuration of the DaemonSetStatus type for use with +// apply. +func DaemonSetStatus() *DaemonSetStatusApplyConfiguration { + return &DaemonSetStatusApplyConfiguration{} +} + +// WithCurrentNumberScheduled sets the CurrentNumberScheduled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentNumberScheduled field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithCurrentNumberScheduled(value int32) *DaemonSetStatusApplyConfiguration { + b.CurrentNumberScheduled = &value + return b +} + +// WithNumberMisscheduled sets the NumberMisscheduled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumberMisscheduled field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithNumberMisscheduled(value int32) *DaemonSetStatusApplyConfiguration { + b.NumberMisscheduled = &value + return b +} + +// WithDesiredNumberScheduled sets the DesiredNumberScheduled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DesiredNumberScheduled field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithDesiredNumberScheduled(value int32) *DaemonSetStatusApplyConfiguration { + b.DesiredNumberScheduled = &value + return b +} + +// WithNumberReady sets the NumberReady field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumberReady field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithNumberReady(value int32) *DaemonSetStatusApplyConfiguration { + b.NumberReady = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithObservedGeneration(value int64) *DaemonSetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithUpdatedNumberScheduled sets the UpdatedNumberScheduled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdatedNumberScheduled field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithUpdatedNumberScheduled(value int32) *DaemonSetStatusApplyConfiguration { + b.UpdatedNumberScheduled = &value + return b +} + +// WithNumberAvailable sets the NumberAvailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumberAvailable field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithNumberAvailable(value int32) *DaemonSetStatusApplyConfiguration { + b.NumberAvailable = &value + return b +} + +// WithNumberUnavailable sets the NumberUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NumberUnavailable field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithNumberUnavailable(value int32) *DaemonSetStatusApplyConfiguration { + b.NumberUnavailable = &value + return b +} + +// WithCollisionCount sets the CollisionCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CollisionCount field is set to the value of the last call. +func (b *DaemonSetStatusApplyConfiguration) WithCollisionCount(value int32) *DaemonSetStatusApplyConfiguration { + b.CollisionCount = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *DaemonSetStatusApplyConfiguration) WithConditions(values ...*DaemonSetConditionApplyConfiguration) *DaemonSetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/daemonsetupdatestrategy.go b/pkg/clients/applyconfiguration/apps/v1/daemonsetupdatestrategy.go new file mode 100644 index 000000000..189963073 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/daemonsetupdatestrategy.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" +) + +// DaemonSetUpdateStrategyApplyConfiguration represents an declarative configuration of the DaemonSetUpdateStrategy type for use +// with apply. +type DaemonSetUpdateStrategyApplyConfiguration struct { + Type *v1.DaemonSetUpdateStrategyType `json:"type,omitempty"` + RollingUpdate *RollingUpdateDaemonSetApplyConfiguration `json:"rollingUpdate,omitempty"` +} + +// DaemonSetUpdateStrategyApplyConfiguration constructs an declarative configuration of the DaemonSetUpdateStrategy type for use with +// apply. +func DaemonSetUpdateStrategy() *DaemonSetUpdateStrategyApplyConfiguration { + return &DaemonSetUpdateStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *DaemonSetUpdateStrategyApplyConfiguration) WithType(value v1.DaemonSetUpdateStrategyType) *DaemonSetUpdateStrategyApplyConfiguration { + b.Type = &value + return b +} + +// WithRollingUpdate sets the RollingUpdate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RollingUpdate field is set to the value of the last call. +func (b *DaemonSetUpdateStrategyApplyConfiguration) WithRollingUpdate(value *RollingUpdateDaemonSetApplyConfiguration) *DaemonSetUpdateStrategyApplyConfiguration { + b.RollingUpdate = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/deployment.go b/pkg/clients/applyconfiguration/apps/v1/deployment.go new file mode 100644 index 000000000..992d84451 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/deployment.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DeploymentApplyConfiguration represents an declarative configuration of the Deployment type for use +// with apply. +type DeploymentApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *DeploymentSpecApplyConfiguration `json:"spec,omitempty"` + Status *DeploymentStatusApplyConfiguration `json:"status,omitempty"` +} + +// Deployment constructs an declarative configuration of the Deployment type for use with +// apply. +func Deployment(name, namespace string) *DeploymentApplyConfiguration { + b := &DeploymentApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Deployment") + b.WithAPIVersion("apps/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithKind(value string) *DeploymentApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithAPIVersion(value string) *DeploymentApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithName(value string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithGenerateName(value string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithNamespace(value string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithUID(value types.UID) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithResourceVersion(value string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithGeneration(value int64) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithCreationTimestamp(value metav1.Time) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *DeploymentApplyConfiguration) WithLabels(entries map[string]string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *DeploymentApplyConfiguration) WithAnnotations(entries map[string]string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *DeploymentApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *DeploymentApplyConfiguration) WithFinalizers(values ...string) *DeploymentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *DeploymentApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithSpec(value *DeploymentSpecApplyConfiguration) *DeploymentApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *DeploymentApplyConfiguration) WithStatus(value *DeploymentStatusApplyConfiguration) *DeploymentApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/deploymentcondition.go b/pkg/clients/applyconfiguration/apps/v1/deploymentcondition.go new file mode 100644 index 000000000..e036bd48a --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/deploymentcondition.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// DeploymentConditionApplyConfiguration represents an declarative configuration of the DeploymentCondition type for use +// with apply. +type DeploymentConditionApplyConfiguration struct { + Type *v1.DeploymentConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// DeploymentConditionApplyConfiguration constructs an declarative configuration of the DeploymentCondition type for use with +// apply. +func DeploymentCondition() *DeploymentConditionApplyConfiguration { + return &DeploymentConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *DeploymentConditionApplyConfiguration) WithType(value v1.DeploymentConditionType) *DeploymentConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *DeploymentConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *DeploymentConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastUpdateTime sets the LastUpdateTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastUpdateTime field is set to the value of the last call. +func (b *DeploymentConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *DeploymentConditionApplyConfiguration { + b.LastUpdateTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *DeploymentConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *DeploymentConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *DeploymentConditionApplyConfiguration) WithReason(value string) *DeploymentConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *DeploymentConditionApplyConfiguration) WithMessage(value string) *DeploymentConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/deploymentspec.go b/pkg/clients/applyconfiguration/apps/v1/deploymentspec.go new file mode 100644 index 000000000..aeaaf598c --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/deploymentspec.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DeploymentSpecApplyConfiguration represents an declarative configuration of the DeploymentSpec type for use +// with apply. +type DeploymentSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"` + Strategy *DeploymentStrategyApplyConfiguration `json:"strategy,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + Paused *bool `json:"paused,omitempty"` + ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"` +} + +// DeploymentSpecApplyConfiguration constructs an declarative configuration of the DeploymentSpec type for use with +// apply. +func DeploymentSpec() *DeploymentSpecApplyConfiguration { + return &DeploymentSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithReplicas(value int32) *DeploymentSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *DeploymentSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithTemplate(value *corev1.PodTemplateSpecApplyConfiguration) *DeploymentSpecApplyConfiguration { + b.Template = value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithStrategy(value *DeploymentStrategyApplyConfiguration) *DeploymentSpecApplyConfiguration { + b.Strategy = value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithMinReadySeconds(value int32) *DeploymentSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithRevisionHistoryLimit sets the RevisionHistoryLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RevisionHistoryLimit field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithRevisionHistoryLimit(value int32) *DeploymentSpecApplyConfiguration { + b.RevisionHistoryLimit = &value + return b +} + +// WithPaused sets the Paused field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Paused field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithPaused(value bool) *DeploymentSpecApplyConfiguration { + b.Paused = &value + return b +} + +// WithProgressDeadlineSeconds sets the ProgressDeadlineSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProgressDeadlineSeconds field is set to the value of the last call. +func (b *DeploymentSpecApplyConfiguration) WithProgressDeadlineSeconds(value int32) *DeploymentSpecApplyConfiguration { + b.ProgressDeadlineSeconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/deploymentstatus.go b/pkg/clients/applyconfiguration/apps/v1/deploymentstatus.go new file mode 100644 index 000000000..dba669d19 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/deploymentstatus.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// DeploymentStatusApplyConfiguration represents an declarative configuration of the DeploymentStatus type for use +// with apply. +type DeploymentStatusApplyConfiguration struct { + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` + UpdatedReplicas *int32 `json:"updatedReplicas,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + UnavailableReplicas *int32 `json:"unavailableReplicas,omitempty"` + Conditions []DeploymentConditionApplyConfiguration `json:"conditions,omitempty"` + CollisionCount *int32 `json:"collisionCount,omitempty"` +} + +// DeploymentStatusApplyConfiguration constructs an declarative configuration of the DeploymentStatus type for use with +// apply. +func DeploymentStatus() *DeploymentStatusApplyConfiguration { + return &DeploymentStatusApplyConfiguration{} +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithObservedGeneration(value int64) *DeploymentStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithReplicas(value int32) *DeploymentStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithUpdatedReplicas sets the UpdatedReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdatedReplicas field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithUpdatedReplicas(value int32) *DeploymentStatusApplyConfiguration { + b.UpdatedReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithReadyReplicas(value int32) *DeploymentStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithAvailableReplicas(value int32) *DeploymentStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithUnavailableReplicas sets the UnavailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnavailableReplicas field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithUnavailableReplicas(value int32) *DeploymentStatusApplyConfiguration { + b.UnavailableReplicas = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *DeploymentStatusApplyConfiguration) WithConditions(values ...*DeploymentConditionApplyConfiguration) *DeploymentStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithCollisionCount sets the CollisionCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CollisionCount field is set to the value of the last call. +func (b *DeploymentStatusApplyConfiguration) WithCollisionCount(value int32) *DeploymentStatusApplyConfiguration { + b.CollisionCount = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/deploymentstrategy.go b/pkg/clients/applyconfiguration/apps/v1/deploymentstrategy.go new file mode 100644 index 000000000..cc59877bd --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/deploymentstrategy.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" +) + +// DeploymentStrategyApplyConfiguration represents an declarative configuration of the DeploymentStrategy type for use +// with apply. +type DeploymentStrategyApplyConfiguration struct { + Type *v1.DeploymentStrategyType `json:"type,omitempty"` + RollingUpdate *RollingUpdateDeploymentApplyConfiguration `json:"rollingUpdate,omitempty"` +} + +// DeploymentStrategyApplyConfiguration constructs an declarative configuration of the DeploymentStrategy type for use with +// apply. +func DeploymentStrategy() *DeploymentStrategyApplyConfiguration { + return &DeploymentStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *DeploymentStrategyApplyConfiguration) WithType(value v1.DeploymentStrategyType) *DeploymentStrategyApplyConfiguration { + b.Type = &value + return b +} + +// WithRollingUpdate sets the RollingUpdate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RollingUpdate field is set to the value of the last call. +func (b *DeploymentStrategyApplyConfiguration) WithRollingUpdate(value *RollingUpdateDeploymentApplyConfiguration) *DeploymentStrategyApplyConfiguration { + b.RollingUpdate = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/replicaset.go b/pkg/clients/applyconfiguration/apps/v1/replicaset.go new file mode 100644 index 000000000..5529a1990 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/replicaset.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ReplicaSetApplyConfiguration represents an declarative configuration of the ReplicaSet type for use +// with apply. +type ReplicaSetApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ReplicaSetSpecApplyConfiguration `json:"spec,omitempty"` + Status *ReplicaSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// ReplicaSet constructs an declarative configuration of the ReplicaSet type for use with +// apply. +func ReplicaSet(name, namespace string) *ReplicaSetApplyConfiguration { + b := &ReplicaSetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ReplicaSet") + b.WithAPIVersion("apps/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithKind(value string) *ReplicaSetApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithAPIVersion(value string) *ReplicaSetApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithName(value string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithGenerateName(value string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithNamespace(value string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithUID(value types.UID) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithResourceVersion(value string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithGeneration(value int64) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ReplicaSetApplyConfiguration) WithLabels(entries map[string]string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ReplicaSetApplyConfiguration) WithAnnotations(entries map[string]string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ReplicaSetApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ReplicaSetApplyConfiguration) WithFinalizers(values ...string) *ReplicaSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ReplicaSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithSpec(value *ReplicaSetSpecApplyConfiguration) *ReplicaSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ReplicaSetApplyConfiguration) WithStatus(value *ReplicaSetStatusApplyConfiguration) *ReplicaSetApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/replicasetcondition.go b/pkg/clients/applyconfiguration/apps/v1/replicasetcondition.go new file mode 100644 index 000000000..06ca07b8d --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/replicasetcondition.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ReplicaSetConditionApplyConfiguration represents an declarative configuration of the ReplicaSetCondition type for use +// with apply. +type ReplicaSetConditionApplyConfiguration struct { + Type *v1.ReplicaSetConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ReplicaSetConditionApplyConfiguration constructs an declarative configuration of the ReplicaSetCondition type for use with +// apply. +func ReplicaSetCondition() *ReplicaSetConditionApplyConfiguration { + return &ReplicaSetConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ReplicaSetConditionApplyConfiguration) WithType(value v1.ReplicaSetConditionType) *ReplicaSetConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ReplicaSetConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *ReplicaSetConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *ReplicaSetConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *ReplicaSetConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ReplicaSetConditionApplyConfiguration) WithReason(value string) *ReplicaSetConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ReplicaSetConditionApplyConfiguration) WithMessage(value string) *ReplicaSetConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/replicasetspec.go b/pkg/clients/applyconfiguration/apps/v1/replicasetspec.go new file mode 100644 index 000000000..2c3bf2d89 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/replicasetspec.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ReplicaSetSpecApplyConfiguration represents an declarative configuration of the ReplicaSetSpec type for use +// with apply. +type ReplicaSetSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"` +} + +// ReplicaSetSpecApplyConfiguration constructs an declarative configuration of the ReplicaSetSpec type for use with +// apply. +func ReplicaSetSpec() *ReplicaSetSpecApplyConfiguration { + return &ReplicaSetSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ReplicaSetSpecApplyConfiguration) WithReplicas(value int32) *ReplicaSetSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *ReplicaSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *ReplicaSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *ReplicaSetSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *ReplicaSetSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *ReplicaSetSpecApplyConfiguration) WithTemplate(value *corev1.PodTemplateSpecApplyConfiguration) *ReplicaSetSpecApplyConfiguration { + b.Template = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/replicasetstatus.go b/pkg/clients/applyconfiguration/apps/v1/replicasetstatus.go new file mode 100644 index 000000000..92a992aea --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/replicasetstatus.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ReplicaSetStatusApplyConfiguration represents an declarative configuration of the ReplicaSetStatus type for use +// with apply. +type ReplicaSetStatusApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + FullyLabeledReplicas *int32 `json:"fullyLabeledReplicas,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Conditions []ReplicaSetConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// ReplicaSetStatusApplyConfiguration constructs an declarative configuration of the ReplicaSetStatus type for use with +// apply. +func ReplicaSetStatus() *ReplicaSetStatusApplyConfiguration { + return &ReplicaSetStatusApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ReplicaSetStatusApplyConfiguration) WithReplicas(value int32) *ReplicaSetStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithFullyLabeledReplicas sets the FullyLabeledReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FullyLabeledReplicas field is set to the value of the last call. +func (b *ReplicaSetStatusApplyConfiguration) WithFullyLabeledReplicas(value int32) *ReplicaSetStatusApplyConfiguration { + b.FullyLabeledReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *ReplicaSetStatusApplyConfiguration) WithReadyReplicas(value int32) *ReplicaSetStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *ReplicaSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *ReplicaSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *ReplicaSetStatusApplyConfiguration) WithObservedGeneration(value int64) *ReplicaSetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ReplicaSetStatusApplyConfiguration) WithConditions(values ...*ReplicaSetConditionApplyConfiguration) *ReplicaSetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/rollingupdatedaemonset.go b/pkg/clients/applyconfiguration/apps/v1/rollingupdatedaemonset.go new file mode 100644 index 000000000..27a906e8e --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/rollingupdatedaemonset.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RollingUpdateDaemonSetApplyConfiguration represents an declarative configuration of the RollingUpdateDaemonSet type for use +// with apply. +type RollingUpdateDaemonSetApplyConfiguration struct { + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` +} + +// RollingUpdateDaemonSetApplyConfiguration constructs an declarative configuration of the RollingUpdateDaemonSet type for use with +// apply. +func RollingUpdateDaemonSet() *RollingUpdateDaemonSetApplyConfiguration { + return &RollingUpdateDaemonSetApplyConfiguration{} +} + +// WithMaxUnavailable sets the MaxUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxUnavailable field is set to the value of the last call. +func (b *RollingUpdateDaemonSetApplyConfiguration) WithMaxUnavailable(value intstr.IntOrString) *RollingUpdateDaemonSetApplyConfiguration { + b.MaxUnavailable = &value + return b +} + +// WithMaxSurge sets the MaxSurge field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxSurge field is set to the value of the last call. +func (b *RollingUpdateDaemonSetApplyConfiguration) WithMaxSurge(value intstr.IntOrString) *RollingUpdateDaemonSetApplyConfiguration { + b.MaxSurge = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/rollingupdatedeployment.go b/pkg/clients/applyconfiguration/apps/v1/rollingupdatedeployment.go new file mode 100644 index 000000000..56217f1fd --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/rollingupdatedeployment.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RollingUpdateDeploymentApplyConfiguration represents an declarative configuration of the RollingUpdateDeployment type for use +// with apply. +type RollingUpdateDeploymentApplyConfiguration struct { + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` +} + +// RollingUpdateDeploymentApplyConfiguration constructs an declarative configuration of the RollingUpdateDeployment type for use with +// apply. +func RollingUpdateDeployment() *RollingUpdateDeploymentApplyConfiguration { + return &RollingUpdateDeploymentApplyConfiguration{} +} + +// WithMaxUnavailable sets the MaxUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxUnavailable field is set to the value of the last call. +func (b *RollingUpdateDeploymentApplyConfiguration) WithMaxUnavailable(value intstr.IntOrString) *RollingUpdateDeploymentApplyConfiguration { + b.MaxUnavailable = &value + return b +} + +// WithMaxSurge sets the MaxSurge field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxSurge field is set to the value of the last call. +func (b *RollingUpdateDeploymentApplyConfiguration) WithMaxSurge(value intstr.IntOrString) *RollingUpdateDeploymentApplyConfiguration { + b.MaxSurge = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/rollingupdatestatefulsetstrategy.go b/pkg/clients/applyconfiguration/apps/v1/rollingupdatestatefulsetstrategy.go new file mode 100644 index 000000000..af6f97320 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/rollingupdatestatefulsetstrategy.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RollingUpdateStatefulSetStrategyApplyConfiguration represents an declarative configuration of the RollingUpdateStatefulSetStrategy type for use +// with apply. +type RollingUpdateStatefulSetStrategyApplyConfiguration struct { + Partition *int32 `json:"partition,omitempty"` + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` +} + +// RollingUpdateStatefulSetStrategyApplyConfiguration constructs an declarative configuration of the RollingUpdateStatefulSetStrategy type for use with +// apply. +func RollingUpdateStatefulSetStrategy() *RollingUpdateStatefulSetStrategyApplyConfiguration { + return &RollingUpdateStatefulSetStrategyApplyConfiguration{} +} + +// WithPartition sets the Partition field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Partition field is set to the value of the last call. +func (b *RollingUpdateStatefulSetStrategyApplyConfiguration) WithPartition(value int32) *RollingUpdateStatefulSetStrategyApplyConfiguration { + b.Partition = &value + return b +} + +// WithMaxUnavailable sets the MaxUnavailable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxUnavailable field is set to the value of the last call. +func (b *RollingUpdateStatefulSetStrategyApplyConfiguration) WithMaxUnavailable(value intstr.IntOrString) *RollingUpdateStatefulSetStrategyApplyConfiguration { + b.MaxUnavailable = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulset.go b/pkg/clients/applyconfiguration/apps/v1/statefulset.go new file mode 100644 index 000000000..78da799a1 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulset.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// StatefulSetApplyConfiguration represents an declarative configuration of the StatefulSet type for use +// with apply. +type StatefulSetApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *StatefulSetSpecApplyConfiguration `json:"spec,omitempty"` + Status *StatefulSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// StatefulSet constructs an declarative configuration of the StatefulSet type for use with +// apply. +func StatefulSet(name, namespace string) *StatefulSetApplyConfiguration { + b := &StatefulSetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("StatefulSet") + b.WithAPIVersion("apps/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithKind(value string) *StatefulSetApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithAPIVersion(value string) *StatefulSetApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithName(value string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithGenerateName(value string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithNamespace(value string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithUID(value types.UID) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithResourceVersion(value string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithGeneration(value int64) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithCreationTimestamp(value metav1.Time) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *StatefulSetApplyConfiguration) WithLabels(entries map[string]string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *StatefulSetApplyConfiguration) WithAnnotations(entries map[string]string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *StatefulSetApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *StatefulSetApplyConfiguration) WithFinalizers(values ...string) *StatefulSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *StatefulSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithSpec(value *StatefulSetSpecApplyConfiguration) *StatefulSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *StatefulSetApplyConfiguration) WithStatus(value *StatefulSetStatusApplyConfiguration) *StatefulSetApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulsetcondition.go b/pkg/clients/applyconfiguration/apps/v1/statefulsetcondition.go new file mode 100644 index 000000000..94a38cee1 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulsetcondition.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// StatefulSetConditionApplyConfiguration represents an declarative configuration of the StatefulSetCondition type for use +// with apply. +type StatefulSetConditionApplyConfiguration struct { + Type *v1.StatefulSetConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// StatefulSetConditionApplyConfiguration constructs an declarative configuration of the StatefulSetCondition type for use with +// apply. +func StatefulSetCondition() *StatefulSetConditionApplyConfiguration { + return &StatefulSetConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *StatefulSetConditionApplyConfiguration) WithType(value v1.StatefulSetConditionType) *StatefulSetConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *StatefulSetConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *StatefulSetConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *StatefulSetConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *StatefulSetConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *StatefulSetConditionApplyConfiguration) WithReason(value string) *StatefulSetConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *StatefulSetConditionApplyConfiguration) WithMessage(value string) *StatefulSetConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulsetordinals.go b/pkg/clients/applyconfiguration/apps/v1/statefulsetordinals.go new file mode 100644 index 000000000..998a4e093 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulsetordinals.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// StatefulSetOrdinalsApplyConfiguration represents an declarative configuration of the StatefulSetOrdinals type for use +// with apply. +type StatefulSetOrdinalsApplyConfiguration struct { + Start *int32 `json:"start,omitempty"` +} + +// StatefulSetOrdinalsApplyConfiguration constructs an declarative configuration of the StatefulSetOrdinals type for use with +// apply. +func StatefulSetOrdinals() *StatefulSetOrdinalsApplyConfiguration { + return &StatefulSetOrdinalsApplyConfiguration{} +} + +// WithStart sets the Start field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Start field is set to the value of the last call. +func (b *StatefulSetOrdinalsApplyConfiguration) WithStart(value int32) *StatefulSetOrdinalsApplyConfiguration { + b.Start = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go b/pkg/clients/applyconfiguration/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go new file mode 100644 index 000000000..6087f813e --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" +) + +// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration represents an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use +// with apply. +type StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration struct { + WhenDeleted *v1.PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty"` + WhenScaled *v1.PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"` +} + +// StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration constructs an declarative configuration of the StatefulSetPersistentVolumeClaimRetentionPolicy type for use with +// apply. +func StatefulSetPersistentVolumeClaimRetentionPolicy() *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration { + return &StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{} +} + +// WithWhenDeleted sets the WhenDeleted field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WhenDeleted field is set to the value of the last call. +func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenDeleted(value v1.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration { + b.WhenDeleted = &value + return b +} + +// WithWhenScaled sets the WhenScaled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WhenScaled field is set to the value of the last call. +func (b *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) WithWhenScaled(value v1.PersistentVolumeClaimRetentionPolicyType) *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration { + b.WhenScaled = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulsetspec.go b/pkg/clients/applyconfiguration/apps/v1/statefulsetspec.go new file mode 100644 index 000000000..70478d590 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulsetspec.go @@ -0,0 +1,127 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + appsv1 "k8s.io/api/apps/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// StatefulSetSpecApplyConfiguration represents an declarative configuration of the StatefulSetSpec type for use +// with apply. +type StatefulSetSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"` + VolumeClaimTemplates []corev1.PersistentVolumeClaimApplyConfiguration `json:"volumeClaimTemplates,omitempty"` + ServiceName *string `json:"serviceName,omitempty"` + PodManagementPolicy *appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"` + UpdateStrategy *StatefulSetUpdateStrategyApplyConfiguration `json:"updateStrategy,omitempty"` + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration `json:"persistentVolumeClaimRetentionPolicy,omitempty"` + Ordinals *StatefulSetOrdinalsApplyConfiguration `json:"ordinals,omitempty"` +} + +// StatefulSetSpecApplyConfiguration constructs an declarative configuration of the StatefulSetSpec type for use with +// apply. +func StatefulSetSpec() *StatefulSetSpecApplyConfiguration { + return &StatefulSetSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithReplicas(value int32) *StatefulSetSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *StatefulSetSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithTemplate(value *corev1.PodTemplateSpecApplyConfiguration) *StatefulSetSpecApplyConfiguration { + b.Template = value + return b +} + +// WithVolumeClaimTemplates adds the given value to the VolumeClaimTemplates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeClaimTemplates field. +func (b *StatefulSetSpecApplyConfiguration) WithVolumeClaimTemplates(values ...*corev1.PersistentVolumeClaimApplyConfiguration) *StatefulSetSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeClaimTemplates") + } + b.VolumeClaimTemplates = append(b.VolumeClaimTemplates, *values[i]) + } + return b +} + +// WithServiceName sets the ServiceName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceName field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithServiceName(value string) *StatefulSetSpecApplyConfiguration { + b.ServiceName = &value + return b +} + +// WithPodManagementPolicy sets the PodManagementPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodManagementPolicy field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithPodManagementPolicy(value appsv1.PodManagementPolicyType) *StatefulSetSpecApplyConfiguration { + b.PodManagementPolicy = &value + return b +} + +// WithUpdateStrategy sets the UpdateStrategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdateStrategy field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithUpdateStrategy(value *StatefulSetUpdateStrategyApplyConfiguration) *StatefulSetSpecApplyConfiguration { + b.UpdateStrategy = value + return b +} + +// WithRevisionHistoryLimit sets the RevisionHistoryLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RevisionHistoryLimit field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithRevisionHistoryLimit(value int32) *StatefulSetSpecApplyConfiguration { + b.RevisionHistoryLimit = &value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithMinReadySeconds(value int32) *StatefulSetSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithPersistentVolumeClaimRetentionPolicy sets the PersistentVolumeClaimRetentionPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PersistentVolumeClaimRetentionPolicy field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithPersistentVolumeClaimRetentionPolicy(value *StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration) *StatefulSetSpecApplyConfiguration { + b.PersistentVolumeClaimRetentionPolicy = value + return b +} + +// WithOrdinals sets the Ordinals field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ordinals field is set to the value of the last call. +func (b *StatefulSetSpecApplyConfiguration) WithOrdinals(value *StatefulSetOrdinalsApplyConfiguration) *StatefulSetSpecApplyConfiguration { + b.Ordinals = value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulsetstatus.go b/pkg/clients/applyconfiguration/apps/v1/statefulsetstatus.go new file mode 100644 index 000000000..08b8d4ebd --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulsetstatus.go @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// StatefulSetStatusApplyConfiguration represents an declarative configuration of the StatefulSetStatus type for use +// with apply. +type StatefulSetStatusApplyConfiguration struct { + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + CurrentReplicas *int32 `json:"currentReplicas,omitempty"` + UpdatedReplicas *int32 `json:"updatedReplicas,omitempty"` + CurrentRevision *string `json:"currentRevision,omitempty"` + UpdateRevision *string `json:"updateRevision,omitempty"` + CollisionCount *int32 `json:"collisionCount,omitempty"` + Conditions []StatefulSetConditionApplyConfiguration `json:"conditions,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` +} + +// StatefulSetStatusApplyConfiguration constructs an declarative configuration of the StatefulSetStatus type for use with +// apply. +func StatefulSetStatus() *StatefulSetStatusApplyConfiguration { + return &StatefulSetStatusApplyConfiguration{} +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithObservedGeneration(value int64) *StatefulSetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithReadyReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithCurrentReplicas sets the CurrentReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithCurrentReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.CurrentReplicas = &value + return b +} + +// WithUpdatedReplicas sets the UpdatedReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdatedReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithUpdatedReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.UpdatedReplicas = &value + return b +} + +// WithCurrentRevision sets the CurrentRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentRevision field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithCurrentRevision(value string) *StatefulSetStatusApplyConfiguration { + b.CurrentRevision = &value + return b +} + +// WithUpdateRevision sets the UpdateRevision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdateRevision field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithUpdateRevision(value string) *StatefulSetStatusApplyConfiguration { + b.UpdateRevision = &value + return b +} + +// WithCollisionCount sets the CollisionCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CollisionCount field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithCollisionCount(value int32) *StatefulSetStatusApplyConfiguration { + b.CollisionCount = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *StatefulSetStatusApplyConfiguration) WithConditions(values ...*StatefulSetConditionApplyConfiguration) *StatefulSetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *StatefulSetStatusApplyConfiguration) WithAvailableReplicas(value int32) *StatefulSetStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} diff --git a/pkg/clients/applyconfiguration/apps/v1/statefulsetupdatestrategy.go b/pkg/clients/applyconfiguration/apps/v1/statefulsetupdatestrategy.go new file mode 100644 index 000000000..7727c67e3 --- /dev/null +++ b/pkg/clients/applyconfiguration/apps/v1/statefulsetupdatestrategy.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" +) + +// StatefulSetUpdateStrategyApplyConfiguration represents an declarative configuration of the StatefulSetUpdateStrategy type for use +// with apply. +type StatefulSetUpdateStrategyApplyConfiguration struct { + Type *v1.StatefulSetUpdateStrategyType `json:"type,omitempty"` + RollingUpdate *RollingUpdateStatefulSetStrategyApplyConfiguration `json:"rollingUpdate,omitempty"` +} + +// StatefulSetUpdateStrategyApplyConfiguration constructs an declarative configuration of the StatefulSetUpdateStrategy type for use with +// apply. +func StatefulSetUpdateStrategy() *StatefulSetUpdateStrategyApplyConfiguration { + return &StatefulSetUpdateStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *StatefulSetUpdateStrategyApplyConfiguration) WithType(value v1.StatefulSetUpdateStrategyType) *StatefulSetUpdateStrategyApplyConfiguration { + b.Type = &value + return b +} + +// WithRollingUpdate sets the RollingUpdate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RollingUpdate field is set to the value of the last call. +func (b *StatefulSetUpdateStrategyApplyConfiguration) WithRollingUpdate(value *RollingUpdateStatefulSetStrategyApplyConfiguration) *StatefulSetUpdateStrategyApplyConfiguration { + b.RollingUpdate = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/crossversionobjectreference.go b/pkg/clients/applyconfiguration/autoscaling/v1/crossversionobjectreference.go new file mode 100644 index 000000000..ff810c727 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/crossversionobjectreference.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CrossVersionObjectReferenceApplyConfiguration represents an declarative configuration of the CrossVersionObjectReference type for use +// with apply. +type CrossVersionObjectReferenceApplyConfiguration struct { + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` +} + +// CrossVersionObjectReferenceApplyConfiguration constructs an declarative configuration of the CrossVersionObjectReference type for use with +// apply. +func CrossVersionObjectReference() *CrossVersionObjectReferenceApplyConfiguration { + return &CrossVersionObjectReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CrossVersionObjectReferenceApplyConfiguration) WithKind(value string) *CrossVersionObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CrossVersionObjectReferenceApplyConfiguration) WithName(value string) *CrossVersionObjectReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CrossVersionObjectReferenceApplyConfiguration) WithAPIVersion(value string) *CrossVersionObjectReferenceApplyConfiguration { + b.APIVersion = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscaler.go b/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..230b46ee8 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HorizontalPodAutoscalerApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscaler type for use +// with apply. +type HorizontalPodAutoscalerApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *HorizontalPodAutoscalerSpecApplyConfiguration `json:"spec,omitempty"` + Status *HorizontalPodAutoscalerStatusApplyConfiguration `json:"status,omitempty"` +} + +// HorizontalPodAutoscaler constructs an declarative configuration of the HorizontalPodAutoscaler type for use with +// apply. +func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApplyConfiguration { + b := &HorizontalPodAutoscalerApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("HorizontalPodAutoscaler") + b.WithAPIVersion("autoscaling/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithKind(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithAPIVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithName(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithGenerateName(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithNamespace(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithUID(value types.UID) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithResourceVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithGeneration(value int64) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithCreationTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithLabels(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithAnnotations(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithFinalizers(values ...string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *HorizontalPodAutoscalerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithSpec(value *HorizontalPodAutoscalerSpecApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithStatus(value *HorizontalPodAutoscalerStatusApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscalerspec.go b/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscalerspec.go new file mode 100644 index 000000000..3751ef6d1 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscalerspec.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// HorizontalPodAutoscalerSpecApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerSpec type for use +// with apply. +type HorizontalPodAutoscalerSpecApplyConfiguration struct { + ScaleTargetRef *CrossVersionObjectReferenceApplyConfiguration `json:"scaleTargetRef,omitempty"` + MinReplicas *int32 `json:"minReplicas,omitempty"` + MaxReplicas *int32 `json:"maxReplicas,omitempty"` + TargetCPUUtilizationPercentage *int32 `json:"targetCPUUtilizationPercentage,omitempty"` +} + +// HorizontalPodAutoscalerSpecApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerSpec type for use with +// apply. +func HorizontalPodAutoscalerSpec() *HorizontalPodAutoscalerSpecApplyConfiguration { + return &HorizontalPodAutoscalerSpecApplyConfiguration{} +} + +// WithScaleTargetRef sets the ScaleTargetRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleTargetRef field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithScaleTargetRef(value *CrossVersionObjectReferenceApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.ScaleTargetRef = value + return b +} + +// WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMinReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.MinReplicas = &value + return b +} + +// WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMaxReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.MaxReplicas = &value + return b +} + +// WithTargetCPUUtilizationPercentage sets the TargetCPUUtilizationPercentage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetCPUUtilizationPercentage field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithTargetCPUUtilizationPercentage(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.TargetCPUUtilizationPercentage = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscalerstatus.go b/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscalerstatus.go new file mode 100644 index 000000000..f7dd376f8 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/horizontalpodautoscalerstatus.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// HorizontalPodAutoscalerStatusApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerStatus type for use +// with apply. +type HorizontalPodAutoscalerStatusApplyConfiguration struct { + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + LastScaleTime *v1.Time `json:"lastScaleTime,omitempty"` + CurrentReplicas *int32 `json:"currentReplicas,omitempty"` + DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` + CurrentCPUUtilizationPercentage *int32 `json:"currentCPUUtilizationPercentage,omitempty"` +} + +// HorizontalPodAutoscalerStatusApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerStatus type for use with +// apply. +func HorizontalPodAutoscalerStatus() *HorizontalPodAutoscalerStatusApplyConfiguration { + return &HorizontalPodAutoscalerStatusApplyConfiguration{} +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithObservedGeneration(value int64) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithLastScaleTime sets the LastScaleTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastScaleTime field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithLastScaleTime(value v1.Time) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.LastScaleTime = &value + return b +} + +// WithCurrentReplicas sets the CurrentReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.CurrentReplicas = &value + return b +} + +// WithDesiredReplicas sets the DesiredReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DesiredReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithDesiredReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.DesiredReplicas = &value + return b +} + +// WithCurrentCPUUtilizationPercentage sets the CurrentCPUUtilizationPercentage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentCPUUtilizationPercentage field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentCPUUtilizationPercentage(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.CurrentCPUUtilizationPercentage = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/scale.go b/pkg/clients/applyconfiguration/autoscaling/v1/scale.go new file mode 100644 index 000000000..caa814967 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/scale.go @@ -0,0 +1,204 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ScaleApplyConfiguration represents an declarative configuration of the Scale type for use +// with apply. +type ScaleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ScaleSpecApplyConfiguration `json:"spec,omitempty"` + Status *ScaleStatusApplyConfiguration `json:"status,omitempty"` +} + +// ScaleApplyConfiguration constructs an declarative configuration of the Scale type for use with +// apply. +func Scale() *ScaleApplyConfiguration { + b := &ScaleApplyConfiguration{} + b.WithKind("Scale") + b.WithAPIVersion("autoscaling/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithKind(value string) *ScaleApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithAPIVersion(value string) *ScaleApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGenerateName(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithNamespace(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithUID(value types.UID) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithResourceVersion(value string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithGeneration(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ScaleApplyConfiguration) WithLabels(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ScaleApplyConfiguration) WithAnnotations(entries map[string]string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ScaleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ScaleApplyConfiguration) WithFinalizers(values ...string) *ScaleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ScaleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithSpec(value *ScaleSpecApplyConfiguration) *ScaleApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ScaleApplyConfiguration) WithStatus(value *ScaleStatusApplyConfiguration) *ScaleApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/scalespec.go b/pkg/clients/applyconfiguration/autoscaling/v1/scalespec.go new file mode 100644 index 000000000..07bc505e2 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/scalespec.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ScaleSpecApplyConfiguration represents an declarative configuration of the ScaleSpec type for use +// with apply. +type ScaleSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` +} + +// ScaleSpecApplyConfiguration constructs an declarative configuration of the ScaleSpec type for use with +// apply. +func ScaleSpec() *ScaleSpecApplyConfiguration { + return &ScaleSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ScaleSpecApplyConfiguration) WithReplicas(value int32) *ScaleSpecApplyConfiguration { + b.Replicas = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v1/scalestatus.go b/pkg/clients/applyconfiguration/autoscaling/v1/scalestatus.go new file mode 100644 index 000000000..9bb109226 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v1/scalestatus.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ScaleStatusApplyConfiguration represents an declarative configuration of the ScaleStatus type for use +// with apply. +type ScaleStatusApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + Selector *string `json:"selector,omitempty"` +} + +// ScaleStatusApplyConfiguration constructs an declarative configuration of the ScaleStatus type for use with +// apply. +func ScaleStatus() *ScaleStatusApplyConfiguration { + return &ScaleStatusApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ScaleStatusApplyConfiguration) WithReplicas(value int32) *ScaleStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *ScaleStatusApplyConfiguration) WithSelector(value string) *ScaleStatusApplyConfiguration { + b.Selector = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/containerresourcemetricsource.go b/pkg/clients/applyconfiguration/autoscaling/v2/containerresourcemetricsource.go new file mode 100644 index 000000000..4860209fa --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/containerresourcemetricsource.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ContainerResourceMetricSourceApplyConfiguration represents an declarative configuration of the ContainerResourceMetricSource type for use +// with apply. +type ContainerResourceMetricSourceApplyConfiguration struct { + Name *v1.ResourceName `json:"name,omitempty"` + Target *MetricTargetApplyConfiguration `json:"target,omitempty"` + Container *string `json:"container,omitempty"` +} + +// ContainerResourceMetricSourceApplyConfiguration constructs an declarative configuration of the ContainerResourceMetricSource type for use with +// apply. +func ContainerResourceMetricSource() *ContainerResourceMetricSourceApplyConfiguration { + return &ContainerResourceMetricSourceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContainerResourceMetricSourceApplyConfiguration) WithName(value v1.ResourceName) *ContainerResourceMetricSourceApplyConfiguration { + b.Name = &value + return b +} + +// WithTarget sets the Target field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Target field is set to the value of the last call. +func (b *ContainerResourceMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ContainerResourceMetricSourceApplyConfiguration { + b.Target = value + return b +} + +// WithContainer sets the Container field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Container field is set to the value of the last call. +func (b *ContainerResourceMetricSourceApplyConfiguration) WithContainer(value string) *ContainerResourceMetricSourceApplyConfiguration { + b.Container = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/containerresourcemetricstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/containerresourcemetricstatus.go new file mode 100644 index 000000000..eeb70480f --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/containerresourcemetricstatus.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ContainerResourceMetricStatusApplyConfiguration represents an declarative configuration of the ContainerResourceMetricStatus type for use +// with apply. +type ContainerResourceMetricStatusApplyConfiguration struct { + Name *v1.ResourceName `json:"name,omitempty"` + Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` + Container *string `json:"container,omitempty"` +} + +// ContainerResourceMetricStatusApplyConfiguration constructs an declarative configuration of the ContainerResourceMetricStatus type for use with +// apply. +func ContainerResourceMetricStatus() *ContainerResourceMetricStatusApplyConfiguration { + return &ContainerResourceMetricStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContainerResourceMetricStatusApplyConfiguration) WithName(value v1.ResourceName) *ContainerResourceMetricStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithCurrent sets the Current field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Current field is set to the value of the last call. +func (b *ContainerResourceMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ContainerResourceMetricStatusApplyConfiguration { + b.Current = value + return b +} + +// WithContainer sets the Container field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Container field is set to the value of the last call. +func (b *ContainerResourceMetricStatusApplyConfiguration) WithContainer(value string) *ContainerResourceMetricStatusApplyConfiguration { + b.Container = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/crossversionobjectreference.go b/pkg/clients/applyconfiguration/autoscaling/v2/crossversionobjectreference.go new file mode 100644 index 000000000..417173f66 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/crossversionobjectreference.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// CrossVersionObjectReferenceApplyConfiguration represents an declarative configuration of the CrossVersionObjectReference type for use +// with apply. +type CrossVersionObjectReferenceApplyConfiguration struct { + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` +} + +// CrossVersionObjectReferenceApplyConfiguration constructs an declarative configuration of the CrossVersionObjectReference type for use with +// apply. +func CrossVersionObjectReference() *CrossVersionObjectReferenceApplyConfiguration { + return &CrossVersionObjectReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CrossVersionObjectReferenceApplyConfiguration) WithKind(value string) *CrossVersionObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CrossVersionObjectReferenceApplyConfiguration) WithName(value string) *CrossVersionObjectReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CrossVersionObjectReferenceApplyConfiguration) WithAPIVersion(value string) *CrossVersionObjectReferenceApplyConfiguration { + b.APIVersion = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/externalmetricsource.go b/pkg/clients/applyconfiguration/autoscaling/v2/externalmetricsource.go new file mode 100644 index 000000000..a40d0f2ec --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/externalmetricsource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// ExternalMetricSourceApplyConfiguration represents an declarative configuration of the ExternalMetricSource type for use +// with apply. +type ExternalMetricSourceApplyConfiguration struct { + Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` + Target *MetricTargetApplyConfiguration `json:"target,omitempty"` +} + +// ExternalMetricSourceApplyConfiguration constructs an declarative configuration of the ExternalMetricSource type for use with +// apply. +func ExternalMetricSource() *ExternalMetricSourceApplyConfiguration { + return &ExternalMetricSourceApplyConfiguration{} +} + +// WithMetric sets the Metric field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metric field is set to the value of the last call. +func (b *ExternalMetricSourceApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ExternalMetricSourceApplyConfiguration { + b.Metric = value + return b +} + +// WithTarget sets the Target field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Target field is set to the value of the last call. +func (b *ExternalMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ExternalMetricSourceApplyConfiguration { + b.Target = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/externalmetricstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/externalmetricstatus.go new file mode 100644 index 000000000..9ce6ace22 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/externalmetricstatus.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// ExternalMetricStatusApplyConfiguration represents an declarative configuration of the ExternalMetricStatus type for use +// with apply. +type ExternalMetricStatusApplyConfiguration struct { + Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` + Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` +} + +// ExternalMetricStatusApplyConfiguration constructs an declarative configuration of the ExternalMetricStatus type for use with +// apply. +func ExternalMetricStatus() *ExternalMetricStatusApplyConfiguration { + return &ExternalMetricStatusApplyConfiguration{} +} + +// WithMetric sets the Metric field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metric field is set to the value of the last call. +func (b *ExternalMetricStatusApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ExternalMetricStatusApplyConfiguration { + b.Metric = value + return b +} + +// WithCurrent sets the Current field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Current field is set to the value of the last call. +func (b *ExternalMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ExternalMetricStatusApplyConfiguration { + b.Current = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscaler.go b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscaler.go new file mode 100644 index 000000000..8b22a4fa9 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscaler.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HorizontalPodAutoscalerApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscaler type for use +// with apply. +type HorizontalPodAutoscalerApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *HorizontalPodAutoscalerSpecApplyConfiguration `json:"spec,omitempty"` + Status *HorizontalPodAutoscalerStatusApplyConfiguration `json:"status,omitempty"` +} + +// HorizontalPodAutoscaler constructs an declarative configuration of the HorizontalPodAutoscaler type for use with +// apply. +func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApplyConfiguration { + b := &HorizontalPodAutoscalerApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("HorizontalPodAutoscaler") + b.WithAPIVersion("autoscaling/v2") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithKind(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithAPIVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithName(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithGenerateName(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithNamespace(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithUID(value types.UID) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithResourceVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithGeneration(value int64) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithCreationTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithLabels(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithAnnotations(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithFinalizers(values ...string) *HorizontalPodAutoscalerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *HorizontalPodAutoscalerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithSpec(value *HorizontalPodAutoscalerSpecApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *HorizontalPodAutoscalerApplyConfiguration) WithStatus(value *HorizontalPodAutoscalerStatusApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerbehavior.go b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerbehavior.go new file mode 100644 index 000000000..50eb29e80 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerbehavior.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// HorizontalPodAutoscalerBehaviorApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerBehavior type for use +// with apply. +type HorizontalPodAutoscalerBehaviorApplyConfiguration struct { + ScaleUp *HPAScalingRulesApplyConfiguration `json:"scaleUp,omitempty"` + ScaleDown *HPAScalingRulesApplyConfiguration `json:"scaleDown,omitempty"` +} + +// HorizontalPodAutoscalerBehaviorApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerBehavior type for use with +// apply. +func HorizontalPodAutoscalerBehavior() *HorizontalPodAutoscalerBehaviorApplyConfiguration { + return &HorizontalPodAutoscalerBehaviorApplyConfiguration{} +} + +// WithScaleUp sets the ScaleUp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleUp field is set to the value of the last call. +func (b *HorizontalPodAutoscalerBehaviorApplyConfiguration) WithScaleUp(value *HPAScalingRulesApplyConfiguration) *HorizontalPodAutoscalerBehaviorApplyConfiguration { + b.ScaleUp = value + return b +} + +// WithScaleDown sets the ScaleDown field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleDown field is set to the value of the last call. +func (b *HorizontalPodAutoscalerBehaviorApplyConfiguration) WithScaleDown(value *HPAScalingRulesApplyConfiguration) *HorizontalPodAutoscalerBehaviorApplyConfiguration { + b.ScaleDown = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalercondition.go b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalercondition.go new file mode 100644 index 000000000..39f141823 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalercondition.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// HorizontalPodAutoscalerConditionApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerCondition type for use +// with apply. +type HorizontalPodAutoscalerConditionApplyConfiguration struct { + Type *v2.HorizontalPodAutoscalerConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// HorizontalPodAutoscalerConditionApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerCondition type for use with +// apply. +func HorizontalPodAutoscalerCondition() *HorizontalPodAutoscalerConditionApplyConfiguration { + return &HorizontalPodAutoscalerConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithType(value v2.HorizontalPodAutoscalerConditionType) *HorizontalPodAutoscalerConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *HorizontalPodAutoscalerConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *HorizontalPodAutoscalerConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithReason(value string) *HorizontalPodAutoscalerConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithMessage(value string) *HorizontalPodAutoscalerConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerspec.go b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerspec.go new file mode 100644 index 000000000..69e0b3193 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerspec.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// HorizontalPodAutoscalerSpecApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerSpec type for use +// with apply. +type HorizontalPodAutoscalerSpecApplyConfiguration struct { + ScaleTargetRef *CrossVersionObjectReferenceApplyConfiguration `json:"scaleTargetRef,omitempty"` + MinReplicas *int32 `json:"minReplicas,omitempty"` + MaxReplicas *int32 `json:"maxReplicas,omitempty"` + Metrics []MetricSpecApplyConfiguration `json:"metrics,omitempty"` + Behavior *HorizontalPodAutoscalerBehaviorApplyConfiguration `json:"behavior,omitempty"` +} + +// HorizontalPodAutoscalerSpecApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerSpec type for use with +// apply. +func HorizontalPodAutoscalerSpec() *HorizontalPodAutoscalerSpecApplyConfiguration { + return &HorizontalPodAutoscalerSpecApplyConfiguration{} +} + +// WithScaleTargetRef sets the ScaleTargetRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleTargetRef field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithScaleTargetRef(value *CrossVersionObjectReferenceApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.ScaleTargetRef = value + return b +} + +// WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMinReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.MinReplicas = &value + return b +} + +// WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMaxReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.MaxReplicas = &value + return b +} + +// WithMetrics adds the given value to the Metrics field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Metrics field. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMetrics(values ...*MetricSpecApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMetrics") + } + b.Metrics = append(b.Metrics, *values[i]) + } + return b +} + +// WithBehavior sets the Behavior field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Behavior field is set to the value of the last call. +func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithBehavior(value *HorizontalPodAutoscalerBehaviorApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { + b.Behavior = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerstatus.go new file mode 100644 index 000000000..f9af7491d --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/horizontalpodautoscalerstatus.go @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// HorizontalPodAutoscalerStatusApplyConfiguration represents an declarative configuration of the HorizontalPodAutoscalerStatus type for use +// with apply. +type HorizontalPodAutoscalerStatusApplyConfiguration struct { + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + LastScaleTime *v1.Time `json:"lastScaleTime,omitempty"` + CurrentReplicas *int32 `json:"currentReplicas,omitempty"` + DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` + CurrentMetrics []MetricStatusApplyConfiguration `json:"currentMetrics,omitempty"` + Conditions []HorizontalPodAutoscalerConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// HorizontalPodAutoscalerStatusApplyConfiguration constructs an declarative configuration of the HorizontalPodAutoscalerStatus type for use with +// apply. +func HorizontalPodAutoscalerStatus() *HorizontalPodAutoscalerStatusApplyConfiguration { + return &HorizontalPodAutoscalerStatusApplyConfiguration{} +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithObservedGeneration(value int64) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithLastScaleTime sets the LastScaleTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastScaleTime field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithLastScaleTime(value v1.Time) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.LastScaleTime = &value + return b +} + +// WithCurrentReplicas sets the CurrentReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.CurrentReplicas = &value + return b +} + +// WithDesiredReplicas sets the DesiredReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DesiredReplicas field is set to the value of the last call. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithDesiredReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { + b.DesiredReplicas = &value + return b +} + +// WithCurrentMetrics adds the given value to the CurrentMetrics field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CurrentMetrics field. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentMetrics(values ...*MetricStatusApplyConfiguration) *HorizontalPodAutoscalerStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCurrentMetrics") + } + b.CurrentMetrics = append(b.CurrentMetrics, *values[i]) + } + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithConditions(values ...*HorizontalPodAutoscalerConditionApplyConfiguration) *HorizontalPodAutoscalerStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/hpascalingpolicy.go b/pkg/clients/applyconfiguration/autoscaling/v2/hpascalingpolicy.go new file mode 100644 index 000000000..e3e07d18e --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/hpascalingpolicy.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" +) + +// HPAScalingPolicyApplyConfiguration represents an declarative configuration of the HPAScalingPolicy type for use +// with apply. +type HPAScalingPolicyApplyConfiguration struct { + Type *v2.HPAScalingPolicyType `json:"type,omitempty"` + Value *int32 `json:"value,omitempty"` + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` +} + +// HPAScalingPolicyApplyConfiguration constructs an declarative configuration of the HPAScalingPolicy type for use with +// apply. +func HPAScalingPolicy() *HPAScalingPolicyApplyConfiguration { + return &HPAScalingPolicyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *HPAScalingPolicyApplyConfiguration) WithType(value v2.HPAScalingPolicyType) *HPAScalingPolicyApplyConfiguration { + b.Type = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *HPAScalingPolicyApplyConfiguration) WithValue(value int32) *HPAScalingPolicyApplyConfiguration { + b.Value = &value + return b +} + +// WithPeriodSeconds sets the PeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PeriodSeconds field is set to the value of the last call. +func (b *HPAScalingPolicyApplyConfiguration) WithPeriodSeconds(value int32) *HPAScalingPolicyApplyConfiguration { + b.PeriodSeconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/hpascalingrules.go b/pkg/clients/applyconfiguration/autoscaling/v2/hpascalingrules.go new file mode 100644 index 000000000..0bedd9fc0 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/hpascalingrules.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" +) + +// HPAScalingRulesApplyConfiguration represents an declarative configuration of the HPAScalingRules type for use +// with apply. +type HPAScalingRulesApplyConfiguration struct { + StabilizationWindowSeconds *int32 `json:"stabilizationWindowSeconds,omitempty"` + SelectPolicy *v2.ScalingPolicySelect `json:"selectPolicy,omitempty"` + Policies []HPAScalingPolicyApplyConfiguration `json:"policies,omitempty"` +} + +// HPAScalingRulesApplyConfiguration constructs an declarative configuration of the HPAScalingRules type for use with +// apply. +func HPAScalingRules() *HPAScalingRulesApplyConfiguration { + return &HPAScalingRulesApplyConfiguration{} +} + +// WithStabilizationWindowSeconds sets the StabilizationWindowSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StabilizationWindowSeconds field is set to the value of the last call. +func (b *HPAScalingRulesApplyConfiguration) WithStabilizationWindowSeconds(value int32) *HPAScalingRulesApplyConfiguration { + b.StabilizationWindowSeconds = &value + return b +} + +// WithSelectPolicy sets the SelectPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SelectPolicy field is set to the value of the last call. +func (b *HPAScalingRulesApplyConfiguration) WithSelectPolicy(value v2.ScalingPolicySelect) *HPAScalingRulesApplyConfiguration { + b.SelectPolicy = &value + return b +} + +// WithPolicies adds the given value to the Policies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Policies field. +func (b *HPAScalingRulesApplyConfiguration) WithPolicies(values ...*HPAScalingPolicyApplyConfiguration) *HPAScalingRulesApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPolicies") + } + b.Policies = append(b.Policies, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/metricidentifier.go b/pkg/clients/applyconfiguration/autoscaling/v2/metricidentifier.go new file mode 100644 index 000000000..2fc6b1bc3 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/metricidentifier.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MetricIdentifierApplyConfiguration represents an declarative configuration of the MetricIdentifier type for use +// with apply. +type MetricIdentifierApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` +} + +// MetricIdentifierApplyConfiguration constructs an declarative configuration of the MetricIdentifier type for use with +// apply. +func MetricIdentifier() *MetricIdentifierApplyConfiguration { + return &MetricIdentifierApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MetricIdentifierApplyConfiguration) WithName(value string) *MetricIdentifierApplyConfiguration { + b.Name = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *MetricIdentifierApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MetricIdentifierApplyConfiguration { + b.Selector = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/metricspec.go b/pkg/clients/applyconfiguration/autoscaling/v2/metricspec.go new file mode 100644 index 000000000..3a499c194 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/metricspec.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" +) + +// MetricSpecApplyConfiguration represents an declarative configuration of the MetricSpec type for use +// with apply. +type MetricSpecApplyConfiguration struct { + Type *v2.MetricSourceType `json:"type,omitempty"` + Object *ObjectMetricSourceApplyConfiguration `json:"object,omitempty"` + Pods *PodsMetricSourceApplyConfiguration `json:"pods,omitempty"` + Resource *ResourceMetricSourceApplyConfiguration `json:"resource,omitempty"` + ContainerResource *ContainerResourceMetricSourceApplyConfiguration `json:"containerResource,omitempty"` + External *ExternalMetricSourceApplyConfiguration `json:"external,omitempty"` +} + +// MetricSpecApplyConfiguration constructs an declarative configuration of the MetricSpec type for use with +// apply. +func MetricSpec() *MetricSpecApplyConfiguration { + return &MetricSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MetricSpecApplyConfiguration) WithType(value v2.MetricSourceType) *MetricSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithObject sets the Object field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Object field is set to the value of the last call. +func (b *MetricSpecApplyConfiguration) WithObject(value *ObjectMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { + b.Object = value + return b +} + +// WithPods sets the Pods field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pods field is set to the value of the last call. +func (b *MetricSpecApplyConfiguration) WithPods(value *PodsMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { + b.Pods = value + return b +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *MetricSpecApplyConfiguration) WithResource(value *ResourceMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { + b.Resource = value + return b +} + +// WithContainerResource sets the ContainerResource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerResource field is set to the value of the last call. +func (b *MetricSpecApplyConfiguration) WithContainerResource(value *ContainerResourceMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { + b.ContainerResource = value + return b +} + +// WithExternal sets the External field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the External field is set to the value of the last call. +func (b *MetricSpecApplyConfiguration) WithExternal(value *ExternalMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { + b.External = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/metricstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/metricstatus.go new file mode 100644 index 000000000..a08b83162 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/metricstatus.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" +) + +// MetricStatusApplyConfiguration represents an declarative configuration of the MetricStatus type for use +// with apply. +type MetricStatusApplyConfiguration struct { + Type *v2.MetricSourceType `json:"type,omitempty"` + Object *ObjectMetricStatusApplyConfiguration `json:"object,omitempty"` + Pods *PodsMetricStatusApplyConfiguration `json:"pods,omitempty"` + Resource *ResourceMetricStatusApplyConfiguration `json:"resource,omitempty"` + ContainerResource *ContainerResourceMetricStatusApplyConfiguration `json:"containerResource,omitempty"` + External *ExternalMetricStatusApplyConfiguration `json:"external,omitempty"` +} + +// MetricStatusApplyConfiguration constructs an declarative configuration of the MetricStatus type for use with +// apply. +func MetricStatus() *MetricStatusApplyConfiguration { + return &MetricStatusApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MetricStatusApplyConfiguration) WithType(value v2.MetricSourceType) *MetricStatusApplyConfiguration { + b.Type = &value + return b +} + +// WithObject sets the Object field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Object field is set to the value of the last call. +func (b *MetricStatusApplyConfiguration) WithObject(value *ObjectMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { + b.Object = value + return b +} + +// WithPods sets the Pods field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pods field is set to the value of the last call. +func (b *MetricStatusApplyConfiguration) WithPods(value *PodsMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { + b.Pods = value + return b +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *MetricStatusApplyConfiguration) WithResource(value *ResourceMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { + b.Resource = value + return b +} + +// WithContainerResource sets the ContainerResource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerResource field is set to the value of the last call. +func (b *MetricStatusApplyConfiguration) WithContainerResource(value *ContainerResourceMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { + b.ContainerResource = value + return b +} + +// WithExternal sets the External field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the External field is set to the value of the last call. +func (b *MetricStatusApplyConfiguration) WithExternal(value *ExternalMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { + b.External = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/metrictarget.go b/pkg/clients/applyconfiguration/autoscaling/v2/metrictarget.go new file mode 100644 index 000000000..c75908b1c --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/metrictarget.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// MetricTargetApplyConfiguration represents an declarative configuration of the MetricTarget type for use +// with apply. +type MetricTargetApplyConfiguration struct { + Type *v2.MetricTargetType `json:"type,omitempty"` + Value *resource.Quantity `json:"value,omitempty"` + AverageValue *resource.Quantity `json:"averageValue,omitempty"` + AverageUtilization *int32 `json:"averageUtilization,omitempty"` +} + +// MetricTargetApplyConfiguration constructs an declarative configuration of the MetricTarget type for use with +// apply. +func MetricTarget() *MetricTargetApplyConfiguration { + return &MetricTargetApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MetricTargetApplyConfiguration) WithType(value v2.MetricTargetType) *MetricTargetApplyConfiguration { + b.Type = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *MetricTargetApplyConfiguration) WithValue(value resource.Quantity) *MetricTargetApplyConfiguration { + b.Value = &value + return b +} + +// WithAverageValue sets the AverageValue field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AverageValue field is set to the value of the last call. +func (b *MetricTargetApplyConfiguration) WithAverageValue(value resource.Quantity) *MetricTargetApplyConfiguration { + b.AverageValue = &value + return b +} + +// WithAverageUtilization sets the AverageUtilization field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AverageUtilization field is set to the value of the last call. +func (b *MetricTargetApplyConfiguration) WithAverageUtilization(value int32) *MetricTargetApplyConfiguration { + b.AverageUtilization = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/metricvaluestatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/metricvaluestatus.go new file mode 100644 index 000000000..1bf2f839e --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/metricvaluestatus.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// MetricValueStatusApplyConfiguration represents an declarative configuration of the MetricValueStatus type for use +// with apply. +type MetricValueStatusApplyConfiguration struct { + Value *resource.Quantity `json:"value,omitempty"` + AverageValue *resource.Quantity `json:"averageValue,omitempty"` + AverageUtilization *int32 `json:"averageUtilization,omitempty"` +} + +// MetricValueStatusApplyConfiguration constructs an declarative configuration of the MetricValueStatus type for use with +// apply. +func MetricValueStatus() *MetricValueStatusApplyConfiguration { + return &MetricValueStatusApplyConfiguration{} +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *MetricValueStatusApplyConfiguration) WithValue(value resource.Quantity) *MetricValueStatusApplyConfiguration { + b.Value = &value + return b +} + +// WithAverageValue sets the AverageValue field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AverageValue field is set to the value of the last call. +func (b *MetricValueStatusApplyConfiguration) WithAverageValue(value resource.Quantity) *MetricValueStatusApplyConfiguration { + b.AverageValue = &value + return b +} + +// WithAverageUtilization sets the AverageUtilization field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AverageUtilization field is set to the value of the last call. +func (b *MetricValueStatusApplyConfiguration) WithAverageUtilization(value int32) *MetricValueStatusApplyConfiguration { + b.AverageUtilization = &value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/objectmetricsource.go b/pkg/clients/applyconfiguration/autoscaling/v2/objectmetricsource.go new file mode 100644 index 000000000..6b823593a --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/objectmetricsource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// ObjectMetricSourceApplyConfiguration represents an declarative configuration of the ObjectMetricSource type for use +// with apply. +type ObjectMetricSourceApplyConfiguration struct { + DescribedObject *CrossVersionObjectReferenceApplyConfiguration `json:"describedObject,omitempty"` + Target *MetricTargetApplyConfiguration `json:"target,omitempty"` + Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` +} + +// ObjectMetricSourceApplyConfiguration constructs an declarative configuration of the ObjectMetricSource type for use with +// apply. +func ObjectMetricSource() *ObjectMetricSourceApplyConfiguration { + return &ObjectMetricSourceApplyConfiguration{} +} + +// WithDescribedObject sets the DescribedObject field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DescribedObject field is set to the value of the last call. +func (b *ObjectMetricSourceApplyConfiguration) WithDescribedObject(value *CrossVersionObjectReferenceApplyConfiguration) *ObjectMetricSourceApplyConfiguration { + b.DescribedObject = value + return b +} + +// WithTarget sets the Target field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Target field is set to the value of the last call. +func (b *ObjectMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ObjectMetricSourceApplyConfiguration { + b.Target = value + return b +} + +// WithMetric sets the Metric field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metric field is set to the value of the last call. +func (b *ObjectMetricSourceApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ObjectMetricSourceApplyConfiguration { + b.Metric = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/objectmetricstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/objectmetricstatus.go new file mode 100644 index 000000000..d126c1876 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/objectmetricstatus.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// ObjectMetricStatusApplyConfiguration represents an declarative configuration of the ObjectMetricStatus type for use +// with apply. +type ObjectMetricStatusApplyConfiguration struct { + Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` + Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` + DescribedObject *CrossVersionObjectReferenceApplyConfiguration `json:"describedObject,omitempty"` +} + +// ObjectMetricStatusApplyConfiguration constructs an declarative configuration of the ObjectMetricStatus type for use with +// apply. +func ObjectMetricStatus() *ObjectMetricStatusApplyConfiguration { + return &ObjectMetricStatusApplyConfiguration{} +} + +// WithMetric sets the Metric field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metric field is set to the value of the last call. +func (b *ObjectMetricStatusApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ObjectMetricStatusApplyConfiguration { + b.Metric = value + return b +} + +// WithCurrent sets the Current field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Current field is set to the value of the last call. +func (b *ObjectMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ObjectMetricStatusApplyConfiguration { + b.Current = value + return b +} + +// WithDescribedObject sets the DescribedObject field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DescribedObject field is set to the value of the last call. +func (b *ObjectMetricStatusApplyConfiguration) WithDescribedObject(value *CrossVersionObjectReferenceApplyConfiguration) *ObjectMetricStatusApplyConfiguration { + b.DescribedObject = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/podsmetricsource.go b/pkg/clients/applyconfiguration/autoscaling/v2/podsmetricsource.go new file mode 100644 index 000000000..401ef0359 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/podsmetricsource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// PodsMetricSourceApplyConfiguration represents an declarative configuration of the PodsMetricSource type for use +// with apply. +type PodsMetricSourceApplyConfiguration struct { + Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` + Target *MetricTargetApplyConfiguration `json:"target,omitempty"` +} + +// PodsMetricSourceApplyConfiguration constructs an declarative configuration of the PodsMetricSource type for use with +// apply. +func PodsMetricSource() *PodsMetricSourceApplyConfiguration { + return &PodsMetricSourceApplyConfiguration{} +} + +// WithMetric sets the Metric field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metric field is set to the value of the last call. +func (b *PodsMetricSourceApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *PodsMetricSourceApplyConfiguration { + b.Metric = value + return b +} + +// WithTarget sets the Target field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Target field is set to the value of the last call. +func (b *PodsMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *PodsMetricSourceApplyConfiguration { + b.Target = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/podsmetricstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/podsmetricstatus.go new file mode 100644 index 000000000..f947c6713 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/podsmetricstatus.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// PodsMetricStatusApplyConfiguration represents an declarative configuration of the PodsMetricStatus type for use +// with apply. +type PodsMetricStatusApplyConfiguration struct { + Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` + Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` +} + +// PodsMetricStatusApplyConfiguration constructs an declarative configuration of the PodsMetricStatus type for use with +// apply. +func PodsMetricStatus() *PodsMetricStatusApplyConfiguration { + return &PodsMetricStatusApplyConfiguration{} +} + +// WithMetric sets the Metric field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Metric field is set to the value of the last call. +func (b *PodsMetricStatusApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *PodsMetricStatusApplyConfiguration { + b.Metric = value + return b +} + +// WithCurrent sets the Current field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Current field is set to the value of the last call. +func (b *PodsMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *PodsMetricStatusApplyConfiguration { + b.Current = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/resourcemetricsource.go b/pkg/clients/applyconfiguration/autoscaling/v2/resourcemetricsource.go new file mode 100644 index 000000000..f82159edb --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/resourcemetricsource.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ResourceMetricSourceApplyConfiguration represents an declarative configuration of the ResourceMetricSource type for use +// with apply. +type ResourceMetricSourceApplyConfiguration struct { + Name *v1.ResourceName `json:"name,omitempty"` + Target *MetricTargetApplyConfiguration `json:"target,omitempty"` +} + +// ResourceMetricSourceApplyConfiguration constructs an declarative configuration of the ResourceMetricSource type for use with +// apply. +func ResourceMetricSource() *ResourceMetricSourceApplyConfiguration { + return &ResourceMetricSourceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceMetricSourceApplyConfiguration) WithName(value v1.ResourceName) *ResourceMetricSourceApplyConfiguration { + b.Name = &value + return b +} + +// WithTarget sets the Target field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Target field is set to the value of the last call. +func (b *ResourceMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ResourceMetricSourceApplyConfiguration { + b.Target = value + return b +} diff --git a/pkg/clients/applyconfiguration/autoscaling/v2/resourcemetricstatus.go b/pkg/clients/applyconfiguration/autoscaling/v2/resourcemetricstatus.go new file mode 100644 index 000000000..9d2323312 --- /dev/null +++ b/pkg/clients/applyconfiguration/autoscaling/v2/resourcemetricstatus.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ResourceMetricStatusApplyConfiguration represents an declarative configuration of the ResourceMetricStatus type for use +// with apply. +type ResourceMetricStatusApplyConfiguration struct { + Name *v1.ResourceName `json:"name,omitempty"` + Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` +} + +// ResourceMetricStatusApplyConfiguration constructs an declarative configuration of the ResourceMetricStatus type for use with +// apply. +func ResourceMetricStatus() *ResourceMetricStatusApplyConfiguration { + return &ResourceMetricStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceMetricStatusApplyConfiguration) WithName(value v1.ResourceName) *ResourceMetricStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithCurrent sets the Current field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Current field is set to the value of the last call. +func (b *ResourceMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ResourceMetricStatusApplyConfiguration { + b.Current = value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/cronjob.go b/pkg/clients/applyconfiguration/batch/v1/cronjob.go new file mode 100644 index 000000000..161e3e90f --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/cronjob.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CronJobApplyConfiguration represents an declarative configuration of the CronJob type for use +// with apply. +type CronJobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *CronJobSpecApplyConfiguration `json:"spec,omitempty"` + Status *CronJobStatusApplyConfiguration `json:"status,omitempty"` +} + +// CronJob constructs an declarative configuration of the CronJob type for use with +// apply. +func CronJob(name, namespace string) *CronJobApplyConfiguration { + b := &CronJobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("CronJob") + b.WithAPIVersion("batch/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithKind(value string) *CronJobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithAPIVersion(value string) *CronJobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithName(value string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithGenerateName(value string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithNamespace(value string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithUID(value types.UID) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithResourceVersion(value string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithGeneration(value int64) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CronJobApplyConfiguration) WithLabels(entries map[string]string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CronJobApplyConfiguration) WithAnnotations(entries map[string]string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CronJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CronJobApplyConfiguration) WithFinalizers(values ...string) *CronJobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CronJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithSpec(value *CronJobSpecApplyConfiguration) *CronJobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CronJobApplyConfiguration) WithStatus(value *CronJobStatusApplyConfiguration) *CronJobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/cronjobspec.go b/pkg/clients/applyconfiguration/batch/v1/cronjobspec.go new file mode 100644 index 000000000..d160e0a2c --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/cronjobspec.go @@ -0,0 +1,93 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" +) + +// CronJobSpecApplyConfiguration represents an declarative configuration of the CronJobSpec type for use +// with apply. +type CronJobSpecApplyConfiguration struct { + Schedule *string `json:"schedule,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty"` + ConcurrencyPolicy *v1.ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"` + Suspend *bool `json:"suspend,omitempty"` + JobTemplate *JobTemplateSpecApplyConfiguration `json:"jobTemplate,omitempty"` + SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"` + FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"` +} + +// CronJobSpecApplyConfiguration constructs an declarative configuration of the CronJobSpec type for use with +// apply. +func CronJobSpec() *CronJobSpecApplyConfiguration { + return &CronJobSpecApplyConfiguration{} +} + +// WithSchedule sets the Schedule field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schedule field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithSchedule(value string) *CronJobSpecApplyConfiguration { + b.Schedule = &value + return b +} + +// WithTimeZone sets the TimeZone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeZone field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithTimeZone(value string) *CronJobSpecApplyConfiguration { + b.TimeZone = &value + return b +} + +// WithStartingDeadlineSeconds sets the StartingDeadlineSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartingDeadlineSeconds field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithStartingDeadlineSeconds(value int64) *CronJobSpecApplyConfiguration { + b.StartingDeadlineSeconds = &value + return b +} + +// WithConcurrencyPolicy sets the ConcurrencyPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConcurrencyPolicy field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithConcurrencyPolicy(value v1.ConcurrencyPolicy) *CronJobSpecApplyConfiguration { + b.ConcurrencyPolicy = &value + return b +} + +// WithSuspend sets the Suspend field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Suspend field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithSuspend(value bool) *CronJobSpecApplyConfiguration { + b.Suspend = &value + return b +} + +// WithJobTemplate sets the JobTemplate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JobTemplate field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithJobTemplate(value *JobTemplateSpecApplyConfiguration) *CronJobSpecApplyConfiguration { + b.JobTemplate = value + return b +} + +// WithSuccessfulJobsHistoryLimit sets the SuccessfulJobsHistoryLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SuccessfulJobsHistoryLimit field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithSuccessfulJobsHistoryLimit(value int32) *CronJobSpecApplyConfiguration { + b.SuccessfulJobsHistoryLimit = &value + return b +} + +// WithFailedJobsHistoryLimit sets the FailedJobsHistoryLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailedJobsHistoryLimit field is set to the value of the last call. +func (b *CronJobSpecApplyConfiguration) WithFailedJobsHistoryLimit(value int32) *CronJobSpecApplyConfiguration { + b.FailedJobsHistoryLimit = &value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/cronjobstatus.go b/pkg/clients/applyconfiguration/batch/v1/cronjobstatus.go new file mode 100644 index 000000000..01a4e0a31 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/cronjobstatus.go @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CronJobStatusApplyConfiguration represents an declarative configuration of the CronJobStatus type for use +// with apply. +type CronJobStatusApplyConfiguration struct { + Active []v1.ObjectReferenceApplyConfiguration `json:"active,omitempty"` + LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"` + LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty"` +} + +// CronJobStatusApplyConfiguration constructs an declarative configuration of the CronJobStatus type for use with +// apply. +func CronJobStatus() *CronJobStatusApplyConfiguration { + return &CronJobStatusApplyConfiguration{} +} + +// WithActive adds the given value to the Active field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Active field. +func (b *CronJobStatusApplyConfiguration) WithActive(values ...*v1.ObjectReferenceApplyConfiguration) *CronJobStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithActive") + } + b.Active = append(b.Active, *values[i]) + } + return b +} + +// WithLastScheduleTime sets the LastScheduleTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastScheduleTime field is set to the value of the last call. +func (b *CronJobStatusApplyConfiguration) WithLastScheduleTime(value metav1.Time) *CronJobStatusApplyConfiguration { + b.LastScheduleTime = &value + return b +} + +// WithLastSuccessfulTime sets the LastSuccessfulTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastSuccessfulTime field is set to the value of the last call. +func (b *CronJobStatusApplyConfiguration) WithLastSuccessfulTime(value metav1.Time) *CronJobStatusApplyConfiguration { + b.LastSuccessfulTime = &value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/job.go b/pkg/clients/applyconfiguration/batch/v1/job.go new file mode 100644 index 000000000..60e5b4558 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/job.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// JobApplyConfiguration represents an declarative configuration of the Job type for use +// with apply. +type JobApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *JobSpecApplyConfiguration `json:"spec,omitempty"` + Status *JobStatusApplyConfiguration `json:"status,omitempty"` +} + +// Job constructs an declarative configuration of the Job type for use with +// apply. +func Job(name, namespace string) *JobApplyConfiguration { + b := &JobApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Job") + b.WithAPIVersion("batch/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *JobApplyConfiguration) WithKind(value string) *JobApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *JobApplyConfiguration) WithAPIVersion(value string) *JobApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *JobApplyConfiguration) WithName(value string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *JobApplyConfiguration) WithGenerateName(value string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *JobApplyConfiguration) WithNamespace(value string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *JobApplyConfiguration) WithUID(value types.UID) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *JobApplyConfiguration) WithResourceVersion(value string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *JobApplyConfiguration) WithGeneration(value int64) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *JobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *JobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *JobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *JobApplyConfiguration) WithLabels(entries map[string]string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *JobApplyConfiguration) WithAnnotations(entries map[string]string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *JobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *JobApplyConfiguration) WithFinalizers(values ...string) *JobApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *JobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *JobApplyConfiguration) WithSpec(value *JobSpecApplyConfiguration) *JobApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *JobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *JobApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/jobcondition.go b/pkg/clients/applyconfiguration/batch/v1/jobcondition.go new file mode 100644 index 000000000..1e6320107 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/jobcondition.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// JobConditionApplyConfiguration represents an declarative configuration of the JobCondition type for use +// with apply. +type JobConditionApplyConfiguration struct { + Type *v1.JobConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + LastProbeTime *metav1.Time `json:"lastProbeTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// JobConditionApplyConfiguration constructs an declarative configuration of the JobCondition type for use with +// apply. +func JobCondition() *JobConditionApplyConfiguration { + return &JobConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithType(value v1.JobConditionType) *JobConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *JobConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastProbeTime sets the LastProbeTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastProbeTime field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithLastProbeTime(value metav1.Time) *JobConditionApplyConfiguration { + b.LastProbeTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *JobConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithReason(value string) *JobConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *JobConditionApplyConfiguration) WithMessage(value string) *JobConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/jobspec.go b/pkg/clients/applyconfiguration/batch/v1/jobspec.go new file mode 100644 index 000000000..c281a2ef2 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/jobspec.go @@ -0,0 +1,149 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// JobSpecApplyConfiguration represents an declarative configuration of the JobSpec type for use +// with apply. +type JobSpecApplyConfiguration struct { + Parallelism *int32 `json:"parallelism,omitempty"` + Completions *int32 `json:"completions,omitempty"` + ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"` + PodFailurePolicy *PodFailurePolicyApplyConfiguration `json:"podFailurePolicy,omitempty"` + BackoffLimit *int32 `json:"backoffLimit,omitempty"` + BackoffLimitPerIndex *int32 `json:"backoffLimitPerIndex,omitempty"` + MaxFailedIndexes *int32 `json:"maxFailedIndexes,omitempty"` + Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + ManualSelector *bool `json:"manualSelector,omitempty"` + Template *corev1.PodTemplateSpecApplyConfiguration `json:"template,omitempty"` + TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"` + CompletionMode *batchv1.CompletionMode `json:"completionMode,omitempty"` + Suspend *bool `json:"suspend,omitempty"` + PodReplacementPolicy *batchv1.PodReplacementPolicy `json:"podReplacementPolicy,omitempty"` +} + +// JobSpecApplyConfiguration constructs an declarative configuration of the JobSpec type for use with +// apply. +func JobSpec() *JobSpecApplyConfiguration { + return &JobSpecApplyConfiguration{} +} + +// WithParallelism sets the Parallelism field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Parallelism field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithParallelism(value int32) *JobSpecApplyConfiguration { + b.Parallelism = &value + return b +} + +// WithCompletions sets the Completions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Completions field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithCompletions(value int32) *JobSpecApplyConfiguration { + b.Completions = &value + return b +} + +// WithActiveDeadlineSeconds sets the ActiveDeadlineSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ActiveDeadlineSeconds field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithActiveDeadlineSeconds(value int64) *JobSpecApplyConfiguration { + b.ActiveDeadlineSeconds = &value + return b +} + +// WithPodFailurePolicy sets the PodFailurePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodFailurePolicy field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithPodFailurePolicy(value *PodFailurePolicyApplyConfiguration) *JobSpecApplyConfiguration { + b.PodFailurePolicy = value + return b +} + +// WithBackoffLimit sets the BackoffLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BackoffLimit field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithBackoffLimit(value int32) *JobSpecApplyConfiguration { + b.BackoffLimit = &value + return b +} + +// WithBackoffLimitPerIndex sets the BackoffLimitPerIndex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BackoffLimitPerIndex field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithBackoffLimitPerIndex(value int32) *JobSpecApplyConfiguration { + b.BackoffLimitPerIndex = &value + return b +} + +// WithMaxFailedIndexes sets the MaxFailedIndexes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxFailedIndexes field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithMaxFailedIndexes(value int32) *JobSpecApplyConfiguration { + b.MaxFailedIndexes = &value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithSelector(value *metav1.LabelSelectorApplyConfiguration) *JobSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithManualSelector sets the ManualSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ManualSelector field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithManualSelector(value bool) *JobSpecApplyConfiguration { + b.ManualSelector = &value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithTemplate(value *corev1.PodTemplateSpecApplyConfiguration) *JobSpecApplyConfiguration { + b.Template = value + return b +} + +// WithTTLSecondsAfterFinished sets the TTLSecondsAfterFinished field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TTLSecondsAfterFinished field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithTTLSecondsAfterFinished(value int32) *JobSpecApplyConfiguration { + b.TTLSecondsAfterFinished = &value + return b +} + +// WithCompletionMode sets the CompletionMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CompletionMode field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithCompletionMode(value batchv1.CompletionMode) *JobSpecApplyConfiguration { + b.CompletionMode = &value + return b +} + +// WithSuspend sets the Suspend field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Suspend field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithSuspend(value bool) *JobSpecApplyConfiguration { + b.Suspend = &value + return b +} + +// WithPodReplacementPolicy sets the PodReplacementPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodReplacementPolicy field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithPodReplacementPolicy(value batchv1.PodReplacementPolicy) *JobSpecApplyConfiguration { + b.PodReplacementPolicy = &value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/jobstatus.go b/pkg/clients/applyconfiguration/batch/v1/jobstatus.go new file mode 100644 index 000000000..78fbd06d9 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/jobstatus.go @@ -0,0 +1,125 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// JobStatusApplyConfiguration represents an declarative configuration of the JobStatus type for use +// with apply. +type JobStatusApplyConfiguration struct { + Conditions []JobConditionApplyConfiguration `json:"conditions,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + CompletionTime *metav1.Time `json:"completionTime,omitempty"` + Active *int32 `json:"active,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` + Terminating *int32 `json:"terminating,omitempty"` + CompletedIndexes *string `json:"completedIndexes,omitempty"` + FailedIndexes *string `json:"failedIndexes,omitempty"` + UncountedTerminatedPods *UncountedTerminatedPodsApplyConfiguration `json:"uncountedTerminatedPods,omitempty"` + Ready *int32 `json:"ready,omitempty"` +} + +// JobStatusApplyConfiguration constructs an declarative configuration of the JobStatus type for use with +// apply. +func JobStatus() *JobStatusApplyConfiguration { + return &JobStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *JobStatusApplyConfiguration) WithConditions(values ...*JobConditionApplyConfiguration) *JobStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithStartTime sets the StartTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartTime field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithStartTime(value metav1.Time) *JobStatusApplyConfiguration { + b.StartTime = &value + return b +} + +// WithCompletionTime sets the CompletionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CompletionTime field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithCompletionTime(value metav1.Time) *JobStatusApplyConfiguration { + b.CompletionTime = &value + return b +} + +// WithActive sets the Active field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Active field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithActive(value int32) *JobStatusApplyConfiguration { + b.Active = &value + return b +} + +// WithSucceeded sets the Succeeded field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Succeeded field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithSucceeded(value int32) *JobStatusApplyConfiguration { + b.Succeeded = &value + return b +} + +// WithFailed sets the Failed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Failed field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithFailed(value int32) *JobStatusApplyConfiguration { + b.Failed = &value + return b +} + +// WithTerminating sets the Terminating field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Terminating field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithTerminating(value int32) *JobStatusApplyConfiguration { + b.Terminating = &value + return b +} + +// WithCompletedIndexes sets the CompletedIndexes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CompletedIndexes field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithCompletedIndexes(value string) *JobStatusApplyConfiguration { + b.CompletedIndexes = &value + return b +} + +// WithFailedIndexes sets the FailedIndexes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailedIndexes field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithFailedIndexes(value string) *JobStatusApplyConfiguration { + b.FailedIndexes = &value + return b +} + +// WithUncountedTerminatedPods sets the UncountedTerminatedPods field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UncountedTerminatedPods field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithUncountedTerminatedPods(value *UncountedTerminatedPodsApplyConfiguration) *JobStatusApplyConfiguration { + b.UncountedTerminatedPods = value + return b +} + +// WithReady sets the Ready field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ready field is set to the value of the last call. +func (b *JobStatusApplyConfiguration) WithReady(value int32) *JobStatusApplyConfiguration { + b.Ready = &value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/jobtemplatespec.go b/pkg/clients/applyconfiguration/batch/v1/jobtemplatespec.go new file mode 100644 index 000000000..e07713549 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/jobtemplatespec.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// JobTemplateSpecApplyConfiguration represents an declarative configuration of the JobTemplateSpec type for use +// with apply. +type JobTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *JobSpecApplyConfiguration `json:"spec,omitempty"` +} + +// JobTemplateSpecApplyConfiguration constructs an declarative configuration of the JobTemplateSpec type for use with +// apply. +func JobTemplateSpec() *JobTemplateSpecApplyConfiguration { + return &JobTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithName(value string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithGenerateName(value string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithNamespace(value string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithUID(value types.UID) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithResourceVersion(value string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithGeneration(value int64) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *JobTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *JobTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *JobTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *JobTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *JobTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *JobTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *JobTemplateSpecApplyConfiguration) WithSpec(value *JobSpecApplyConfiguration) *JobTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/podfailurepolicy.go b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicy.go new file mode 100644 index 000000000..beaf5b604 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicy.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodFailurePolicyApplyConfiguration represents an declarative configuration of the PodFailurePolicy type for use +// with apply. +type PodFailurePolicyApplyConfiguration struct { + Rules []PodFailurePolicyRuleApplyConfiguration `json:"rules,omitempty"` +} + +// PodFailurePolicyApplyConfiguration constructs an declarative configuration of the PodFailurePolicy type for use with +// apply. +func PodFailurePolicy() *PodFailurePolicyApplyConfiguration { + return &PodFailurePolicyApplyConfiguration{} +} + +// WithRules adds the given value to the Rules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Rules field. +func (b *PodFailurePolicyApplyConfiguration) WithRules(values ...*PodFailurePolicyRuleApplyConfiguration) *PodFailurePolicyApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRules") + } + b.Rules = append(b.Rules, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyonexitcodesrequirement.go b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyonexitcodesrequirement.go new file mode 100644 index 000000000..8ed01bdad --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyonexitcodesrequirement.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" +) + +// PodFailurePolicyOnExitCodesRequirementApplyConfiguration represents an declarative configuration of the PodFailurePolicyOnExitCodesRequirement type for use +// with apply. +type PodFailurePolicyOnExitCodesRequirementApplyConfiguration struct { + ContainerName *string `json:"containerName,omitempty"` + Operator *v1.PodFailurePolicyOnExitCodesOperator `json:"operator,omitempty"` + Values []int32 `json:"values,omitempty"` +} + +// PodFailurePolicyOnExitCodesRequirementApplyConfiguration constructs an declarative configuration of the PodFailurePolicyOnExitCodesRequirement type for use with +// apply. +func PodFailurePolicyOnExitCodesRequirement() *PodFailurePolicyOnExitCodesRequirementApplyConfiguration { + return &PodFailurePolicyOnExitCodesRequirementApplyConfiguration{} +} + +// WithContainerName sets the ContainerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerName field is set to the value of the last call. +func (b *PodFailurePolicyOnExitCodesRequirementApplyConfiguration) WithContainerName(value string) *PodFailurePolicyOnExitCodesRequirementApplyConfiguration { + b.ContainerName = &value + return b +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *PodFailurePolicyOnExitCodesRequirementApplyConfiguration) WithOperator(value v1.PodFailurePolicyOnExitCodesOperator) *PodFailurePolicyOnExitCodesRequirementApplyConfiguration { + b.Operator = &value + return b +} + +// WithValues adds the given value to the Values field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Values field. +func (b *PodFailurePolicyOnExitCodesRequirementApplyConfiguration) WithValues(values ...int32) *PodFailurePolicyOnExitCodesRequirementApplyConfiguration { + for i := range values { + b.Values = append(b.Values, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyonpodconditionspattern.go b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyonpodconditionspattern.go new file mode 100644 index 000000000..795e3ce62 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyonpodconditionspattern.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PodFailurePolicyOnPodConditionsPatternApplyConfiguration represents an declarative configuration of the PodFailurePolicyOnPodConditionsPattern type for use +// with apply. +type PodFailurePolicyOnPodConditionsPatternApplyConfiguration struct { + Type *v1.PodConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` +} + +// PodFailurePolicyOnPodConditionsPatternApplyConfiguration constructs an declarative configuration of the PodFailurePolicyOnPodConditionsPattern type for use with +// apply. +func PodFailurePolicyOnPodConditionsPattern() *PodFailurePolicyOnPodConditionsPatternApplyConfiguration { + return &PodFailurePolicyOnPodConditionsPatternApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *PodFailurePolicyOnPodConditionsPatternApplyConfiguration) WithType(value v1.PodConditionType) *PodFailurePolicyOnPodConditionsPatternApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PodFailurePolicyOnPodConditionsPatternApplyConfiguration) WithStatus(value v1.ConditionStatus) *PodFailurePolicyOnPodConditionsPatternApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyrule.go b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyrule.go new file mode 100644 index 000000000..02ee2b56a --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/podfailurepolicyrule.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" +) + +// PodFailurePolicyRuleApplyConfiguration represents an declarative configuration of the PodFailurePolicyRule type for use +// with apply. +type PodFailurePolicyRuleApplyConfiguration struct { + Action *v1.PodFailurePolicyAction `json:"action,omitempty"` + OnExitCodes *PodFailurePolicyOnExitCodesRequirementApplyConfiguration `json:"onExitCodes,omitempty"` + OnPodConditions []PodFailurePolicyOnPodConditionsPatternApplyConfiguration `json:"onPodConditions,omitempty"` +} + +// PodFailurePolicyRuleApplyConfiguration constructs an declarative configuration of the PodFailurePolicyRule type for use with +// apply. +func PodFailurePolicyRule() *PodFailurePolicyRuleApplyConfiguration { + return &PodFailurePolicyRuleApplyConfiguration{} +} + +// WithAction sets the Action field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Action field is set to the value of the last call. +func (b *PodFailurePolicyRuleApplyConfiguration) WithAction(value v1.PodFailurePolicyAction) *PodFailurePolicyRuleApplyConfiguration { + b.Action = &value + return b +} + +// WithOnExitCodes sets the OnExitCodes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OnExitCodes field is set to the value of the last call. +func (b *PodFailurePolicyRuleApplyConfiguration) WithOnExitCodes(value *PodFailurePolicyOnExitCodesRequirementApplyConfiguration) *PodFailurePolicyRuleApplyConfiguration { + b.OnExitCodes = value + return b +} + +// WithOnPodConditions adds the given value to the OnPodConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OnPodConditions field. +func (b *PodFailurePolicyRuleApplyConfiguration) WithOnPodConditions(values ...*PodFailurePolicyOnPodConditionsPatternApplyConfiguration) *PodFailurePolicyRuleApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOnPodConditions") + } + b.OnPodConditions = append(b.OnPodConditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/batch/v1/uncountedterminatedpods.go b/pkg/clients/applyconfiguration/batch/v1/uncountedterminatedpods.go new file mode 100644 index 000000000..4c2fa6244 --- /dev/null +++ b/pkg/clients/applyconfiguration/batch/v1/uncountedterminatedpods.go @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// UncountedTerminatedPodsApplyConfiguration represents an declarative configuration of the UncountedTerminatedPods type for use +// with apply. +type UncountedTerminatedPodsApplyConfiguration struct { + Succeeded []types.UID `json:"succeeded,omitempty"` + Failed []types.UID `json:"failed,omitempty"` +} + +// UncountedTerminatedPodsApplyConfiguration constructs an declarative configuration of the UncountedTerminatedPods type for use with +// apply. +func UncountedTerminatedPods() *UncountedTerminatedPodsApplyConfiguration { + return &UncountedTerminatedPodsApplyConfiguration{} +} + +// WithSucceeded adds the given value to the Succeeded field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Succeeded field. +func (b *UncountedTerminatedPodsApplyConfiguration) WithSucceeded(values ...types.UID) *UncountedTerminatedPodsApplyConfiguration { + for i := range values { + b.Succeeded = append(b.Succeeded, values[i]) + } + return b +} + +// WithFailed adds the given value to the Failed field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Failed field. +func (b *UncountedTerminatedPodsApplyConfiguration) WithFailed(values ...types.UID) *UncountedTerminatedPodsApplyConfiguration { + for i := range values { + b.Failed = append(b.Failed, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequest.go b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..b4840efd2 --- /dev/null +++ b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CertificateSigningRequestApplyConfiguration represents an declarative configuration of the CertificateSigningRequest type for use +// with apply. +type CertificateSigningRequestApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *CertificateSigningRequestSpecApplyConfiguration `json:"spec,omitempty"` + Status *CertificateSigningRequestStatusApplyConfiguration `json:"status,omitempty"` +} + +// CertificateSigningRequest constructs an declarative configuration of the CertificateSigningRequest type for use with +// apply. +func CertificateSigningRequest(name string) *CertificateSigningRequestApplyConfiguration { + b := &CertificateSigningRequestApplyConfiguration{} + b.WithName(name) + b.WithKind("CertificateSigningRequest") + b.WithAPIVersion("certificates.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithKind(value string) *CertificateSigningRequestApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithAPIVersion(value string) *CertificateSigningRequestApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithName(value string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithGenerateName(value string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithNamespace(value string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithUID(value types.UID) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithResourceVersion(value string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithGeneration(value int64) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CertificateSigningRequestApplyConfiguration) WithLabels(entries map[string]string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CertificateSigningRequestApplyConfiguration) WithAnnotations(entries map[string]string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CertificateSigningRequestApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CertificateSigningRequestApplyConfiguration) WithFinalizers(values ...string) *CertificateSigningRequestApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CertificateSigningRequestApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithSpec(value *CertificateSigningRequestSpecApplyConfiguration) *CertificateSigningRequestApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CertificateSigningRequestApplyConfiguration) WithStatus(value *CertificateSigningRequestStatusApplyConfiguration) *CertificateSigningRequestApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequestcondition.go b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequestcondition.go new file mode 100644 index 000000000..f3916dd2a --- /dev/null +++ b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequestcondition.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/certificates/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CertificateSigningRequestConditionApplyConfiguration represents an declarative configuration of the CertificateSigningRequestCondition type for use +// with apply. +type CertificateSigningRequestConditionApplyConfiguration struct { + Type *v1.RequestConditionType `json:"type,omitempty"` + Status *corev1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// CertificateSigningRequestConditionApplyConfiguration constructs an declarative configuration of the CertificateSigningRequestCondition type for use with +// apply. +func CertificateSigningRequestCondition() *CertificateSigningRequestConditionApplyConfiguration { + return &CertificateSigningRequestConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CertificateSigningRequestConditionApplyConfiguration) WithType(value v1.RequestConditionType) *CertificateSigningRequestConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CertificateSigningRequestConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *CertificateSigningRequestConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *CertificateSigningRequestConditionApplyConfiguration) WithReason(value string) *CertificateSigningRequestConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *CertificateSigningRequestConditionApplyConfiguration) WithMessage(value string) *CertificateSigningRequestConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithLastUpdateTime sets the LastUpdateTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastUpdateTime field is set to the value of the last call. +func (b *CertificateSigningRequestConditionApplyConfiguration) WithLastUpdateTime(value metav1.Time) *CertificateSigningRequestConditionApplyConfiguration { + b.LastUpdateTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *CertificateSigningRequestConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *CertificateSigningRequestConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequestspec.go b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequestspec.go new file mode 100644 index 000000000..6ce6ad4a9 --- /dev/null +++ b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequestspec.go @@ -0,0 +1,105 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/certificates/v1" +) + +// CertificateSigningRequestSpecApplyConfiguration represents an declarative configuration of the CertificateSigningRequestSpec type for use +// with apply. +type CertificateSigningRequestSpecApplyConfiguration struct { + Request []byte `json:"request,omitempty"` + SignerName *string `json:"signerName,omitempty"` + ExpirationSeconds *int32 `json:"expirationSeconds,omitempty"` + Usages []v1.KeyUsage `json:"usages,omitempty"` + Username *string `json:"username,omitempty"` + UID *string `json:"uid,omitempty"` + Groups []string `json:"groups,omitempty"` + Extra map[string]v1.ExtraValue `json:"extra,omitempty"` +} + +// CertificateSigningRequestSpecApplyConfiguration constructs an declarative configuration of the CertificateSigningRequestSpec type for use with +// apply. +func CertificateSigningRequestSpec() *CertificateSigningRequestSpecApplyConfiguration { + return &CertificateSigningRequestSpecApplyConfiguration{} +} + +// WithRequest adds the given value to the Request field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Request field. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithRequest(values ...byte) *CertificateSigningRequestSpecApplyConfiguration { + for i := range values { + b.Request = append(b.Request, values[i]) + } + return b +} + +// WithSignerName sets the SignerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SignerName field is set to the value of the last call. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithSignerName(value string) *CertificateSigningRequestSpecApplyConfiguration { + b.SignerName = &value + return b +} + +// WithExpirationSeconds sets the ExpirationSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExpirationSeconds field is set to the value of the last call. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithExpirationSeconds(value int32) *CertificateSigningRequestSpecApplyConfiguration { + b.ExpirationSeconds = &value + return b +} + +// WithUsages adds the given value to the Usages field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Usages field. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithUsages(values ...v1.KeyUsage) *CertificateSigningRequestSpecApplyConfiguration { + for i := range values { + b.Usages = append(b.Usages, values[i]) + } + return b +} + +// WithUsername sets the Username field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Username field is set to the value of the last call. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithUsername(value string) *CertificateSigningRequestSpecApplyConfiguration { + b.Username = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithUID(value string) *CertificateSigningRequestSpecApplyConfiguration { + b.UID = &value + return b +} + +// WithGroups adds the given value to the Groups field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Groups field. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithGroups(values ...string) *CertificateSigningRequestSpecApplyConfiguration { + for i := range values { + b.Groups = append(b.Groups, values[i]) + } + return b +} + +// WithExtra puts the entries into the Extra field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Extra field, +// overwriting an existing map entries in Extra field with the same key. +func (b *CertificateSigningRequestSpecApplyConfiguration) WithExtra(entries map[string]v1.ExtraValue) *CertificateSigningRequestSpecApplyConfiguration { + if b.Extra == nil && len(entries) > 0 { + b.Extra = make(map[string]v1.ExtraValue, len(entries)) + } + for k, v := range entries { + b.Extra[k] = v + } + return b +} diff --git a/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequeststatus.go b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequeststatus.go new file mode 100644 index 000000000..895b9f5ce --- /dev/null +++ b/pkg/clients/applyconfiguration/certificates/v1/certificatesigningrequeststatus.go @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CertificateSigningRequestStatusApplyConfiguration represents an declarative configuration of the CertificateSigningRequestStatus type for use +// with apply. +type CertificateSigningRequestStatusApplyConfiguration struct { + Conditions []CertificateSigningRequestConditionApplyConfiguration `json:"conditions,omitempty"` + Certificate []byte `json:"certificate,omitempty"` +} + +// CertificateSigningRequestStatusApplyConfiguration constructs an declarative configuration of the CertificateSigningRequestStatus type for use with +// apply. +func CertificateSigningRequestStatus() *CertificateSigningRequestStatusApplyConfiguration { + return &CertificateSigningRequestStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *CertificateSigningRequestStatusApplyConfiguration) WithConditions(values ...*CertificateSigningRequestConditionApplyConfiguration) *CertificateSigningRequestStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithCertificate adds the given value to the Certificate field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Certificate field. +func (b *CertificateSigningRequestStatusApplyConfiguration) WithCertificate(values ...byte) *CertificateSigningRequestStatusApplyConfiguration { + for i := range values { + b.Certificate = append(b.Certificate, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/coordination/v1/lease.go b/pkg/clients/applyconfiguration/coordination/v1/lease.go new file mode 100644 index 000000000..1ed5e6eee --- /dev/null +++ b/pkg/clients/applyconfiguration/coordination/v1/lease.go @@ -0,0 +1,197 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// LeaseApplyConfiguration represents an declarative configuration of the Lease type for use +// with apply. +type LeaseApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *LeaseSpecApplyConfiguration `json:"spec,omitempty"` +} + +// Lease constructs an declarative configuration of the Lease type for use with +// apply. +func Lease(name, namespace string) *LeaseApplyConfiguration { + b := &LeaseApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Lease") + b.WithAPIVersion("coordination.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithKind(value string) *LeaseApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithAPIVersion(value string) *LeaseApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithName(value string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithGenerateName(value string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithNamespace(value string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithUID(value types.UID) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithResourceVersion(value string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithGeneration(value int64) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithCreationTimestamp(value metav1.Time) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *LeaseApplyConfiguration) WithLabels(entries map[string]string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *LeaseApplyConfiguration) WithAnnotations(entries map[string]string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *LeaseApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *LeaseApplyConfiguration) WithFinalizers(values ...string) *LeaseApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *LeaseApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *LeaseApplyConfiguration) WithSpec(value *LeaseSpecApplyConfiguration) *LeaseApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/coordination/v1/leasespec.go b/pkg/clients/applyconfiguration/coordination/v1/leasespec.go new file mode 100644 index 000000000..562729315 --- /dev/null +++ b/pkg/clients/applyconfiguration/coordination/v1/leasespec.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LeaseSpecApplyConfiguration represents an declarative configuration of the LeaseSpec type for use +// with apply. +type LeaseSpecApplyConfiguration struct { + HolderIdentity *string `json:"holderIdentity,omitempty"` + LeaseDurationSeconds *int32 `json:"leaseDurationSeconds,omitempty"` + AcquireTime *v1.MicroTime `json:"acquireTime,omitempty"` + RenewTime *v1.MicroTime `json:"renewTime,omitempty"` + LeaseTransitions *int32 `json:"leaseTransitions,omitempty"` +} + +// LeaseSpecApplyConfiguration constructs an declarative configuration of the LeaseSpec type for use with +// apply. +func LeaseSpec() *LeaseSpecApplyConfiguration { + return &LeaseSpecApplyConfiguration{} +} + +// WithHolderIdentity sets the HolderIdentity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HolderIdentity field is set to the value of the last call. +func (b *LeaseSpecApplyConfiguration) WithHolderIdentity(value string) *LeaseSpecApplyConfiguration { + b.HolderIdentity = &value + return b +} + +// WithLeaseDurationSeconds sets the LeaseDurationSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LeaseDurationSeconds field is set to the value of the last call. +func (b *LeaseSpecApplyConfiguration) WithLeaseDurationSeconds(value int32) *LeaseSpecApplyConfiguration { + b.LeaseDurationSeconds = &value + return b +} + +// WithAcquireTime sets the AcquireTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AcquireTime field is set to the value of the last call. +func (b *LeaseSpecApplyConfiguration) WithAcquireTime(value v1.MicroTime) *LeaseSpecApplyConfiguration { + b.AcquireTime = &value + return b +} + +// WithRenewTime sets the RenewTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RenewTime field is set to the value of the last call. +func (b *LeaseSpecApplyConfiguration) WithRenewTime(value v1.MicroTime) *LeaseSpecApplyConfiguration { + b.RenewTime = &value + return b +} + +// WithLeaseTransitions sets the LeaseTransitions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LeaseTransitions field is set to the value of the last call. +func (b *LeaseSpecApplyConfiguration) WithLeaseTransitions(value int32) *LeaseSpecApplyConfiguration { + b.LeaseTransitions = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/affinity.go b/pkg/clients/applyconfiguration/core/v1/affinity.go new file mode 100644 index 000000000..e18368c0c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/affinity.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// AffinityApplyConfiguration represents an declarative configuration of the Affinity type for use +// with apply. +type AffinityApplyConfiguration struct { + NodeAffinity *NodeAffinityApplyConfiguration `json:"nodeAffinity,omitempty"` + PodAffinity *PodAffinityApplyConfiguration `json:"podAffinity,omitempty"` + PodAntiAffinity *PodAntiAffinityApplyConfiguration `json:"podAntiAffinity,omitempty"` +} + +// AffinityApplyConfiguration constructs an declarative configuration of the Affinity type for use with +// apply. +func Affinity() *AffinityApplyConfiguration { + return &AffinityApplyConfiguration{} +} + +// WithNodeAffinity sets the NodeAffinity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeAffinity field is set to the value of the last call. +func (b *AffinityApplyConfiguration) WithNodeAffinity(value *NodeAffinityApplyConfiguration) *AffinityApplyConfiguration { + b.NodeAffinity = value + return b +} + +// WithPodAffinity sets the PodAffinity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodAffinity field is set to the value of the last call. +func (b *AffinityApplyConfiguration) WithPodAffinity(value *PodAffinityApplyConfiguration) *AffinityApplyConfiguration { + b.PodAffinity = value + return b +} + +// WithPodAntiAffinity sets the PodAntiAffinity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodAntiAffinity field is set to the value of the last call. +func (b *AffinityApplyConfiguration) WithPodAntiAffinity(value *PodAntiAffinityApplyConfiguration) *AffinityApplyConfiguration { + b.PodAntiAffinity = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/attachedvolume.go b/pkg/clients/applyconfiguration/core/v1/attachedvolume.go new file mode 100644 index 000000000..6b66d012a --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/attachedvolume.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// AttachedVolumeApplyConfiguration represents an declarative configuration of the AttachedVolume type for use +// with apply. +type AttachedVolumeApplyConfiguration struct { + Name *v1.UniqueVolumeName `json:"name,omitempty"` + DevicePath *string `json:"devicePath,omitempty"` +} + +// AttachedVolumeApplyConfiguration constructs an declarative configuration of the AttachedVolume type for use with +// apply. +func AttachedVolume() *AttachedVolumeApplyConfiguration { + return &AttachedVolumeApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *AttachedVolumeApplyConfiguration) WithName(value v1.UniqueVolumeName) *AttachedVolumeApplyConfiguration { + b.Name = &value + return b +} + +// WithDevicePath sets the DevicePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DevicePath field is set to the value of the last call. +func (b *AttachedVolumeApplyConfiguration) WithDevicePath(value string) *AttachedVolumeApplyConfiguration { + b.DevicePath = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/awselasticblockstorevolumesource.go b/pkg/clients/applyconfiguration/core/v1/awselasticblockstorevolumesource.go new file mode 100644 index 000000000..eac7c1cf2 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/awselasticblockstorevolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// AWSElasticBlockStoreVolumeSourceApplyConfiguration represents an declarative configuration of the AWSElasticBlockStoreVolumeSource type for use +// with apply. +type AWSElasticBlockStoreVolumeSourceApplyConfiguration struct { + VolumeID *string `json:"volumeID,omitempty"` + FSType *string `json:"fsType,omitempty"` + Partition *int32 `json:"partition,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// AWSElasticBlockStoreVolumeSourceApplyConfiguration constructs an declarative configuration of the AWSElasticBlockStoreVolumeSource type for use with +// apply. +func AWSElasticBlockStoreVolumeSource() *AWSElasticBlockStoreVolumeSourceApplyConfiguration { + return &AWSElasticBlockStoreVolumeSourceApplyConfiguration{} +} + +// WithVolumeID sets the VolumeID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeID field is set to the value of the last call. +func (b *AWSElasticBlockStoreVolumeSourceApplyConfiguration) WithVolumeID(value string) *AWSElasticBlockStoreVolumeSourceApplyConfiguration { + b.VolumeID = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *AWSElasticBlockStoreVolumeSourceApplyConfiguration) WithFSType(value string) *AWSElasticBlockStoreVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithPartition sets the Partition field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Partition field is set to the value of the last call. +func (b *AWSElasticBlockStoreVolumeSourceApplyConfiguration) WithPartition(value int32) *AWSElasticBlockStoreVolumeSourceApplyConfiguration { + b.Partition = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *AWSElasticBlockStoreVolumeSourceApplyConfiguration) WithReadOnly(value bool) *AWSElasticBlockStoreVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/azurediskvolumesource.go b/pkg/clients/applyconfiguration/core/v1/azurediskvolumesource.go new file mode 100644 index 000000000..b296feb29 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/azurediskvolumesource.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// AzureDiskVolumeSourceApplyConfiguration represents an declarative configuration of the AzureDiskVolumeSource type for use +// with apply. +type AzureDiskVolumeSourceApplyConfiguration struct { + DiskName *string `json:"diskName,omitempty"` + DataDiskURI *string `json:"diskURI,omitempty"` + CachingMode *v1.AzureDataDiskCachingMode `json:"cachingMode,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Kind *v1.AzureDataDiskKind `json:"kind,omitempty"` +} + +// AzureDiskVolumeSourceApplyConfiguration constructs an declarative configuration of the AzureDiskVolumeSource type for use with +// apply. +func AzureDiskVolumeSource() *AzureDiskVolumeSourceApplyConfiguration { + return &AzureDiskVolumeSourceApplyConfiguration{} +} + +// WithDiskName sets the DiskName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DiskName field is set to the value of the last call. +func (b *AzureDiskVolumeSourceApplyConfiguration) WithDiskName(value string) *AzureDiskVolumeSourceApplyConfiguration { + b.DiskName = &value + return b +} + +// WithDataDiskURI sets the DataDiskURI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DataDiskURI field is set to the value of the last call. +func (b *AzureDiskVolumeSourceApplyConfiguration) WithDataDiskURI(value string) *AzureDiskVolumeSourceApplyConfiguration { + b.DataDiskURI = &value + return b +} + +// WithCachingMode sets the CachingMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CachingMode field is set to the value of the last call. +func (b *AzureDiskVolumeSourceApplyConfiguration) WithCachingMode(value v1.AzureDataDiskCachingMode) *AzureDiskVolumeSourceApplyConfiguration { + b.CachingMode = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *AzureDiskVolumeSourceApplyConfiguration) WithFSType(value string) *AzureDiskVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *AzureDiskVolumeSourceApplyConfiguration) WithReadOnly(value bool) *AzureDiskVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *AzureDiskVolumeSourceApplyConfiguration) WithKind(value v1.AzureDataDiskKind) *AzureDiskVolumeSourceApplyConfiguration { + b.Kind = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/azurefilepersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/azurefilepersistentvolumesource.go new file mode 100644 index 000000000..6b9ae6e7e --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/azurefilepersistentvolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// AzureFilePersistentVolumeSourceApplyConfiguration represents an declarative configuration of the AzureFilePersistentVolumeSource type for use +// with apply. +type AzureFilePersistentVolumeSourceApplyConfiguration struct { + SecretName *string `json:"secretName,omitempty"` + ShareName *string `json:"shareName,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SecretNamespace *string `json:"secretNamespace,omitempty"` +} + +// AzureFilePersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the AzureFilePersistentVolumeSource type for use with +// apply. +func AzureFilePersistentVolumeSource() *AzureFilePersistentVolumeSourceApplyConfiguration { + return &AzureFilePersistentVolumeSourceApplyConfiguration{} +} + +// WithSecretName sets the SecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretName field is set to the value of the last call. +func (b *AzureFilePersistentVolumeSourceApplyConfiguration) WithSecretName(value string) *AzureFilePersistentVolumeSourceApplyConfiguration { + b.SecretName = &value + return b +} + +// WithShareName sets the ShareName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ShareName field is set to the value of the last call. +func (b *AzureFilePersistentVolumeSourceApplyConfiguration) WithShareName(value string) *AzureFilePersistentVolumeSourceApplyConfiguration { + b.ShareName = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *AzureFilePersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *AzureFilePersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithSecretNamespace sets the SecretNamespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretNamespace field is set to the value of the last call. +func (b *AzureFilePersistentVolumeSourceApplyConfiguration) WithSecretNamespace(value string) *AzureFilePersistentVolumeSourceApplyConfiguration { + b.SecretNamespace = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/azurefilevolumesource.go b/pkg/clients/applyconfiguration/core/v1/azurefilevolumesource.go new file mode 100644 index 000000000..ca866bef1 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/azurefilevolumesource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// AzureFileVolumeSourceApplyConfiguration represents an declarative configuration of the AzureFileVolumeSource type for use +// with apply. +type AzureFileVolumeSourceApplyConfiguration struct { + SecretName *string `json:"secretName,omitempty"` + ShareName *string `json:"shareName,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// AzureFileVolumeSourceApplyConfiguration constructs an declarative configuration of the AzureFileVolumeSource type for use with +// apply. +func AzureFileVolumeSource() *AzureFileVolumeSourceApplyConfiguration { + return &AzureFileVolumeSourceApplyConfiguration{} +} + +// WithSecretName sets the SecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretName field is set to the value of the last call. +func (b *AzureFileVolumeSourceApplyConfiguration) WithSecretName(value string) *AzureFileVolumeSourceApplyConfiguration { + b.SecretName = &value + return b +} + +// WithShareName sets the ShareName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ShareName field is set to the value of the last call. +func (b *AzureFileVolumeSourceApplyConfiguration) WithShareName(value string) *AzureFileVolumeSourceApplyConfiguration { + b.ShareName = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *AzureFileVolumeSourceApplyConfiguration) WithReadOnly(value bool) *AzureFileVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/capabilities.go b/pkg/clients/applyconfiguration/core/v1/capabilities.go new file mode 100644 index 000000000..44458203c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/capabilities.go @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// CapabilitiesApplyConfiguration represents an declarative configuration of the Capabilities type for use +// with apply. +type CapabilitiesApplyConfiguration struct { + Add []v1.Capability `json:"add,omitempty"` + Drop []v1.Capability `json:"drop,omitempty"` +} + +// CapabilitiesApplyConfiguration constructs an declarative configuration of the Capabilities type for use with +// apply. +func Capabilities() *CapabilitiesApplyConfiguration { + return &CapabilitiesApplyConfiguration{} +} + +// WithAdd adds the given value to the Add field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Add field. +func (b *CapabilitiesApplyConfiguration) WithAdd(values ...v1.Capability) *CapabilitiesApplyConfiguration { + for i := range values { + b.Add = append(b.Add, values[i]) + } + return b +} + +// WithDrop adds the given value to the Drop field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Drop field. +func (b *CapabilitiesApplyConfiguration) WithDrop(values ...v1.Capability) *CapabilitiesApplyConfiguration { + for i := range values { + b.Drop = append(b.Drop, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/cephfspersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/cephfspersistentvolumesource.go new file mode 100644 index 000000000..b037ae7f6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/cephfspersistentvolumesource.go @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CephFSPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the CephFSPersistentVolumeSource type for use +// with apply. +type CephFSPersistentVolumeSourceApplyConfiguration struct { + Monitors []string `json:"monitors,omitempty"` + Path *string `json:"path,omitempty"` + User *string `json:"user,omitempty"` + SecretFile *string `json:"secretFile,omitempty"` + SecretRef *SecretReferenceApplyConfiguration `json:"secretRef,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// CephFSPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the CephFSPersistentVolumeSource type for use with +// apply. +func CephFSPersistentVolumeSource() *CephFSPersistentVolumeSourceApplyConfiguration { + return &CephFSPersistentVolumeSourceApplyConfiguration{} +} + +// WithMonitors adds the given value to the Monitors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Monitors field. +func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithMonitors(values ...string) *CephFSPersistentVolumeSourceApplyConfiguration { + for i := range values { + b.Monitors = append(b.Monitors, values[i]) + } + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithPath(value string) *CephFSPersistentVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithUser sets the User field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the User field is set to the value of the last call. +func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithUser(value string) *CephFSPersistentVolumeSourceApplyConfiguration { + b.User = &value + return b +} + +// WithSecretFile sets the SecretFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretFile field is set to the value of the last call. +func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithSecretFile(value string) *CephFSPersistentVolumeSourceApplyConfiguration { + b.SecretFile = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *SecretReferenceApplyConfiguration) *CephFSPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *CephFSPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/cephfsvolumesource.go b/pkg/clients/applyconfiguration/core/v1/cephfsvolumesource.go new file mode 100644 index 000000000..58aa96ef6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/cephfsvolumesource.go @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CephFSVolumeSourceApplyConfiguration represents an declarative configuration of the CephFSVolumeSource type for use +// with apply. +type CephFSVolumeSourceApplyConfiguration struct { + Monitors []string `json:"monitors,omitempty"` + Path *string `json:"path,omitempty"` + User *string `json:"user,omitempty"` + SecretFile *string `json:"secretFile,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// CephFSVolumeSourceApplyConfiguration constructs an declarative configuration of the CephFSVolumeSource type for use with +// apply. +func CephFSVolumeSource() *CephFSVolumeSourceApplyConfiguration { + return &CephFSVolumeSourceApplyConfiguration{} +} + +// WithMonitors adds the given value to the Monitors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Monitors field. +func (b *CephFSVolumeSourceApplyConfiguration) WithMonitors(values ...string) *CephFSVolumeSourceApplyConfiguration { + for i := range values { + b.Monitors = append(b.Monitors, values[i]) + } + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *CephFSVolumeSourceApplyConfiguration) WithPath(value string) *CephFSVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithUser sets the User field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the User field is set to the value of the last call. +func (b *CephFSVolumeSourceApplyConfiguration) WithUser(value string) *CephFSVolumeSourceApplyConfiguration { + b.User = &value + return b +} + +// WithSecretFile sets the SecretFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretFile field is set to the value of the last call. +func (b *CephFSVolumeSourceApplyConfiguration) WithSecretFile(value string) *CephFSVolumeSourceApplyConfiguration { + b.SecretFile = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *CephFSVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *CephFSVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *CephFSVolumeSourceApplyConfiguration) WithReadOnly(value bool) *CephFSVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/cinderpersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/cinderpersistentvolumesource.go new file mode 100644 index 000000000..694809130 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/cinderpersistentvolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CinderPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the CinderPersistentVolumeSource type for use +// with apply. +type CinderPersistentVolumeSourceApplyConfiguration struct { + VolumeID *string `json:"volumeID,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SecretRef *SecretReferenceApplyConfiguration `json:"secretRef,omitempty"` +} + +// CinderPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the CinderPersistentVolumeSource type for use with +// apply. +func CinderPersistentVolumeSource() *CinderPersistentVolumeSourceApplyConfiguration { + return &CinderPersistentVolumeSourceApplyConfiguration{} +} + +// WithVolumeID sets the VolumeID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeID field is set to the value of the last call. +func (b *CinderPersistentVolumeSourceApplyConfiguration) WithVolumeID(value string) *CinderPersistentVolumeSourceApplyConfiguration { + b.VolumeID = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *CinderPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *CinderPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *CinderPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *CinderPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *CinderPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *SecretReferenceApplyConfiguration) *CinderPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/cindervolumesource.go b/pkg/clients/applyconfiguration/core/v1/cindervolumesource.go new file mode 100644 index 000000000..f92271f32 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/cindervolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CinderVolumeSourceApplyConfiguration represents an declarative configuration of the CinderVolumeSource type for use +// with apply. +type CinderVolumeSourceApplyConfiguration struct { + VolumeID *string `json:"volumeID,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` +} + +// CinderVolumeSourceApplyConfiguration constructs an declarative configuration of the CinderVolumeSource type for use with +// apply. +func CinderVolumeSource() *CinderVolumeSourceApplyConfiguration { + return &CinderVolumeSourceApplyConfiguration{} +} + +// WithVolumeID sets the VolumeID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeID field is set to the value of the last call. +func (b *CinderVolumeSourceApplyConfiguration) WithVolumeID(value string) *CinderVolumeSourceApplyConfiguration { + b.VolumeID = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *CinderVolumeSourceApplyConfiguration) WithFSType(value string) *CinderVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *CinderVolumeSourceApplyConfiguration) WithReadOnly(value bool) *CinderVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *CinderVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *CinderVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/claimsource.go b/pkg/clients/applyconfiguration/core/v1/claimsource.go new file mode 100644 index 000000000..723b7c8f6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/claimsource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ClaimSourceApplyConfiguration represents an declarative configuration of the ClaimSource type for use +// with apply. +type ClaimSourceApplyConfiguration struct { + ResourceClaimName *string `json:"resourceClaimName,omitempty"` + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty"` +} + +// ClaimSourceApplyConfiguration constructs an declarative configuration of the ClaimSource type for use with +// apply. +func ClaimSource() *ClaimSourceApplyConfiguration { + return &ClaimSourceApplyConfiguration{} +} + +// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimName field is set to the value of the last call. +func (b *ClaimSourceApplyConfiguration) WithResourceClaimName(value string) *ClaimSourceApplyConfiguration { + b.ResourceClaimName = &value + return b +} + +// WithResourceClaimTemplateName sets the ResourceClaimTemplateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimTemplateName field is set to the value of the last call. +func (b *ClaimSourceApplyConfiguration) WithResourceClaimTemplateName(value string) *ClaimSourceApplyConfiguration { + b.ResourceClaimTemplateName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/clientipconfig.go b/pkg/clients/applyconfiguration/core/v1/clientipconfig.go new file mode 100644 index 000000000..602e25dca --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/clientipconfig.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ClientIPConfigApplyConfiguration represents an declarative configuration of the ClientIPConfig type for use +// with apply. +type ClientIPConfigApplyConfiguration struct { + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` +} + +// ClientIPConfigApplyConfiguration constructs an declarative configuration of the ClientIPConfig type for use with +// apply. +func ClientIPConfig() *ClientIPConfigApplyConfiguration { + return &ClientIPConfigApplyConfiguration{} +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *ClientIPConfigApplyConfiguration) WithTimeoutSeconds(value int32) *ClientIPConfigApplyConfiguration { + b.TimeoutSeconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/clustertrustbundleprojection.go b/pkg/clients/applyconfiguration/core/v1/clustertrustbundleprojection.go new file mode 100644 index 000000000..b4c6a02ba --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/clustertrustbundleprojection.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterTrustBundleProjectionApplyConfiguration represents an declarative configuration of the ClusterTrustBundleProjection type for use +// with apply. +type ClusterTrustBundleProjectionApplyConfiguration struct { + Name *string `json:"name,omitempty"` + SignerName *string `json:"signerName,omitempty"` + LabelSelector *v1.LabelSelectorApplyConfiguration `json:"labelSelector,omitempty"` + Optional *bool `json:"optional,omitempty"` + Path *string `json:"path,omitempty"` +} + +// ClusterTrustBundleProjectionApplyConfiguration constructs an declarative configuration of the ClusterTrustBundleProjection type for use with +// apply. +func ClusterTrustBundleProjection() *ClusterTrustBundleProjectionApplyConfiguration { + return &ClusterTrustBundleProjectionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterTrustBundleProjectionApplyConfiguration) WithName(value string) *ClusterTrustBundleProjectionApplyConfiguration { + b.Name = &value + return b +} + +// WithSignerName sets the SignerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SignerName field is set to the value of the last call. +func (b *ClusterTrustBundleProjectionApplyConfiguration) WithSignerName(value string) *ClusterTrustBundleProjectionApplyConfiguration { + b.SignerName = &value + return b +} + +// WithLabelSelector sets the LabelSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelector field is set to the value of the last call. +func (b *ClusterTrustBundleProjectionApplyConfiguration) WithLabelSelector(value *v1.LabelSelectorApplyConfiguration) *ClusterTrustBundleProjectionApplyConfiguration { + b.LabelSelector = value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *ClusterTrustBundleProjectionApplyConfiguration) WithOptional(value bool) *ClusterTrustBundleProjectionApplyConfiguration { + b.Optional = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ClusterTrustBundleProjectionApplyConfiguration) WithPath(value string) *ClusterTrustBundleProjectionApplyConfiguration { + b.Path = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/componentcondition.go b/pkg/clients/applyconfiguration/core/v1/componentcondition.go new file mode 100644 index 000000000..5d50af65c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/componentcondition.go @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ComponentConditionApplyConfiguration represents an declarative configuration of the ComponentCondition type for use +// with apply. +type ComponentConditionApplyConfiguration struct { + Type *v1.ComponentConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + Message *string `json:"message,omitempty"` + Error *string `json:"error,omitempty"` +} + +// ComponentConditionApplyConfiguration constructs an declarative configuration of the ComponentCondition type for use with +// apply. +func ComponentCondition() *ComponentConditionApplyConfiguration { + return &ComponentConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ComponentConditionApplyConfiguration) WithType(value v1.ComponentConditionType) *ComponentConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ComponentConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *ComponentConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ComponentConditionApplyConfiguration) WithMessage(value string) *ComponentConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithError sets the Error field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Error field is set to the value of the last call. +func (b *ComponentConditionApplyConfiguration) WithError(value string) *ComponentConditionApplyConfiguration { + b.Error = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/componentstatus.go b/pkg/clients/applyconfiguration/core/v1/componentstatus.go new file mode 100644 index 000000000..464e60dec --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/componentstatus.go @@ -0,0 +1,201 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ComponentStatusApplyConfiguration represents an declarative configuration of the ComponentStatus type for use +// with apply. +type ComponentStatusApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Conditions []ComponentConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// ComponentStatus constructs an declarative configuration of the ComponentStatus type for use with +// apply. +func ComponentStatus(name string) *ComponentStatusApplyConfiguration { + b := &ComponentStatusApplyConfiguration{} + b.WithName(name) + b.WithKind("ComponentStatus") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithKind(value string) *ComponentStatusApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithAPIVersion(value string) *ComponentStatusApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithName(value string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithGenerateName(value string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithNamespace(value string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithUID(value types.UID) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithResourceVersion(value string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithGeneration(value int64) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ComponentStatusApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ComponentStatusApplyConfiguration) WithLabels(entries map[string]string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ComponentStatusApplyConfiguration) WithAnnotations(entries map[string]string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ComponentStatusApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ComponentStatusApplyConfiguration) WithFinalizers(values ...string) *ComponentStatusApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ComponentStatusApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ComponentStatusApplyConfiguration) WithConditions(values ...*ComponentConditionApplyConfiguration) *ComponentStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/configmap.go b/pkg/clients/applyconfiguration/core/v1/configmap.go new file mode 100644 index 000000000..c759ca442 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/configmap.go @@ -0,0 +1,227 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ConfigMapApplyConfiguration represents an declarative configuration of the ConfigMap type for use +// with apply. +type ConfigMapApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Immutable *bool `json:"immutable,omitempty"` + Data map[string]string `json:"data,omitempty"` + BinaryData map[string][]byte `json:"binaryData,omitempty"` +} + +// ConfigMap constructs an declarative configuration of the ConfigMap type for use with +// apply. +func ConfigMap(name, namespace string) *ConfigMapApplyConfiguration { + b := &ConfigMapApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ConfigMap") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithKind(value string) *ConfigMapApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithAPIVersion(value string) *ConfigMapApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithName(value string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithGenerateName(value string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithNamespace(value string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithUID(value types.UID) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithResourceVersion(value string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithGeneration(value int64) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ConfigMapApplyConfiguration) WithLabels(entries map[string]string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ConfigMapApplyConfiguration) WithAnnotations(entries map[string]string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ConfigMapApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ConfigMapApplyConfiguration) WithFinalizers(values ...string) *ConfigMapApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ConfigMapApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithImmutable sets the Immutable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Immutable field is set to the value of the last call. +func (b *ConfigMapApplyConfiguration) WithImmutable(value bool) *ConfigMapApplyConfiguration { + b.Immutable = &value + return b +} + +// WithData puts the entries into the Data field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Data field, +// overwriting an existing map entries in Data field with the same key. +func (b *ConfigMapApplyConfiguration) WithData(entries map[string]string) *ConfigMapApplyConfiguration { + if b.Data == nil && len(entries) > 0 { + b.Data = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Data[k] = v + } + return b +} + +// WithBinaryData puts the entries into the BinaryData field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the BinaryData field, +// overwriting an existing map entries in BinaryData field with the same key. +func (b *ConfigMapApplyConfiguration) WithBinaryData(entries map[string][]byte) *ConfigMapApplyConfiguration { + if b.BinaryData == nil && len(entries) > 0 { + b.BinaryData = make(map[string][]byte, len(entries)) + } + for k, v := range entries { + b.BinaryData[k] = v + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/configmapenvsource.go b/pkg/clients/applyconfiguration/core/v1/configmapenvsource.go new file mode 100644 index 000000000..debfef926 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/configmapenvsource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ConfigMapEnvSourceApplyConfiguration represents an declarative configuration of the ConfigMapEnvSource type for use +// with apply. +type ConfigMapEnvSourceApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Optional *bool `json:"optional,omitempty"` +} + +// ConfigMapEnvSourceApplyConfiguration constructs an declarative configuration of the ConfigMapEnvSource type for use with +// apply. +func ConfigMapEnvSource() *ConfigMapEnvSourceApplyConfiguration { + return &ConfigMapEnvSourceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConfigMapEnvSourceApplyConfiguration) WithName(value string) *ConfigMapEnvSourceApplyConfiguration { + b.Name = &value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *ConfigMapEnvSourceApplyConfiguration) WithOptional(value bool) *ConfigMapEnvSourceApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/configmapkeyselector.go b/pkg/clients/applyconfiguration/core/v1/configmapkeyselector.go new file mode 100644 index 000000000..18ea2efba --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/configmapkeyselector.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ConfigMapKeySelectorApplyConfiguration represents an declarative configuration of the ConfigMapKeySelector type for use +// with apply. +type ConfigMapKeySelectorApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Key *string `json:"key,omitempty"` + Optional *bool `json:"optional,omitempty"` +} + +// ConfigMapKeySelectorApplyConfiguration constructs an declarative configuration of the ConfigMapKeySelector type for use with +// apply. +func ConfigMapKeySelector() *ConfigMapKeySelectorApplyConfiguration { + return &ConfigMapKeySelectorApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConfigMapKeySelectorApplyConfiguration) WithName(value string) *ConfigMapKeySelectorApplyConfiguration { + b.Name = &value + return b +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *ConfigMapKeySelectorApplyConfiguration) WithKey(value string) *ConfigMapKeySelectorApplyConfiguration { + b.Key = &value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *ConfigMapKeySelectorApplyConfiguration) WithOptional(value bool) *ConfigMapKeySelectorApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/configmapnodeconfigsource.go b/pkg/clients/applyconfiguration/core/v1/configmapnodeconfigsource.go new file mode 100644 index 000000000..5feb5c237 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/configmapnodeconfigsource.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// ConfigMapNodeConfigSourceApplyConfiguration represents an declarative configuration of the ConfigMapNodeConfigSource type for use +// with apply. +type ConfigMapNodeConfigSourceApplyConfiguration struct { + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + UID *types.UID `json:"uid,omitempty"` + ResourceVersion *string `json:"resourceVersion,omitempty"` + KubeletConfigKey *string `json:"kubeletConfigKey,omitempty"` +} + +// ConfigMapNodeConfigSourceApplyConfiguration constructs an declarative configuration of the ConfigMapNodeConfigSource type for use with +// apply. +func ConfigMapNodeConfigSource() *ConfigMapNodeConfigSourceApplyConfiguration { + return &ConfigMapNodeConfigSourceApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ConfigMapNodeConfigSourceApplyConfiguration) WithNamespace(value string) *ConfigMapNodeConfigSourceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConfigMapNodeConfigSourceApplyConfiguration) WithName(value string) *ConfigMapNodeConfigSourceApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ConfigMapNodeConfigSourceApplyConfiguration) WithUID(value types.UID) *ConfigMapNodeConfigSourceApplyConfiguration { + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ConfigMapNodeConfigSourceApplyConfiguration) WithResourceVersion(value string) *ConfigMapNodeConfigSourceApplyConfiguration { + b.ResourceVersion = &value + return b +} + +// WithKubeletConfigKey sets the KubeletConfigKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the KubeletConfigKey field is set to the value of the last call. +func (b *ConfigMapNodeConfigSourceApplyConfiguration) WithKubeletConfigKey(value string) *ConfigMapNodeConfigSourceApplyConfiguration { + b.KubeletConfigKey = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/configmapprojection.go b/pkg/clients/applyconfiguration/core/v1/configmapprojection.go new file mode 100644 index 000000000..c37eca909 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/configmapprojection.go @@ -0,0 +1,49 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ConfigMapProjectionApplyConfiguration represents an declarative configuration of the ConfigMapProjection type for use +// with apply. +type ConfigMapProjectionApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Items []KeyToPathApplyConfiguration `json:"items,omitempty"` + Optional *bool `json:"optional,omitempty"` +} + +// ConfigMapProjectionApplyConfiguration constructs an declarative configuration of the ConfigMapProjection type for use with +// apply. +func ConfigMapProjection() *ConfigMapProjectionApplyConfiguration { + return &ConfigMapProjectionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConfigMapProjectionApplyConfiguration) WithName(value string) *ConfigMapProjectionApplyConfiguration { + b.Name = &value + return b +} + +// WithItems adds the given value to the Items field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Items field. +func (b *ConfigMapProjectionApplyConfiguration) WithItems(values ...*KeyToPathApplyConfiguration) *ConfigMapProjectionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithItems") + } + b.Items = append(b.Items, *values[i]) + } + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *ConfigMapProjectionApplyConfiguration) WithOptional(value bool) *ConfigMapProjectionApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/configmapvolumesource.go b/pkg/clients/applyconfiguration/core/v1/configmapvolumesource.go new file mode 100644 index 000000000..6285f0b7c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/configmapvolumesource.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ConfigMapVolumeSourceApplyConfiguration represents an declarative configuration of the ConfigMapVolumeSource type for use +// with apply. +type ConfigMapVolumeSourceApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Items []KeyToPathApplyConfiguration `json:"items,omitempty"` + DefaultMode *int32 `json:"defaultMode,omitempty"` + Optional *bool `json:"optional,omitempty"` +} + +// ConfigMapVolumeSourceApplyConfiguration constructs an declarative configuration of the ConfigMapVolumeSource type for use with +// apply. +func ConfigMapVolumeSource() *ConfigMapVolumeSourceApplyConfiguration { + return &ConfigMapVolumeSourceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConfigMapVolumeSourceApplyConfiguration) WithName(value string) *ConfigMapVolumeSourceApplyConfiguration { + b.Name = &value + return b +} + +// WithItems adds the given value to the Items field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Items field. +func (b *ConfigMapVolumeSourceApplyConfiguration) WithItems(values ...*KeyToPathApplyConfiguration) *ConfigMapVolumeSourceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithItems") + } + b.Items = append(b.Items, *values[i]) + } + return b +} + +// WithDefaultMode sets the DefaultMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultMode field is set to the value of the last call. +func (b *ConfigMapVolumeSourceApplyConfiguration) WithDefaultMode(value int32) *ConfigMapVolumeSourceApplyConfiguration { + b.DefaultMode = &value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *ConfigMapVolumeSourceApplyConfiguration) WithOptional(value bool) *ConfigMapVolumeSourceApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/container.go b/pkg/clients/applyconfiguration/core/v1/container.go new file mode 100644 index 000000000..ff04e1618 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/container.go @@ -0,0 +1,271 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// ContainerApplyConfiguration represents an declarative configuration of the Container type for use +// with apply. +type ContainerApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Image *string `json:"image,omitempty"` + Command []string `json:"command,omitempty"` + Args []string `json:"args,omitempty"` + WorkingDir *string `json:"workingDir,omitempty"` + Ports []ContainerPortApplyConfiguration `json:"ports,omitempty"` + EnvFrom []EnvFromSourceApplyConfiguration `json:"envFrom,omitempty"` + Env []EnvVarApplyConfiguration `json:"env,omitempty"` + Resources *ResourceRequirementsApplyConfiguration `json:"resources,omitempty"` + ResizePolicy []ContainerResizePolicyApplyConfiguration `json:"resizePolicy,omitempty"` + RestartPolicy *corev1.ContainerRestartPolicy `json:"restartPolicy,omitempty"` + VolumeMounts []VolumeMountApplyConfiguration `json:"volumeMounts,omitempty"` + VolumeDevices []VolumeDeviceApplyConfiguration `json:"volumeDevices,omitempty"` + LivenessProbe *ProbeApplyConfiguration `json:"livenessProbe,omitempty"` + ReadinessProbe *ProbeApplyConfiguration `json:"readinessProbe,omitempty"` + StartupProbe *ProbeApplyConfiguration `json:"startupProbe,omitempty"` + Lifecycle *LifecycleApplyConfiguration `json:"lifecycle,omitempty"` + TerminationMessagePath *string `json:"terminationMessagePath,omitempty"` + TerminationMessagePolicy *corev1.TerminationMessagePolicy `json:"terminationMessagePolicy,omitempty"` + ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"` + SecurityContext *SecurityContextApplyConfiguration `json:"securityContext,omitempty"` + Stdin *bool `json:"stdin,omitempty"` + StdinOnce *bool `json:"stdinOnce,omitempty"` + TTY *bool `json:"tty,omitempty"` +} + +// ContainerApplyConfiguration constructs an declarative configuration of the Container type for use with +// apply. +func Container() *ContainerApplyConfiguration { + return &ContainerApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithName(value string) *ContainerApplyConfiguration { + b.Name = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithImage(value string) *ContainerApplyConfiguration { + b.Image = &value + return b +} + +// WithCommand adds the given value to the Command field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Command field. +func (b *ContainerApplyConfiguration) WithCommand(values ...string) *ContainerApplyConfiguration { + for i := range values { + b.Command = append(b.Command, values[i]) + } + return b +} + +// WithArgs adds the given value to the Args field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Args field. +func (b *ContainerApplyConfiguration) WithArgs(values ...string) *ContainerApplyConfiguration { + for i := range values { + b.Args = append(b.Args, values[i]) + } + return b +} + +// WithWorkingDir sets the WorkingDir field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WorkingDir field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithWorkingDir(value string) *ContainerApplyConfiguration { + b.WorkingDir = &value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *ContainerApplyConfiguration) WithPorts(values ...*ContainerPortApplyConfiguration) *ContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} + +// WithEnvFrom adds the given value to the EnvFrom field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EnvFrom field. +func (b *ContainerApplyConfiguration) WithEnvFrom(values ...*EnvFromSourceApplyConfiguration) *ContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnvFrom") + } + b.EnvFrom = append(b.EnvFrom, *values[i]) + } + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *ContainerApplyConfiguration) WithEnv(values ...*EnvVarApplyConfiguration) *ContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnv") + } + b.Env = append(b.Env, *values[i]) + } + return b +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithResources(value *ResourceRequirementsApplyConfiguration) *ContainerApplyConfiguration { + b.Resources = value + return b +} + +// WithResizePolicy adds the given value to the ResizePolicy field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResizePolicy field. +func (b *ContainerApplyConfiguration) WithResizePolicy(values ...*ContainerResizePolicyApplyConfiguration) *ContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResizePolicy") + } + b.ResizePolicy = append(b.ResizePolicy, *values[i]) + } + return b +} + +// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartPolicy field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithRestartPolicy(value corev1.ContainerRestartPolicy) *ContainerApplyConfiguration { + b.RestartPolicy = &value + return b +} + +// WithVolumeMounts adds the given value to the VolumeMounts field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeMounts field. +func (b *ContainerApplyConfiguration) WithVolumeMounts(values ...*VolumeMountApplyConfiguration) *ContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeMounts") + } + b.VolumeMounts = append(b.VolumeMounts, *values[i]) + } + return b +} + +// WithVolumeDevices adds the given value to the VolumeDevices field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeDevices field. +func (b *ContainerApplyConfiguration) WithVolumeDevices(values ...*VolumeDeviceApplyConfiguration) *ContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeDevices") + } + b.VolumeDevices = append(b.VolumeDevices, *values[i]) + } + return b +} + +// WithLivenessProbe sets the LivenessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LivenessProbe field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithLivenessProbe(value *ProbeApplyConfiguration) *ContainerApplyConfiguration { + b.LivenessProbe = value + return b +} + +// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadinessProbe field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithReadinessProbe(value *ProbeApplyConfiguration) *ContainerApplyConfiguration { + b.ReadinessProbe = value + return b +} + +// WithStartupProbe sets the StartupProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartupProbe field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithStartupProbe(value *ProbeApplyConfiguration) *ContainerApplyConfiguration { + b.StartupProbe = value + return b +} + +// WithLifecycle sets the Lifecycle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Lifecycle field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithLifecycle(value *LifecycleApplyConfiguration) *ContainerApplyConfiguration { + b.Lifecycle = value + return b +} + +// WithTerminationMessagePath sets the TerminationMessagePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationMessagePath field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithTerminationMessagePath(value string) *ContainerApplyConfiguration { + b.TerminationMessagePath = &value + return b +} + +// WithTerminationMessagePolicy sets the TerminationMessagePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationMessagePolicy field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithTerminationMessagePolicy(value corev1.TerminationMessagePolicy) *ContainerApplyConfiguration { + b.TerminationMessagePolicy = &value + return b +} + +// WithImagePullPolicy sets the ImagePullPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImagePullPolicy field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithImagePullPolicy(value corev1.PullPolicy) *ContainerApplyConfiguration { + b.ImagePullPolicy = &value + return b +} + +// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecurityContext field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithSecurityContext(value *SecurityContextApplyConfiguration) *ContainerApplyConfiguration { + b.SecurityContext = value + return b +} + +// WithStdin sets the Stdin field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Stdin field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithStdin(value bool) *ContainerApplyConfiguration { + b.Stdin = &value + return b +} + +// WithStdinOnce sets the StdinOnce field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StdinOnce field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithStdinOnce(value bool) *ContainerApplyConfiguration { + b.StdinOnce = &value + return b +} + +// WithTTY sets the TTY field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TTY field is set to the value of the last call. +func (b *ContainerApplyConfiguration) WithTTY(value bool) *ContainerApplyConfiguration { + b.TTY = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerimage.go b/pkg/clients/applyconfiguration/core/v1/containerimage.go new file mode 100644 index 000000000..a1f84ba13 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerimage.go @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ContainerImageApplyConfiguration represents an declarative configuration of the ContainerImage type for use +// with apply. +type ContainerImageApplyConfiguration struct { + Names []string `json:"names,omitempty"` + SizeBytes *int64 `json:"sizeBytes,omitempty"` +} + +// ContainerImageApplyConfiguration constructs an declarative configuration of the ContainerImage type for use with +// apply. +func ContainerImage() *ContainerImageApplyConfiguration { + return &ContainerImageApplyConfiguration{} +} + +// WithNames adds the given value to the Names field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Names field. +func (b *ContainerImageApplyConfiguration) WithNames(values ...string) *ContainerImageApplyConfiguration { + for i := range values { + b.Names = append(b.Names, values[i]) + } + return b +} + +// WithSizeBytes sets the SizeBytes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SizeBytes field is set to the value of the last call. +func (b *ContainerImageApplyConfiguration) WithSizeBytes(value int64) *ContainerImageApplyConfiguration { + b.SizeBytes = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerport.go b/pkg/clients/applyconfiguration/core/v1/containerport.go new file mode 100644 index 000000000..a56d95d81 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerport.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ContainerPortApplyConfiguration represents an declarative configuration of the ContainerPort type for use +// with apply. +type ContainerPortApplyConfiguration struct { + Name *string `json:"name,omitempty"` + HostPort *int32 `json:"hostPort,omitempty"` + ContainerPort *int32 `json:"containerPort,omitempty"` + Protocol *v1.Protocol `json:"protocol,omitempty"` + HostIP *string `json:"hostIP,omitempty"` +} + +// ContainerPortApplyConfiguration constructs an declarative configuration of the ContainerPort type for use with +// apply. +func ContainerPort() *ContainerPortApplyConfiguration { + return &ContainerPortApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContainerPortApplyConfiguration) WithName(value string) *ContainerPortApplyConfiguration { + b.Name = &value + return b +} + +// WithHostPort sets the HostPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostPort field is set to the value of the last call. +func (b *ContainerPortApplyConfiguration) WithHostPort(value int32) *ContainerPortApplyConfiguration { + b.HostPort = &value + return b +} + +// WithContainerPort sets the ContainerPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerPort field is set to the value of the last call. +func (b *ContainerPortApplyConfiguration) WithContainerPort(value int32) *ContainerPortApplyConfiguration { + b.ContainerPort = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *ContainerPortApplyConfiguration) WithProtocol(value v1.Protocol) *ContainerPortApplyConfiguration { + b.Protocol = &value + return b +} + +// WithHostIP sets the HostIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostIP field is set to the value of the last call. +func (b *ContainerPortApplyConfiguration) WithHostIP(value string) *ContainerPortApplyConfiguration { + b.HostIP = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerresizepolicy.go b/pkg/clients/applyconfiguration/core/v1/containerresizepolicy.go new file mode 100644 index 000000000..20da8f2b6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerresizepolicy.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ContainerResizePolicyApplyConfiguration represents an declarative configuration of the ContainerResizePolicy type for use +// with apply. +type ContainerResizePolicyApplyConfiguration struct { + ResourceName *v1.ResourceName `json:"resourceName,omitempty"` + RestartPolicy *v1.ResourceResizeRestartPolicy `json:"restartPolicy,omitempty"` +} + +// ContainerResizePolicyApplyConfiguration constructs an declarative configuration of the ContainerResizePolicy type for use with +// apply. +func ContainerResizePolicy() *ContainerResizePolicyApplyConfiguration { + return &ContainerResizePolicyApplyConfiguration{} +} + +// WithResourceName sets the ResourceName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceName field is set to the value of the last call. +func (b *ContainerResizePolicyApplyConfiguration) WithResourceName(value v1.ResourceName) *ContainerResizePolicyApplyConfiguration { + b.ResourceName = &value + return b +} + +// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartPolicy field is set to the value of the last call. +func (b *ContainerResizePolicyApplyConfiguration) WithRestartPolicy(value v1.ResourceResizeRestartPolicy) *ContainerResizePolicyApplyConfiguration { + b.RestartPolicy = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerstate.go b/pkg/clients/applyconfiguration/core/v1/containerstate.go new file mode 100644 index 000000000..3a1ff6897 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerstate.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ContainerStateApplyConfiguration represents an declarative configuration of the ContainerState type for use +// with apply. +type ContainerStateApplyConfiguration struct { + Waiting *ContainerStateWaitingApplyConfiguration `json:"waiting,omitempty"` + Running *ContainerStateRunningApplyConfiguration `json:"running,omitempty"` + Terminated *ContainerStateTerminatedApplyConfiguration `json:"terminated,omitempty"` +} + +// ContainerStateApplyConfiguration constructs an declarative configuration of the ContainerState type for use with +// apply. +func ContainerState() *ContainerStateApplyConfiguration { + return &ContainerStateApplyConfiguration{} +} + +// WithWaiting sets the Waiting field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Waiting field is set to the value of the last call. +func (b *ContainerStateApplyConfiguration) WithWaiting(value *ContainerStateWaitingApplyConfiguration) *ContainerStateApplyConfiguration { + b.Waiting = value + return b +} + +// WithRunning sets the Running field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Running field is set to the value of the last call. +func (b *ContainerStateApplyConfiguration) WithRunning(value *ContainerStateRunningApplyConfiguration) *ContainerStateApplyConfiguration { + b.Running = value + return b +} + +// WithTerminated sets the Terminated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Terminated field is set to the value of the last call. +func (b *ContainerStateApplyConfiguration) WithTerminated(value *ContainerStateTerminatedApplyConfiguration) *ContainerStateApplyConfiguration { + b.Terminated = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerstaterunning.go b/pkg/clients/applyconfiguration/core/v1/containerstaterunning.go new file mode 100644 index 000000000..22a2af966 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerstaterunning.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ContainerStateRunningApplyConfiguration represents an declarative configuration of the ContainerStateRunning type for use +// with apply. +type ContainerStateRunningApplyConfiguration struct { + StartedAt *v1.Time `json:"startedAt,omitempty"` +} + +// ContainerStateRunningApplyConfiguration constructs an declarative configuration of the ContainerStateRunning type for use with +// apply. +func ContainerStateRunning() *ContainerStateRunningApplyConfiguration { + return &ContainerStateRunningApplyConfiguration{} +} + +// WithStartedAt sets the StartedAt field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartedAt field is set to the value of the last call. +func (b *ContainerStateRunningApplyConfiguration) WithStartedAt(value v1.Time) *ContainerStateRunningApplyConfiguration { + b.StartedAt = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerstateterminated.go b/pkg/clients/applyconfiguration/core/v1/containerstateterminated.go new file mode 100644 index 000000000..5e51740a7 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerstateterminated.go @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ContainerStateTerminatedApplyConfiguration represents an declarative configuration of the ContainerStateTerminated type for use +// with apply. +type ContainerStateTerminatedApplyConfiguration struct { + ExitCode *int32 `json:"exitCode,omitempty"` + Signal *int32 `json:"signal,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + StartedAt *v1.Time `json:"startedAt,omitempty"` + FinishedAt *v1.Time `json:"finishedAt,omitempty"` + ContainerID *string `json:"containerID,omitempty"` +} + +// ContainerStateTerminatedApplyConfiguration constructs an declarative configuration of the ContainerStateTerminated type for use with +// apply. +func ContainerStateTerminated() *ContainerStateTerminatedApplyConfiguration { + return &ContainerStateTerminatedApplyConfiguration{} +} + +// WithExitCode sets the ExitCode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExitCode field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithExitCode(value int32) *ContainerStateTerminatedApplyConfiguration { + b.ExitCode = &value + return b +} + +// WithSignal sets the Signal field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Signal field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithSignal(value int32) *ContainerStateTerminatedApplyConfiguration { + b.Signal = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithReason(value string) *ContainerStateTerminatedApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithMessage(value string) *ContainerStateTerminatedApplyConfiguration { + b.Message = &value + return b +} + +// WithStartedAt sets the StartedAt field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartedAt field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithStartedAt(value v1.Time) *ContainerStateTerminatedApplyConfiguration { + b.StartedAt = &value + return b +} + +// WithFinishedAt sets the FinishedAt field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FinishedAt field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithFinishedAt(value v1.Time) *ContainerStateTerminatedApplyConfiguration { + b.FinishedAt = &value + return b +} + +// WithContainerID sets the ContainerID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerID field is set to the value of the last call. +func (b *ContainerStateTerminatedApplyConfiguration) WithContainerID(value string) *ContainerStateTerminatedApplyConfiguration { + b.ContainerID = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerstatewaiting.go b/pkg/clients/applyconfiguration/core/v1/containerstatewaiting.go new file mode 100644 index 000000000..2006f1057 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerstatewaiting.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ContainerStateWaitingApplyConfiguration represents an declarative configuration of the ContainerStateWaiting type for use +// with apply. +type ContainerStateWaitingApplyConfiguration struct { + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ContainerStateWaitingApplyConfiguration constructs an declarative configuration of the ContainerStateWaiting type for use with +// apply. +func ContainerStateWaiting() *ContainerStateWaitingApplyConfiguration { + return &ContainerStateWaitingApplyConfiguration{} +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ContainerStateWaitingApplyConfiguration) WithReason(value string) *ContainerStateWaitingApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ContainerStateWaitingApplyConfiguration) WithMessage(value string) *ContainerStateWaitingApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/containerstatus.go b/pkg/clients/applyconfiguration/core/v1/containerstatus.go new file mode 100644 index 000000000..01826b74d --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/containerstatus.go @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// ContainerStatusApplyConfiguration represents an declarative configuration of the ContainerStatus type for use +// with apply. +type ContainerStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + State *ContainerStateApplyConfiguration `json:"state,omitempty"` + LastTerminationState *ContainerStateApplyConfiguration `json:"lastState,omitempty"` + Ready *bool `json:"ready,omitempty"` + RestartCount *int32 `json:"restartCount,omitempty"` + Image *string `json:"image,omitempty"` + ImageID *string `json:"imageID,omitempty"` + ContainerID *string `json:"containerID,omitempty"` + Started *bool `json:"started,omitempty"` + AllocatedResources *corev1.ResourceList `json:"allocatedResources,omitempty"` + Resources *ResourceRequirementsApplyConfiguration `json:"resources,omitempty"` +} + +// ContainerStatusApplyConfiguration constructs an declarative configuration of the ContainerStatus type for use with +// apply. +func ContainerStatus() *ContainerStatusApplyConfiguration { + return &ContainerStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithName(value string) *ContainerStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithState(value *ContainerStateApplyConfiguration) *ContainerStatusApplyConfiguration { + b.State = value + return b +} + +// WithLastTerminationState sets the LastTerminationState field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTerminationState field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithLastTerminationState(value *ContainerStateApplyConfiguration) *ContainerStatusApplyConfiguration { + b.LastTerminationState = value + return b +} + +// WithReady sets the Ready field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ready field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithReady(value bool) *ContainerStatusApplyConfiguration { + b.Ready = &value + return b +} + +// WithRestartCount sets the RestartCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartCount field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithRestartCount(value int32) *ContainerStatusApplyConfiguration { + b.RestartCount = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithImage(value string) *ContainerStatusApplyConfiguration { + b.Image = &value + return b +} + +// WithImageID sets the ImageID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImageID field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithImageID(value string) *ContainerStatusApplyConfiguration { + b.ImageID = &value + return b +} + +// WithContainerID sets the ContainerID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerID field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithContainerID(value string) *ContainerStatusApplyConfiguration { + b.ContainerID = &value + return b +} + +// WithStarted sets the Started field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Started field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithStarted(value bool) *ContainerStatusApplyConfiguration { + b.Started = &value + return b +} + +// WithAllocatedResources sets the AllocatedResources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocatedResources field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithAllocatedResources(value corev1.ResourceList) *ContainerStatusApplyConfiguration { + b.AllocatedResources = &value + return b +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *ContainerStatusApplyConfiguration) WithResources(value *ResourceRequirementsApplyConfiguration) *ContainerStatusApplyConfiguration { + b.Resources = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/csipersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/csipersistentvolumesource.go new file mode 100644 index 000000000..fa971d633 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/csipersistentvolumesource.go @@ -0,0 +1,113 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CSIPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the CSIPersistentVolumeSource type for use +// with apply. +type CSIPersistentVolumeSourceApplyConfiguration struct { + Driver *string `json:"driver,omitempty"` + VolumeHandle *string `json:"volumeHandle,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + FSType *string `json:"fsType,omitempty"` + VolumeAttributes map[string]string `json:"volumeAttributes,omitempty"` + ControllerPublishSecretRef *SecretReferenceApplyConfiguration `json:"controllerPublishSecretRef,omitempty"` + NodeStageSecretRef *SecretReferenceApplyConfiguration `json:"nodeStageSecretRef,omitempty"` + NodePublishSecretRef *SecretReferenceApplyConfiguration `json:"nodePublishSecretRef,omitempty"` + ControllerExpandSecretRef *SecretReferenceApplyConfiguration `json:"controllerExpandSecretRef,omitempty"` + NodeExpandSecretRef *SecretReferenceApplyConfiguration `json:"nodeExpandSecretRef,omitempty"` +} + +// CSIPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the CSIPersistentVolumeSource type for use with +// apply. +func CSIPersistentVolumeSource() *CSIPersistentVolumeSourceApplyConfiguration { + return &CSIPersistentVolumeSourceApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithDriver(value string) *CSIPersistentVolumeSourceApplyConfiguration { + b.Driver = &value + return b +} + +// WithVolumeHandle sets the VolumeHandle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeHandle field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithVolumeHandle(value string) *CSIPersistentVolumeSourceApplyConfiguration { + b.VolumeHandle = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *CSIPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *CSIPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithVolumeAttributes puts the entries into the VolumeAttributes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the VolumeAttributes field, +// overwriting an existing map entries in VolumeAttributes field with the same key. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithVolumeAttributes(entries map[string]string) *CSIPersistentVolumeSourceApplyConfiguration { + if b.VolumeAttributes == nil && len(entries) > 0 { + b.VolumeAttributes = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.VolumeAttributes[k] = v + } + return b +} + +// WithControllerPublishSecretRef sets the ControllerPublishSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControllerPublishSecretRef field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithControllerPublishSecretRef(value *SecretReferenceApplyConfiguration) *CSIPersistentVolumeSourceApplyConfiguration { + b.ControllerPublishSecretRef = value + return b +} + +// WithNodeStageSecretRef sets the NodeStageSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeStageSecretRef field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithNodeStageSecretRef(value *SecretReferenceApplyConfiguration) *CSIPersistentVolumeSourceApplyConfiguration { + b.NodeStageSecretRef = value + return b +} + +// WithNodePublishSecretRef sets the NodePublishSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePublishSecretRef field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithNodePublishSecretRef(value *SecretReferenceApplyConfiguration) *CSIPersistentVolumeSourceApplyConfiguration { + b.NodePublishSecretRef = value + return b +} + +// WithControllerExpandSecretRef sets the ControllerExpandSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ControllerExpandSecretRef field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithControllerExpandSecretRef(value *SecretReferenceApplyConfiguration) *CSIPersistentVolumeSourceApplyConfiguration { + b.ControllerExpandSecretRef = value + return b +} + +// WithNodeExpandSecretRef sets the NodeExpandSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeExpandSecretRef field is set to the value of the last call. +func (b *CSIPersistentVolumeSourceApplyConfiguration) WithNodeExpandSecretRef(value *SecretReferenceApplyConfiguration) *CSIPersistentVolumeSourceApplyConfiguration { + b.NodeExpandSecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/csivolumesource.go b/pkg/clients/applyconfiguration/core/v1/csivolumesource.go new file mode 100644 index 000000000..fadf7ed57 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/csivolumesource.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CSIVolumeSourceApplyConfiguration represents an declarative configuration of the CSIVolumeSource type for use +// with apply. +type CSIVolumeSourceApplyConfiguration struct { + Driver *string `json:"driver,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + FSType *string `json:"fsType,omitempty"` + VolumeAttributes map[string]string `json:"volumeAttributes,omitempty"` + NodePublishSecretRef *LocalObjectReferenceApplyConfiguration `json:"nodePublishSecretRef,omitempty"` +} + +// CSIVolumeSourceApplyConfiguration constructs an declarative configuration of the CSIVolumeSource type for use with +// apply. +func CSIVolumeSource() *CSIVolumeSourceApplyConfiguration { + return &CSIVolumeSourceApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *CSIVolumeSourceApplyConfiguration) WithDriver(value string) *CSIVolumeSourceApplyConfiguration { + b.Driver = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *CSIVolumeSourceApplyConfiguration) WithReadOnly(value bool) *CSIVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *CSIVolumeSourceApplyConfiguration) WithFSType(value string) *CSIVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithVolumeAttributes puts the entries into the VolumeAttributes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the VolumeAttributes field, +// overwriting an existing map entries in VolumeAttributes field with the same key. +func (b *CSIVolumeSourceApplyConfiguration) WithVolumeAttributes(entries map[string]string) *CSIVolumeSourceApplyConfiguration { + if b.VolumeAttributes == nil && len(entries) > 0 { + b.VolumeAttributes = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.VolumeAttributes[k] = v + } + return b +} + +// WithNodePublishSecretRef sets the NodePublishSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePublishSecretRef field is set to the value of the last call. +func (b *CSIVolumeSourceApplyConfiguration) WithNodePublishSecretRef(value *LocalObjectReferenceApplyConfiguration) *CSIVolumeSourceApplyConfiguration { + b.NodePublishSecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/daemonendpoint.go b/pkg/clients/applyconfiguration/core/v1/daemonendpoint.go new file mode 100644 index 000000000..0813603e6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/daemonendpoint.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// DaemonEndpointApplyConfiguration represents an declarative configuration of the DaemonEndpoint type for use +// with apply. +type DaemonEndpointApplyConfiguration struct { + Port *int32 `json:"Port,omitempty"` +} + +// DaemonEndpointApplyConfiguration constructs an declarative configuration of the DaemonEndpoint type for use with +// apply. +func DaemonEndpoint() *DaemonEndpointApplyConfiguration { + return &DaemonEndpointApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *DaemonEndpointApplyConfiguration) WithPort(value int32) *DaemonEndpointApplyConfiguration { + b.Port = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/downwardapiprojection.go b/pkg/clients/applyconfiguration/core/v1/downwardapiprojection.go new file mode 100644 index 000000000..b7d99d997 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/downwardapiprojection.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// DownwardAPIProjectionApplyConfiguration represents an declarative configuration of the DownwardAPIProjection type for use +// with apply. +type DownwardAPIProjectionApplyConfiguration struct { + Items []DownwardAPIVolumeFileApplyConfiguration `json:"items,omitempty"` +} + +// DownwardAPIProjectionApplyConfiguration constructs an declarative configuration of the DownwardAPIProjection type for use with +// apply. +func DownwardAPIProjection() *DownwardAPIProjectionApplyConfiguration { + return &DownwardAPIProjectionApplyConfiguration{} +} + +// WithItems adds the given value to the Items field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Items field. +func (b *DownwardAPIProjectionApplyConfiguration) WithItems(values ...*DownwardAPIVolumeFileApplyConfiguration) *DownwardAPIProjectionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithItems") + } + b.Items = append(b.Items, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/downwardapivolumefile.go b/pkg/clients/applyconfiguration/core/v1/downwardapivolumefile.go new file mode 100644 index 000000000..43ea46052 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/downwardapivolumefile.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// DownwardAPIVolumeFileApplyConfiguration represents an declarative configuration of the DownwardAPIVolumeFile type for use +// with apply. +type DownwardAPIVolumeFileApplyConfiguration struct { + Path *string `json:"path,omitempty"` + FieldRef *ObjectFieldSelectorApplyConfiguration `json:"fieldRef,omitempty"` + ResourceFieldRef *ResourceFieldSelectorApplyConfiguration `json:"resourceFieldRef,omitempty"` + Mode *int32 `json:"mode,omitempty"` +} + +// DownwardAPIVolumeFileApplyConfiguration constructs an declarative configuration of the DownwardAPIVolumeFile type for use with +// apply. +func DownwardAPIVolumeFile() *DownwardAPIVolumeFileApplyConfiguration { + return &DownwardAPIVolumeFileApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *DownwardAPIVolumeFileApplyConfiguration) WithPath(value string) *DownwardAPIVolumeFileApplyConfiguration { + b.Path = &value + return b +} + +// WithFieldRef sets the FieldRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldRef field is set to the value of the last call. +func (b *DownwardAPIVolumeFileApplyConfiguration) WithFieldRef(value *ObjectFieldSelectorApplyConfiguration) *DownwardAPIVolumeFileApplyConfiguration { + b.FieldRef = value + return b +} + +// WithResourceFieldRef sets the ResourceFieldRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceFieldRef field is set to the value of the last call. +func (b *DownwardAPIVolumeFileApplyConfiguration) WithResourceFieldRef(value *ResourceFieldSelectorApplyConfiguration) *DownwardAPIVolumeFileApplyConfiguration { + b.ResourceFieldRef = value + return b +} + +// WithMode sets the Mode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Mode field is set to the value of the last call. +func (b *DownwardAPIVolumeFileApplyConfiguration) WithMode(value int32) *DownwardAPIVolumeFileApplyConfiguration { + b.Mode = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/downwardapivolumesource.go b/pkg/clients/applyconfiguration/core/v1/downwardapivolumesource.go new file mode 100644 index 000000000..21b16ffac --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/downwardapivolumesource.go @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// DownwardAPIVolumeSourceApplyConfiguration represents an declarative configuration of the DownwardAPIVolumeSource type for use +// with apply. +type DownwardAPIVolumeSourceApplyConfiguration struct { + Items []DownwardAPIVolumeFileApplyConfiguration `json:"items,omitempty"` + DefaultMode *int32 `json:"defaultMode,omitempty"` +} + +// DownwardAPIVolumeSourceApplyConfiguration constructs an declarative configuration of the DownwardAPIVolumeSource type for use with +// apply. +func DownwardAPIVolumeSource() *DownwardAPIVolumeSourceApplyConfiguration { + return &DownwardAPIVolumeSourceApplyConfiguration{} +} + +// WithItems adds the given value to the Items field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Items field. +func (b *DownwardAPIVolumeSourceApplyConfiguration) WithItems(values ...*DownwardAPIVolumeFileApplyConfiguration) *DownwardAPIVolumeSourceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithItems") + } + b.Items = append(b.Items, *values[i]) + } + return b +} + +// WithDefaultMode sets the DefaultMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultMode field is set to the value of the last call. +func (b *DownwardAPIVolumeSourceApplyConfiguration) WithDefaultMode(value int32) *DownwardAPIVolumeSourceApplyConfiguration { + b.DefaultMode = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/emptydirvolumesource.go b/pkg/clients/applyconfiguration/core/v1/emptydirvolumesource.go new file mode 100644 index 000000000..528986ed6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/emptydirvolumesource.go @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// EmptyDirVolumeSourceApplyConfiguration represents an declarative configuration of the EmptyDirVolumeSource type for use +// with apply. +type EmptyDirVolumeSourceApplyConfiguration struct { + Medium *v1.StorageMedium `json:"medium,omitempty"` + SizeLimit *resource.Quantity `json:"sizeLimit,omitempty"` +} + +// EmptyDirVolumeSourceApplyConfiguration constructs an declarative configuration of the EmptyDirVolumeSource type for use with +// apply. +func EmptyDirVolumeSource() *EmptyDirVolumeSourceApplyConfiguration { + return &EmptyDirVolumeSourceApplyConfiguration{} +} + +// WithMedium sets the Medium field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Medium field is set to the value of the last call. +func (b *EmptyDirVolumeSourceApplyConfiguration) WithMedium(value v1.StorageMedium) *EmptyDirVolumeSourceApplyConfiguration { + b.Medium = &value + return b +} + +// WithSizeLimit sets the SizeLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SizeLimit field is set to the value of the last call. +func (b *EmptyDirVolumeSourceApplyConfiguration) WithSizeLimit(value resource.Quantity) *EmptyDirVolumeSourceApplyConfiguration { + b.SizeLimit = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/endpointaddress.go b/pkg/clients/applyconfiguration/core/v1/endpointaddress.go new file mode 100644 index 000000000..063970141 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/endpointaddress.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EndpointAddressApplyConfiguration represents an declarative configuration of the EndpointAddress type for use +// with apply. +type EndpointAddressApplyConfiguration struct { + IP *string `json:"ip,omitempty"` + Hostname *string `json:"hostname,omitempty"` + NodeName *string `json:"nodeName,omitempty"` + TargetRef *ObjectReferenceApplyConfiguration `json:"targetRef,omitempty"` +} + +// EndpointAddressApplyConfiguration constructs an declarative configuration of the EndpointAddress type for use with +// apply. +func EndpointAddress() *EndpointAddressApplyConfiguration { + return &EndpointAddressApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *EndpointAddressApplyConfiguration) WithIP(value string) *EndpointAddressApplyConfiguration { + b.IP = &value + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *EndpointAddressApplyConfiguration) WithHostname(value string) *EndpointAddressApplyConfiguration { + b.Hostname = &value + return b +} + +// WithNodeName sets the NodeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeName field is set to the value of the last call. +func (b *EndpointAddressApplyConfiguration) WithNodeName(value string) *EndpointAddressApplyConfiguration { + b.NodeName = &value + return b +} + +// WithTargetRef sets the TargetRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetRef field is set to the value of the last call. +func (b *EndpointAddressApplyConfiguration) WithTargetRef(value *ObjectReferenceApplyConfiguration) *EndpointAddressApplyConfiguration { + b.TargetRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/endpointport.go b/pkg/clients/applyconfiguration/core/v1/endpointport.go new file mode 100644 index 000000000..1c16aa865 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/endpointport.go @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// EndpointPortApplyConfiguration represents an declarative configuration of the EndpointPort type for use +// with apply. +type EndpointPortApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Port *int32 `json:"port,omitempty"` + Protocol *v1.Protocol `json:"protocol,omitempty"` + AppProtocol *string `json:"appProtocol,omitempty"` +} + +// EndpointPortApplyConfiguration constructs an declarative configuration of the EndpointPort type for use with +// apply. +func EndpointPort() *EndpointPortApplyConfiguration { + return &EndpointPortApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithName(value string) *EndpointPortApplyConfiguration { + b.Name = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithPort(value int32) *EndpointPortApplyConfiguration { + b.Port = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithProtocol(value v1.Protocol) *EndpointPortApplyConfiguration { + b.Protocol = &value + return b +} + +// WithAppProtocol sets the AppProtocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AppProtocol field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithAppProtocol(value string) *EndpointPortApplyConfiguration { + b.AppProtocol = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/endpoints.go b/pkg/clients/applyconfiguration/core/v1/endpoints.go new file mode 100644 index 000000000..2cd089f34 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/endpoints.go @@ -0,0 +1,202 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EndpointsApplyConfiguration represents an declarative configuration of the Endpoints type for use +// with apply. +type EndpointsApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Subsets []EndpointSubsetApplyConfiguration `json:"subsets,omitempty"` +} + +// Endpoints constructs an declarative configuration of the Endpoints type for use with +// apply. +func Endpoints(name, namespace string) *EndpointsApplyConfiguration { + b := &EndpointsApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Endpoints") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithKind(value string) *EndpointsApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithAPIVersion(value string) *EndpointsApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithName(value string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithGenerateName(value string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithNamespace(value string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithUID(value types.UID) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithResourceVersion(value string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithGeneration(value int64) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EndpointsApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EndpointsApplyConfiguration) WithLabels(entries map[string]string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EndpointsApplyConfiguration) WithAnnotations(entries map[string]string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *EndpointsApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *EndpointsApplyConfiguration) WithFinalizers(values ...string) *EndpointsApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *EndpointsApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSubsets adds the given value to the Subsets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Subsets field. +func (b *EndpointsApplyConfiguration) WithSubsets(values ...*EndpointSubsetApplyConfiguration) *EndpointsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSubsets") + } + b.Subsets = append(b.Subsets, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/endpointsubset.go b/pkg/clients/applyconfiguration/core/v1/endpointsubset.go new file mode 100644 index 000000000..6f2d6f838 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/endpointsubset.go @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EndpointSubsetApplyConfiguration represents an declarative configuration of the EndpointSubset type for use +// with apply. +type EndpointSubsetApplyConfiguration struct { + Addresses []EndpointAddressApplyConfiguration `json:"addresses,omitempty"` + NotReadyAddresses []EndpointAddressApplyConfiguration `json:"notReadyAddresses,omitempty"` + Ports []EndpointPortApplyConfiguration `json:"ports,omitempty"` +} + +// EndpointSubsetApplyConfiguration constructs an declarative configuration of the EndpointSubset type for use with +// apply. +func EndpointSubset() *EndpointSubsetApplyConfiguration { + return &EndpointSubsetApplyConfiguration{} +} + +// WithAddresses adds the given value to the Addresses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Addresses field. +func (b *EndpointSubsetApplyConfiguration) WithAddresses(values ...*EndpointAddressApplyConfiguration) *EndpointSubsetApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAddresses") + } + b.Addresses = append(b.Addresses, *values[i]) + } + return b +} + +// WithNotReadyAddresses adds the given value to the NotReadyAddresses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NotReadyAddresses field. +func (b *EndpointSubsetApplyConfiguration) WithNotReadyAddresses(values ...*EndpointAddressApplyConfiguration) *EndpointSubsetApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNotReadyAddresses") + } + b.NotReadyAddresses = append(b.NotReadyAddresses, *values[i]) + } + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *EndpointSubsetApplyConfiguration) WithPorts(values ...*EndpointPortApplyConfiguration) *EndpointSubsetApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/envfromsource.go b/pkg/clients/applyconfiguration/core/v1/envfromsource.go new file mode 100644 index 000000000..5e4015c94 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/envfromsource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EnvFromSourceApplyConfiguration represents an declarative configuration of the EnvFromSource type for use +// with apply. +type EnvFromSourceApplyConfiguration struct { + Prefix *string `json:"prefix,omitempty"` + ConfigMapRef *ConfigMapEnvSourceApplyConfiguration `json:"configMapRef,omitempty"` + SecretRef *SecretEnvSourceApplyConfiguration `json:"secretRef,omitempty"` +} + +// EnvFromSourceApplyConfiguration constructs an declarative configuration of the EnvFromSource type for use with +// apply. +func EnvFromSource() *EnvFromSourceApplyConfiguration { + return &EnvFromSourceApplyConfiguration{} +} + +// WithPrefix sets the Prefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Prefix field is set to the value of the last call. +func (b *EnvFromSourceApplyConfiguration) WithPrefix(value string) *EnvFromSourceApplyConfiguration { + b.Prefix = &value + return b +} + +// WithConfigMapRef sets the ConfigMapRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMapRef field is set to the value of the last call. +func (b *EnvFromSourceApplyConfiguration) WithConfigMapRef(value *ConfigMapEnvSourceApplyConfiguration) *EnvFromSourceApplyConfiguration { + b.ConfigMapRef = value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *EnvFromSourceApplyConfiguration) WithSecretRef(value *SecretEnvSourceApplyConfiguration) *EnvFromSourceApplyConfiguration { + b.SecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/envvar.go b/pkg/clients/applyconfiguration/core/v1/envvar.go new file mode 100644 index 000000000..d0d7b0d71 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/envvar.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EnvVarApplyConfiguration represents an declarative configuration of the EnvVar type for use +// with apply. +type EnvVarApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + ValueFrom *EnvVarSourceApplyConfiguration `json:"valueFrom,omitempty"` +} + +// EnvVarApplyConfiguration constructs an declarative configuration of the EnvVar type for use with +// apply. +func EnvVar() *EnvVarApplyConfiguration { + return &EnvVarApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EnvVarApplyConfiguration) WithName(value string) *EnvVarApplyConfiguration { + b.Name = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *EnvVarApplyConfiguration) WithValue(value string) *EnvVarApplyConfiguration { + b.Value = &value + return b +} + +// WithValueFrom sets the ValueFrom field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ValueFrom field is set to the value of the last call. +func (b *EnvVarApplyConfiguration) WithValueFrom(value *EnvVarSourceApplyConfiguration) *EnvVarApplyConfiguration { + b.ValueFrom = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/envvarsource.go b/pkg/clients/applyconfiguration/core/v1/envvarsource.go new file mode 100644 index 000000000..a032448f4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/envvarsource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EnvVarSourceApplyConfiguration represents an declarative configuration of the EnvVarSource type for use +// with apply. +type EnvVarSourceApplyConfiguration struct { + FieldRef *ObjectFieldSelectorApplyConfiguration `json:"fieldRef,omitempty"` + ResourceFieldRef *ResourceFieldSelectorApplyConfiguration `json:"resourceFieldRef,omitempty"` + ConfigMapKeyRef *ConfigMapKeySelectorApplyConfiguration `json:"configMapKeyRef,omitempty"` + SecretKeyRef *SecretKeySelectorApplyConfiguration `json:"secretKeyRef,omitempty"` +} + +// EnvVarSourceApplyConfiguration constructs an declarative configuration of the EnvVarSource type for use with +// apply. +func EnvVarSource() *EnvVarSourceApplyConfiguration { + return &EnvVarSourceApplyConfiguration{} +} + +// WithFieldRef sets the FieldRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldRef field is set to the value of the last call. +func (b *EnvVarSourceApplyConfiguration) WithFieldRef(value *ObjectFieldSelectorApplyConfiguration) *EnvVarSourceApplyConfiguration { + b.FieldRef = value + return b +} + +// WithResourceFieldRef sets the ResourceFieldRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceFieldRef field is set to the value of the last call. +func (b *EnvVarSourceApplyConfiguration) WithResourceFieldRef(value *ResourceFieldSelectorApplyConfiguration) *EnvVarSourceApplyConfiguration { + b.ResourceFieldRef = value + return b +} + +// WithConfigMapKeyRef sets the ConfigMapKeyRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMapKeyRef field is set to the value of the last call. +func (b *EnvVarSourceApplyConfiguration) WithConfigMapKeyRef(value *ConfigMapKeySelectorApplyConfiguration) *EnvVarSourceApplyConfiguration { + b.ConfigMapKeyRef = value + return b +} + +// WithSecretKeyRef sets the SecretKeyRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretKeyRef field is set to the value of the last call. +func (b *EnvVarSourceApplyConfiguration) WithSecretKeyRef(value *SecretKeySelectorApplyConfiguration) *EnvVarSourceApplyConfiguration { + b.SecretKeyRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/ephemeralcontainer.go b/pkg/clients/applyconfiguration/core/v1/ephemeralcontainer.go new file mode 100644 index 000000000..92ece9ac5 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/ephemeralcontainer.go @@ -0,0 +1,257 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// EphemeralContainerApplyConfiguration represents an declarative configuration of the EphemeralContainer type for use +// with apply. +type EphemeralContainerApplyConfiguration struct { + EphemeralContainerCommonApplyConfiguration `json:",inline"` + TargetContainerName *string `json:"targetContainerName,omitempty"` +} + +// EphemeralContainerApplyConfiguration constructs an declarative configuration of the EphemeralContainer type for use with +// apply. +func EphemeralContainer() *EphemeralContainerApplyConfiguration { + return &EphemeralContainerApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithName(value string) *EphemeralContainerApplyConfiguration { + b.Name = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithImage(value string) *EphemeralContainerApplyConfiguration { + b.Image = &value + return b +} + +// WithCommand adds the given value to the Command field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Command field. +func (b *EphemeralContainerApplyConfiguration) WithCommand(values ...string) *EphemeralContainerApplyConfiguration { + for i := range values { + b.Command = append(b.Command, values[i]) + } + return b +} + +// WithArgs adds the given value to the Args field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Args field. +func (b *EphemeralContainerApplyConfiguration) WithArgs(values ...string) *EphemeralContainerApplyConfiguration { + for i := range values { + b.Args = append(b.Args, values[i]) + } + return b +} + +// WithWorkingDir sets the WorkingDir field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WorkingDir field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithWorkingDir(value string) *EphemeralContainerApplyConfiguration { + b.WorkingDir = &value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *EphemeralContainerApplyConfiguration) WithPorts(values ...*ContainerPortApplyConfiguration) *EphemeralContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} + +// WithEnvFrom adds the given value to the EnvFrom field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EnvFrom field. +func (b *EphemeralContainerApplyConfiguration) WithEnvFrom(values ...*EnvFromSourceApplyConfiguration) *EphemeralContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnvFrom") + } + b.EnvFrom = append(b.EnvFrom, *values[i]) + } + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *EphemeralContainerApplyConfiguration) WithEnv(values ...*EnvVarApplyConfiguration) *EphemeralContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnv") + } + b.Env = append(b.Env, *values[i]) + } + return b +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithResources(value *ResourceRequirementsApplyConfiguration) *EphemeralContainerApplyConfiguration { + b.Resources = value + return b +} + +// WithResizePolicy adds the given value to the ResizePolicy field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResizePolicy field. +func (b *EphemeralContainerApplyConfiguration) WithResizePolicy(values ...*ContainerResizePolicyApplyConfiguration) *EphemeralContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResizePolicy") + } + b.ResizePolicy = append(b.ResizePolicy, *values[i]) + } + return b +} + +// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartPolicy field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithRestartPolicy(value corev1.ContainerRestartPolicy) *EphemeralContainerApplyConfiguration { + b.RestartPolicy = &value + return b +} + +// WithVolumeMounts adds the given value to the VolumeMounts field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeMounts field. +func (b *EphemeralContainerApplyConfiguration) WithVolumeMounts(values ...*VolumeMountApplyConfiguration) *EphemeralContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeMounts") + } + b.VolumeMounts = append(b.VolumeMounts, *values[i]) + } + return b +} + +// WithVolumeDevices adds the given value to the VolumeDevices field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeDevices field. +func (b *EphemeralContainerApplyConfiguration) WithVolumeDevices(values ...*VolumeDeviceApplyConfiguration) *EphemeralContainerApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeDevices") + } + b.VolumeDevices = append(b.VolumeDevices, *values[i]) + } + return b +} + +// WithLivenessProbe sets the LivenessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LivenessProbe field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithLivenessProbe(value *ProbeApplyConfiguration) *EphemeralContainerApplyConfiguration { + b.LivenessProbe = value + return b +} + +// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadinessProbe field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithReadinessProbe(value *ProbeApplyConfiguration) *EphemeralContainerApplyConfiguration { + b.ReadinessProbe = value + return b +} + +// WithStartupProbe sets the StartupProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartupProbe field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithStartupProbe(value *ProbeApplyConfiguration) *EphemeralContainerApplyConfiguration { + b.StartupProbe = value + return b +} + +// WithLifecycle sets the Lifecycle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Lifecycle field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithLifecycle(value *LifecycleApplyConfiguration) *EphemeralContainerApplyConfiguration { + b.Lifecycle = value + return b +} + +// WithTerminationMessagePath sets the TerminationMessagePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationMessagePath field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithTerminationMessagePath(value string) *EphemeralContainerApplyConfiguration { + b.TerminationMessagePath = &value + return b +} + +// WithTerminationMessagePolicy sets the TerminationMessagePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationMessagePolicy field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithTerminationMessagePolicy(value corev1.TerminationMessagePolicy) *EphemeralContainerApplyConfiguration { + b.TerminationMessagePolicy = &value + return b +} + +// WithImagePullPolicy sets the ImagePullPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImagePullPolicy field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithImagePullPolicy(value corev1.PullPolicy) *EphemeralContainerApplyConfiguration { + b.ImagePullPolicy = &value + return b +} + +// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecurityContext field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithSecurityContext(value *SecurityContextApplyConfiguration) *EphemeralContainerApplyConfiguration { + b.SecurityContext = value + return b +} + +// WithStdin sets the Stdin field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Stdin field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithStdin(value bool) *EphemeralContainerApplyConfiguration { + b.Stdin = &value + return b +} + +// WithStdinOnce sets the StdinOnce field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StdinOnce field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithStdinOnce(value bool) *EphemeralContainerApplyConfiguration { + b.StdinOnce = &value + return b +} + +// WithTTY sets the TTY field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TTY field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithTTY(value bool) *EphemeralContainerApplyConfiguration { + b.TTY = &value + return b +} + +// WithTargetContainerName sets the TargetContainerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetContainerName field is set to the value of the last call. +func (b *EphemeralContainerApplyConfiguration) WithTargetContainerName(value string) *EphemeralContainerApplyConfiguration { + b.TargetContainerName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/ephemeralcontainercommon.go b/pkg/clients/applyconfiguration/core/v1/ephemeralcontainercommon.go new file mode 100644 index 000000000..09b0b1632 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/ephemeralcontainercommon.go @@ -0,0 +1,271 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// EphemeralContainerCommonApplyConfiguration represents an declarative configuration of the EphemeralContainerCommon type for use +// with apply. +type EphemeralContainerCommonApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Image *string `json:"image,omitempty"` + Command []string `json:"command,omitempty"` + Args []string `json:"args,omitempty"` + WorkingDir *string `json:"workingDir,omitempty"` + Ports []ContainerPortApplyConfiguration `json:"ports,omitempty"` + EnvFrom []EnvFromSourceApplyConfiguration `json:"envFrom,omitempty"` + Env []EnvVarApplyConfiguration `json:"env,omitempty"` + Resources *ResourceRequirementsApplyConfiguration `json:"resources,omitempty"` + ResizePolicy []ContainerResizePolicyApplyConfiguration `json:"resizePolicy,omitempty"` + RestartPolicy *corev1.ContainerRestartPolicy `json:"restartPolicy,omitempty"` + VolumeMounts []VolumeMountApplyConfiguration `json:"volumeMounts,omitempty"` + VolumeDevices []VolumeDeviceApplyConfiguration `json:"volumeDevices,omitempty"` + LivenessProbe *ProbeApplyConfiguration `json:"livenessProbe,omitempty"` + ReadinessProbe *ProbeApplyConfiguration `json:"readinessProbe,omitempty"` + StartupProbe *ProbeApplyConfiguration `json:"startupProbe,omitempty"` + Lifecycle *LifecycleApplyConfiguration `json:"lifecycle,omitempty"` + TerminationMessagePath *string `json:"terminationMessagePath,omitempty"` + TerminationMessagePolicy *corev1.TerminationMessagePolicy `json:"terminationMessagePolicy,omitempty"` + ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"` + SecurityContext *SecurityContextApplyConfiguration `json:"securityContext,omitempty"` + Stdin *bool `json:"stdin,omitempty"` + StdinOnce *bool `json:"stdinOnce,omitempty"` + TTY *bool `json:"tty,omitempty"` +} + +// EphemeralContainerCommonApplyConfiguration constructs an declarative configuration of the EphemeralContainerCommon type for use with +// apply. +func EphemeralContainerCommon() *EphemeralContainerCommonApplyConfiguration { + return &EphemeralContainerCommonApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithName(value string) *EphemeralContainerCommonApplyConfiguration { + b.Name = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithImage(value string) *EphemeralContainerCommonApplyConfiguration { + b.Image = &value + return b +} + +// WithCommand adds the given value to the Command field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Command field. +func (b *EphemeralContainerCommonApplyConfiguration) WithCommand(values ...string) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + b.Command = append(b.Command, values[i]) + } + return b +} + +// WithArgs adds the given value to the Args field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Args field. +func (b *EphemeralContainerCommonApplyConfiguration) WithArgs(values ...string) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + b.Args = append(b.Args, values[i]) + } + return b +} + +// WithWorkingDir sets the WorkingDir field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WorkingDir field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithWorkingDir(value string) *EphemeralContainerCommonApplyConfiguration { + b.WorkingDir = &value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *EphemeralContainerCommonApplyConfiguration) WithPorts(values ...*ContainerPortApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} + +// WithEnvFrom adds the given value to the EnvFrom field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EnvFrom field. +func (b *EphemeralContainerCommonApplyConfiguration) WithEnvFrom(values ...*EnvFromSourceApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnvFrom") + } + b.EnvFrom = append(b.EnvFrom, *values[i]) + } + return b +} + +// WithEnv adds the given value to the Env field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Env field. +func (b *EphemeralContainerCommonApplyConfiguration) WithEnv(values ...*EnvVarApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEnv") + } + b.Env = append(b.Env, *values[i]) + } + return b +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithResources(value *ResourceRequirementsApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + b.Resources = value + return b +} + +// WithResizePolicy adds the given value to the ResizePolicy field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResizePolicy field. +func (b *EphemeralContainerCommonApplyConfiguration) WithResizePolicy(values ...*ContainerResizePolicyApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResizePolicy") + } + b.ResizePolicy = append(b.ResizePolicy, *values[i]) + } + return b +} + +// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartPolicy field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithRestartPolicy(value corev1.ContainerRestartPolicy) *EphemeralContainerCommonApplyConfiguration { + b.RestartPolicy = &value + return b +} + +// WithVolumeMounts adds the given value to the VolumeMounts field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeMounts field. +func (b *EphemeralContainerCommonApplyConfiguration) WithVolumeMounts(values ...*VolumeMountApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeMounts") + } + b.VolumeMounts = append(b.VolumeMounts, *values[i]) + } + return b +} + +// WithVolumeDevices adds the given value to the VolumeDevices field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeDevices field. +func (b *EphemeralContainerCommonApplyConfiguration) WithVolumeDevices(values ...*VolumeDeviceApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumeDevices") + } + b.VolumeDevices = append(b.VolumeDevices, *values[i]) + } + return b +} + +// WithLivenessProbe sets the LivenessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LivenessProbe field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithLivenessProbe(value *ProbeApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + b.LivenessProbe = value + return b +} + +// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadinessProbe field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithReadinessProbe(value *ProbeApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + b.ReadinessProbe = value + return b +} + +// WithStartupProbe sets the StartupProbe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartupProbe field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithStartupProbe(value *ProbeApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + b.StartupProbe = value + return b +} + +// WithLifecycle sets the Lifecycle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Lifecycle field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithLifecycle(value *LifecycleApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + b.Lifecycle = value + return b +} + +// WithTerminationMessagePath sets the TerminationMessagePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationMessagePath field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithTerminationMessagePath(value string) *EphemeralContainerCommonApplyConfiguration { + b.TerminationMessagePath = &value + return b +} + +// WithTerminationMessagePolicy sets the TerminationMessagePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationMessagePolicy field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithTerminationMessagePolicy(value corev1.TerminationMessagePolicy) *EphemeralContainerCommonApplyConfiguration { + b.TerminationMessagePolicy = &value + return b +} + +// WithImagePullPolicy sets the ImagePullPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImagePullPolicy field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithImagePullPolicy(value corev1.PullPolicy) *EphemeralContainerCommonApplyConfiguration { + b.ImagePullPolicy = &value + return b +} + +// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecurityContext field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithSecurityContext(value *SecurityContextApplyConfiguration) *EphemeralContainerCommonApplyConfiguration { + b.SecurityContext = value + return b +} + +// WithStdin sets the Stdin field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Stdin field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithStdin(value bool) *EphemeralContainerCommonApplyConfiguration { + b.Stdin = &value + return b +} + +// WithStdinOnce sets the StdinOnce field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StdinOnce field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithStdinOnce(value bool) *EphemeralContainerCommonApplyConfiguration { + b.StdinOnce = &value + return b +} + +// WithTTY sets the TTY field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TTY field is set to the value of the last call. +func (b *EphemeralContainerCommonApplyConfiguration) WithTTY(value bool) *EphemeralContainerCommonApplyConfiguration { + b.TTY = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/ephemeralvolumesource.go b/pkg/clients/applyconfiguration/core/v1/ephemeralvolumesource.go new file mode 100644 index 000000000..913951a86 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/ephemeralvolumesource.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EphemeralVolumeSourceApplyConfiguration represents an declarative configuration of the EphemeralVolumeSource type for use +// with apply. +type EphemeralVolumeSourceApplyConfiguration struct { + VolumeClaimTemplate *PersistentVolumeClaimTemplateApplyConfiguration `json:"volumeClaimTemplate,omitempty"` +} + +// EphemeralVolumeSourceApplyConfiguration constructs an declarative configuration of the EphemeralVolumeSource type for use with +// apply. +func EphemeralVolumeSource() *EphemeralVolumeSourceApplyConfiguration { + return &EphemeralVolumeSourceApplyConfiguration{} +} + +// WithVolumeClaimTemplate sets the VolumeClaimTemplate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeClaimTemplate field is set to the value of the last call. +func (b *EphemeralVolumeSourceApplyConfiguration) WithVolumeClaimTemplate(value *PersistentVolumeClaimTemplateApplyConfiguration) *EphemeralVolumeSourceApplyConfiguration { + b.VolumeClaimTemplate = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/event.go b/pkg/clients/applyconfiguration/core/v1/event.go new file mode 100644 index 000000000..583dab4eb --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/event.go @@ -0,0 +1,314 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EventApplyConfiguration represents an declarative configuration of the Event type for use +// with apply. +type EventApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + InvolvedObject *ObjectReferenceApplyConfiguration `json:"involvedObject,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + Source *EventSourceApplyConfiguration `json:"source,omitempty"` + FirstTimestamp *metav1.Time `json:"firstTimestamp,omitempty"` + LastTimestamp *metav1.Time `json:"lastTimestamp,omitempty"` + Count *int32 `json:"count,omitempty"` + Type *string `json:"type,omitempty"` + EventTime *metav1.MicroTime `json:"eventTime,omitempty"` + Series *EventSeriesApplyConfiguration `json:"series,omitempty"` + Action *string `json:"action,omitempty"` + Related *ObjectReferenceApplyConfiguration `json:"related,omitempty"` + ReportingController *string `json:"reportingComponent,omitempty"` + ReportingInstance *string `json:"reportingInstance,omitempty"` +} + +// Event constructs an declarative configuration of the Event type for use with +// apply. +func Event(name, namespace string) *EventApplyConfiguration { + b := &EventApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Event") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *EventApplyConfiguration) WithKind(value string) *EventApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *EventApplyConfiguration) WithAPIVersion(value string) *EventApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EventApplyConfiguration) WithName(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *EventApplyConfiguration) WithGenerateName(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *EventApplyConfiguration) WithNamespace(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *EventApplyConfiguration) WithUID(value types.UID) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *EventApplyConfiguration) WithResourceVersion(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *EventApplyConfiguration) WithGeneration(value int64) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EventApplyConfiguration) WithLabels(entries map[string]string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EventApplyConfiguration) WithAnnotations(entries map[string]string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *EventApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *EventApplyConfiguration) WithFinalizers(values ...string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *EventApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithInvolvedObject sets the InvolvedObject field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InvolvedObject field is set to the value of the last call. +func (b *EventApplyConfiguration) WithInvolvedObject(value *ObjectReferenceApplyConfiguration) *EventApplyConfiguration { + b.InvolvedObject = value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *EventApplyConfiguration) WithReason(value string) *EventApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *EventApplyConfiguration) WithMessage(value string) *EventApplyConfiguration { + b.Message = &value + return b +} + +// WithSource sets the Source field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Source field is set to the value of the last call. +func (b *EventApplyConfiguration) WithSource(value *EventSourceApplyConfiguration) *EventApplyConfiguration { + b.Source = value + return b +} + +// WithFirstTimestamp sets the FirstTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FirstTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithFirstTimestamp(value metav1.Time) *EventApplyConfiguration { + b.FirstTimestamp = &value + return b +} + +// WithLastTimestamp sets the LastTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithLastTimestamp(value metav1.Time) *EventApplyConfiguration { + b.LastTimestamp = &value + return b +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *EventApplyConfiguration) WithCount(value int32) *EventApplyConfiguration { + b.Count = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *EventApplyConfiguration) WithType(value string) *EventApplyConfiguration { + b.Type = &value + return b +} + +// WithEventTime sets the EventTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EventTime field is set to the value of the last call. +func (b *EventApplyConfiguration) WithEventTime(value metav1.MicroTime) *EventApplyConfiguration { + b.EventTime = &value + return b +} + +// WithSeries sets the Series field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Series field is set to the value of the last call. +func (b *EventApplyConfiguration) WithSeries(value *EventSeriesApplyConfiguration) *EventApplyConfiguration { + b.Series = value + return b +} + +// WithAction sets the Action field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Action field is set to the value of the last call. +func (b *EventApplyConfiguration) WithAction(value string) *EventApplyConfiguration { + b.Action = &value + return b +} + +// WithRelated sets the Related field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Related field is set to the value of the last call. +func (b *EventApplyConfiguration) WithRelated(value *ObjectReferenceApplyConfiguration) *EventApplyConfiguration { + b.Related = value + return b +} + +// WithReportingController sets the ReportingController field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReportingController field is set to the value of the last call. +func (b *EventApplyConfiguration) WithReportingController(value string) *EventApplyConfiguration { + b.ReportingController = &value + return b +} + +// WithReportingInstance sets the ReportingInstance field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReportingInstance field is set to the value of the last call. +func (b *EventApplyConfiguration) WithReportingInstance(value string) *EventApplyConfiguration { + b.ReportingInstance = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/eventseries.go b/pkg/clients/applyconfiguration/core/v1/eventseries.go new file mode 100644 index 000000000..c2430423a --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/eventseries.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EventSeriesApplyConfiguration represents an declarative configuration of the EventSeries type for use +// with apply. +type EventSeriesApplyConfiguration struct { + Count *int32 `json:"count,omitempty"` + LastObservedTime *v1.MicroTime `json:"lastObservedTime,omitempty"` +} + +// EventSeriesApplyConfiguration constructs an declarative configuration of the EventSeries type for use with +// apply. +func EventSeries() *EventSeriesApplyConfiguration { + return &EventSeriesApplyConfiguration{} +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *EventSeriesApplyConfiguration) WithCount(value int32) *EventSeriesApplyConfiguration { + b.Count = &value + return b +} + +// WithLastObservedTime sets the LastObservedTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastObservedTime field is set to the value of the last call. +func (b *EventSeriesApplyConfiguration) WithLastObservedTime(value v1.MicroTime) *EventSeriesApplyConfiguration { + b.LastObservedTime = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/eventsource.go b/pkg/clients/applyconfiguration/core/v1/eventsource.go new file mode 100644 index 000000000..f5358f8fd --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/eventsource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EventSourceApplyConfiguration represents an declarative configuration of the EventSource type for use +// with apply. +type EventSourceApplyConfiguration struct { + Component *string `json:"component,omitempty"` + Host *string `json:"host,omitempty"` +} + +// EventSourceApplyConfiguration constructs an declarative configuration of the EventSource type for use with +// apply. +func EventSource() *EventSourceApplyConfiguration { + return &EventSourceApplyConfiguration{} +} + +// WithComponent sets the Component field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Component field is set to the value of the last call. +func (b *EventSourceApplyConfiguration) WithComponent(value string) *EventSourceApplyConfiguration { + b.Component = &value + return b +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *EventSourceApplyConfiguration) WithHost(value string) *EventSourceApplyConfiguration { + b.Host = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/execaction.go b/pkg/clients/applyconfiguration/core/v1/execaction.go new file mode 100644 index 000000000..656d5d6d7 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/execaction.go @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ExecActionApplyConfiguration represents an declarative configuration of the ExecAction type for use +// with apply. +type ExecActionApplyConfiguration struct { + Command []string `json:"command,omitempty"` +} + +// ExecActionApplyConfiguration constructs an declarative configuration of the ExecAction type for use with +// apply. +func ExecAction() *ExecActionApplyConfiguration { + return &ExecActionApplyConfiguration{} +} + +// WithCommand adds the given value to the Command field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Command field. +func (b *ExecActionApplyConfiguration) WithCommand(values ...string) *ExecActionApplyConfiguration { + for i := range values { + b.Command = append(b.Command, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/fcvolumesource.go b/pkg/clients/applyconfiguration/core/v1/fcvolumesource.go new file mode 100644 index 000000000..339ae1083 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/fcvolumesource.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// FCVolumeSourceApplyConfiguration represents an declarative configuration of the FCVolumeSource type for use +// with apply. +type FCVolumeSourceApplyConfiguration struct { + TargetWWNs []string `json:"targetWWNs,omitempty"` + Lun *int32 `json:"lun,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + WWIDs []string `json:"wwids,omitempty"` +} + +// FCVolumeSourceApplyConfiguration constructs an declarative configuration of the FCVolumeSource type for use with +// apply. +func FCVolumeSource() *FCVolumeSourceApplyConfiguration { + return &FCVolumeSourceApplyConfiguration{} +} + +// WithTargetWWNs adds the given value to the TargetWWNs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TargetWWNs field. +func (b *FCVolumeSourceApplyConfiguration) WithTargetWWNs(values ...string) *FCVolumeSourceApplyConfiguration { + for i := range values { + b.TargetWWNs = append(b.TargetWWNs, values[i]) + } + return b +} + +// WithLun sets the Lun field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Lun field is set to the value of the last call. +func (b *FCVolumeSourceApplyConfiguration) WithLun(value int32) *FCVolumeSourceApplyConfiguration { + b.Lun = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *FCVolumeSourceApplyConfiguration) WithFSType(value string) *FCVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *FCVolumeSourceApplyConfiguration) WithReadOnly(value bool) *FCVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithWWIDs adds the given value to the WWIDs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the WWIDs field. +func (b *FCVolumeSourceApplyConfiguration) WithWWIDs(values ...string) *FCVolumeSourceApplyConfiguration { + for i := range values { + b.WWIDs = append(b.WWIDs, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/flexpersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/flexpersistentvolumesource.go new file mode 100644 index 000000000..5305f9027 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/flexpersistentvolumesource.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// FlexPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the FlexPersistentVolumeSource type for use +// with apply. +type FlexPersistentVolumeSourceApplyConfiguration struct { + Driver *string `json:"driver,omitempty"` + FSType *string `json:"fsType,omitempty"` + SecretRef *SecretReferenceApplyConfiguration `json:"secretRef,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Options map[string]string `json:"options,omitempty"` +} + +// FlexPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the FlexPersistentVolumeSource type for use with +// apply. +func FlexPersistentVolumeSource() *FlexPersistentVolumeSourceApplyConfiguration { + return &FlexPersistentVolumeSourceApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *FlexPersistentVolumeSourceApplyConfiguration) WithDriver(value string) *FlexPersistentVolumeSourceApplyConfiguration { + b.Driver = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *FlexPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *FlexPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *FlexPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *SecretReferenceApplyConfiguration) *FlexPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *FlexPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *FlexPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithOptions puts the entries into the Options field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Options field, +// overwriting an existing map entries in Options field with the same key. +func (b *FlexPersistentVolumeSourceApplyConfiguration) WithOptions(entries map[string]string) *FlexPersistentVolumeSourceApplyConfiguration { + if b.Options == nil && len(entries) > 0 { + b.Options = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Options[k] = v + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/flexvolumesource.go b/pkg/clients/applyconfiguration/core/v1/flexvolumesource.go new file mode 100644 index 000000000..022cf5d10 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/flexvolumesource.go @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// FlexVolumeSourceApplyConfiguration represents an declarative configuration of the FlexVolumeSource type for use +// with apply. +type FlexVolumeSourceApplyConfiguration struct { + Driver *string `json:"driver,omitempty"` + FSType *string `json:"fsType,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Options map[string]string `json:"options,omitempty"` +} + +// FlexVolumeSourceApplyConfiguration constructs an declarative configuration of the FlexVolumeSource type for use with +// apply. +func FlexVolumeSource() *FlexVolumeSourceApplyConfiguration { + return &FlexVolumeSourceApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *FlexVolumeSourceApplyConfiguration) WithDriver(value string) *FlexVolumeSourceApplyConfiguration { + b.Driver = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *FlexVolumeSourceApplyConfiguration) WithFSType(value string) *FlexVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *FlexVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *FlexVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *FlexVolumeSourceApplyConfiguration) WithReadOnly(value bool) *FlexVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithOptions puts the entries into the Options field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Options field, +// overwriting an existing map entries in Options field with the same key. +func (b *FlexVolumeSourceApplyConfiguration) WithOptions(entries map[string]string) *FlexVolumeSourceApplyConfiguration { + if b.Options == nil && len(entries) > 0 { + b.Options = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Options[k] = v + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/flockervolumesource.go b/pkg/clients/applyconfiguration/core/v1/flockervolumesource.go new file mode 100644 index 000000000..215731c4f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/flockervolumesource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// FlockerVolumeSourceApplyConfiguration represents an declarative configuration of the FlockerVolumeSource type for use +// with apply. +type FlockerVolumeSourceApplyConfiguration struct { + DatasetName *string `json:"datasetName,omitempty"` + DatasetUUID *string `json:"datasetUUID,omitempty"` +} + +// FlockerVolumeSourceApplyConfiguration constructs an declarative configuration of the FlockerVolumeSource type for use with +// apply. +func FlockerVolumeSource() *FlockerVolumeSourceApplyConfiguration { + return &FlockerVolumeSourceApplyConfiguration{} +} + +// WithDatasetName sets the DatasetName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DatasetName field is set to the value of the last call. +func (b *FlockerVolumeSourceApplyConfiguration) WithDatasetName(value string) *FlockerVolumeSourceApplyConfiguration { + b.DatasetName = &value + return b +} + +// WithDatasetUUID sets the DatasetUUID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DatasetUUID field is set to the value of the last call. +func (b *FlockerVolumeSourceApplyConfiguration) WithDatasetUUID(value string) *FlockerVolumeSourceApplyConfiguration { + b.DatasetUUID = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/gcepersistentdiskvolumesource.go b/pkg/clients/applyconfiguration/core/v1/gcepersistentdiskvolumesource.go new file mode 100644 index 000000000..a8e50fdfd --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/gcepersistentdiskvolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// GCEPersistentDiskVolumeSourceApplyConfiguration represents an declarative configuration of the GCEPersistentDiskVolumeSource type for use +// with apply. +type GCEPersistentDiskVolumeSourceApplyConfiguration struct { + PDName *string `json:"pdName,omitempty"` + FSType *string `json:"fsType,omitempty"` + Partition *int32 `json:"partition,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// GCEPersistentDiskVolumeSourceApplyConfiguration constructs an declarative configuration of the GCEPersistentDiskVolumeSource type for use with +// apply. +func GCEPersistentDiskVolumeSource() *GCEPersistentDiskVolumeSourceApplyConfiguration { + return &GCEPersistentDiskVolumeSourceApplyConfiguration{} +} + +// WithPDName sets the PDName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PDName field is set to the value of the last call. +func (b *GCEPersistentDiskVolumeSourceApplyConfiguration) WithPDName(value string) *GCEPersistentDiskVolumeSourceApplyConfiguration { + b.PDName = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *GCEPersistentDiskVolumeSourceApplyConfiguration) WithFSType(value string) *GCEPersistentDiskVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithPartition sets the Partition field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Partition field is set to the value of the last call. +func (b *GCEPersistentDiskVolumeSourceApplyConfiguration) WithPartition(value int32) *GCEPersistentDiskVolumeSourceApplyConfiguration { + b.Partition = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *GCEPersistentDiskVolumeSourceApplyConfiguration) WithReadOnly(value bool) *GCEPersistentDiskVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/gitrepovolumesource.go b/pkg/clients/applyconfiguration/core/v1/gitrepovolumesource.go new file mode 100644 index 000000000..71d724284 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/gitrepovolumesource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// GitRepoVolumeSourceApplyConfiguration represents an declarative configuration of the GitRepoVolumeSource type for use +// with apply. +type GitRepoVolumeSourceApplyConfiguration struct { + Repository *string `json:"repository,omitempty"` + Revision *string `json:"revision,omitempty"` + Directory *string `json:"directory,omitempty"` +} + +// GitRepoVolumeSourceApplyConfiguration constructs an declarative configuration of the GitRepoVolumeSource type for use with +// apply. +func GitRepoVolumeSource() *GitRepoVolumeSourceApplyConfiguration { + return &GitRepoVolumeSourceApplyConfiguration{} +} + +// WithRepository sets the Repository field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Repository field is set to the value of the last call. +func (b *GitRepoVolumeSourceApplyConfiguration) WithRepository(value string) *GitRepoVolumeSourceApplyConfiguration { + b.Repository = &value + return b +} + +// WithRevision sets the Revision field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Revision field is set to the value of the last call. +func (b *GitRepoVolumeSourceApplyConfiguration) WithRevision(value string) *GitRepoVolumeSourceApplyConfiguration { + b.Revision = &value + return b +} + +// WithDirectory sets the Directory field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Directory field is set to the value of the last call. +func (b *GitRepoVolumeSourceApplyConfiguration) WithDirectory(value string) *GitRepoVolumeSourceApplyConfiguration { + b.Directory = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/glusterfspersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/glusterfspersistentvolumesource.go new file mode 100644 index 000000000..bc8226044 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/glusterfspersistentvolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// GlusterfsPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the GlusterfsPersistentVolumeSource type for use +// with apply. +type GlusterfsPersistentVolumeSourceApplyConfiguration struct { + EndpointsName *string `json:"endpoints,omitempty"` + Path *string `json:"path,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + EndpointsNamespace *string `json:"endpointsNamespace,omitempty"` +} + +// GlusterfsPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the GlusterfsPersistentVolumeSource type for use with +// apply. +func GlusterfsPersistentVolumeSource() *GlusterfsPersistentVolumeSourceApplyConfiguration { + return &GlusterfsPersistentVolumeSourceApplyConfiguration{} +} + +// WithEndpointsName sets the EndpointsName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EndpointsName field is set to the value of the last call. +func (b *GlusterfsPersistentVolumeSourceApplyConfiguration) WithEndpointsName(value string) *GlusterfsPersistentVolumeSourceApplyConfiguration { + b.EndpointsName = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *GlusterfsPersistentVolumeSourceApplyConfiguration) WithPath(value string) *GlusterfsPersistentVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *GlusterfsPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *GlusterfsPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithEndpointsNamespace sets the EndpointsNamespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EndpointsNamespace field is set to the value of the last call. +func (b *GlusterfsPersistentVolumeSourceApplyConfiguration) WithEndpointsNamespace(value string) *GlusterfsPersistentVolumeSourceApplyConfiguration { + b.EndpointsNamespace = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/glusterfsvolumesource.go b/pkg/clients/applyconfiguration/core/v1/glusterfsvolumesource.go new file mode 100644 index 000000000..0ced562c4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/glusterfsvolumesource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// GlusterfsVolumeSourceApplyConfiguration represents an declarative configuration of the GlusterfsVolumeSource type for use +// with apply. +type GlusterfsVolumeSourceApplyConfiguration struct { + EndpointsName *string `json:"endpoints,omitempty"` + Path *string `json:"path,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// GlusterfsVolumeSourceApplyConfiguration constructs an declarative configuration of the GlusterfsVolumeSource type for use with +// apply. +func GlusterfsVolumeSource() *GlusterfsVolumeSourceApplyConfiguration { + return &GlusterfsVolumeSourceApplyConfiguration{} +} + +// WithEndpointsName sets the EndpointsName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EndpointsName field is set to the value of the last call. +func (b *GlusterfsVolumeSourceApplyConfiguration) WithEndpointsName(value string) *GlusterfsVolumeSourceApplyConfiguration { + b.EndpointsName = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *GlusterfsVolumeSourceApplyConfiguration) WithPath(value string) *GlusterfsVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *GlusterfsVolumeSourceApplyConfiguration) WithReadOnly(value bool) *GlusterfsVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/grpcaction.go b/pkg/clients/applyconfiguration/core/v1/grpcaction.go new file mode 100644 index 000000000..78c10e02e --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/grpcaction.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// GRPCActionApplyConfiguration represents an declarative configuration of the GRPCAction type for use +// with apply. +type GRPCActionApplyConfiguration struct { + Port *int32 `json:"port,omitempty"` + Service *string `json:"service,omitempty"` +} + +// GRPCActionApplyConfiguration constructs an declarative configuration of the GRPCAction type for use with +// apply. +func GRPCAction() *GRPCActionApplyConfiguration { + return &GRPCActionApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *GRPCActionApplyConfiguration) WithPort(value int32) *GRPCActionApplyConfiguration { + b.Port = &value + return b +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *GRPCActionApplyConfiguration) WithService(value string) *GRPCActionApplyConfiguration { + b.Service = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/hostalias.go b/pkg/clients/applyconfiguration/core/v1/hostalias.go new file mode 100644 index 000000000..9ebaab302 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/hostalias.go @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// HostAliasApplyConfiguration represents an declarative configuration of the HostAlias type for use +// with apply. +type HostAliasApplyConfiguration struct { + IP *string `json:"ip,omitempty"` + Hostnames []string `json:"hostnames,omitempty"` +} + +// HostAliasApplyConfiguration constructs an declarative configuration of the HostAlias type for use with +// apply. +func HostAlias() *HostAliasApplyConfiguration { + return &HostAliasApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *HostAliasApplyConfiguration) WithIP(value string) *HostAliasApplyConfiguration { + b.IP = &value + return b +} + +// WithHostnames adds the given value to the Hostnames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Hostnames field. +func (b *HostAliasApplyConfiguration) WithHostnames(values ...string) *HostAliasApplyConfiguration { + for i := range values { + b.Hostnames = append(b.Hostnames, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/hostip.go b/pkg/clients/applyconfiguration/core/v1/hostip.go new file mode 100644 index 000000000..b04a44ac4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/hostip.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// HostIPApplyConfiguration represents an declarative configuration of the HostIP type for use +// with apply. +type HostIPApplyConfiguration struct { + IP *string `json:"ip,omitempty"` +} + +// HostIPApplyConfiguration constructs an declarative configuration of the HostIP type for use with +// apply. +func HostIP() *HostIPApplyConfiguration { + return &HostIPApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *HostIPApplyConfiguration) WithIP(value string) *HostIPApplyConfiguration { + b.IP = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/hostpathvolumesource.go b/pkg/clients/applyconfiguration/core/v1/hostpathvolumesource.go new file mode 100644 index 000000000..c2e8625b2 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/hostpathvolumesource.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// HostPathVolumeSourceApplyConfiguration represents an declarative configuration of the HostPathVolumeSource type for use +// with apply. +type HostPathVolumeSourceApplyConfiguration struct { + Path *string `json:"path,omitempty"` + Type *v1.HostPathType `json:"type,omitempty"` +} + +// HostPathVolumeSourceApplyConfiguration constructs an declarative configuration of the HostPathVolumeSource type for use with +// apply. +func HostPathVolumeSource() *HostPathVolumeSourceApplyConfiguration { + return &HostPathVolumeSourceApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *HostPathVolumeSourceApplyConfiguration) WithPath(value string) *HostPathVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *HostPathVolumeSourceApplyConfiguration) WithType(value v1.HostPathType) *HostPathVolumeSourceApplyConfiguration { + b.Type = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/httpgetaction.go b/pkg/clients/applyconfiguration/core/v1/httpgetaction.go new file mode 100644 index 000000000..f22e1f39a --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/httpgetaction.go @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// HTTPGetActionApplyConfiguration represents an declarative configuration of the HTTPGetAction type for use +// with apply. +type HTTPGetActionApplyConfiguration struct { + Path *string `json:"path,omitempty"` + Port *intstr.IntOrString `json:"port,omitempty"` + Host *string `json:"host,omitempty"` + Scheme *v1.URIScheme `json:"scheme,omitempty"` + HTTPHeaders []HTTPHeaderApplyConfiguration `json:"httpHeaders,omitempty"` +} + +// HTTPGetActionApplyConfiguration constructs an declarative configuration of the HTTPGetAction type for use with +// apply. +func HTTPGetAction() *HTTPGetActionApplyConfiguration { + return &HTTPGetActionApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *HTTPGetActionApplyConfiguration) WithPath(value string) *HTTPGetActionApplyConfiguration { + b.Path = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *HTTPGetActionApplyConfiguration) WithPort(value intstr.IntOrString) *HTTPGetActionApplyConfiguration { + b.Port = &value + return b +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *HTTPGetActionApplyConfiguration) WithHost(value string) *HTTPGetActionApplyConfiguration { + b.Host = &value + return b +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *HTTPGetActionApplyConfiguration) WithScheme(value v1.URIScheme) *HTTPGetActionApplyConfiguration { + b.Scheme = &value + return b +} + +// WithHTTPHeaders adds the given value to the HTTPHeaders field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the HTTPHeaders field. +func (b *HTTPGetActionApplyConfiguration) WithHTTPHeaders(values ...*HTTPHeaderApplyConfiguration) *HTTPGetActionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHTTPHeaders") + } + b.HTTPHeaders = append(b.HTTPHeaders, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/httpheader.go b/pkg/clients/applyconfiguration/core/v1/httpheader.go new file mode 100644 index 000000000..5a14f1aab --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/httpheader.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// HTTPHeaderApplyConfiguration represents an declarative configuration of the HTTPHeader type for use +// with apply. +type HTTPHeaderApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// HTTPHeaderApplyConfiguration constructs an declarative configuration of the HTTPHeader type for use with +// apply. +func HTTPHeader() *HTTPHeaderApplyConfiguration { + return &HTTPHeaderApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *HTTPHeaderApplyConfiguration) WithName(value string) *HTTPHeaderApplyConfiguration { + b.Name = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *HTTPHeaderApplyConfiguration) WithValue(value string) *HTTPHeaderApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/iscsipersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/iscsipersistentvolumesource.go new file mode 100644 index 000000000..0b2ad21ab --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/iscsipersistentvolumesource.go @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ISCSIPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the ISCSIPersistentVolumeSource type for use +// with apply. +type ISCSIPersistentVolumeSourceApplyConfiguration struct { + TargetPortal *string `json:"targetPortal,omitempty"` + IQN *string `json:"iqn,omitempty"` + Lun *int32 `json:"lun,omitempty"` + ISCSIInterface *string `json:"iscsiInterface,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Portals []string `json:"portals,omitempty"` + DiscoveryCHAPAuth *bool `json:"chapAuthDiscovery,omitempty"` + SessionCHAPAuth *bool `json:"chapAuthSession,omitempty"` + SecretRef *SecretReferenceApplyConfiguration `json:"secretRef,omitempty"` + InitiatorName *string `json:"initiatorName,omitempty"` +} + +// ISCSIPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the ISCSIPersistentVolumeSource type for use with +// apply. +func ISCSIPersistentVolumeSource() *ISCSIPersistentVolumeSourceApplyConfiguration { + return &ISCSIPersistentVolumeSourceApplyConfiguration{} +} + +// WithTargetPortal sets the TargetPortal field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetPortal field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithTargetPortal(value string) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.TargetPortal = &value + return b +} + +// WithIQN sets the IQN field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IQN field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithIQN(value string) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.IQN = &value + return b +} + +// WithLun sets the Lun field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Lun field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithLun(value int32) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.Lun = &value + return b +} + +// WithISCSIInterface sets the ISCSIInterface field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ISCSIInterface field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithISCSIInterface(value string) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.ISCSIInterface = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithPortals adds the given value to the Portals field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Portals field. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithPortals(values ...string) *ISCSIPersistentVolumeSourceApplyConfiguration { + for i := range values { + b.Portals = append(b.Portals, values[i]) + } + return b +} + +// WithDiscoveryCHAPAuth sets the DiscoveryCHAPAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DiscoveryCHAPAuth field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithDiscoveryCHAPAuth(value bool) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.DiscoveryCHAPAuth = &value + return b +} + +// WithSessionCHAPAuth sets the SessionCHAPAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SessionCHAPAuth field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithSessionCHAPAuth(value bool) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.SessionCHAPAuth = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *SecretReferenceApplyConfiguration) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithInitiatorName sets the InitiatorName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InitiatorName field is set to the value of the last call. +func (b *ISCSIPersistentVolumeSourceApplyConfiguration) WithInitiatorName(value string) *ISCSIPersistentVolumeSourceApplyConfiguration { + b.InitiatorName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/iscsivolumesource.go b/pkg/clients/applyconfiguration/core/v1/iscsivolumesource.go new file mode 100644 index 000000000..77acfde12 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/iscsivolumesource.go @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ISCSIVolumeSourceApplyConfiguration represents an declarative configuration of the ISCSIVolumeSource type for use +// with apply. +type ISCSIVolumeSourceApplyConfiguration struct { + TargetPortal *string `json:"targetPortal,omitempty"` + IQN *string `json:"iqn,omitempty"` + Lun *int32 `json:"lun,omitempty"` + ISCSIInterface *string `json:"iscsiInterface,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Portals []string `json:"portals,omitempty"` + DiscoveryCHAPAuth *bool `json:"chapAuthDiscovery,omitempty"` + SessionCHAPAuth *bool `json:"chapAuthSession,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` + InitiatorName *string `json:"initiatorName,omitempty"` +} + +// ISCSIVolumeSourceApplyConfiguration constructs an declarative configuration of the ISCSIVolumeSource type for use with +// apply. +func ISCSIVolumeSource() *ISCSIVolumeSourceApplyConfiguration { + return &ISCSIVolumeSourceApplyConfiguration{} +} + +// WithTargetPortal sets the TargetPortal field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetPortal field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithTargetPortal(value string) *ISCSIVolumeSourceApplyConfiguration { + b.TargetPortal = &value + return b +} + +// WithIQN sets the IQN field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IQN field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithIQN(value string) *ISCSIVolumeSourceApplyConfiguration { + b.IQN = &value + return b +} + +// WithLun sets the Lun field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Lun field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithLun(value int32) *ISCSIVolumeSourceApplyConfiguration { + b.Lun = &value + return b +} + +// WithISCSIInterface sets the ISCSIInterface field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ISCSIInterface field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithISCSIInterface(value string) *ISCSIVolumeSourceApplyConfiguration { + b.ISCSIInterface = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithFSType(value string) *ISCSIVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithReadOnly(value bool) *ISCSIVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithPortals adds the given value to the Portals field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Portals field. +func (b *ISCSIVolumeSourceApplyConfiguration) WithPortals(values ...string) *ISCSIVolumeSourceApplyConfiguration { + for i := range values { + b.Portals = append(b.Portals, values[i]) + } + return b +} + +// WithDiscoveryCHAPAuth sets the DiscoveryCHAPAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DiscoveryCHAPAuth field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithDiscoveryCHAPAuth(value bool) *ISCSIVolumeSourceApplyConfiguration { + b.DiscoveryCHAPAuth = &value + return b +} + +// WithSessionCHAPAuth sets the SessionCHAPAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SessionCHAPAuth field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithSessionCHAPAuth(value bool) *ISCSIVolumeSourceApplyConfiguration { + b.SessionCHAPAuth = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *ISCSIVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithInitiatorName sets the InitiatorName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InitiatorName field is set to the value of the last call. +func (b *ISCSIVolumeSourceApplyConfiguration) WithInitiatorName(value string) *ISCSIVolumeSourceApplyConfiguration { + b.InitiatorName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/keytopath.go b/pkg/clients/applyconfiguration/core/v1/keytopath.go new file mode 100644 index 000000000..0b30f942b --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/keytopath.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// KeyToPathApplyConfiguration represents an declarative configuration of the KeyToPath type for use +// with apply. +type KeyToPathApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Path *string `json:"path,omitempty"` + Mode *int32 `json:"mode,omitempty"` +} + +// KeyToPathApplyConfiguration constructs an declarative configuration of the KeyToPath type for use with +// apply. +func KeyToPath() *KeyToPathApplyConfiguration { + return &KeyToPathApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *KeyToPathApplyConfiguration) WithKey(value string) *KeyToPathApplyConfiguration { + b.Key = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *KeyToPathApplyConfiguration) WithPath(value string) *KeyToPathApplyConfiguration { + b.Path = &value + return b +} + +// WithMode sets the Mode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Mode field is set to the value of the last call. +func (b *KeyToPathApplyConfiguration) WithMode(value int32) *KeyToPathApplyConfiguration { + b.Mode = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/lifecycle.go b/pkg/clients/applyconfiguration/core/v1/lifecycle.go new file mode 100644 index 000000000..c21ca70d1 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/lifecycle.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LifecycleApplyConfiguration represents an declarative configuration of the Lifecycle type for use +// with apply. +type LifecycleApplyConfiguration struct { + PostStart *LifecycleHandlerApplyConfiguration `json:"postStart,omitempty"` + PreStop *LifecycleHandlerApplyConfiguration `json:"preStop,omitempty"` +} + +// LifecycleApplyConfiguration constructs an declarative configuration of the Lifecycle type for use with +// apply. +func Lifecycle() *LifecycleApplyConfiguration { + return &LifecycleApplyConfiguration{} +} + +// WithPostStart sets the PostStart field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PostStart field is set to the value of the last call. +func (b *LifecycleApplyConfiguration) WithPostStart(value *LifecycleHandlerApplyConfiguration) *LifecycleApplyConfiguration { + b.PostStart = value + return b +} + +// WithPreStop sets the PreStop field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreStop field is set to the value of the last call. +func (b *LifecycleApplyConfiguration) WithPreStop(value *LifecycleHandlerApplyConfiguration) *LifecycleApplyConfiguration { + b.PreStop = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/lifecyclehandler.go b/pkg/clients/applyconfiguration/core/v1/lifecyclehandler.go new file mode 100644 index 000000000..8365283f6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/lifecyclehandler.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LifecycleHandlerApplyConfiguration represents an declarative configuration of the LifecycleHandler type for use +// with apply. +type LifecycleHandlerApplyConfiguration struct { + Exec *ExecActionApplyConfiguration `json:"exec,omitempty"` + HTTPGet *HTTPGetActionApplyConfiguration `json:"httpGet,omitempty"` + TCPSocket *TCPSocketActionApplyConfiguration `json:"tcpSocket,omitempty"` + Sleep *SleepActionApplyConfiguration `json:"sleep,omitempty"` +} + +// LifecycleHandlerApplyConfiguration constructs an declarative configuration of the LifecycleHandler type for use with +// apply. +func LifecycleHandler() *LifecycleHandlerApplyConfiguration { + return &LifecycleHandlerApplyConfiguration{} +} + +// WithExec sets the Exec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Exec field is set to the value of the last call. +func (b *LifecycleHandlerApplyConfiguration) WithExec(value *ExecActionApplyConfiguration) *LifecycleHandlerApplyConfiguration { + b.Exec = value + return b +} + +// WithHTTPGet sets the HTTPGet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HTTPGet field is set to the value of the last call. +func (b *LifecycleHandlerApplyConfiguration) WithHTTPGet(value *HTTPGetActionApplyConfiguration) *LifecycleHandlerApplyConfiguration { + b.HTTPGet = value + return b +} + +// WithTCPSocket sets the TCPSocket field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TCPSocket field is set to the value of the last call. +func (b *LifecycleHandlerApplyConfiguration) WithTCPSocket(value *TCPSocketActionApplyConfiguration) *LifecycleHandlerApplyConfiguration { + b.TCPSocket = value + return b +} + +// WithSleep sets the Sleep field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sleep field is set to the value of the last call. +func (b *LifecycleHandlerApplyConfiguration) WithSleep(value *SleepActionApplyConfiguration) *LifecycleHandlerApplyConfiguration { + b.Sleep = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/limitrange.go b/pkg/clients/applyconfiguration/core/v1/limitrange.go new file mode 100644 index 000000000..fffa6523f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/limitrange.go @@ -0,0 +1,197 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// LimitRangeApplyConfiguration represents an declarative configuration of the LimitRange type for use +// with apply. +type LimitRangeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *LimitRangeSpecApplyConfiguration `json:"spec,omitempty"` +} + +// LimitRange constructs an declarative configuration of the LimitRange type for use with +// apply. +func LimitRange(name, namespace string) *LimitRangeApplyConfiguration { + b := &LimitRangeApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("LimitRange") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithKind(value string) *LimitRangeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithAPIVersion(value string) *LimitRangeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithName(value string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithGenerateName(value string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithNamespace(value string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithUID(value types.UID) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithResourceVersion(value string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithGeneration(value int64) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *LimitRangeApplyConfiguration) WithLabels(entries map[string]string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *LimitRangeApplyConfiguration) WithAnnotations(entries map[string]string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *LimitRangeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *LimitRangeApplyConfiguration) WithFinalizers(values ...string) *LimitRangeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *LimitRangeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *LimitRangeApplyConfiguration) WithSpec(value *LimitRangeSpecApplyConfiguration) *LimitRangeApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/limitrangeitem.go b/pkg/clients/applyconfiguration/core/v1/limitrangeitem.go new file mode 100644 index 000000000..b52876324 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/limitrangeitem.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// LimitRangeItemApplyConfiguration represents an declarative configuration of the LimitRangeItem type for use +// with apply. +type LimitRangeItemApplyConfiguration struct { + Type *v1.LimitType `json:"type,omitempty"` + Max *v1.ResourceList `json:"max,omitempty"` + Min *v1.ResourceList `json:"min,omitempty"` + Default *v1.ResourceList `json:"default,omitempty"` + DefaultRequest *v1.ResourceList `json:"defaultRequest,omitempty"` + MaxLimitRequestRatio *v1.ResourceList `json:"maxLimitRequestRatio,omitempty"` +} + +// LimitRangeItemApplyConfiguration constructs an declarative configuration of the LimitRangeItem type for use with +// apply. +func LimitRangeItem() *LimitRangeItemApplyConfiguration { + return &LimitRangeItemApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *LimitRangeItemApplyConfiguration) WithType(value v1.LimitType) *LimitRangeItemApplyConfiguration { + b.Type = &value + return b +} + +// WithMax sets the Max field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Max field is set to the value of the last call. +func (b *LimitRangeItemApplyConfiguration) WithMax(value v1.ResourceList) *LimitRangeItemApplyConfiguration { + b.Max = &value + return b +} + +// WithMin sets the Min field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Min field is set to the value of the last call. +func (b *LimitRangeItemApplyConfiguration) WithMin(value v1.ResourceList) *LimitRangeItemApplyConfiguration { + b.Min = &value + return b +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *LimitRangeItemApplyConfiguration) WithDefault(value v1.ResourceList) *LimitRangeItemApplyConfiguration { + b.Default = &value + return b +} + +// WithDefaultRequest sets the DefaultRequest field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultRequest field is set to the value of the last call. +func (b *LimitRangeItemApplyConfiguration) WithDefaultRequest(value v1.ResourceList) *LimitRangeItemApplyConfiguration { + b.DefaultRequest = &value + return b +} + +// WithMaxLimitRequestRatio sets the MaxLimitRequestRatio field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxLimitRequestRatio field is set to the value of the last call. +func (b *LimitRangeItemApplyConfiguration) WithMaxLimitRequestRatio(value v1.ResourceList) *LimitRangeItemApplyConfiguration { + b.MaxLimitRequestRatio = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/limitrangespec.go b/pkg/clients/applyconfiguration/core/v1/limitrangespec.go new file mode 100644 index 000000000..0ff5e396f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/limitrangespec.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LimitRangeSpecApplyConfiguration represents an declarative configuration of the LimitRangeSpec type for use +// with apply. +type LimitRangeSpecApplyConfiguration struct { + Limits []LimitRangeItemApplyConfiguration `json:"limits,omitempty"` +} + +// LimitRangeSpecApplyConfiguration constructs an declarative configuration of the LimitRangeSpec type for use with +// apply. +func LimitRangeSpec() *LimitRangeSpecApplyConfiguration { + return &LimitRangeSpecApplyConfiguration{} +} + +// WithLimits adds the given value to the Limits field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Limits field. +func (b *LimitRangeSpecApplyConfiguration) WithLimits(values ...*LimitRangeItemApplyConfiguration) *LimitRangeSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithLimits") + } + b.Limits = append(b.Limits, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/loadbalanceringress.go b/pkg/clients/applyconfiguration/core/v1/loadbalanceringress.go new file mode 100644 index 000000000..0c0c4241c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/loadbalanceringress.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// LoadBalancerIngressApplyConfiguration represents an declarative configuration of the LoadBalancerIngress type for use +// with apply. +type LoadBalancerIngressApplyConfiguration struct { + IP *string `json:"ip,omitempty"` + Hostname *string `json:"hostname,omitempty"` + IPMode *v1.LoadBalancerIPMode `json:"ipMode,omitempty"` + Ports []PortStatusApplyConfiguration `json:"ports,omitempty"` +} + +// LoadBalancerIngressApplyConfiguration constructs an declarative configuration of the LoadBalancerIngress type for use with +// apply. +func LoadBalancerIngress() *LoadBalancerIngressApplyConfiguration { + return &LoadBalancerIngressApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *LoadBalancerIngressApplyConfiguration) WithIP(value string) *LoadBalancerIngressApplyConfiguration { + b.IP = &value + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *LoadBalancerIngressApplyConfiguration) WithHostname(value string) *LoadBalancerIngressApplyConfiguration { + b.Hostname = &value + return b +} + +// WithIPMode sets the IPMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPMode field is set to the value of the last call. +func (b *LoadBalancerIngressApplyConfiguration) WithIPMode(value v1.LoadBalancerIPMode) *LoadBalancerIngressApplyConfiguration { + b.IPMode = &value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *LoadBalancerIngressApplyConfiguration) WithPorts(values ...*PortStatusApplyConfiguration) *LoadBalancerIngressApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/loadbalancerstatus.go b/pkg/clients/applyconfiguration/core/v1/loadbalancerstatus.go new file mode 100644 index 000000000..cd19db50a --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/loadbalancerstatus.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LoadBalancerStatusApplyConfiguration represents an declarative configuration of the LoadBalancerStatus type for use +// with apply. +type LoadBalancerStatusApplyConfiguration struct { + Ingress []LoadBalancerIngressApplyConfiguration `json:"ingress,omitempty"` +} + +// LoadBalancerStatusApplyConfiguration constructs an declarative configuration of the LoadBalancerStatus type for use with +// apply. +func LoadBalancerStatus() *LoadBalancerStatusApplyConfiguration { + return &LoadBalancerStatusApplyConfiguration{} +} + +// WithIngress adds the given value to the Ingress field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ingress field. +func (b *LoadBalancerStatusApplyConfiguration) WithIngress(values ...*LoadBalancerIngressApplyConfiguration) *LoadBalancerStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIngress") + } + b.Ingress = append(b.Ingress, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/localobjectreference.go b/pkg/clients/applyconfiguration/core/v1/localobjectreference.go new file mode 100644 index 000000000..cb8a8e386 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/localobjectreference.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LocalObjectReferenceApplyConfiguration represents an declarative configuration of the LocalObjectReference type for use +// with apply. +type LocalObjectReferenceApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// LocalObjectReferenceApplyConfiguration constructs an declarative configuration of the LocalObjectReference type for use with +// apply. +func LocalObjectReference() *LocalObjectReferenceApplyConfiguration { + return &LocalObjectReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LocalObjectReferenceApplyConfiguration) WithName(value string) *LocalObjectReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/localvolumesource.go b/pkg/clients/applyconfiguration/core/v1/localvolumesource.go new file mode 100644 index 000000000..dc1eb3872 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/localvolumesource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LocalVolumeSourceApplyConfiguration represents an declarative configuration of the LocalVolumeSource type for use +// with apply. +type LocalVolumeSourceApplyConfiguration struct { + Path *string `json:"path,omitempty"` + FSType *string `json:"fsType,omitempty"` +} + +// LocalVolumeSourceApplyConfiguration constructs an declarative configuration of the LocalVolumeSource type for use with +// apply. +func LocalVolumeSource() *LocalVolumeSourceApplyConfiguration { + return &LocalVolumeSourceApplyConfiguration{} +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *LocalVolumeSourceApplyConfiguration) WithPath(value string) *LocalVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *LocalVolumeSourceApplyConfiguration) WithFSType(value string) *LocalVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/modifyvolumestatus.go b/pkg/clients/applyconfiguration/core/v1/modifyvolumestatus.go new file mode 100644 index 000000000..e1f2835db --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/modifyvolumestatus.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ModifyVolumeStatusApplyConfiguration represents an declarative configuration of the ModifyVolumeStatus type for use +// with apply. +type ModifyVolumeStatusApplyConfiguration struct { + TargetVolumeAttributesClassName *string `json:"targetVolumeAttributesClassName,omitempty"` + Status *v1.PersistentVolumeClaimModifyVolumeStatus `json:"status,omitempty"` +} + +// ModifyVolumeStatusApplyConfiguration constructs an declarative configuration of the ModifyVolumeStatus type for use with +// apply. +func ModifyVolumeStatus() *ModifyVolumeStatusApplyConfiguration { + return &ModifyVolumeStatusApplyConfiguration{} +} + +// WithTargetVolumeAttributesClassName sets the TargetVolumeAttributesClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetVolumeAttributesClassName field is set to the value of the last call. +func (b *ModifyVolumeStatusApplyConfiguration) WithTargetVolumeAttributesClassName(value string) *ModifyVolumeStatusApplyConfiguration { + b.TargetVolumeAttributesClassName = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ModifyVolumeStatusApplyConfiguration) WithStatus(value v1.PersistentVolumeClaimModifyVolumeStatus) *ModifyVolumeStatusApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/namespace.go b/pkg/clients/applyconfiguration/core/v1/namespace.go new file mode 100644 index 000000000..97d184613 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/namespace.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// NamespaceApplyConfiguration represents an declarative configuration of the Namespace type for use +// with apply. +type NamespaceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *NamespaceSpecApplyConfiguration `json:"spec,omitempty"` + Status *NamespaceStatusApplyConfiguration `json:"status,omitempty"` +} + +// Namespace constructs an declarative configuration of the Namespace type for use with +// apply. +func Namespace(name string) *NamespaceApplyConfiguration { + b := &NamespaceApplyConfiguration{} + b.WithName(name) + b.WithKind("Namespace") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithKind(value string) *NamespaceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithAPIVersion(value string) *NamespaceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithName(value string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithGenerateName(value string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithNamespace(value string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithUID(value types.UID) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithResourceVersion(value string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithGeneration(value int64) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NamespaceApplyConfiguration) WithLabels(entries map[string]string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NamespaceApplyConfiguration) WithAnnotations(entries map[string]string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NamespaceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NamespaceApplyConfiguration) WithFinalizers(values ...string) *NamespaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NamespaceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithSpec(value *NamespaceSpecApplyConfiguration) *NamespaceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NamespaceApplyConfiguration) WithStatus(value *NamespaceStatusApplyConfiguration) *NamespaceApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/namespacecondition.go b/pkg/clients/applyconfiguration/core/v1/namespacecondition.go new file mode 100644 index 000000000..00dd82b46 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/namespacecondition.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NamespaceConditionApplyConfiguration represents an declarative configuration of the NamespaceCondition type for use +// with apply. +type NamespaceConditionApplyConfiguration struct { + Type *v1.NamespaceConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// NamespaceConditionApplyConfiguration constructs an declarative configuration of the NamespaceCondition type for use with +// apply. +func NamespaceCondition() *NamespaceConditionApplyConfiguration { + return &NamespaceConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *NamespaceConditionApplyConfiguration) WithType(value v1.NamespaceConditionType) *NamespaceConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NamespaceConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *NamespaceConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *NamespaceConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *NamespaceConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *NamespaceConditionApplyConfiguration) WithReason(value string) *NamespaceConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *NamespaceConditionApplyConfiguration) WithMessage(value string) *NamespaceConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/namespacespec.go b/pkg/clients/applyconfiguration/core/v1/namespacespec.go new file mode 100644 index 000000000..3ffa263d9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/namespacespec.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NamespaceSpecApplyConfiguration represents an declarative configuration of the NamespaceSpec type for use +// with apply. +type NamespaceSpecApplyConfiguration struct { + Finalizers []v1.FinalizerName `json:"finalizers,omitempty"` +} + +// NamespaceSpecApplyConfiguration constructs an declarative configuration of the NamespaceSpec type for use with +// apply. +func NamespaceSpec() *NamespaceSpecApplyConfiguration { + return &NamespaceSpecApplyConfiguration{} +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NamespaceSpecApplyConfiguration) WithFinalizers(values ...v1.FinalizerName) *NamespaceSpecApplyConfiguration { + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/namespacestatus.go b/pkg/clients/applyconfiguration/core/v1/namespacestatus.go new file mode 100644 index 000000000..9cccf1bc2 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/namespacestatus.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NamespaceStatusApplyConfiguration represents an declarative configuration of the NamespaceStatus type for use +// with apply. +type NamespaceStatusApplyConfiguration struct { + Phase *v1.NamespacePhase `json:"phase,omitempty"` + Conditions []NamespaceConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// NamespaceStatusApplyConfiguration constructs an declarative configuration of the NamespaceStatus type for use with +// apply. +func NamespaceStatus() *NamespaceStatusApplyConfiguration { + return &NamespaceStatusApplyConfiguration{} +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *NamespaceStatusApplyConfiguration) WithPhase(value v1.NamespacePhase) *NamespaceStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *NamespaceStatusApplyConfiguration) WithConditions(values ...*NamespaceConditionApplyConfiguration) *NamespaceStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nfsvolumesource.go b/pkg/clients/applyconfiguration/core/v1/nfsvolumesource.go new file mode 100644 index 000000000..922d65ef6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nfsvolumesource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NFSVolumeSourceApplyConfiguration represents an declarative configuration of the NFSVolumeSource type for use +// with apply. +type NFSVolumeSourceApplyConfiguration struct { + Server *string `json:"server,omitempty"` + Path *string `json:"path,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// NFSVolumeSourceApplyConfiguration constructs an declarative configuration of the NFSVolumeSource type for use with +// apply. +func NFSVolumeSource() *NFSVolumeSourceApplyConfiguration { + return &NFSVolumeSourceApplyConfiguration{} +} + +// WithServer sets the Server field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Server field is set to the value of the last call. +func (b *NFSVolumeSourceApplyConfiguration) WithServer(value string) *NFSVolumeSourceApplyConfiguration { + b.Server = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *NFSVolumeSourceApplyConfiguration) WithPath(value string) *NFSVolumeSourceApplyConfiguration { + b.Path = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *NFSVolumeSourceApplyConfiguration) WithReadOnly(value bool) *NFSVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/node.go b/pkg/clients/applyconfiguration/core/v1/node.go new file mode 100644 index 000000000..314d5b1ea --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/node.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// NodeApplyConfiguration represents an declarative configuration of the Node type for use +// with apply. +type NodeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *NodeSpecApplyConfiguration `json:"spec,omitempty"` + Status *NodeStatusApplyConfiguration `json:"status,omitempty"` +} + +// Node constructs an declarative configuration of the Node type for use with +// apply. +func Node(name string) *NodeApplyConfiguration { + b := &NodeApplyConfiguration{} + b.WithName(name) + b.WithKind("Node") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithKind(value string) *NodeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithAPIVersion(value string) *NodeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithName(value string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithGenerateName(value string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithNamespace(value string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithUID(value types.UID) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithResourceVersion(value string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithGeneration(value int64) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NodeApplyConfiguration) WithLabels(entries map[string]string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NodeApplyConfiguration) WithAnnotations(entries map[string]string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NodeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NodeApplyConfiguration) WithFinalizers(values ...string) *NodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NodeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithSpec(value *NodeSpecApplyConfiguration) *NodeApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NodeApplyConfiguration) WithStatus(value *NodeStatusApplyConfiguration) *NodeApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeaddress.go b/pkg/clients/applyconfiguration/core/v1/nodeaddress.go new file mode 100644 index 000000000..f36c74d96 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeaddress.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NodeAddressApplyConfiguration represents an declarative configuration of the NodeAddress type for use +// with apply. +type NodeAddressApplyConfiguration struct { + Type *v1.NodeAddressType `json:"type,omitempty"` + Address *string `json:"address,omitempty"` +} + +// NodeAddressApplyConfiguration constructs an declarative configuration of the NodeAddress type for use with +// apply. +func NodeAddress() *NodeAddressApplyConfiguration { + return &NodeAddressApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *NodeAddressApplyConfiguration) WithType(value v1.NodeAddressType) *NodeAddressApplyConfiguration { + b.Type = &value + return b +} + +// WithAddress sets the Address field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Address field is set to the value of the last call. +func (b *NodeAddressApplyConfiguration) WithAddress(value string) *NodeAddressApplyConfiguration { + b.Address = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeaffinity.go b/pkg/clients/applyconfiguration/core/v1/nodeaffinity.go new file mode 100644 index 000000000..e052a5c99 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeaffinity.go @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeAffinityApplyConfiguration represents an declarative configuration of the NodeAffinity type for use +// with apply. +type NodeAffinityApplyConfiguration struct { + RequiredDuringSchedulingIgnoredDuringExecution *NodeSelectorApplyConfiguration `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` + PreferredDuringSchedulingIgnoredDuringExecution []PreferredSchedulingTermApplyConfiguration `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` +} + +// NodeAffinityApplyConfiguration constructs an declarative configuration of the NodeAffinity type for use with +// apply. +func NodeAffinity() *NodeAffinityApplyConfiguration { + return &NodeAffinityApplyConfiguration{} +} + +// WithRequiredDuringSchedulingIgnoredDuringExecution sets the RequiredDuringSchedulingIgnoredDuringExecution field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RequiredDuringSchedulingIgnoredDuringExecution field is set to the value of the last call. +func (b *NodeAffinityApplyConfiguration) WithRequiredDuringSchedulingIgnoredDuringExecution(value *NodeSelectorApplyConfiguration) *NodeAffinityApplyConfiguration { + b.RequiredDuringSchedulingIgnoredDuringExecution = value + return b +} + +// WithPreferredDuringSchedulingIgnoredDuringExecution adds the given value to the PreferredDuringSchedulingIgnoredDuringExecution field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PreferredDuringSchedulingIgnoredDuringExecution field. +func (b *NodeAffinityApplyConfiguration) WithPreferredDuringSchedulingIgnoredDuringExecution(values ...*PreferredSchedulingTermApplyConfiguration) *NodeAffinityApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPreferredDuringSchedulingIgnoredDuringExecution") + } + b.PreferredDuringSchedulingIgnoredDuringExecution = append(b.PreferredDuringSchedulingIgnoredDuringExecution, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodecondition.go b/pkg/clients/applyconfiguration/core/v1/nodecondition.go new file mode 100644 index 000000000..f29c7f3a4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodecondition.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodeConditionApplyConfiguration represents an declarative configuration of the NodeCondition type for use +// with apply. +type NodeConditionApplyConfiguration struct { + Type *v1.NodeConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastHeartbeatTime *metav1.Time `json:"lastHeartbeatTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// NodeConditionApplyConfiguration constructs an declarative configuration of the NodeCondition type for use with +// apply. +func NodeCondition() *NodeConditionApplyConfiguration { + return &NodeConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *NodeConditionApplyConfiguration) WithType(value v1.NodeConditionType) *NodeConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NodeConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *NodeConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastHeartbeatTime sets the LastHeartbeatTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastHeartbeatTime field is set to the value of the last call. +func (b *NodeConditionApplyConfiguration) WithLastHeartbeatTime(value metav1.Time) *NodeConditionApplyConfiguration { + b.LastHeartbeatTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *NodeConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *NodeConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *NodeConditionApplyConfiguration) WithReason(value string) *NodeConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *NodeConditionApplyConfiguration) WithMessage(value string) *NodeConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeconfigsource.go b/pkg/clients/applyconfiguration/core/v1/nodeconfigsource.go new file mode 100644 index 000000000..f9dd89b7c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeconfigsource.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeConfigSourceApplyConfiguration represents an declarative configuration of the NodeConfigSource type for use +// with apply. +type NodeConfigSourceApplyConfiguration struct { + ConfigMap *ConfigMapNodeConfigSourceApplyConfiguration `json:"configMap,omitempty"` +} + +// NodeConfigSourceApplyConfiguration constructs an declarative configuration of the NodeConfigSource type for use with +// apply. +func NodeConfigSource() *NodeConfigSourceApplyConfiguration { + return &NodeConfigSourceApplyConfiguration{} +} + +// WithConfigMap sets the ConfigMap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMap field is set to the value of the last call. +func (b *NodeConfigSourceApplyConfiguration) WithConfigMap(value *ConfigMapNodeConfigSourceApplyConfiguration) *NodeConfigSourceApplyConfiguration { + b.ConfigMap = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeconfigstatus.go b/pkg/clients/applyconfiguration/core/v1/nodeconfigstatus.go new file mode 100644 index 000000000..023b12012 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeconfigstatus.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeConfigStatusApplyConfiguration represents an declarative configuration of the NodeConfigStatus type for use +// with apply. +type NodeConfigStatusApplyConfiguration struct { + Assigned *NodeConfigSourceApplyConfiguration `json:"assigned,omitempty"` + Active *NodeConfigSourceApplyConfiguration `json:"active,omitempty"` + LastKnownGood *NodeConfigSourceApplyConfiguration `json:"lastKnownGood,omitempty"` + Error *string `json:"error,omitempty"` +} + +// NodeConfigStatusApplyConfiguration constructs an declarative configuration of the NodeConfigStatus type for use with +// apply. +func NodeConfigStatus() *NodeConfigStatusApplyConfiguration { + return &NodeConfigStatusApplyConfiguration{} +} + +// WithAssigned sets the Assigned field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Assigned field is set to the value of the last call. +func (b *NodeConfigStatusApplyConfiguration) WithAssigned(value *NodeConfigSourceApplyConfiguration) *NodeConfigStatusApplyConfiguration { + b.Assigned = value + return b +} + +// WithActive sets the Active field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Active field is set to the value of the last call. +func (b *NodeConfigStatusApplyConfiguration) WithActive(value *NodeConfigSourceApplyConfiguration) *NodeConfigStatusApplyConfiguration { + b.Active = value + return b +} + +// WithLastKnownGood sets the LastKnownGood field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastKnownGood field is set to the value of the last call. +func (b *NodeConfigStatusApplyConfiguration) WithLastKnownGood(value *NodeConfigSourceApplyConfiguration) *NodeConfigStatusApplyConfiguration { + b.LastKnownGood = value + return b +} + +// WithError sets the Error field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Error field is set to the value of the last call. +func (b *NodeConfigStatusApplyConfiguration) WithError(value string) *NodeConfigStatusApplyConfiguration { + b.Error = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodedaemonendpoints.go b/pkg/clients/applyconfiguration/core/v1/nodedaemonendpoints.go new file mode 100644 index 000000000..461f635a4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodedaemonendpoints.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeDaemonEndpointsApplyConfiguration represents an declarative configuration of the NodeDaemonEndpoints type for use +// with apply. +type NodeDaemonEndpointsApplyConfiguration struct { + KubeletEndpoint *DaemonEndpointApplyConfiguration `json:"kubeletEndpoint,omitempty"` +} + +// NodeDaemonEndpointsApplyConfiguration constructs an declarative configuration of the NodeDaemonEndpoints type for use with +// apply. +func NodeDaemonEndpoints() *NodeDaemonEndpointsApplyConfiguration { + return &NodeDaemonEndpointsApplyConfiguration{} +} + +// WithKubeletEndpoint sets the KubeletEndpoint field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the KubeletEndpoint field is set to the value of the last call. +func (b *NodeDaemonEndpointsApplyConfiguration) WithKubeletEndpoint(value *DaemonEndpointApplyConfiguration) *NodeDaemonEndpointsApplyConfiguration { + b.KubeletEndpoint = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeselector.go b/pkg/clients/applyconfiguration/core/v1/nodeselector.go new file mode 100644 index 000000000..f74087c6f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeselector.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeSelectorApplyConfiguration represents an declarative configuration of the NodeSelector type for use +// with apply. +type NodeSelectorApplyConfiguration struct { + NodeSelectorTerms []NodeSelectorTermApplyConfiguration `json:"nodeSelectorTerms,omitempty"` +} + +// NodeSelectorApplyConfiguration constructs an declarative configuration of the NodeSelector type for use with +// apply. +func NodeSelector() *NodeSelectorApplyConfiguration { + return &NodeSelectorApplyConfiguration{} +} + +// WithNodeSelectorTerms adds the given value to the NodeSelectorTerms field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NodeSelectorTerms field. +func (b *NodeSelectorApplyConfiguration) WithNodeSelectorTerms(values ...*NodeSelectorTermApplyConfiguration) *NodeSelectorApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNodeSelectorTerms") + } + b.NodeSelectorTerms = append(b.NodeSelectorTerms, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeselectorrequirement.go b/pkg/clients/applyconfiguration/core/v1/nodeselectorrequirement.go new file mode 100644 index 000000000..59dc2f5f9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeselectorrequirement.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NodeSelectorRequirementApplyConfiguration represents an declarative configuration of the NodeSelectorRequirement type for use +// with apply. +type NodeSelectorRequirementApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Operator *v1.NodeSelectorOperator `json:"operator,omitempty"` + Values []string `json:"values,omitempty"` +} + +// NodeSelectorRequirementApplyConfiguration constructs an declarative configuration of the NodeSelectorRequirement type for use with +// apply. +func NodeSelectorRequirement() *NodeSelectorRequirementApplyConfiguration { + return &NodeSelectorRequirementApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *NodeSelectorRequirementApplyConfiguration) WithKey(value string) *NodeSelectorRequirementApplyConfiguration { + b.Key = &value + return b +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *NodeSelectorRequirementApplyConfiguration) WithOperator(value v1.NodeSelectorOperator) *NodeSelectorRequirementApplyConfiguration { + b.Operator = &value + return b +} + +// WithValues adds the given value to the Values field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Values field. +func (b *NodeSelectorRequirementApplyConfiguration) WithValues(values ...string) *NodeSelectorRequirementApplyConfiguration { + for i := range values { + b.Values = append(b.Values, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodeselectorterm.go b/pkg/clients/applyconfiguration/core/v1/nodeselectorterm.go new file mode 100644 index 000000000..7c7b36a7b --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodeselectorterm.go @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeSelectorTermApplyConfiguration represents an declarative configuration of the NodeSelectorTerm type for use +// with apply. +type NodeSelectorTermApplyConfiguration struct { + MatchExpressions []NodeSelectorRequirementApplyConfiguration `json:"matchExpressions,omitempty"` + MatchFields []NodeSelectorRequirementApplyConfiguration `json:"matchFields,omitempty"` +} + +// NodeSelectorTermApplyConfiguration constructs an declarative configuration of the NodeSelectorTerm type for use with +// apply. +func NodeSelectorTerm() *NodeSelectorTermApplyConfiguration { + return &NodeSelectorTermApplyConfiguration{} +} + +// WithMatchExpressions adds the given value to the MatchExpressions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchExpressions field. +func (b *NodeSelectorTermApplyConfiguration) WithMatchExpressions(values ...*NodeSelectorRequirementApplyConfiguration) *NodeSelectorTermApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchExpressions") + } + b.MatchExpressions = append(b.MatchExpressions, *values[i]) + } + return b +} + +// WithMatchFields adds the given value to the MatchFields field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchFields field. +func (b *NodeSelectorTermApplyConfiguration) WithMatchFields(values ...*NodeSelectorRequirementApplyConfiguration) *NodeSelectorTermApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchFields") + } + b.MatchFields = append(b.MatchFields, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodespec.go b/pkg/clients/applyconfiguration/core/v1/nodespec.go new file mode 100644 index 000000000..160da8f33 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodespec.go @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeSpecApplyConfiguration represents an declarative configuration of the NodeSpec type for use +// with apply. +type NodeSpecApplyConfiguration struct { + PodCIDR *string `json:"podCIDR,omitempty"` + PodCIDRs []string `json:"podCIDRs,omitempty"` + ProviderID *string `json:"providerID,omitempty"` + Unschedulable *bool `json:"unschedulable,omitempty"` + Taints []TaintApplyConfiguration `json:"taints,omitempty"` + ConfigSource *NodeConfigSourceApplyConfiguration `json:"configSource,omitempty"` + DoNotUseExternalID *string `json:"externalID,omitempty"` +} + +// NodeSpecApplyConfiguration constructs an declarative configuration of the NodeSpec type for use with +// apply. +func NodeSpec() *NodeSpecApplyConfiguration { + return &NodeSpecApplyConfiguration{} +} + +// WithPodCIDR sets the PodCIDR field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodCIDR field is set to the value of the last call. +func (b *NodeSpecApplyConfiguration) WithPodCIDR(value string) *NodeSpecApplyConfiguration { + b.PodCIDR = &value + return b +} + +// WithPodCIDRs adds the given value to the PodCIDRs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PodCIDRs field. +func (b *NodeSpecApplyConfiguration) WithPodCIDRs(values ...string) *NodeSpecApplyConfiguration { + for i := range values { + b.PodCIDRs = append(b.PodCIDRs, values[i]) + } + return b +} + +// WithProviderID sets the ProviderID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProviderID field is set to the value of the last call. +func (b *NodeSpecApplyConfiguration) WithProviderID(value string) *NodeSpecApplyConfiguration { + b.ProviderID = &value + return b +} + +// WithUnschedulable sets the Unschedulable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Unschedulable field is set to the value of the last call. +func (b *NodeSpecApplyConfiguration) WithUnschedulable(value bool) *NodeSpecApplyConfiguration { + b.Unschedulable = &value + return b +} + +// WithTaints adds the given value to the Taints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Taints field. +func (b *NodeSpecApplyConfiguration) WithTaints(values ...*TaintApplyConfiguration) *NodeSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTaints") + } + b.Taints = append(b.Taints, *values[i]) + } + return b +} + +// WithConfigSource sets the ConfigSource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigSource field is set to the value of the last call. +func (b *NodeSpecApplyConfiguration) WithConfigSource(value *NodeConfigSourceApplyConfiguration) *NodeSpecApplyConfiguration { + b.ConfigSource = value + return b +} + +// WithDoNotUseExternalID sets the DoNotUseExternalID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DoNotUseExternalID field is set to the value of the last call. +func (b *NodeSpecApplyConfiguration) WithDoNotUseExternalID(value string) *NodeSpecApplyConfiguration { + b.DoNotUseExternalID = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodestatus.go b/pkg/clients/applyconfiguration/core/v1/nodestatus.go new file mode 100644 index 000000000..a1eeccf25 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodestatus.go @@ -0,0 +1,142 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NodeStatusApplyConfiguration represents an declarative configuration of the NodeStatus type for use +// with apply. +type NodeStatusApplyConfiguration struct { + Capacity *v1.ResourceList `json:"capacity,omitempty"` + Allocatable *v1.ResourceList `json:"allocatable,omitempty"` + Phase *v1.NodePhase `json:"phase,omitempty"` + Conditions []NodeConditionApplyConfiguration `json:"conditions,omitempty"` + Addresses []NodeAddressApplyConfiguration `json:"addresses,omitempty"` + DaemonEndpoints *NodeDaemonEndpointsApplyConfiguration `json:"daemonEndpoints,omitempty"` + NodeInfo *NodeSystemInfoApplyConfiguration `json:"nodeInfo,omitempty"` + Images []ContainerImageApplyConfiguration `json:"images,omitempty"` + VolumesInUse []v1.UniqueVolumeName `json:"volumesInUse,omitempty"` + VolumesAttached []AttachedVolumeApplyConfiguration `json:"volumesAttached,omitempty"` + Config *NodeConfigStatusApplyConfiguration `json:"config,omitempty"` +} + +// NodeStatusApplyConfiguration constructs an declarative configuration of the NodeStatus type for use with +// apply. +func NodeStatus() *NodeStatusApplyConfiguration { + return &NodeStatusApplyConfiguration{} +} + +// WithCapacity sets the Capacity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capacity field is set to the value of the last call. +func (b *NodeStatusApplyConfiguration) WithCapacity(value v1.ResourceList) *NodeStatusApplyConfiguration { + b.Capacity = &value + return b +} + +// WithAllocatable sets the Allocatable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Allocatable field is set to the value of the last call. +func (b *NodeStatusApplyConfiguration) WithAllocatable(value v1.ResourceList) *NodeStatusApplyConfiguration { + b.Allocatable = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *NodeStatusApplyConfiguration) WithPhase(value v1.NodePhase) *NodeStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *NodeStatusApplyConfiguration) WithConditions(values ...*NodeConditionApplyConfiguration) *NodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAddresses adds the given value to the Addresses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Addresses field. +func (b *NodeStatusApplyConfiguration) WithAddresses(values ...*NodeAddressApplyConfiguration) *NodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAddresses") + } + b.Addresses = append(b.Addresses, *values[i]) + } + return b +} + +// WithDaemonEndpoints sets the DaemonEndpoints field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DaemonEndpoints field is set to the value of the last call. +func (b *NodeStatusApplyConfiguration) WithDaemonEndpoints(value *NodeDaemonEndpointsApplyConfiguration) *NodeStatusApplyConfiguration { + b.DaemonEndpoints = value + return b +} + +// WithNodeInfo sets the NodeInfo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeInfo field is set to the value of the last call. +func (b *NodeStatusApplyConfiguration) WithNodeInfo(value *NodeSystemInfoApplyConfiguration) *NodeStatusApplyConfiguration { + b.NodeInfo = value + return b +} + +// WithImages adds the given value to the Images field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Images field. +func (b *NodeStatusApplyConfiguration) WithImages(values ...*ContainerImageApplyConfiguration) *NodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithImages") + } + b.Images = append(b.Images, *values[i]) + } + return b +} + +// WithVolumesInUse adds the given value to the VolumesInUse field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumesInUse field. +func (b *NodeStatusApplyConfiguration) WithVolumesInUse(values ...v1.UniqueVolumeName) *NodeStatusApplyConfiguration { + for i := range values { + b.VolumesInUse = append(b.VolumesInUse, values[i]) + } + return b +} + +// WithVolumesAttached adds the given value to the VolumesAttached field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumesAttached field. +func (b *NodeStatusApplyConfiguration) WithVolumesAttached(values ...*AttachedVolumeApplyConfiguration) *NodeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumesAttached") + } + b.VolumesAttached = append(b.VolumesAttached, *values[i]) + } + return b +} + +// WithConfig sets the Config field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Config field is set to the value of the last call. +func (b *NodeStatusApplyConfiguration) WithConfig(value *NodeConfigStatusApplyConfiguration) *NodeStatusApplyConfiguration { + b.Config = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/nodesysteminfo.go b/pkg/clients/applyconfiguration/core/v1/nodesysteminfo.go new file mode 100644 index 000000000..9f57c698f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/nodesysteminfo.go @@ -0,0 +1,107 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// NodeSystemInfoApplyConfiguration represents an declarative configuration of the NodeSystemInfo type for use +// with apply. +type NodeSystemInfoApplyConfiguration struct { + MachineID *string `json:"machineID,omitempty"` + SystemUUID *string `json:"systemUUID,omitempty"` + BootID *string `json:"bootID,omitempty"` + KernelVersion *string `json:"kernelVersion,omitempty"` + OSImage *string `json:"osImage,omitempty"` + ContainerRuntimeVersion *string `json:"containerRuntimeVersion,omitempty"` + KubeletVersion *string `json:"kubeletVersion,omitempty"` + KubeProxyVersion *string `json:"kubeProxyVersion,omitempty"` + OperatingSystem *string `json:"operatingSystem,omitempty"` + Architecture *string `json:"architecture,omitempty"` +} + +// NodeSystemInfoApplyConfiguration constructs an declarative configuration of the NodeSystemInfo type for use with +// apply. +func NodeSystemInfo() *NodeSystemInfoApplyConfiguration { + return &NodeSystemInfoApplyConfiguration{} +} + +// WithMachineID sets the MachineID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineID field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithMachineID(value string) *NodeSystemInfoApplyConfiguration { + b.MachineID = &value + return b +} + +// WithSystemUUID sets the SystemUUID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SystemUUID field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithSystemUUID(value string) *NodeSystemInfoApplyConfiguration { + b.SystemUUID = &value + return b +} + +// WithBootID sets the BootID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BootID field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithBootID(value string) *NodeSystemInfoApplyConfiguration { + b.BootID = &value + return b +} + +// WithKernelVersion sets the KernelVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the KernelVersion field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithKernelVersion(value string) *NodeSystemInfoApplyConfiguration { + b.KernelVersion = &value + return b +} + +// WithOSImage sets the OSImage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OSImage field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithOSImage(value string) *NodeSystemInfoApplyConfiguration { + b.OSImage = &value + return b +} + +// WithContainerRuntimeVersion sets the ContainerRuntimeVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerRuntimeVersion field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithContainerRuntimeVersion(value string) *NodeSystemInfoApplyConfiguration { + b.ContainerRuntimeVersion = &value + return b +} + +// WithKubeletVersion sets the KubeletVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the KubeletVersion field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithKubeletVersion(value string) *NodeSystemInfoApplyConfiguration { + b.KubeletVersion = &value + return b +} + +// WithKubeProxyVersion sets the KubeProxyVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the KubeProxyVersion field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithKubeProxyVersion(value string) *NodeSystemInfoApplyConfiguration { + b.KubeProxyVersion = &value + return b +} + +// WithOperatingSystem sets the OperatingSystem field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OperatingSystem field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithOperatingSystem(value string) *NodeSystemInfoApplyConfiguration { + b.OperatingSystem = &value + return b +} + +// WithArchitecture sets the Architecture field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Architecture field is set to the value of the last call. +func (b *NodeSystemInfoApplyConfiguration) WithArchitecture(value string) *NodeSystemInfoApplyConfiguration { + b.Architecture = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/objectfieldselector.go b/pkg/clients/applyconfiguration/core/v1/objectfieldselector.go new file mode 100644 index 000000000..70c2d71a9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/objectfieldselector.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ObjectFieldSelectorApplyConfiguration represents an declarative configuration of the ObjectFieldSelector type for use +// with apply. +type ObjectFieldSelectorApplyConfiguration struct { + APIVersion *string `json:"apiVersion,omitempty"` + FieldPath *string `json:"fieldPath,omitempty"` +} + +// ObjectFieldSelectorApplyConfiguration constructs an declarative configuration of the ObjectFieldSelector type for use with +// apply. +func ObjectFieldSelector() *ObjectFieldSelectorApplyConfiguration { + return &ObjectFieldSelectorApplyConfiguration{} +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ObjectFieldSelectorApplyConfiguration) WithAPIVersion(value string) *ObjectFieldSelectorApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithFieldPath sets the FieldPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldPath field is set to the value of the last call. +func (b *ObjectFieldSelectorApplyConfiguration) WithFieldPath(value string) *ObjectFieldSelectorApplyConfiguration { + b.FieldPath = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/objectreference.go b/pkg/clients/applyconfiguration/core/v1/objectreference.go new file mode 100644 index 000000000..5f90afd88 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/objectreference.go @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// ObjectReferenceApplyConfiguration represents an declarative configuration of the ObjectReference type for use +// with apply. +type ObjectReferenceApplyConfiguration struct { + Kind *string `json:"kind,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + UID *types.UID `json:"uid,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` + ResourceVersion *string `json:"resourceVersion,omitempty"` + FieldPath *string `json:"fieldPath,omitempty"` +} + +// ObjectReferenceApplyConfiguration constructs an declarative configuration of the ObjectReference type for use with +// apply. +func ObjectReference() *ObjectReferenceApplyConfiguration { + return &ObjectReferenceApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithKind(value string) *ObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithNamespace(value string) *ObjectReferenceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithName(value string) *ObjectReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithUID(value types.UID) *ObjectReferenceApplyConfiguration { + b.UID = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithAPIVersion(value string) *ObjectReferenceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithResourceVersion(value string) *ObjectReferenceApplyConfiguration { + b.ResourceVersion = &value + return b +} + +// WithFieldPath sets the FieldPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldPath field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithFieldPath(value string) *ObjectReferenceApplyConfiguration { + b.FieldPath = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolume.go b/pkg/clients/applyconfiguration/core/v1/persistentvolume.go new file mode 100644 index 000000000..745b9ec56 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolume.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PersistentVolumeApplyConfiguration represents an declarative configuration of the PersistentVolume type for use +// with apply. +type PersistentVolumeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PersistentVolumeSpecApplyConfiguration `json:"spec,omitempty"` + Status *PersistentVolumeStatusApplyConfiguration `json:"status,omitempty"` +} + +// PersistentVolume constructs an declarative configuration of the PersistentVolume type for use with +// apply. +func PersistentVolume(name string) *PersistentVolumeApplyConfiguration { + b := &PersistentVolumeApplyConfiguration{} + b.WithName(name) + b.WithKind("PersistentVolume") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithKind(value string) *PersistentVolumeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithAPIVersion(value string) *PersistentVolumeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithName(value string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithGenerateName(value string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithNamespace(value string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithUID(value types.UID) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithResourceVersion(value string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithGeneration(value int64) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PersistentVolumeApplyConfiguration) WithLabels(entries map[string]string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PersistentVolumeApplyConfiguration) WithAnnotations(entries map[string]string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PersistentVolumeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PersistentVolumeApplyConfiguration) WithFinalizers(values ...string) *PersistentVolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PersistentVolumeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithSpec(value *PersistentVolumeSpecApplyConfiguration) *PersistentVolumeApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PersistentVolumeApplyConfiguration) WithStatus(value *PersistentVolumeStatusApplyConfiguration) *PersistentVolumeApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaim.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..460648404 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaim.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PersistentVolumeClaimApplyConfiguration represents an declarative configuration of the PersistentVolumeClaim type for use +// with apply. +type PersistentVolumeClaimApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PersistentVolumeClaimSpecApplyConfiguration `json:"spec,omitempty"` + Status *PersistentVolumeClaimStatusApplyConfiguration `json:"status,omitempty"` +} + +// PersistentVolumeClaim constructs an declarative configuration of the PersistentVolumeClaim type for use with +// apply. +func PersistentVolumeClaim(name, namespace string) *PersistentVolumeClaimApplyConfiguration { + b := &PersistentVolumeClaimApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PersistentVolumeClaim") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithKind(value string) *PersistentVolumeClaimApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithAPIVersion(value string) *PersistentVolumeClaimApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithName(value string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithGenerateName(value string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithNamespace(value string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithUID(value types.UID) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithResourceVersion(value string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithGeneration(value int64) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PersistentVolumeClaimApplyConfiguration) WithLabels(entries map[string]string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PersistentVolumeClaimApplyConfiguration) WithAnnotations(entries map[string]string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PersistentVolumeClaimApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PersistentVolumeClaimApplyConfiguration) WithFinalizers(values ...string) *PersistentVolumeClaimApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PersistentVolumeClaimApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithSpec(value *PersistentVolumeClaimSpecApplyConfiguration) *PersistentVolumeClaimApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PersistentVolumeClaimApplyConfiguration) WithStatus(value *PersistentVolumeClaimStatusApplyConfiguration) *PersistentVolumeClaimApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimcondition.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimcondition.go new file mode 100644 index 000000000..83431348e --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimcondition.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PersistentVolumeClaimConditionApplyConfiguration represents an declarative configuration of the PersistentVolumeClaimCondition type for use +// with apply. +type PersistentVolumeClaimConditionApplyConfiguration struct { + Type *v1.PersistentVolumeClaimConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastProbeTime *metav1.Time `json:"lastProbeTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// PersistentVolumeClaimConditionApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimCondition type for use with +// apply. +func PersistentVolumeClaimCondition() *PersistentVolumeClaimConditionApplyConfiguration { + return &PersistentVolumeClaimConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *PersistentVolumeClaimConditionApplyConfiguration) WithType(value v1.PersistentVolumeClaimConditionType) *PersistentVolumeClaimConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PersistentVolumeClaimConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *PersistentVolumeClaimConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastProbeTime sets the LastProbeTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastProbeTime field is set to the value of the last call. +func (b *PersistentVolumeClaimConditionApplyConfiguration) WithLastProbeTime(value metav1.Time) *PersistentVolumeClaimConditionApplyConfiguration { + b.LastProbeTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *PersistentVolumeClaimConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *PersistentVolumeClaimConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *PersistentVolumeClaimConditionApplyConfiguration) WithReason(value string) *PersistentVolumeClaimConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *PersistentVolumeClaimConditionApplyConfiguration) WithMessage(value string) *PersistentVolumeClaimConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimspec.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimspec.go new file mode 100644 index 000000000..7b984757f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimspec.go @@ -0,0 +1,105 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PersistentVolumeClaimSpecApplyConfiguration represents an declarative configuration of the PersistentVolumeClaimSpec type for use +// with apply. +type PersistentVolumeClaimSpecApplyConfiguration struct { + AccessModes []v1.PersistentVolumeAccessMode `json:"accessModes,omitempty"` + Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + Resources *VolumeResourceRequirementsApplyConfiguration `json:"resources,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` + StorageClassName *string `json:"storageClassName,omitempty"` + VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty"` + DataSource *TypedLocalObjectReferenceApplyConfiguration `json:"dataSource,omitempty"` + DataSourceRef *TypedObjectReferenceApplyConfiguration `json:"dataSourceRef,omitempty"` + VolumeAttributesClassName *string `json:"volumeAttributesClassName,omitempty"` +} + +// PersistentVolumeClaimSpecApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimSpec type for use with +// apply. +func PersistentVolumeClaimSpec() *PersistentVolumeClaimSpecApplyConfiguration { + return &PersistentVolumeClaimSpecApplyConfiguration{} +} + +// WithAccessModes adds the given value to the AccessModes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AccessModes field. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithAccessModes(values ...v1.PersistentVolumeAccessMode) *PersistentVolumeClaimSpecApplyConfiguration { + for i := range values { + b.AccessModes = append(b.AccessModes, values[i]) + } + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithSelector(value *metav1.LabelSelectorApplyConfiguration) *PersistentVolumeClaimSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithResources(value *VolumeResourceRequirementsApplyConfiguration) *PersistentVolumeClaimSpecApplyConfiguration { + b.Resources = value + return b +} + +// WithVolumeName sets the VolumeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeName field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithVolumeName(value string) *PersistentVolumeClaimSpecApplyConfiguration { + b.VolumeName = &value + return b +} + +// WithStorageClassName sets the StorageClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageClassName field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithStorageClassName(value string) *PersistentVolumeClaimSpecApplyConfiguration { + b.StorageClassName = &value + return b +} + +// WithVolumeMode sets the VolumeMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeMode field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithVolumeMode(value v1.PersistentVolumeMode) *PersistentVolumeClaimSpecApplyConfiguration { + b.VolumeMode = &value + return b +} + +// WithDataSource sets the DataSource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DataSource field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithDataSource(value *TypedLocalObjectReferenceApplyConfiguration) *PersistentVolumeClaimSpecApplyConfiguration { + b.DataSource = value + return b +} + +// WithDataSourceRef sets the DataSourceRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DataSourceRef field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithDataSourceRef(value *TypedObjectReferenceApplyConfiguration) *PersistentVolumeClaimSpecApplyConfiguration { + b.DataSourceRef = value + return b +} + +// WithVolumeAttributesClassName sets the VolumeAttributesClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeAttributesClassName field is set to the value of the last call. +func (b *PersistentVolumeClaimSpecApplyConfiguration) WithVolumeAttributesClassName(value string) *PersistentVolumeClaimSpecApplyConfiguration { + b.VolumeAttributesClassName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimstatus.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimstatus.go new file mode 100644 index 000000000..b8c9c5648 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimstatus.go @@ -0,0 +1,106 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PersistentVolumeClaimStatusApplyConfiguration represents an declarative configuration of the PersistentVolumeClaimStatus type for use +// with apply. +type PersistentVolumeClaimStatusApplyConfiguration struct { + Phase *v1.PersistentVolumeClaimPhase `json:"phase,omitempty"` + AccessModes []v1.PersistentVolumeAccessMode `json:"accessModes,omitempty"` + Capacity *v1.ResourceList `json:"capacity,omitempty"` + Conditions []PersistentVolumeClaimConditionApplyConfiguration `json:"conditions,omitempty"` + AllocatedResources *v1.ResourceList `json:"allocatedResources,omitempty"` + AllocatedResourceStatuses map[v1.ResourceName]v1.ClaimResourceStatus `json:"allocatedResourceStatuses,omitempty"` + CurrentVolumeAttributesClassName *string `json:"currentVolumeAttributesClassName,omitempty"` + ModifyVolumeStatus *ModifyVolumeStatusApplyConfiguration `json:"modifyVolumeStatus,omitempty"` +} + +// PersistentVolumeClaimStatusApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimStatus type for use with +// apply. +func PersistentVolumeClaimStatus() *PersistentVolumeClaimStatusApplyConfiguration { + return &PersistentVolumeClaimStatusApplyConfiguration{} +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithPhase(value v1.PersistentVolumeClaimPhase) *PersistentVolumeClaimStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithAccessModes adds the given value to the AccessModes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AccessModes field. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithAccessModes(values ...v1.PersistentVolumeAccessMode) *PersistentVolumeClaimStatusApplyConfiguration { + for i := range values { + b.AccessModes = append(b.AccessModes, values[i]) + } + return b +} + +// WithCapacity sets the Capacity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capacity field is set to the value of the last call. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithCapacity(value v1.ResourceList) *PersistentVolumeClaimStatusApplyConfiguration { + b.Capacity = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithConditions(values ...*PersistentVolumeClaimConditionApplyConfiguration) *PersistentVolumeClaimStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAllocatedResources sets the AllocatedResources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocatedResources field is set to the value of the last call. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithAllocatedResources(value v1.ResourceList) *PersistentVolumeClaimStatusApplyConfiguration { + b.AllocatedResources = &value + return b +} + +// WithAllocatedResourceStatuses puts the entries into the AllocatedResourceStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the AllocatedResourceStatuses field, +// overwriting an existing map entries in AllocatedResourceStatuses field with the same key. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithAllocatedResourceStatuses(entries map[v1.ResourceName]v1.ClaimResourceStatus) *PersistentVolumeClaimStatusApplyConfiguration { + if b.AllocatedResourceStatuses == nil && len(entries) > 0 { + b.AllocatedResourceStatuses = make(map[v1.ResourceName]v1.ClaimResourceStatus, len(entries)) + } + for k, v := range entries { + b.AllocatedResourceStatuses[k] = v + } + return b +} + +// WithCurrentVolumeAttributesClassName sets the CurrentVolumeAttributesClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CurrentVolumeAttributesClassName field is set to the value of the last call. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithCurrentVolumeAttributesClassName(value string) *PersistentVolumeClaimStatusApplyConfiguration { + b.CurrentVolumeAttributesClassName = &value + return b +} + +// WithModifyVolumeStatus sets the ModifyVolumeStatus field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ModifyVolumeStatus field is set to the value of the last call. +func (b *PersistentVolumeClaimStatusApplyConfiguration) WithModifyVolumeStatus(value *ModifyVolumeStatusApplyConfiguration) *PersistentVolumeClaimStatusApplyConfiguration { + b.ModifyVolumeStatus = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimtemplate.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimtemplate.go new file mode 100644 index 000000000..dd4fb2bc4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimtemplate.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PersistentVolumeClaimTemplateApplyConfiguration represents an declarative configuration of the PersistentVolumeClaimTemplate type for use +// with apply. +type PersistentVolumeClaimTemplateApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PersistentVolumeClaimSpecApplyConfiguration `json:"spec,omitempty"` +} + +// PersistentVolumeClaimTemplateApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimTemplate type for use with +// apply. +func PersistentVolumeClaimTemplate() *PersistentVolumeClaimTemplateApplyConfiguration { + return &PersistentVolumeClaimTemplateApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithName(value string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithGenerateName(value string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithNamespace(value string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithUID(value types.UID) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithResourceVersion(value string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithGeneration(value int64) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithLabels(entries map[string]string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithAnnotations(entries map[string]string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithFinalizers(values ...string) *PersistentVolumeClaimTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PersistentVolumeClaimTemplateApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PersistentVolumeClaimTemplateApplyConfiguration) WithSpec(value *PersistentVolumeClaimSpecApplyConfiguration) *PersistentVolumeClaimTemplateApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimvolumesource.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimvolumesource.go new file mode 100644 index 000000000..a2101e203 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumeclaimvolumesource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PersistentVolumeClaimVolumeSourceApplyConfiguration represents an declarative configuration of the PersistentVolumeClaimVolumeSource type for use +// with apply. +type PersistentVolumeClaimVolumeSourceApplyConfiguration struct { + ClaimName *string `json:"claimName,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// PersistentVolumeClaimVolumeSourceApplyConfiguration constructs an declarative configuration of the PersistentVolumeClaimVolumeSource type for use with +// apply. +func PersistentVolumeClaimVolumeSource() *PersistentVolumeClaimVolumeSourceApplyConfiguration { + return &PersistentVolumeClaimVolumeSourceApplyConfiguration{} +} + +// WithClaimName sets the ClaimName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClaimName field is set to the value of the last call. +func (b *PersistentVolumeClaimVolumeSourceApplyConfiguration) WithClaimName(value string) *PersistentVolumeClaimVolumeSourceApplyConfiguration { + b.ClaimName = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *PersistentVolumeClaimVolumeSourceApplyConfiguration) WithReadOnly(value bool) *PersistentVolumeClaimVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumesource.go new file mode 100644 index 000000000..56c5279d9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumesource.go @@ -0,0 +1,215 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PersistentVolumeSourceApplyConfiguration represents an declarative configuration of the PersistentVolumeSource type for use +// with apply. +type PersistentVolumeSourceApplyConfiguration struct { + GCEPersistentDisk *GCEPersistentDiskVolumeSourceApplyConfiguration `json:"gcePersistentDisk,omitempty"` + AWSElasticBlockStore *AWSElasticBlockStoreVolumeSourceApplyConfiguration `json:"awsElasticBlockStore,omitempty"` + HostPath *HostPathVolumeSourceApplyConfiguration `json:"hostPath,omitempty"` + Glusterfs *GlusterfsPersistentVolumeSourceApplyConfiguration `json:"glusterfs,omitempty"` + NFS *NFSVolumeSourceApplyConfiguration `json:"nfs,omitempty"` + RBD *RBDPersistentVolumeSourceApplyConfiguration `json:"rbd,omitempty"` + ISCSI *ISCSIPersistentVolumeSourceApplyConfiguration `json:"iscsi,omitempty"` + Cinder *CinderPersistentVolumeSourceApplyConfiguration `json:"cinder,omitempty"` + CephFS *CephFSPersistentVolumeSourceApplyConfiguration `json:"cephfs,omitempty"` + FC *FCVolumeSourceApplyConfiguration `json:"fc,omitempty"` + Flocker *FlockerVolumeSourceApplyConfiguration `json:"flocker,omitempty"` + FlexVolume *FlexPersistentVolumeSourceApplyConfiguration `json:"flexVolume,omitempty"` + AzureFile *AzureFilePersistentVolumeSourceApplyConfiguration `json:"azureFile,omitempty"` + VsphereVolume *VsphereVirtualDiskVolumeSourceApplyConfiguration `json:"vsphereVolume,omitempty"` + Quobyte *QuobyteVolumeSourceApplyConfiguration `json:"quobyte,omitempty"` + AzureDisk *AzureDiskVolumeSourceApplyConfiguration `json:"azureDisk,omitempty"` + PhotonPersistentDisk *PhotonPersistentDiskVolumeSourceApplyConfiguration `json:"photonPersistentDisk,omitempty"` + PortworxVolume *PortworxVolumeSourceApplyConfiguration `json:"portworxVolume,omitempty"` + ScaleIO *ScaleIOPersistentVolumeSourceApplyConfiguration `json:"scaleIO,omitempty"` + Local *LocalVolumeSourceApplyConfiguration `json:"local,omitempty"` + StorageOS *StorageOSPersistentVolumeSourceApplyConfiguration `json:"storageos,omitempty"` + CSI *CSIPersistentVolumeSourceApplyConfiguration `json:"csi,omitempty"` +} + +// PersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the PersistentVolumeSource type for use with +// apply. +func PersistentVolumeSource() *PersistentVolumeSourceApplyConfiguration { + return &PersistentVolumeSourceApplyConfiguration{} +} + +// WithGCEPersistentDisk sets the GCEPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GCEPersistentDisk field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithGCEPersistentDisk(value *GCEPersistentDiskVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.GCEPersistentDisk = value + return b +} + +// WithAWSElasticBlockStore sets the AWSElasticBlockStore field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AWSElasticBlockStore field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithAWSElasticBlockStore(value *AWSElasticBlockStoreVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.AWSElasticBlockStore = value + return b +} + +// WithHostPath sets the HostPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostPath field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithHostPath(value *HostPathVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.HostPath = value + return b +} + +// WithGlusterfs sets the Glusterfs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Glusterfs field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithGlusterfs(value *GlusterfsPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.Glusterfs = value + return b +} + +// WithNFS sets the NFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NFS field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithNFS(value *NFSVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.NFS = value + return b +} + +// WithRBD sets the RBD field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBD field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithRBD(value *RBDPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.RBD = value + return b +} + +// WithISCSI sets the ISCSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ISCSI field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithISCSI(value *ISCSIPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.ISCSI = value + return b +} + +// WithCinder sets the Cinder field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Cinder field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithCinder(value *CinderPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.Cinder = value + return b +} + +// WithCephFS sets the CephFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CephFS field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithCephFS(value *CephFSPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.CephFS = value + return b +} + +// WithFC sets the FC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FC field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithFC(value *FCVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.FC = value + return b +} + +// WithFlocker sets the Flocker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Flocker field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithFlocker(value *FlockerVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.Flocker = value + return b +} + +// WithFlexVolume sets the FlexVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FlexVolume field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithFlexVolume(value *FlexPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.FlexVolume = value + return b +} + +// WithAzureFile sets the AzureFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureFile field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithAzureFile(value *AzureFilePersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.AzureFile = value + return b +} + +// WithVsphereVolume sets the VsphereVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VsphereVolume field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithVsphereVolume(value *VsphereVirtualDiskVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.VsphereVolume = value + return b +} + +// WithQuobyte sets the Quobyte field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Quobyte field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithQuobyte(value *QuobyteVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.Quobyte = value + return b +} + +// WithAzureDisk sets the AzureDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureDisk field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithAzureDisk(value *AzureDiskVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.AzureDisk = value + return b +} + +// WithPhotonPersistentDisk sets the PhotonPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PhotonPersistentDisk field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithPhotonPersistentDisk(value *PhotonPersistentDiskVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.PhotonPersistentDisk = value + return b +} + +// WithPortworxVolume sets the PortworxVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PortworxVolume field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithPortworxVolume(value *PortworxVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.PortworxVolume = value + return b +} + +// WithScaleIO sets the ScaleIO field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleIO field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithScaleIO(value *ScaleIOPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.ScaleIO = value + return b +} + +// WithLocal sets the Local field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Local field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithLocal(value *LocalVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.Local = value + return b +} + +// WithStorageOS sets the StorageOS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageOS field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithStorageOS(value *StorageOSPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.StorageOS = value + return b +} + +// WithCSI sets the CSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CSI field is set to the value of the last call. +func (b *PersistentVolumeSourceApplyConfiguration) WithCSI(value *CSIPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSourceApplyConfiguration { + b.CSI = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumespec.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumespec.go new file mode 100644 index 000000000..cc9fe2a61 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumespec.go @@ -0,0 +1,283 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PersistentVolumeSpecApplyConfiguration represents an declarative configuration of the PersistentVolumeSpec type for use +// with apply. +type PersistentVolumeSpecApplyConfiguration struct { + Capacity *v1.ResourceList `json:"capacity,omitempty"` + PersistentVolumeSourceApplyConfiguration `json:",inline"` + AccessModes []v1.PersistentVolumeAccessMode `json:"accessModes,omitempty"` + ClaimRef *ObjectReferenceApplyConfiguration `json:"claimRef,omitempty"` + PersistentVolumeReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"persistentVolumeReclaimPolicy,omitempty"` + StorageClassName *string `json:"storageClassName,omitempty"` + MountOptions []string `json:"mountOptions,omitempty"` + VolumeMode *v1.PersistentVolumeMode `json:"volumeMode,omitempty"` + NodeAffinity *VolumeNodeAffinityApplyConfiguration `json:"nodeAffinity,omitempty"` + VolumeAttributesClassName *string `json:"volumeAttributesClassName,omitempty"` +} + +// PersistentVolumeSpecApplyConfiguration constructs an declarative configuration of the PersistentVolumeSpec type for use with +// apply. +func PersistentVolumeSpec() *PersistentVolumeSpecApplyConfiguration { + return &PersistentVolumeSpecApplyConfiguration{} +} + +// WithCapacity sets the Capacity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capacity field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithCapacity(value v1.ResourceList) *PersistentVolumeSpecApplyConfiguration { + b.Capacity = &value + return b +} + +// WithGCEPersistentDisk sets the GCEPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GCEPersistentDisk field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithGCEPersistentDisk(value *GCEPersistentDiskVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.GCEPersistentDisk = value + return b +} + +// WithAWSElasticBlockStore sets the AWSElasticBlockStore field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AWSElasticBlockStore field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithAWSElasticBlockStore(value *AWSElasticBlockStoreVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.AWSElasticBlockStore = value + return b +} + +// WithHostPath sets the HostPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostPath field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithHostPath(value *HostPathVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.HostPath = value + return b +} + +// WithGlusterfs sets the Glusterfs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Glusterfs field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithGlusterfs(value *GlusterfsPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.Glusterfs = value + return b +} + +// WithNFS sets the NFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NFS field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithNFS(value *NFSVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.NFS = value + return b +} + +// WithRBD sets the RBD field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBD field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithRBD(value *RBDPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.RBD = value + return b +} + +// WithISCSI sets the ISCSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ISCSI field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithISCSI(value *ISCSIPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.ISCSI = value + return b +} + +// WithCinder sets the Cinder field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Cinder field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithCinder(value *CinderPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.Cinder = value + return b +} + +// WithCephFS sets the CephFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CephFS field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithCephFS(value *CephFSPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.CephFS = value + return b +} + +// WithFC sets the FC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FC field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithFC(value *FCVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.FC = value + return b +} + +// WithFlocker sets the Flocker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Flocker field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithFlocker(value *FlockerVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.Flocker = value + return b +} + +// WithFlexVolume sets the FlexVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FlexVolume field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithFlexVolume(value *FlexPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.FlexVolume = value + return b +} + +// WithAzureFile sets the AzureFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureFile field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithAzureFile(value *AzureFilePersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.AzureFile = value + return b +} + +// WithVsphereVolume sets the VsphereVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VsphereVolume field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithVsphereVolume(value *VsphereVirtualDiskVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.VsphereVolume = value + return b +} + +// WithQuobyte sets the Quobyte field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Quobyte field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithQuobyte(value *QuobyteVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.Quobyte = value + return b +} + +// WithAzureDisk sets the AzureDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureDisk field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithAzureDisk(value *AzureDiskVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.AzureDisk = value + return b +} + +// WithPhotonPersistentDisk sets the PhotonPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PhotonPersistentDisk field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithPhotonPersistentDisk(value *PhotonPersistentDiskVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.PhotonPersistentDisk = value + return b +} + +// WithPortworxVolume sets the PortworxVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PortworxVolume field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithPortworxVolume(value *PortworxVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.PortworxVolume = value + return b +} + +// WithScaleIO sets the ScaleIO field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleIO field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithScaleIO(value *ScaleIOPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.ScaleIO = value + return b +} + +// WithLocal sets the Local field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Local field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithLocal(value *LocalVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.Local = value + return b +} + +// WithStorageOS sets the StorageOS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageOS field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithStorageOS(value *StorageOSPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.StorageOS = value + return b +} + +// WithCSI sets the CSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CSI field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithCSI(value *CSIPersistentVolumeSourceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.CSI = value + return b +} + +// WithAccessModes adds the given value to the AccessModes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AccessModes field. +func (b *PersistentVolumeSpecApplyConfiguration) WithAccessModes(values ...v1.PersistentVolumeAccessMode) *PersistentVolumeSpecApplyConfiguration { + for i := range values { + b.AccessModes = append(b.AccessModes, values[i]) + } + return b +} + +// WithClaimRef sets the ClaimRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClaimRef field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithClaimRef(value *ObjectReferenceApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.ClaimRef = value + return b +} + +// WithPersistentVolumeReclaimPolicy sets the PersistentVolumeReclaimPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PersistentVolumeReclaimPolicy field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithPersistentVolumeReclaimPolicy(value v1.PersistentVolumeReclaimPolicy) *PersistentVolumeSpecApplyConfiguration { + b.PersistentVolumeReclaimPolicy = &value + return b +} + +// WithStorageClassName sets the StorageClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageClassName field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithStorageClassName(value string) *PersistentVolumeSpecApplyConfiguration { + b.StorageClassName = &value + return b +} + +// WithMountOptions adds the given value to the MountOptions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MountOptions field. +func (b *PersistentVolumeSpecApplyConfiguration) WithMountOptions(values ...string) *PersistentVolumeSpecApplyConfiguration { + for i := range values { + b.MountOptions = append(b.MountOptions, values[i]) + } + return b +} + +// WithVolumeMode sets the VolumeMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeMode field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithVolumeMode(value v1.PersistentVolumeMode) *PersistentVolumeSpecApplyConfiguration { + b.VolumeMode = &value + return b +} + +// WithNodeAffinity sets the NodeAffinity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeAffinity field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithNodeAffinity(value *VolumeNodeAffinityApplyConfiguration) *PersistentVolumeSpecApplyConfiguration { + b.NodeAffinity = value + return b +} + +// WithVolumeAttributesClassName sets the VolumeAttributesClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeAttributesClassName field is set to the value of the last call. +func (b *PersistentVolumeSpecApplyConfiguration) WithVolumeAttributesClassName(value string) *PersistentVolumeSpecApplyConfiguration { + b.VolumeAttributesClassName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/persistentvolumestatus.go b/pkg/clients/applyconfiguration/core/v1/persistentvolumestatus.go new file mode 100644 index 000000000..c198c21fe --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/persistentvolumestatus.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PersistentVolumeStatusApplyConfiguration represents an declarative configuration of the PersistentVolumeStatus type for use +// with apply. +type PersistentVolumeStatusApplyConfiguration struct { + Phase *v1.PersistentVolumePhase `json:"phase,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` + LastPhaseTransitionTime *metav1.Time `json:"lastPhaseTransitionTime,omitempty"` +} + +// PersistentVolumeStatusApplyConfiguration constructs an declarative configuration of the PersistentVolumeStatus type for use with +// apply. +func PersistentVolumeStatus() *PersistentVolumeStatusApplyConfiguration { + return &PersistentVolumeStatusApplyConfiguration{} +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *PersistentVolumeStatusApplyConfiguration) WithPhase(value v1.PersistentVolumePhase) *PersistentVolumeStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *PersistentVolumeStatusApplyConfiguration) WithMessage(value string) *PersistentVolumeStatusApplyConfiguration { + b.Message = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *PersistentVolumeStatusApplyConfiguration) WithReason(value string) *PersistentVolumeStatusApplyConfiguration { + b.Reason = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *PersistentVolumeStatusApplyConfiguration) WithLastPhaseTransitionTime(value metav1.Time) *PersistentVolumeStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/photonpersistentdiskvolumesource.go b/pkg/clients/applyconfiguration/core/v1/photonpersistentdiskvolumesource.go new file mode 100644 index 000000000..84c02db85 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/photonpersistentdiskvolumesource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PhotonPersistentDiskVolumeSourceApplyConfiguration represents an declarative configuration of the PhotonPersistentDiskVolumeSource type for use +// with apply. +type PhotonPersistentDiskVolumeSourceApplyConfiguration struct { + PdID *string `json:"pdID,omitempty"` + FSType *string `json:"fsType,omitempty"` +} + +// PhotonPersistentDiskVolumeSourceApplyConfiguration constructs an declarative configuration of the PhotonPersistentDiskVolumeSource type for use with +// apply. +func PhotonPersistentDiskVolumeSource() *PhotonPersistentDiskVolumeSourceApplyConfiguration { + return &PhotonPersistentDiskVolumeSourceApplyConfiguration{} +} + +// WithPdID sets the PdID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PdID field is set to the value of the last call. +func (b *PhotonPersistentDiskVolumeSourceApplyConfiguration) WithPdID(value string) *PhotonPersistentDiskVolumeSourceApplyConfiguration { + b.PdID = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *PhotonPersistentDiskVolumeSourceApplyConfiguration) WithFSType(value string) *PhotonPersistentDiskVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/pod.go b/pkg/clients/applyconfiguration/core/v1/pod.go new file mode 100644 index 000000000..955a5b9d7 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/pod.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodApplyConfiguration represents an declarative configuration of the Pod type for use +// with apply. +type PodApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PodSpecApplyConfiguration `json:"spec,omitempty"` + Status *PodStatusApplyConfiguration `json:"status,omitempty"` +} + +// Pod constructs an declarative configuration of the Pod type for use with +// apply. +func Pod(name, namespace string) *PodApplyConfiguration { + b := &PodApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Pod") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PodApplyConfiguration) WithKind(value string) *PodApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PodApplyConfiguration) WithAPIVersion(value string) *PodApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodApplyConfiguration) WithName(value string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PodApplyConfiguration) WithGenerateName(value string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PodApplyConfiguration) WithNamespace(value string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PodApplyConfiguration) WithUID(value types.UID) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PodApplyConfiguration) WithResourceVersion(value string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PodApplyConfiguration) WithGeneration(value int64) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PodApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PodApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PodApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PodApplyConfiguration) WithLabels(entries map[string]string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PodApplyConfiguration) WithAnnotations(entries map[string]string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PodApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PodApplyConfiguration) WithFinalizers(values ...string) *PodApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PodApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PodApplyConfiguration) WithSpec(value *PodSpecApplyConfiguration) *PodApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PodApplyConfiguration) WithStatus(value *PodStatusApplyConfiguration) *PodApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podaffinity.go b/pkg/clients/applyconfiguration/core/v1/podaffinity.go new file mode 100644 index 000000000..55b258a56 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podaffinity.go @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodAffinityApplyConfiguration represents an declarative configuration of the PodAffinity type for use +// with apply. +type PodAffinityApplyConfiguration struct { + RequiredDuringSchedulingIgnoredDuringExecution []PodAffinityTermApplyConfiguration `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` + PreferredDuringSchedulingIgnoredDuringExecution []WeightedPodAffinityTermApplyConfiguration `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` +} + +// PodAffinityApplyConfiguration constructs an declarative configuration of the PodAffinity type for use with +// apply. +func PodAffinity() *PodAffinityApplyConfiguration { + return &PodAffinityApplyConfiguration{} +} + +// WithRequiredDuringSchedulingIgnoredDuringExecution adds the given value to the RequiredDuringSchedulingIgnoredDuringExecution field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RequiredDuringSchedulingIgnoredDuringExecution field. +func (b *PodAffinityApplyConfiguration) WithRequiredDuringSchedulingIgnoredDuringExecution(values ...*PodAffinityTermApplyConfiguration) *PodAffinityApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRequiredDuringSchedulingIgnoredDuringExecution") + } + b.RequiredDuringSchedulingIgnoredDuringExecution = append(b.RequiredDuringSchedulingIgnoredDuringExecution, *values[i]) + } + return b +} + +// WithPreferredDuringSchedulingIgnoredDuringExecution adds the given value to the PreferredDuringSchedulingIgnoredDuringExecution field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PreferredDuringSchedulingIgnoredDuringExecution field. +func (b *PodAffinityApplyConfiguration) WithPreferredDuringSchedulingIgnoredDuringExecution(values ...*WeightedPodAffinityTermApplyConfiguration) *PodAffinityApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPreferredDuringSchedulingIgnoredDuringExecution") + } + b.PreferredDuringSchedulingIgnoredDuringExecution = append(b.PreferredDuringSchedulingIgnoredDuringExecution, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podaffinityterm.go b/pkg/clients/applyconfiguration/core/v1/podaffinityterm.go new file mode 100644 index 000000000..1aa6cb4ce --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podaffinityterm.go @@ -0,0 +1,81 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodAffinityTermApplyConfiguration represents an declarative configuration of the PodAffinityTerm type for use +// with apply. +type PodAffinityTermApplyConfiguration struct { + LabelSelector *v1.LabelSelectorApplyConfiguration `json:"labelSelector,omitempty"` + Namespaces []string `json:"namespaces,omitempty"` + TopologyKey *string `json:"topologyKey,omitempty"` + NamespaceSelector *v1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` + MatchLabelKeys []string `json:"matchLabelKeys,omitempty"` + MismatchLabelKeys []string `json:"mismatchLabelKeys,omitempty"` +} + +// PodAffinityTermApplyConfiguration constructs an declarative configuration of the PodAffinityTerm type for use with +// apply. +func PodAffinityTerm() *PodAffinityTermApplyConfiguration { + return &PodAffinityTermApplyConfiguration{} +} + +// WithLabelSelector sets the LabelSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelector field is set to the value of the last call. +func (b *PodAffinityTermApplyConfiguration) WithLabelSelector(value *v1.LabelSelectorApplyConfiguration) *PodAffinityTermApplyConfiguration { + b.LabelSelector = value + return b +} + +// WithNamespaces adds the given value to the Namespaces field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Namespaces field. +func (b *PodAffinityTermApplyConfiguration) WithNamespaces(values ...string) *PodAffinityTermApplyConfiguration { + for i := range values { + b.Namespaces = append(b.Namespaces, values[i]) + } + return b +} + +// WithTopologyKey sets the TopologyKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TopologyKey field is set to the value of the last call. +func (b *PodAffinityTermApplyConfiguration) WithTopologyKey(value string) *PodAffinityTermApplyConfiguration { + b.TopologyKey = &value + return b +} + +// WithNamespaceSelector sets the NamespaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NamespaceSelector field is set to the value of the last call. +func (b *PodAffinityTermApplyConfiguration) WithNamespaceSelector(value *v1.LabelSelectorApplyConfiguration) *PodAffinityTermApplyConfiguration { + b.NamespaceSelector = value + return b +} + +// WithMatchLabelKeys adds the given value to the MatchLabelKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchLabelKeys field. +func (b *PodAffinityTermApplyConfiguration) WithMatchLabelKeys(values ...string) *PodAffinityTermApplyConfiguration { + for i := range values { + b.MatchLabelKeys = append(b.MatchLabelKeys, values[i]) + } + return b +} + +// WithMismatchLabelKeys adds the given value to the MismatchLabelKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MismatchLabelKeys field. +func (b *PodAffinityTermApplyConfiguration) WithMismatchLabelKeys(values ...string) *PodAffinityTermApplyConfiguration { + for i := range values { + b.MismatchLabelKeys = append(b.MismatchLabelKeys, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podantiaffinity.go b/pkg/clients/applyconfiguration/core/v1/podantiaffinity.go new file mode 100644 index 000000000..cabce0022 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podantiaffinity.go @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodAntiAffinityApplyConfiguration represents an declarative configuration of the PodAntiAffinity type for use +// with apply. +type PodAntiAffinityApplyConfiguration struct { + RequiredDuringSchedulingIgnoredDuringExecution []PodAffinityTermApplyConfiguration `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` + PreferredDuringSchedulingIgnoredDuringExecution []WeightedPodAffinityTermApplyConfiguration `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` +} + +// PodAntiAffinityApplyConfiguration constructs an declarative configuration of the PodAntiAffinity type for use with +// apply. +func PodAntiAffinity() *PodAntiAffinityApplyConfiguration { + return &PodAntiAffinityApplyConfiguration{} +} + +// WithRequiredDuringSchedulingIgnoredDuringExecution adds the given value to the RequiredDuringSchedulingIgnoredDuringExecution field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RequiredDuringSchedulingIgnoredDuringExecution field. +func (b *PodAntiAffinityApplyConfiguration) WithRequiredDuringSchedulingIgnoredDuringExecution(values ...*PodAffinityTermApplyConfiguration) *PodAntiAffinityApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRequiredDuringSchedulingIgnoredDuringExecution") + } + b.RequiredDuringSchedulingIgnoredDuringExecution = append(b.RequiredDuringSchedulingIgnoredDuringExecution, *values[i]) + } + return b +} + +// WithPreferredDuringSchedulingIgnoredDuringExecution adds the given value to the PreferredDuringSchedulingIgnoredDuringExecution field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PreferredDuringSchedulingIgnoredDuringExecution field. +func (b *PodAntiAffinityApplyConfiguration) WithPreferredDuringSchedulingIgnoredDuringExecution(values ...*WeightedPodAffinityTermApplyConfiguration) *PodAntiAffinityApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPreferredDuringSchedulingIgnoredDuringExecution") + } + b.PreferredDuringSchedulingIgnoredDuringExecution = append(b.PreferredDuringSchedulingIgnoredDuringExecution, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podcondition.go b/pkg/clients/applyconfiguration/core/v1/podcondition.go new file mode 100644 index 000000000..ae57a9ec8 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podcondition.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PodConditionApplyConfiguration represents an declarative configuration of the PodCondition type for use +// with apply. +type PodConditionApplyConfiguration struct { + Type *v1.PodConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastProbeTime *metav1.Time `json:"lastProbeTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// PodConditionApplyConfiguration constructs an declarative configuration of the PodCondition type for use with +// apply. +func PodCondition() *PodConditionApplyConfiguration { + return &PodConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *PodConditionApplyConfiguration) WithType(value v1.PodConditionType) *PodConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PodConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *PodConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastProbeTime sets the LastProbeTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastProbeTime field is set to the value of the last call. +func (b *PodConditionApplyConfiguration) WithLastProbeTime(value metav1.Time) *PodConditionApplyConfiguration { + b.LastProbeTime = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *PodConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *PodConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *PodConditionApplyConfiguration) WithReason(value string) *PodConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *PodConditionApplyConfiguration) WithMessage(value string) *PodConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/poddnsconfig.go b/pkg/clients/applyconfiguration/core/v1/poddnsconfig.go new file mode 100644 index 000000000..49b570191 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/poddnsconfig.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodDNSConfigApplyConfiguration represents an declarative configuration of the PodDNSConfig type for use +// with apply. +type PodDNSConfigApplyConfiguration struct { + Nameservers []string `json:"nameservers,omitempty"` + Searches []string `json:"searches,omitempty"` + Options []PodDNSConfigOptionApplyConfiguration `json:"options,omitempty"` +} + +// PodDNSConfigApplyConfiguration constructs an declarative configuration of the PodDNSConfig type for use with +// apply. +func PodDNSConfig() *PodDNSConfigApplyConfiguration { + return &PodDNSConfigApplyConfiguration{} +} + +// WithNameservers adds the given value to the Nameservers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Nameservers field. +func (b *PodDNSConfigApplyConfiguration) WithNameservers(values ...string) *PodDNSConfigApplyConfiguration { + for i := range values { + b.Nameservers = append(b.Nameservers, values[i]) + } + return b +} + +// WithSearches adds the given value to the Searches field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Searches field. +func (b *PodDNSConfigApplyConfiguration) WithSearches(values ...string) *PodDNSConfigApplyConfiguration { + for i := range values { + b.Searches = append(b.Searches, values[i]) + } + return b +} + +// WithOptions adds the given value to the Options field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Options field. +func (b *PodDNSConfigApplyConfiguration) WithOptions(values ...*PodDNSConfigOptionApplyConfiguration) *PodDNSConfigApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOptions") + } + b.Options = append(b.Options, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/poddnsconfigoption.go b/pkg/clients/applyconfiguration/core/v1/poddnsconfigoption.go new file mode 100644 index 000000000..9ce401fc1 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/poddnsconfigoption.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodDNSConfigOptionApplyConfiguration represents an declarative configuration of the PodDNSConfigOption type for use +// with apply. +type PodDNSConfigOptionApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// PodDNSConfigOptionApplyConfiguration constructs an declarative configuration of the PodDNSConfigOption type for use with +// apply. +func PodDNSConfigOption() *PodDNSConfigOptionApplyConfiguration { + return &PodDNSConfigOptionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodDNSConfigOptionApplyConfiguration) WithName(value string) *PodDNSConfigOptionApplyConfiguration { + b.Name = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *PodDNSConfigOptionApplyConfiguration) WithValue(value string) *PodDNSConfigOptionApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podip.go b/pkg/clients/applyconfiguration/core/v1/podip.go new file mode 100644 index 000000000..58fc87d37 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podip.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodIPApplyConfiguration represents an declarative configuration of the PodIP type for use +// with apply. +type PodIPApplyConfiguration struct { + IP *string `json:"ip,omitempty"` +} + +// PodIPApplyConfiguration constructs an declarative configuration of the PodIP type for use with +// apply. +func PodIP() *PodIPApplyConfiguration { + return &PodIPApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *PodIPApplyConfiguration) WithIP(value string) *PodIPApplyConfiguration { + b.IP = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podos.go b/pkg/clients/applyconfiguration/core/v1/podos.go new file mode 100644 index 000000000..4d9f53aaa --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podos.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PodOSApplyConfiguration represents an declarative configuration of the PodOS type for use +// with apply. +type PodOSApplyConfiguration struct { + Name *v1.OSName `json:"name,omitempty"` +} + +// PodOSApplyConfiguration constructs an declarative configuration of the PodOS type for use with +// apply. +func PodOS() *PodOSApplyConfiguration { + return &PodOSApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodOSApplyConfiguration) WithName(value v1.OSName) *PodOSApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podreadinessgate.go b/pkg/clients/applyconfiguration/core/v1/podreadinessgate.go new file mode 100644 index 000000000..c8ff10608 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podreadinessgate.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PodReadinessGateApplyConfiguration represents an declarative configuration of the PodReadinessGate type for use +// with apply. +type PodReadinessGateApplyConfiguration struct { + ConditionType *v1.PodConditionType `json:"conditionType,omitempty"` +} + +// PodReadinessGateApplyConfiguration constructs an declarative configuration of the PodReadinessGate type for use with +// apply. +func PodReadinessGate() *PodReadinessGateApplyConfiguration { + return &PodReadinessGateApplyConfiguration{} +} + +// WithConditionType sets the ConditionType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConditionType field is set to the value of the last call. +func (b *PodReadinessGateApplyConfiguration) WithConditionType(value v1.PodConditionType) *PodReadinessGateApplyConfiguration { + b.ConditionType = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podresourceclaim.go b/pkg/clients/applyconfiguration/core/v1/podresourceclaim.go new file mode 100644 index 000000000..40d649dd5 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podresourceclaim.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodResourceClaimApplyConfiguration represents an declarative configuration of the PodResourceClaim type for use +// with apply. +type PodResourceClaimApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Source *ClaimSourceApplyConfiguration `json:"source,omitempty"` +} + +// PodResourceClaimApplyConfiguration constructs an declarative configuration of the PodResourceClaim type for use with +// apply. +func PodResourceClaim() *PodResourceClaimApplyConfiguration { + return &PodResourceClaimApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodResourceClaimApplyConfiguration) WithName(value string) *PodResourceClaimApplyConfiguration { + b.Name = &value + return b +} + +// WithSource sets the Source field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Source field is set to the value of the last call. +func (b *PodResourceClaimApplyConfiguration) WithSource(value *ClaimSourceApplyConfiguration) *PodResourceClaimApplyConfiguration { + b.Source = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podresourceclaimstatus.go b/pkg/clients/applyconfiguration/core/v1/podresourceclaimstatus.go new file mode 100644 index 000000000..c39a129a5 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podresourceclaimstatus.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodResourceClaimStatusApplyConfiguration represents an declarative configuration of the PodResourceClaimStatus type for use +// with apply. +type PodResourceClaimStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + ResourceClaimName *string `json:"resourceClaimName,omitempty"` +} + +// PodResourceClaimStatusApplyConfiguration constructs an declarative configuration of the PodResourceClaimStatus type for use with +// apply. +func PodResourceClaimStatus() *PodResourceClaimStatusApplyConfiguration { + return &PodResourceClaimStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodResourceClaimStatusApplyConfiguration) WithName(value string) *PodResourceClaimStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimName field is set to the value of the last call. +func (b *PodResourceClaimStatusApplyConfiguration) WithResourceClaimName(value string) *PodResourceClaimStatusApplyConfiguration { + b.ResourceClaimName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podschedulinggate.go b/pkg/clients/applyconfiguration/core/v1/podschedulinggate.go new file mode 100644 index 000000000..1f3ce374b --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podschedulinggate.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PodSchedulingGateApplyConfiguration represents an declarative configuration of the PodSchedulingGate type for use +// with apply. +type PodSchedulingGateApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// PodSchedulingGateApplyConfiguration constructs an declarative configuration of the PodSchedulingGate type for use with +// apply. +func PodSchedulingGate() *PodSchedulingGateApplyConfiguration { + return &PodSchedulingGateApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodSchedulingGateApplyConfiguration) WithName(value string) *PodSchedulingGateApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podsecuritycontext.go b/pkg/clients/applyconfiguration/core/v1/podsecuritycontext.go new file mode 100644 index 000000000..9cfd96e8a --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podsecuritycontext.go @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// PodSecurityContextApplyConfiguration represents an declarative configuration of the PodSecurityContext type for use +// with apply. +type PodSecurityContextApplyConfiguration struct { + SELinuxOptions *SELinuxOptionsApplyConfiguration `json:"seLinuxOptions,omitempty"` + WindowsOptions *WindowsSecurityContextOptionsApplyConfiguration `json:"windowsOptions,omitempty"` + RunAsUser *int64 `json:"runAsUser,omitempty"` + RunAsGroup *int64 `json:"runAsGroup,omitempty"` + RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"` + SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` + FSGroup *int64 `json:"fsGroup,omitempty"` + Sysctls []SysctlApplyConfiguration `json:"sysctls,omitempty"` + FSGroupChangePolicy *corev1.PodFSGroupChangePolicy `json:"fsGroupChangePolicy,omitempty"` + SeccompProfile *SeccompProfileApplyConfiguration `json:"seccompProfile,omitempty"` +} + +// PodSecurityContextApplyConfiguration constructs an declarative configuration of the PodSecurityContext type for use with +// apply. +func PodSecurityContext() *PodSecurityContextApplyConfiguration { + return &PodSecurityContextApplyConfiguration{} +} + +// WithSELinuxOptions sets the SELinuxOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SELinuxOptions field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithSELinuxOptions(value *SELinuxOptionsApplyConfiguration) *PodSecurityContextApplyConfiguration { + b.SELinuxOptions = value + return b +} + +// WithWindowsOptions sets the WindowsOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WindowsOptions field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithWindowsOptions(value *WindowsSecurityContextOptionsApplyConfiguration) *PodSecurityContextApplyConfiguration { + b.WindowsOptions = value + return b +} + +// WithRunAsUser sets the RunAsUser field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsUser field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithRunAsUser(value int64) *PodSecurityContextApplyConfiguration { + b.RunAsUser = &value + return b +} + +// WithRunAsGroup sets the RunAsGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsGroup field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithRunAsGroup(value int64) *PodSecurityContextApplyConfiguration { + b.RunAsGroup = &value + return b +} + +// WithRunAsNonRoot sets the RunAsNonRoot field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsNonRoot field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithRunAsNonRoot(value bool) *PodSecurityContextApplyConfiguration { + b.RunAsNonRoot = &value + return b +} + +// WithSupplementalGroups adds the given value to the SupplementalGroups field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SupplementalGroups field. +func (b *PodSecurityContextApplyConfiguration) WithSupplementalGroups(values ...int64) *PodSecurityContextApplyConfiguration { + for i := range values { + b.SupplementalGroups = append(b.SupplementalGroups, values[i]) + } + return b +} + +// WithFSGroup sets the FSGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSGroup field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithFSGroup(value int64) *PodSecurityContextApplyConfiguration { + b.FSGroup = &value + return b +} + +// WithSysctls adds the given value to the Sysctls field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Sysctls field. +func (b *PodSecurityContextApplyConfiguration) WithSysctls(values ...*SysctlApplyConfiguration) *PodSecurityContextApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSysctls") + } + b.Sysctls = append(b.Sysctls, *values[i]) + } + return b +} + +// WithFSGroupChangePolicy sets the FSGroupChangePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSGroupChangePolicy field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithFSGroupChangePolicy(value corev1.PodFSGroupChangePolicy) *PodSecurityContextApplyConfiguration { + b.FSGroupChangePolicy = &value + return b +} + +// WithSeccompProfile sets the SeccompProfile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SeccompProfile field is set to the value of the last call. +func (b *PodSecurityContextApplyConfiguration) WithSeccompProfile(value *SeccompProfileApplyConfiguration) *PodSecurityContextApplyConfiguration { + b.SeccompProfile = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podspec.go b/pkg/clients/applyconfiguration/core/v1/podspec.go new file mode 100644 index 000000000..0d216a677 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podspec.go @@ -0,0 +1,433 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// PodSpecApplyConfiguration represents an declarative configuration of the PodSpec type for use +// with apply. +type PodSpecApplyConfiguration struct { + Volumes []VolumeApplyConfiguration `json:"volumes,omitempty"` + InitContainers []ContainerApplyConfiguration `json:"initContainers,omitempty"` + Containers []ContainerApplyConfiguration `json:"containers,omitempty"` + EphemeralContainers []EphemeralContainerApplyConfiguration `json:"ephemeralContainers,omitempty"` + RestartPolicy *corev1.RestartPolicy `json:"restartPolicy,omitempty"` + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` + ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"` + DNSPolicy *corev1.DNSPolicy `json:"dnsPolicy,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + ServiceAccountName *string `json:"serviceAccountName,omitempty"` + DeprecatedServiceAccount *string `json:"serviceAccount,omitempty"` + AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty"` + NodeName *string `json:"nodeName,omitempty"` + HostNetwork *bool `json:"hostNetwork,omitempty"` + HostPID *bool `json:"hostPID,omitempty"` + HostIPC *bool `json:"hostIPC,omitempty"` + ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty"` + SecurityContext *PodSecurityContextApplyConfiguration `json:"securityContext,omitempty"` + ImagePullSecrets []LocalObjectReferenceApplyConfiguration `json:"imagePullSecrets,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Subdomain *string `json:"subdomain,omitempty"` + Affinity *AffinityApplyConfiguration `json:"affinity,omitempty"` + SchedulerName *string `json:"schedulerName,omitempty"` + Tolerations []TolerationApplyConfiguration `json:"tolerations,omitempty"` + HostAliases []HostAliasApplyConfiguration `json:"hostAliases,omitempty"` + PriorityClassName *string `json:"priorityClassName,omitempty"` + Priority *int32 `json:"priority,omitempty"` + DNSConfig *PodDNSConfigApplyConfiguration `json:"dnsConfig,omitempty"` + ReadinessGates []PodReadinessGateApplyConfiguration `json:"readinessGates,omitempty"` + RuntimeClassName *string `json:"runtimeClassName,omitempty"` + EnableServiceLinks *bool `json:"enableServiceLinks,omitempty"` + PreemptionPolicy *corev1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` + Overhead *corev1.ResourceList `json:"overhead,omitempty"` + TopologySpreadConstraints []TopologySpreadConstraintApplyConfiguration `json:"topologySpreadConstraints,omitempty"` + SetHostnameAsFQDN *bool `json:"setHostnameAsFQDN,omitempty"` + OS *PodOSApplyConfiguration `json:"os,omitempty"` + HostUsers *bool `json:"hostUsers,omitempty"` + SchedulingGates []PodSchedulingGateApplyConfiguration `json:"schedulingGates,omitempty"` + ResourceClaims []PodResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` +} + +// PodSpecApplyConfiguration constructs an declarative configuration of the PodSpec type for use with +// apply. +func PodSpec() *PodSpecApplyConfiguration { + return &PodSpecApplyConfiguration{} +} + +// WithVolumes adds the given value to the Volumes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Volumes field. +func (b *PodSpecApplyConfiguration) WithVolumes(values ...*VolumeApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumes") + } + b.Volumes = append(b.Volumes, *values[i]) + } + return b +} + +// WithInitContainers adds the given value to the InitContainers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the InitContainers field. +func (b *PodSpecApplyConfiguration) WithInitContainers(values ...*ContainerApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithInitContainers") + } + b.InitContainers = append(b.InitContainers, *values[i]) + } + return b +} + +// WithContainers adds the given value to the Containers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Containers field. +func (b *PodSpecApplyConfiguration) WithContainers(values ...*ContainerApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithContainers") + } + b.Containers = append(b.Containers, *values[i]) + } + return b +} + +// WithEphemeralContainers adds the given value to the EphemeralContainers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EphemeralContainers field. +func (b *PodSpecApplyConfiguration) WithEphemeralContainers(values ...*EphemeralContainerApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEphemeralContainers") + } + b.EphemeralContainers = append(b.EphemeralContainers, *values[i]) + } + return b +} + +// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RestartPolicy field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithRestartPolicy(value corev1.RestartPolicy) *PodSpecApplyConfiguration { + b.RestartPolicy = &value + return b +} + +// WithTerminationGracePeriodSeconds sets the TerminationGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationGracePeriodSeconds field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithTerminationGracePeriodSeconds(value int64) *PodSpecApplyConfiguration { + b.TerminationGracePeriodSeconds = &value + return b +} + +// WithActiveDeadlineSeconds sets the ActiveDeadlineSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ActiveDeadlineSeconds field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithActiveDeadlineSeconds(value int64) *PodSpecApplyConfiguration { + b.ActiveDeadlineSeconds = &value + return b +} + +// WithDNSPolicy sets the DNSPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DNSPolicy field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithDNSPolicy(value corev1.DNSPolicy) *PodSpecApplyConfiguration { + b.DNSPolicy = &value + return b +} + +// WithNodeSelector puts the entries into the NodeSelector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the NodeSelector field, +// overwriting an existing map entries in NodeSelector field with the same key. +func (b *PodSpecApplyConfiguration) WithNodeSelector(entries map[string]string) *PodSpecApplyConfiguration { + if b.NodeSelector == nil && len(entries) > 0 { + b.NodeSelector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.NodeSelector[k] = v + } + return b +} + +// WithServiceAccountName sets the ServiceAccountName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceAccountName field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithServiceAccountName(value string) *PodSpecApplyConfiguration { + b.ServiceAccountName = &value + return b +} + +// WithDeprecatedServiceAccount sets the DeprecatedServiceAccount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedServiceAccount field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithDeprecatedServiceAccount(value string) *PodSpecApplyConfiguration { + b.DeprecatedServiceAccount = &value + return b +} + +// WithAutomountServiceAccountToken sets the AutomountServiceAccountToken field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AutomountServiceAccountToken field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithAutomountServiceAccountToken(value bool) *PodSpecApplyConfiguration { + b.AutomountServiceAccountToken = &value + return b +} + +// WithNodeName sets the NodeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeName field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithNodeName(value string) *PodSpecApplyConfiguration { + b.NodeName = &value + return b +} + +// WithHostNetwork sets the HostNetwork field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostNetwork field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithHostNetwork(value bool) *PodSpecApplyConfiguration { + b.HostNetwork = &value + return b +} + +// WithHostPID sets the HostPID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostPID field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithHostPID(value bool) *PodSpecApplyConfiguration { + b.HostPID = &value + return b +} + +// WithHostIPC sets the HostIPC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostIPC field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithHostIPC(value bool) *PodSpecApplyConfiguration { + b.HostIPC = &value + return b +} + +// WithShareProcessNamespace sets the ShareProcessNamespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ShareProcessNamespace field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithShareProcessNamespace(value bool) *PodSpecApplyConfiguration { + b.ShareProcessNamespace = &value + return b +} + +// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecurityContext field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithSecurityContext(value *PodSecurityContextApplyConfiguration) *PodSpecApplyConfiguration { + b.SecurityContext = value + return b +} + +// WithImagePullSecrets adds the given value to the ImagePullSecrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ImagePullSecrets field. +func (b *PodSpecApplyConfiguration) WithImagePullSecrets(values ...*LocalObjectReferenceApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithImagePullSecrets") + } + b.ImagePullSecrets = append(b.ImagePullSecrets, *values[i]) + } + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithHostname(value string) *PodSpecApplyConfiguration { + b.Hostname = &value + return b +} + +// WithSubdomain sets the Subdomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subdomain field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithSubdomain(value string) *PodSpecApplyConfiguration { + b.Subdomain = &value + return b +} + +// WithAffinity sets the Affinity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Affinity field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithAffinity(value *AffinityApplyConfiguration) *PodSpecApplyConfiguration { + b.Affinity = value + return b +} + +// WithSchedulerName sets the SchedulerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SchedulerName field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithSchedulerName(value string) *PodSpecApplyConfiguration { + b.SchedulerName = &value + return b +} + +// WithTolerations adds the given value to the Tolerations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Tolerations field. +func (b *PodSpecApplyConfiguration) WithTolerations(values ...*TolerationApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTolerations") + } + b.Tolerations = append(b.Tolerations, *values[i]) + } + return b +} + +// WithHostAliases adds the given value to the HostAliases field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the HostAliases field. +func (b *PodSpecApplyConfiguration) WithHostAliases(values ...*HostAliasApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHostAliases") + } + b.HostAliases = append(b.HostAliases, *values[i]) + } + return b +} + +// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PriorityClassName field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithPriorityClassName(value string) *PodSpecApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithPriority(value int32) *PodSpecApplyConfiguration { + b.Priority = &value + return b +} + +// WithDNSConfig sets the DNSConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DNSConfig field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithDNSConfig(value *PodDNSConfigApplyConfiguration) *PodSpecApplyConfiguration { + b.DNSConfig = value + return b +} + +// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ReadinessGates field. +func (b *PodSpecApplyConfiguration) WithReadinessGates(values ...*PodReadinessGateApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithReadinessGates") + } + b.ReadinessGates = append(b.ReadinessGates, *values[i]) + } + return b +} + +// WithRuntimeClassName sets the RuntimeClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RuntimeClassName field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithRuntimeClassName(value string) *PodSpecApplyConfiguration { + b.RuntimeClassName = &value + return b +} + +// WithEnableServiceLinks sets the EnableServiceLinks field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EnableServiceLinks field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithEnableServiceLinks(value bool) *PodSpecApplyConfiguration { + b.EnableServiceLinks = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreemptionPolicy field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithPreemptionPolicy(value corev1.PreemptionPolicy) *PodSpecApplyConfiguration { + b.PreemptionPolicy = &value + return b +} + +// WithOverhead sets the Overhead field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Overhead field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithOverhead(value corev1.ResourceList) *PodSpecApplyConfiguration { + b.Overhead = &value + return b +} + +// WithTopologySpreadConstraints adds the given value to the TopologySpreadConstraints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TopologySpreadConstraints field. +func (b *PodSpecApplyConfiguration) WithTopologySpreadConstraints(values ...*TopologySpreadConstraintApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTopologySpreadConstraints") + } + b.TopologySpreadConstraints = append(b.TopologySpreadConstraints, *values[i]) + } + return b +} + +// WithSetHostnameAsFQDN sets the SetHostnameAsFQDN field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetHostnameAsFQDN field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithSetHostnameAsFQDN(value bool) *PodSpecApplyConfiguration { + b.SetHostnameAsFQDN = &value + return b +} + +// WithOS sets the OS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OS field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithOS(value *PodOSApplyConfiguration) *PodSpecApplyConfiguration { + b.OS = value + return b +} + +// WithHostUsers sets the HostUsers field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostUsers field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithHostUsers(value bool) *PodSpecApplyConfiguration { + b.HostUsers = &value + return b +} + +// WithSchedulingGates adds the given value to the SchedulingGates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SchedulingGates field. +func (b *PodSpecApplyConfiguration) WithSchedulingGates(values ...*PodSchedulingGateApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSchedulingGates") + } + b.SchedulingGates = append(b.SchedulingGates, *values[i]) + } + return b +} + +// WithResourceClaims adds the given value to the ResourceClaims field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResourceClaims field. +func (b *PodSpecApplyConfiguration) WithResourceClaims(values ...*PodResourceClaimApplyConfiguration) *PodSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaims") + } + b.ResourceClaims = append(b.ResourceClaims, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podstatus.go b/pkg/clients/applyconfiguration/core/v1/podstatus.go new file mode 100644 index 000000000..e058ef1ef --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podstatus.go @@ -0,0 +1,201 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PodStatusApplyConfiguration represents an declarative configuration of the PodStatus type for use +// with apply. +type PodStatusApplyConfiguration struct { + Phase *v1.PodPhase `json:"phase,omitempty"` + Conditions []PodConditionApplyConfiguration `json:"conditions,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` + NominatedNodeName *string `json:"nominatedNodeName,omitempty"` + HostIP *string `json:"hostIP,omitempty"` + HostIPs []HostIPApplyConfiguration `json:"hostIPs,omitempty"` + PodIP *string `json:"podIP,omitempty"` + PodIPs []PodIPApplyConfiguration `json:"podIPs,omitempty"` + StartTime *metav1.Time `json:"startTime,omitempty"` + InitContainerStatuses []ContainerStatusApplyConfiguration `json:"initContainerStatuses,omitempty"` + ContainerStatuses []ContainerStatusApplyConfiguration `json:"containerStatuses,omitempty"` + QOSClass *v1.PodQOSClass `json:"qosClass,omitempty"` + EphemeralContainerStatuses []ContainerStatusApplyConfiguration `json:"ephemeralContainerStatuses,omitempty"` + Resize *v1.PodResizeStatus `json:"resize,omitempty"` + ResourceClaimStatuses []PodResourceClaimStatusApplyConfiguration `json:"resourceClaimStatuses,omitempty"` +} + +// PodStatusApplyConfiguration constructs an declarative configuration of the PodStatus type for use with +// apply. +func PodStatus() *PodStatusApplyConfiguration { + return &PodStatusApplyConfiguration{} +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithPhase(value v1.PodPhase) *PodStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *PodStatusApplyConfiguration) WithConditions(values ...*PodConditionApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithMessage(value string) *PodStatusApplyConfiguration { + b.Message = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithReason(value string) *PodStatusApplyConfiguration { + b.Reason = &value + return b +} + +// WithNominatedNodeName sets the NominatedNodeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NominatedNodeName field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithNominatedNodeName(value string) *PodStatusApplyConfiguration { + b.NominatedNodeName = &value + return b +} + +// WithHostIP sets the HostIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostIP field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithHostIP(value string) *PodStatusApplyConfiguration { + b.HostIP = &value + return b +} + +// WithHostIPs adds the given value to the HostIPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the HostIPs field. +func (b *PodStatusApplyConfiguration) WithHostIPs(values ...*HostIPApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithHostIPs") + } + b.HostIPs = append(b.HostIPs, *values[i]) + } + return b +} + +// WithPodIP sets the PodIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodIP field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithPodIP(value string) *PodStatusApplyConfiguration { + b.PodIP = &value + return b +} + +// WithPodIPs adds the given value to the PodIPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PodIPs field. +func (b *PodStatusApplyConfiguration) WithPodIPs(values ...*PodIPApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodIPs") + } + b.PodIPs = append(b.PodIPs, *values[i]) + } + return b +} + +// WithStartTime sets the StartTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StartTime field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithStartTime(value metav1.Time) *PodStatusApplyConfiguration { + b.StartTime = &value + return b +} + +// WithInitContainerStatuses adds the given value to the InitContainerStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the InitContainerStatuses field. +func (b *PodStatusApplyConfiguration) WithInitContainerStatuses(values ...*ContainerStatusApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithInitContainerStatuses") + } + b.InitContainerStatuses = append(b.InitContainerStatuses, *values[i]) + } + return b +} + +// WithContainerStatuses adds the given value to the ContainerStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ContainerStatuses field. +func (b *PodStatusApplyConfiguration) WithContainerStatuses(values ...*ContainerStatusApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithContainerStatuses") + } + b.ContainerStatuses = append(b.ContainerStatuses, *values[i]) + } + return b +} + +// WithQOSClass sets the QOSClass field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the QOSClass field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithQOSClass(value v1.PodQOSClass) *PodStatusApplyConfiguration { + b.QOSClass = &value + return b +} + +// WithEphemeralContainerStatuses adds the given value to the EphemeralContainerStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EphemeralContainerStatuses field. +func (b *PodStatusApplyConfiguration) WithEphemeralContainerStatuses(values ...*ContainerStatusApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEphemeralContainerStatuses") + } + b.EphemeralContainerStatuses = append(b.EphemeralContainerStatuses, *values[i]) + } + return b +} + +// WithResize sets the Resize field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resize field is set to the value of the last call. +func (b *PodStatusApplyConfiguration) WithResize(value v1.PodResizeStatus) *PodStatusApplyConfiguration { + b.Resize = &value + return b +} + +// WithResourceClaimStatuses adds the given value to the ResourceClaimStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResourceClaimStatuses field. +func (b *PodStatusApplyConfiguration) WithResourceClaimStatuses(values ...*PodResourceClaimStatusApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaimStatuses") + } + b.ResourceClaimStatuses = append(b.ResourceClaimStatuses, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podtemplate.go b/pkg/clients/applyconfiguration/core/v1/podtemplate.go new file mode 100644 index 000000000..4b0eaa6c4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podtemplate.go @@ -0,0 +1,197 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodTemplateApplyConfiguration represents an declarative configuration of the PodTemplate type for use +// with apply. +type PodTemplateApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Template *PodTemplateSpecApplyConfiguration `json:"template,omitempty"` +} + +// PodTemplate constructs an declarative configuration of the PodTemplate type for use with +// apply. +func PodTemplate(name, namespace string) *PodTemplateApplyConfiguration { + b := &PodTemplateApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PodTemplate") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithKind(value string) *PodTemplateApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithAPIVersion(value string) *PodTemplateApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithName(value string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithGenerateName(value string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithNamespace(value string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithUID(value types.UID) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithResourceVersion(value string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithGeneration(value int64) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PodTemplateApplyConfiguration) WithLabels(entries map[string]string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PodTemplateApplyConfiguration) WithAnnotations(entries map[string]string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PodTemplateApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PodTemplateApplyConfiguration) WithFinalizers(values ...string) *PodTemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PodTemplateApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *PodTemplateApplyConfiguration) WithTemplate(value *PodTemplateSpecApplyConfiguration) *PodTemplateApplyConfiguration { + b.Template = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/podtemplatespec.go b/pkg/clients/applyconfiguration/core/v1/podtemplatespec.go new file mode 100644 index 000000000..3ac312ddb --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/podtemplatespec.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodTemplateSpecApplyConfiguration represents an declarative configuration of the PodTemplateSpec type for use +// with apply. +type PodTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PodSpecApplyConfiguration `json:"spec,omitempty"` +} + +// PodTemplateSpecApplyConfiguration constructs an declarative configuration of the PodTemplateSpec type for use with +// apply. +func PodTemplateSpec() *PodTemplateSpecApplyConfiguration { + return &PodTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithName(value string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithGenerateName(value string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithNamespace(value string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithUID(value types.UID) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithResourceVersion(value string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithGeneration(value int64) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PodTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PodTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PodTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PodTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *PodTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PodTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PodTemplateSpecApplyConfiguration) WithSpec(value *PodSpecApplyConfiguration) *PodTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/portstatus.go b/pkg/clients/applyconfiguration/core/v1/portstatus.go new file mode 100644 index 000000000..68a6a9f55 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/portstatus.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// PortStatusApplyConfiguration represents an declarative configuration of the PortStatus type for use +// with apply. +type PortStatusApplyConfiguration struct { + Port *int32 `json:"port,omitempty"` + Protocol *v1.Protocol `json:"protocol,omitempty"` + Error *string `json:"error,omitempty"` +} + +// PortStatusApplyConfiguration constructs an declarative configuration of the PortStatus type for use with +// apply. +func PortStatus() *PortStatusApplyConfiguration { + return &PortStatusApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *PortStatusApplyConfiguration) WithPort(value int32) *PortStatusApplyConfiguration { + b.Port = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *PortStatusApplyConfiguration) WithProtocol(value v1.Protocol) *PortStatusApplyConfiguration { + b.Protocol = &value + return b +} + +// WithError sets the Error field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Error field is set to the value of the last call. +func (b *PortStatusApplyConfiguration) WithError(value string) *PortStatusApplyConfiguration { + b.Error = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/portworxvolumesource.go b/pkg/clients/applyconfiguration/core/v1/portworxvolumesource.go new file mode 100644 index 000000000..3eb113dbf --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/portworxvolumesource.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PortworxVolumeSourceApplyConfiguration represents an declarative configuration of the PortworxVolumeSource type for use +// with apply. +type PortworxVolumeSourceApplyConfiguration struct { + VolumeID *string `json:"volumeID,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// PortworxVolumeSourceApplyConfiguration constructs an declarative configuration of the PortworxVolumeSource type for use with +// apply. +func PortworxVolumeSource() *PortworxVolumeSourceApplyConfiguration { + return &PortworxVolumeSourceApplyConfiguration{} +} + +// WithVolumeID sets the VolumeID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeID field is set to the value of the last call. +func (b *PortworxVolumeSourceApplyConfiguration) WithVolumeID(value string) *PortworxVolumeSourceApplyConfiguration { + b.VolumeID = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *PortworxVolumeSourceApplyConfiguration) WithFSType(value string) *PortworxVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *PortworxVolumeSourceApplyConfiguration) WithReadOnly(value bool) *PortworxVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/preferredschedulingterm.go b/pkg/clients/applyconfiguration/core/v1/preferredschedulingterm.go new file mode 100644 index 000000000..4f7105bae --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/preferredschedulingterm.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PreferredSchedulingTermApplyConfiguration represents an declarative configuration of the PreferredSchedulingTerm type for use +// with apply. +type PreferredSchedulingTermApplyConfiguration struct { + Weight *int32 `json:"weight,omitempty"` + Preference *NodeSelectorTermApplyConfiguration `json:"preference,omitempty"` +} + +// PreferredSchedulingTermApplyConfiguration constructs an declarative configuration of the PreferredSchedulingTerm type for use with +// apply. +func PreferredSchedulingTerm() *PreferredSchedulingTermApplyConfiguration { + return &PreferredSchedulingTermApplyConfiguration{} +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *PreferredSchedulingTermApplyConfiguration) WithWeight(value int32) *PreferredSchedulingTermApplyConfiguration { + b.Weight = &value + return b +} + +// WithPreference sets the Preference field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Preference field is set to the value of the last call. +func (b *PreferredSchedulingTermApplyConfiguration) WithPreference(value *NodeSelectorTermApplyConfiguration) *PreferredSchedulingTermApplyConfiguration { + b.Preference = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/probe.go b/pkg/clients/applyconfiguration/core/v1/probe.go new file mode 100644 index 000000000..cabf4bec1 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/probe.go @@ -0,0 +1,104 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ProbeApplyConfiguration represents an declarative configuration of the Probe type for use +// with apply. +type ProbeApplyConfiguration struct { + ProbeHandlerApplyConfiguration `json:",inline"` + InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` + SuccessThreshold *int32 `json:"successThreshold,omitempty"` + FailureThreshold *int32 `json:"failureThreshold,omitempty"` + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` +} + +// ProbeApplyConfiguration constructs an declarative configuration of the Probe type for use with +// apply. +func Probe() *ProbeApplyConfiguration { + return &ProbeApplyConfiguration{} +} + +// WithExec sets the Exec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Exec field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithExec(value *ExecActionApplyConfiguration) *ProbeApplyConfiguration { + b.Exec = value + return b +} + +// WithHTTPGet sets the HTTPGet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HTTPGet field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithHTTPGet(value *HTTPGetActionApplyConfiguration) *ProbeApplyConfiguration { + b.HTTPGet = value + return b +} + +// WithTCPSocket sets the TCPSocket field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TCPSocket field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithTCPSocket(value *TCPSocketActionApplyConfiguration) *ProbeApplyConfiguration { + b.TCPSocket = value + return b +} + +// WithGRPC sets the GRPC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GRPC field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithGRPC(value *GRPCActionApplyConfiguration) *ProbeApplyConfiguration { + b.GRPC = value + return b +} + +// WithInitialDelaySeconds sets the InitialDelaySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InitialDelaySeconds field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithInitialDelaySeconds(value int32) *ProbeApplyConfiguration { + b.InitialDelaySeconds = &value + return b +} + +// WithTimeoutSeconds sets the TimeoutSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeoutSeconds field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithTimeoutSeconds(value int32) *ProbeApplyConfiguration { + b.TimeoutSeconds = &value + return b +} + +// WithPeriodSeconds sets the PeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PeriodSeconds field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithPeriodSeconds(value int32) *ProbeApplyConfiguration { + b.PeriodSeconds = &value + return b +} + +// WithSuccessThreshold sets the SuccessThreshold field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SuccessThreshold field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithSuccessThreshold(value int32) *ProbeApplyConfiguration { + b.SuccessThreshold = &value + return b +} + +// WithFailureThreshold sets the FailureThreshold field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureThreshold field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithFailureThreshold(value int32) *ProbeApplyConfiguration { + b.FailureThreshold = &value + return b +} + +// WithTerminationGracePeriodSeconds sets the TerminationGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationGracePeriodSeconds field is set to the value of the last call. +func (b *ProbeApplyConfiguration) WithTerminationGracePeriodSeconds(value int64) *ProbeApplyConfiguration { + b.TerminationGracePeriodSeconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/probehandler.go b/pkg/clients/applyconfiguration/core/v1/probehandler.go new file mode 100644 index 000000000..e76b5ebdc --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/probehandler.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ProbeHandlerApplyConfiguration represents an declarative configuration of the ProbeHandler type for use +// with apply. +type ProbeHandlerApplyConfiguration struct { + Exec *ExecActionApplyConfiguration `json:"exec,omitempty"` + HTTPGet *HTTPGetActionApplyConfiguration `json:"httpGet,omitempty"` + TCPSocket *TCPSocketActionApplyConfiguration `json:"tcpSocket,omitempty"` + GRPC *GRPCActionApplyConfiguration `json:"grpc,omitempty"` +} + +// ProbeHandlerApplyConfiguration constructs an declarative configuration of the ProbeHandler type for use with +// apply. +func ProbeHandler() *ProbeHandlerApplyConfiguration { + return &ProbeHandlerApplyConfiguration{} +} + +// WithExec sets the Exec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Exec field is set to the value of the last call. +func (b *ProbeHandlerApplyConfiguration) WithExec(value *ExecActionApplyConfiguration) *ProbeHandlerApplyConfiguration { + b.Exec = value + return b +} + +// WithHTTPGet sets the HTTPGet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HTTPGet field is set to the value of the last call. +func (b *ProbeHandlerApplyConfiguration) WithHTTPGet(value *HTTPGetActionApplyConfiguration) *ProbeHandlerApplyConfiguration { + b.HTTPGet = value + return b +} + +// WithTCPSocket sets the TCPSocket field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TCPSocket field is set to the value of the last call. +func (b *ProbeHandlerApplyConfiguration) WithTCPSocket(value *TCPSocketActionApplyConfiguration) *ProbeHandlerApplyConfiguration { + b.TCPSocket = value + return b +} + +// WithGRPC sets the GRPC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GRPC field is set to the value of the last call. +func (b *ProbeHandlerApplyConfiguration) WithGRPC(value *GRPCActionApplyConfiguration) *ProbeHandlerApplyConfiguration { + b.GRPC = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/projectedvolumesource.go b/pkg/clients/applyconfiguration/core/v1/projectedvolumesource.go new file mode 100644 index 000000000..b3e1785fd --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/projectedvolumesource.go @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ProjectedVolumeSourceApplyConfiguration represents an declarative configuration of the ProjectedVolumeSource type for use +// with apply. +type ProjectedVolumeSourceApplyConfiguration struct { + Sources []VolumeProjectionApplyConfiguration `json:"sources,omitempty"` + DefaultMode *int32 `json:"defaultMode,omitempty"` +} + +// ProjectedVolumeSourceApplyConfiguration constructs an declarative configuration of the ProjectedVolumeSource type for use with +// apply. +func ProjectedVolumeSource() *ProjectedVolumeSourceApplyConfiguration { + return &ProjectedVolumeSourceApplyConfiguration{} +} + +// WithSources adds the given value to the Sources field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Sources field. +func (b *ProjectedVolumeSourceApplyConfiguration) WithSources(values ...*VolumeProjectionApplyConfiguration) *ProjectedVolumeSourceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSources") + } + b.Sources = append(b.Sources, *values[i]) + } + return b +} + +// WithDefaultMode sets the DefaultMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultMode field is set to the value of the last call. +func (b *ProjectedVolumeSourceApplyConfiguration) WithDefaultMode(value int32) *ProjectedVolumeSourceApplyConfiguration { + b.DefaultMode = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/quobytevolumesource.go b/pkg/clients/applyconfiguration/core/v1/quobytevolumesource.go new file mode 100644 index 000000000..241f64ac9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/quobytevolumesource.go @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// QuobyteVolumeSourceApplyConfiguration represents an declarative configuration of the QuobyteVolumeSource type for use +// with apply. +type QuobyteVolumeSourceApplyConfiguration struct { + Registry *string `json:"registry,omitempty"` + Volume *string `json:"volume,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + User *string `json:"user,omitempty"` + Group *string `json:"group,omitempty"` + Tenant *string `json:"tenant,omitempty"` +} + +// QuobyteVolumeSourceApplyConfiguration constructs an declarative configuration of the QuobyteVolumeSource type for use with +// apply. +func QuobyteVolumeSource() *QuobyteVolumeSourceApplyConfiguration { + return &QuobyteVolumeSourceApplyConfiguration{} +} + +// WithRegistry sets the Registry field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Registry field is set to the value of the last call. +func (b *QuobyteVolumeSourceApplyConfiguration) WithRegistry(value string) *QuobyteVolumeSourceApplyConfiguration { + b.Registry = &value + return b +} + +// WithVolume sets the Volume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Volume field is set to the value of the last call. +func (b *QuobyteVolumeSourceApplyConfiguration) WithVolume(value string) *QuobyteVolumeSourceApplyConfiguration { + b.Volume = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *QuobyteVolumeSourceApplyConfiguration) WithReadOnly(value bool) *QuobyteVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithUser sets the User field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the User field is set to the value of the last call. +func (b *QuobyteVolumeSourceApplyConfiguration) WithUser(value string) *QuobyteVolumeSourceApplyConfiguration { + b.User = &value + return b +} + +// WithGroup sets the Group field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Group field is set to the value of the last call. +func (b *QuobyteVolumeSourceApplyConfiguration) WithGroup(value string) *QuobyteVolumeSourceApplyConfiguration { + b.Group = &value + return b +} + +// WithTenant sets the Tenant field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Tenant field is set to the value of the last call. +func (b *QuobyteVolumeSourceApplyConfiguration) WithTenant(value string) *QuobyteVolumeSourceApplyConfiguration { + b.Tenant = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/rbdpersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/rbdpersistentvolumesource.go new file mode 100644 index 000000000..adcacc047 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/rbdpersistentvolumesource.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// RBDPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the RBDPersistentVolumeSource type for use +// with apply. +type RBDPersistentVolumeSourceApplyConfiguration struct { + CephMonitors []string `json:"monitors,omitempty"` + RBDImage *string `json:"image,omitempty"` + FSType *string `json:"fsType,omitempty"` + RBDPool *string `json:"pool,omitempty"` + RadosUser *string `json:"user,omitempty"` + Keyring *string `json:"keyring,omitempty"` + SecretRef *SecretReferenceApplyConfiguration `json:"secretRef,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// RBDPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the RBDPersistentVolumeSource type for use with +// apply. +func RBDPersistentVolumeSource() *RBDPersistentVolumeSourceApplyConfiguration { + return &RBDPersistentVolumeSourceApplyConfiguration{} +} + +// WithCephMonitors adds the given value to the CephMonitors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CephMonitors field. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithCephMonitors(values ...string) *RBDPersistentVolumeSourceApplyConfiguration { + for i := range values { + b.CephMonitors = append(b.CephMonitors, values[i]) + } + return b +} + +// WithRBDImage sets the RBDImage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBDImage field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithRBDImage(value string) *RBDPersistentVolumeSourceApplyConfiguration { + b.RBDImage = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *RBDPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithRBDPool sets the RBDPool field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBDPool field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithRBDPool(value string) *RBDPersistentVolumeSourceApplyConfiguration { + b.RBDPool = &value + return b +} + +// WithRadosUser sets the RadosUser field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RadosUser field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithRadosUser(value string) *RBDPersistentVolumeSourceApplyConfiguration { + b.RadosUser = &value + return b +} + +// WithKeyring sets the Keyring field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Keyring field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithKeyring(value string) *RBDPersistentVolumeSourceApplyConfiguration { + b.Keyring = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *SecretReferenceApplyConfiguration) *RBDPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *RBDPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *RBDPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/rbdvolumesource.go b/pkg/clients/applyconfiguration/core/v1/rbdvolumesource.go new file mode 100644 index 000000000..b70e5ced5 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/rbdvolumesource.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// RBDVolumeSourceApplyConfiguration represents an declarative configuration of the RBDVolumeSource type for use +// with apply. +type RBDVolumeSourceApplyConfiguration struct { + CephMonitors []string `json:"monitors,omitempty"` + RBDImage *string `json:"image,omitempty"` + FSType *string `json:"fsType,omitempty"` + RBDPool *string `json:"pool,omitempty"` + RadosUser *string `json:"user,omitempty"` + Keyring *string `json:"keyring,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// RBDVolumeSourceApplyConfiguration constructs an declarative configuration of the RBDVolumeSource type for use with +// apply. +func RBDVolumeSource() *RBDVolumeSourceApplyConfiguration { + return &RBDVolumeSourceApplyConfiguration{} +} + +// WithCephMonitors adds the given value to the CephMonitors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CephMonitors field. +func (b *RBDVolumeSourceApplyConfiguration) WithCephMonitors(values ...string) *RBDVolumeSourceApplyConfiguration { + for i := range values { + b.CephMonitors = append(b.CephMonitors, values[i]) + } + return b +} + +// WithRBDImage sets the RBDImage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBDImage field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithRBDImage(value string) *RBDVolumeSourceApplyConfiguration { + b.RBDImage = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithFSType(value string) *RBDVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithRBDPool sets the RBDPool field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBDPool field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithRBDPool(value string) *RBDVolumeSourceApplyConfiguration { + b.RBDPool = &value + return b +} + +// WithRadosUser sets the RadosUser field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RadosUser field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithRadosUser(value string) *RBDVolumeSourceApplyConfiguration { + b.RadosUser = &value + return b +} + +// WithKeyring sets the Keyring field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Keyring field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithKeyring(value string) *RBDVolumeSourceApplyConfiguration { + b.Keyring = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *RBDVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *RBDVolumeSourceApplyConfiguration) WithReadOnly(value bool) *RBDVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/replicationcontroller.go b/pkg/clients/applyconfiguration/core/v1/replicationcontroller.go new file mode 100644 index 000000000..dc88f2e92 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/replicationcontroller.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ReplicationControllerApplyConfiguration represents an declarative configuration of the ReplicationController type for use +// with apply. +type ReplicationControllerApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ReplicationControllerSpecApplyConfiguration `json:"spec,omitempty"` + Status *ReplicationControllerStatusApplyConfiguration `json:"status,omitempty"` +} + +// ReplicationController constructs an declarative configuration of the ReplicationController type for use with +// apply. +func ReplicationController(name, namespace string) *ReplicationControllerApplyConfiguration { + b := &ReplicationControllerApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ReplicationController") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithKind(value string) *ReplicationControllerApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithAPIVersion(value string) *ReplicationControllerApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithName(value string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithGenerateName(value string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithNamespace(value string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithUID(value types.UID) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithResourceVersion(value string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithGeneration(value int64) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ReplicationControllerApplyConfiguration) WithLabels(entries map[string]string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ReplicationControllerApplyConfiguration) WithAnnotations(entries map[string]string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ReplicationControllerApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ReplicationControllerApplyConfiguration) WithFinalizers(values ...string) *ReplicationControllerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ReplicationControllerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithSpec(value *ReplicationControllerSpecApplyConfiguration) *ReplicationControllerApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ReplicationControllerApplyConfiguration) WithStatus(value *ReplicationControllerStatusApplyConfiguration) *ReplicationControllerApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/replicationcontrollercondition.go b/pkg/clients/applyconfiguration/core/v1/replicationcontrollercondition.go new file mode 100644 index 000000000..f6b6ac759 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/replicationcontrollercondition.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ReplicationControllerConditionApplyConfiguration represents an declarative configuration of the ReplicationControllerCondition type for use +// with apply. +type ReplicationControllerConditionApplyConfiguration struct { + Type *v1.ReplicationControllerConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ReplicationControllerConditionApplyConfiguration constructs an declarative configuration of the ReplicationControllerCondition type for use with +// apply. +func ReplicationControllerCondition() *ReplicationControllerConditionApplyConfiguration { + return &ReplicationControllerConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ReplicationControllerConditionApplyConfiguration) WithType(value v1.ReplicationControllerConditionType) *ReplicationControllerConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ReplicationControllerConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *ReplicationControllerConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *ReplicationControllerConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *ReplicationControllerConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ReplicationControllerConditionApplyConfiguration) WithReason(value string) *ReplicationControllerConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ReplicationControllerConditionApplyConfiguration) WithMessage(value string) *ReplicationControllerConditionApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/replicationcontrollerspec.go b/pkg/clients/applyconfiguration/core/v1/replicationcontrollerspec.go new file mode 100644 index 000000000..76ebc1fb4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/replicationcontrollerspec.go @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ReplicationControllerSpecApplyConfiguration represents an declarative configuration of the ReplicationControllerSpec type for use +// with apply. +type ReplicationControllerSpecApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + Selector map[string]string `json:"selector,omitempty"` + Template *PodTemplateSpecApplyConfiguration `json:"template,omitempty"` +} + +// ReplicationControllerSpecApplyConfiguration constructs an declarative configuration of the ReplicationControllerSpec type for use with +// apply. +func ReplicationControllerSpec() *ReplicationControllerSpecApplyConfiguration { + return &ReplicationControllerSpecApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ReplicationControllerSpecApplyConfiguration) WithReplicas(value int32) *ReplicationControllerSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithMinReadySeconds sets the MinReadySeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinReadySeconds field is set to the value of the last call. +func (b *ReplicationControllerSpecApplyConfiguration) WithMinReadySeconds(value int32) *ReplicationControllerSpecApplyConfiguration { + b.MinReadySeconds = &value + return b +} + +// WithSelector puts the entries into the Selector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Selector field, +// overwriting an existing map entries in Selector field with the same key. +func (b *ReplicationControllerSpecApplyConfiguration) WithSelector(entries map[string]string) *ReplicationControllerSpecApplyConfiguration { + if b.Selector == nil && len(entries) > 0 { + b.Selector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Selector[k] = v + } + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *ReplicationControllerSpecApplyConfiguration) WithTemplate(value *PodTemplateSpecApplyConfiguration) *ReplicationControllerSpecApplyConfiguration { + b.Template = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/replicationcontrollerstatus.go b/pkg/clients/applyconfiguration/core/v1/replicationcontrollerstatus.go new file mode 100644 index 000000000..41d117c75 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/replicationcontrollerstatus.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ReplicationControllerStatusApplyConfiguration represents an declarative configuration of the ReplicationControllerStatus type for use +// with apply. +type ReplicationControllerStatusApplyConfiguration struct { + Replicas *int32 `json:"replicas,omitempty"` + FullyLabeledReplicas *int32 `json:"fullyLabeledReplicas,omitempty"` + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + Conditions []ReplicationControllerConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// ReplicationControllerStatusApplyConfiguration constructs an declarative configuration of the ReplicationControllerStatus type for use with +// apply. +func ReplicationControllerStatus() *ReplicationControllerStatusApplyConfiguration { + return &ReplicationControllerStatusApplyConfiguration{} +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ReplicationControllerStatusApplyConfiguration) WithReplicas(value int32) *ReplicationControllerStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithFullyLabeledReplicas sets the FullyLabeledReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FullyLabeledReplicas field is set to the value of the last call. +func (b *ReplicationControllerStatusApplyConfiguration) WithFullyLabeledReplicas(value int32) *ReplicationControllerStatusApplyConfiguration { + b.FullyLabeledReplicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *ReplicationControllerStatusApplyConfiguration) WithReadyReplicas(value int32) *ReplicationControllerStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithAvailableReplicas sets the AvailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableReplicas field is set to the value of the last call. +func (b *ReplicationControllerStatusApplyConfiguration) WithAvailableReplicas(value int32) *ReplicationControllerStatusApplyConfiguration { + b.AvailableReplicas = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *ReplicationControllerStatusApplyConfiguration) WithObservedGeneration(value int64) *ReplicationControllerStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ReplicationControllerStatusApplyConfiguration) WithConditions(values ...*ReplicationControllerConditionApplyConfiguration) *ReplicationControllerStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/resourceclaim.go b/pkg/clients/applyconfiguration/core/v1/resourceclaim.go new file mode 100644 index 000000000..bf90e5ff8 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/resourceclaim.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ResourceClaimApplyConfiguration represents an declarative configuration of the ResourceClaim type for use +// with apply. +type ResourceClaimApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// ResourceClaimApplyConfiguration constructs an declarative configuration of the ResourceClaim type for use with +// apply. +func ResourceClaim() *ResourceClaimApplyConfiguration { + return &ResourceClaimApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceClaimApplyConfiguration) WithName(value string) *ResourceClaimApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/resourcefieldselector.go b/pkg/clients/applyconfiguration/core/v1/resourcefieldselector.go new file mode 100644 index 000000000..e9ad40458 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/resourcefieldselector.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// ResourceFieldSelectorApplyConfiguration represents an declarative configuration of the ResourceFieldSelector type for use +// with apply. +type ResourceFieldSelectorApplyConfiguration struct { + ContainerName *string `json:"containerName,omitempty"` + Resource *string `json:"resource,omitempty"` + Divisor *resource.Quantity `json:"divisor,omitempty"` +} + +// ResourceFieldSelectorApplyConfiguration constructs an declarative configuration of the ResourceFieldSelector type for use with +// apply. +func ResourceFieldSelector() *ResourceFieldSelectorApplyConfiguration { + return &ResourceFieldSelectorApplyConfiguration{} +} + +// WithContainerName sets the ContainerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContainerName field is set to the value of the last call. +func (b *ResourceFieldSelectorApplyConfiguration) WithContainerName(value string) *ResourceFieldSelectorApplyConfiguration { + b.ContainerName = &value + return b +} + +// WithResource sets the Resource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resource field is set to the value of the last call. +func (b *ResourceFieldSelectorApplyConfiguration) WithResource(value string) *ResourceFieldSelectorApplyConfiguration { + b.Resource = &value + return b +} + +// WithDivisor sets the Divisor field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Divisor field is set to the value of the last call. +func (b *ResourceFieldSelectorApplyConfiguration) WithDivisor(value resource.Quantity) *ResourceFieldSelectorApplyConfiguration { + b.Divisor = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/resourcequota.go b/pkg/clients/applyconfiguration/core/v1/resourcequota.go new file mode 100644 index 000000000..43af97206 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/resourcequota.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceQuotaApplyConfiguration represents an declarative configuration of the ResourceQuota type for use +// with apply. +type ResourceQuotaApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ResourceQuotaSpecApplyConfiguration `json:"spec,omitempty"` + Status *ResourceQuotaStatusApplyConfiguration `json:"status,omitempty"` +} + +// ResourceQuota constructs an declarative configuration of the ResourceQuota type for use with +// apply. +func ResourceQuota(name, namespace string) *ResourceQuotaApplyConfiguration { + b := &ResourceQuotaApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceQuota") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithKind(value string) *ResourceQuotaApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithAPIVersion(value string) *ResourceQuotaApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithName(value string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithGenerateName(value string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithNamespace(value string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithUID(value types.UID) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithResourceVersion(value string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithGeneration(value int64) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceQuotaApplyConfiguration) WithLabels(entries map[string]string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceQuotaApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceQuotaApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceQuotaApplyConfiguration) WithFinalizers(values ...string) *ResourceQuotaApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceQuotaApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithSpec(value *ResourceQuotaSpecApplyConfiguration) *ResourceQuotaApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceQuotaApplyConfiguration) WithStatus(value *ResourceQuotaStatusApplyConfiguration) *ResourceQuotaApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/resourcequotaspec.go b/pkg/clients/applyconfiguration/core/v1/resourcequotaspec.go new file mode 100644 index 000000000..74137b24f --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/resourcequotaspec.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ResourceQuotaSpecApplyConfiguration represents an declarative configuration of the ResourceQuotaSpec type for use +// with apply. +type ResourceQuotaSpecApplyConfiguration struct { + Hard *v1.ResourceList `json:"hard,omitempty"` + Scopes []v1.ResourceQuotaScope `json:"scopes,omitempty"` + ScopeSelector *ScopeSelectorApplyConfiguration `json:"scopeSelector,omitempty"` +} + +// ResourceQuotaSpecApplyConfiguration constructs an declarative configuration of the ResourceQuotaSpec type for use with +// apply. +func ResourceQuotaSpec() *ResourceQuotaSpecApplyConfiguration { + return &ResourceQuotaSpecApplyConfiguration{} +} + +// WithHard sets the Hard field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hard field is set to the value of the last call. +func (b *ResourceQuotaSpecApplyConfiguration) WithHard(value v1.ResourceList) *ResourceQuotaSpecApplyConfiguration { + b.Hard = &value + return b +} + +// WithScopes adds the given value to the Scopes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Scopes field. +func (b *ResourceQuotaSpecApplyConfiguration) WithScopes(values ...v1.ResourceQuotaScope) *ResourceQuotaSpecApplyConfiguration { + for i := range values { + b.Scopes = append(b.Scopes, values[i]) + } + return b +} + +// WithScopeSelector sets the ScopeSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScopeSelector field is set to the value of the last call. +func (b *ResourceQuotaSpecApplyConfiguration) WithScopeSelector(value *ScopeSelectorApplyConfiguration) *ResourceQuotaSpecApplyConfiguration { + b.ScopeSelector = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/resourcequotastatus.go b/pkg/clients/applyconfiguration/core/v1/resourcequotastatus.go new file mode 100644 index 000000000..e13197047 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/resourcequotastatus.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ResourceQuotaStatusApplyConfiguration represents an declarative configuration of the ResourceQuotaStatus type for use +// with apply. +type ResourceQuotaStatusApplyConfiguration struct { + Hard *v1.ResourceList `json:"hard,omitempty"` + Used *v1.ResourceList `json:"used,omitempty"` +} + +// ResourceQuotaStatusApplyConfiguration constructs an declarative configuration of the ResourceQuotaStatus type for use with +// apply. +func ResourceQuotaStatus() *ResourceQuotaStatusApplyConfiguration { + return &ResourceQuotaStatusApplyConfiguration{} +} + +// WithHard sets the Hard field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hard field is set to the value of the last call. +func (b *ResourceQuotaStatusApplyConfiguration) WithHard(value v1.ResourceList) *ResourceQuotaStatusApplyConfiguration { + b.Hard = &value + return b +} + +// WithUsed sets the Used field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Used field is set to the value of the last call. +func (b *ResourceQuotaStatusApplyConfiguration) WithUsed(value v1.ResourceList) *ResourceQuotaStatusApplyConfiguration { + b.Used = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/resourcerequirements.go b/pkg/clients/applyconfiguration/core/v1/resourcerequirements.go new file mode 100644 index 000000000..ba7c38001 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/resourcerequirements.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ResourceRequirementsApplyConfiguration represents an declarative configuration of the ResourceRequirements type for use +// with apply. +type ResourceRequirementsApplyConfiguration struct { + Limits *v1.ResourceList `json:"limits,omitempty"` + Requests *v1.ResourceList `json:"requests,omitempty"` + Claims []ResourceClaimApplyConfiguration `json:"claims,omitempty"` +} + +// ResourceRequirementsApplyConfiguration constructs an declarative configuration of the ResourceRequirements type for use with +// apply. +func ResourceRequirements() *ResourceRequirementsApplyConfiguration { + return &ResourceRequirementsApplyConfiguration{} +} + +// WithLimits sets the Limits field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Limits field is set to the value of the last call. +func (b *ResourceRequirementsApplyConfiguration) WithLimits(value v1.ResourceList) *ResourceRequirementsApplyConfiguration { + b.Limits = &value + return b +} + +// WithRequests sets the Requests field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Requests field is set to the value of the last call. +func (b *ResourceRequirementsApplyConfiguration) WithRequests(value v1.ResourceList) *ResourceRequirementsApplyConfiguration { + b.Requests = &value + return b +} + +// WithClaims adds the given value to the Claims field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Claims field. +func (b *ResourceRequirementsApplyConfiguration) WithClaims(values ...*ResourceClaimApplyConfiguration) *ResourceRequirementsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClaims") + } + b.Claims = append(b.Claims, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/scaleiopersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/scaleiopersistentvolumesource.go new file mode 100644 index 000000000..f44599f81 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/scaleiopersistentvolumesource.go @@ -0,0 +1,107 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ScaleIOPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the ScaleIOPersistentVolumeSource type for use +// with apply. +type ScaleIOPersistentVolumeSourceApplyConfiguration struct { + Gateway *string `json:"gateway,omitempty"` + System *string `json:"system,omitempty"` + SecretRef *SecretReferenceApplyConfiguration `json:"secretRef,omitempty"` + SSLEnabled *bool `json:"sslEnabled,omitempty"` + ProtectionDomain *string `json:"protectionDomain,omitempty"` + StoragePool *string `json:"storagePool,omitempty"` + StorageMode *string `json:"storageMode,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// ScaleIOPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the ScaleIOPersistentVolumeSource type for use with +// apply. +func ScaleIOPersistentVolumeSource() *ScaleIOPersistentVolumeSourceApplyConfiguration { + return &ScaleIOPersistentVolumeSourceApplyConfiguration{} +} + +// WithGateway sets the Gateway field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Gateway field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithGateway(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.Gateway = &value + return b +} + +// WithSystem sets the System field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the System field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithSystem(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.System = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *SecretReferenceApplyConfiguration) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithSSLEnabled sets the SSLEnabled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SSLEnabled field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithSSLEnabled(value bool) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.SSLEnabled = &value + return b +} + +// WithProtectionDomain sets the ProtectionDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProtectionDomain field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithProtectionDomain(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.ProtectionDomain = &value + return b +} + +// WithStoragePool sets the StoragePool field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoragePool field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithStoragePool(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.StoragePool = &value + return b +} + +// WithStorageMode sets the StorageMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageMode field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithStorageMode(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.StorageMode = &value + return b +} + +// WithVolumeName sets the VolumeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeName field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithVolumeName(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.VolumeName = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *ScaleIOPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *ScaleIOPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/scaleiovolumesource.go b/pkg/clients/applyconfiguration/core/v1/scaleiovolumesource.go new file mode 100644 index 000000000..43f655bb8 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/scaleiovolumesource.go @@ -0,0 +1,107 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ScaleIOVolumeSourceApplyConfiguration represents an declarative configuration of the ScaleIOVolumeSource type for use +// with apply. +type ScaleIOVolumeSourceApplyConfiguration struct { + Gateway *string `json:"gateway,omitempty"` + System *string `json:"system,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` + SSLEnabled *bool `json:"sslEnabled,omitempty"` + ProtectionDomain *string `json:"protectionDomain,omitempty"` + StoragePool *string `json:"storagePool,omitempty"` + StorageMode *string `json:"storageMode,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// ScaleIOVolumeSourceApplyConfiguration constructs an declarative configuration of the ScaleIOVolumeSource type for use with +// apply. +func ScaleIOVolumeSource() *ScaleIOVolumeSourceApplyConfiguration { + return &ScaleIOVolumeSourceApplyConfiguration{} +} + +// WithGateway sets the Gateway field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Gateway field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithGateway(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.Gateway = &value + return b +} + +// WithSystem sets the System field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the System field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithSystem(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.System = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *ScaleIOVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} + +// WithSSLEnabled sets the SSLEnabled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SSLEnabled field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithSSLEnabled(value bool) *ScaleIOVolumeSourceApplyConfiguration { + b.SSLEnabled = &value + return b +} + +// WithProtectionDomain sets the ProtectionDomain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProtectionDomain field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithProtectionDomain(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.ProtectionDomain = &value + return b +} + +// WithStoragePool sets the StoragePool field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoragePool field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithStoragePool(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.StoragePool = &value + return b +} + +// WithStorageMode sets the StorageMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageMode field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithStorageMode(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.StorageMode = &value + return b +} + +// WithVolumeName sets the VolumeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeName field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithVolumeName(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.VolumeName = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithFSType(value string) *ScaleIOVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *ScaleIOVolumeSourceApplyConfiguration) WithReadOnly(value bool) *ScaleIOVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/scopedresourceselectorrequirement.go b/pkg/clients/applyconfiguration/core/v1/scopedresourceselectorrequirement.go new file mode 100644 index 000000000..cead67e7e --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/scopedresourceselectorrequirement.go @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ScopedResourceSelectorRequirementApplyConfiguration represents an declarative configuration of the ScopedResourceSelectorRequirement type for use +// with apply. +type ScopedResourceSelectorRequirementApplyConfiguration struct { + ScopeName *v1.ResourceQuotaScope `json:"scopeName,omitempty"` + Operator *v1.ScopeSelectorOperator `json:"operator,omitempty"` + Values []string `json:"values,omitempty"` +} + +// ScopedResourceSelectorRequirementApplyConfiguration constructs an declarative configuration of the ScopedResourceSelectorRequirement type for use with +// apply. +func ScopedResourceSelectorRequirement() *ScopedResourceSelectorRequirementApplyConfiguration { + return &ScopedResourceSelectorRequirementApplyConfiguration{} +} + +// WithScopeName sets the ScopeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScopeName field is set to the value of the last call. +func (b *ScopedResourceSelectorRequirementApplyConfiguration) WithScopeName(value v1.ResourceQuotaScope) *ScopedResourceSelectorRequirementApplyConfiguration { + b.ScopeName = &value + return b +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *ScopedResourceSelectorRequirementApplyConfiguration) WithOperator(value v1.ScopeSelectorOperator) *ScopedResourceSelectorRequirementApplyConfiguration { + b.Operator = &value + return b +} + +// WithValues adds the given value to the Values field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Values field. +func (b *ScopedResourceSelectorRequirementApplyConfiguration) WithValues(values ...string) *ScopedResourceSelectorRequirementApplyConfiguration { + for i := range values { + b.Values = append(b.Values, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/scopeselector.go b/pkg/clients/applyconfiguration/core/v1/scopeselector.go new file mode 100644 index 000000000..3d97ed29c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/scopeselector.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ScopeSelectorApplyConfiguration represents an declarative configuration of the ScopeSelector type for use +// with apply. +type ScopeSelectorApplyConfiguration struct { + MatchExpressions []ScopedResourceSelectorRequirementApplyConfiguration `json:"matchExpressions,omitempty"` +} + +// ScopeSelectorApplyConfiguration constructs an declarative configuration of the ScopeSelector type for use with +// apply. +func ScopeSelector() *ScopeSelectorApplyConfiguration { + return &ScopeSelectorApplyConfiguration{} +} + +// WithMatchExpressions adds the given value to the MatchExpressions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchExpressions field. +func (b *ScopeSelectorApplyConfiguration) WithMatchExpressions(values ...*ScopedResourceSelectorRequirementApplyConfiguration) *ScopeSelectorApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchExpressions") + } + b.MatchExpressions = append(b.MatchExpressions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/seccompprofile.go b/pkg/clients/applyconfiguration/core/v1/seccompprofile.go new file mode 100644 index 000000000..9074e89a6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/seccompprofile.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// SeccompProfileApplyConfiguration represents an declarative configuration of the SeccompProfile type for use +// with apply. +type SeccompProfileApplyConfiguration struct { + Type *v1.SeccompProfileType `json:"type,omitempty"` + LocalhostProfile *string `json:"localhostProfile,omitempty"` +} + +// SeccompProfileApplyConfiguration constructs an declarative configuration of the SeccompProfile type for use with +// apply. +func SeccompProfile() *SeccompProfileApplyConfiguration { + return &SeccompProfileApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *SeccompProfileApplyConfiguration) WithType(value v1.SeccompProfileType) *SeccompProfileApplyConfiguration { + b.Type = &value + return b +} + +// WithLocalhostProfile sets the LocalhostProfile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LocalhostProfile field is set to the value of the last call. +func (b *SeccompProfileApplyConfiguration) WithLocalhostProfile(value string) *SeccompProfileApplyConfiguration { + b.LocalhostProfile = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/secret.go b/pkg/clients/applyconfiguration/core/v1/secret.go new file mode 100644 index 000000000..4e57e9854 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/secret.go @@ -0,0 +1,237 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// SecretApplyConfiguration represents an declarative configuration of the Secret type for use +// with apply. +type SecretApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Immutable *bool `json:"immutable,omitempty"` + Data map[string][]byte `json:"data,omitempty"` + StringData map[string]string `json:"stringData,omitempty"` + Type *corev1.SecretType `json:"type,omitempty"` +} + +// Secret constructs an declarative configuration of the Secret type for use with +// apply. +func Secret(name, namespace string) *SecretApplyConfiguration { + b := &SecretApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Secret") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithKind(value string) *SecretApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithAPIVersion(value string) *SecretApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithName(value string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithGenerateName(value string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithNamespace(value string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithUID(value types.UID) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithResourceVersion(value string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithGeneration(value int64) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithCreationTimestamp(value metav1.Time) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *SecretApplyConfiguration) WithLabels(entries map[string]string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *SecretApplyConfiguration) WithAnnotations(entries map[string]string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *SecretApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *SecretApplyConfiguration) WithFinalizers(values ...string) *SecretApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *SecretApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithImmutable sets the Immutable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Immutable field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithImmutable(value bool) *SecretApplyConfiguration { + b.Immutable = &value + return b +} + +// WithData puts the entries into the Data field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Data field, +// overwriting an existing map entries in Data field with the same key. +func (b *SecretApplyConfiguration) WithData(entries map[string][]byte) *SecretApplyConfiguration { + if b.Data == nil && len(entries) > 0 { + b.Data = make(map[string][]byte, len(entries)) + } + for k, v := range entries { + b.Data[k] = v + } + return b +} + +// WithStringData puts the entries into the StringData field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the StringData field, +// overwriting an existing map entries in StringData field with the same key. +func (b *SecretApplyConfiguration) WithStringData(entries map[string]string) *SecretApplyConfiguration { + if b.StringData == nil && len(entries) > 0 { + b.StringData = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.StringData[k] = v + } + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *SecretApplyConfiguration) WithType(value corev1.SecretType) *SecretApplyConfiguration { + b.Type = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/secretenvsource.go b/pkg/clients/applyconfiguration/core/v1/secretenvsource.go new file mode 100644 index 000000000..57c7bc516 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/secretenvsource.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SecretEnvSourceApplyConfiguration represents an declarative configuration of the SecretEnvSource type for use +// with apply. +type SecretEnvSourceApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Optional *bool `json:"optional,omitempty"` +} + +// SecretEnvSourceApplyConfiguration constructs an declarative configuration of the SecretEnvSource type for use with +// apply. +func SecretEnvSource() *SecretEnvSourceApplyConfiguration { + return &SecretEnvSourceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SecretEnvSourceApplyConfiguration) WithName(value string) *SecretEnvSourceApplyConfiguration { + b.Name = &value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *SecretEnvSourceApplyConfiguration) WithOptional(value bool) *SecretEnvSourceApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/secretkeyselector.go b/pkg/clients/applyconfiguration/core/v1/secretkeyselector.go new file mode 100644 index 000000000..2a87cceff --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/secretkeyselector.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SecretKeySelectorApplyConfiguration represents an declarative configuration of the SecretKeySelector type for use +// with apply. +type SecretKeySelectorApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Key *string `json:"key,omitempty"` + Optional *bool `json:"optional,omitempty"` +} + +// SecretKeySelectorApplyConfiguration constructs an declarative configuration of the SecretKeySelector type for use with +// apply. +func SecretKeySelector() *SecretKeySelectorApplyConfiguration { + return &SecretKeySelectorApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SecretKeySelectorApplyConfiguration) WithName(value string) *SecretKeySelectorApplyConfiguration { + b.Name = &value + return b +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *SecretKeySelectorApplyConfiguration) WithKey(value string) *SecretKeySelectorApplyConfiguration { + b.Key = &value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *SecretKeySelectorApplyConfiguration) WithOptional(value bool) *SecretKeySelectorApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/secretprojection.go b/pkg/clients/applyconfiguration/core/v1/secretprojection.go new file mode 100644 index 000000000..87714a796 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/secretprojection.go @@ -0,0 +1,49 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SecretProjectionApplyConfiguration represents an declarative configuration of the SecretProjection type for use +// with apply. +type SecretProjectionApplyConfiguration struct { + LocalObjectReferenceApplyConfiguration `json:",inline"` + Items []KeyToPathApplyConfiguration `json:"items,omitempty"` + Optional *bool `json:"optional,omitempty"` +} + +// SecretProjectionApplyConfiguration constructs an declarative configuration of the SecretProjection type for use with +// apply. +func SecretProjection() *SecretProjectionApplyConfiguration { + return &SecretProjectionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SecretProjectionApplyConfiguration) WithName(value string) *SecretProjectionApplyConfiguration { + b.Name = &value + return b +} + +// WithItems adds the given value to the Items field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Items field. +func (b *SecretProjectionApplyConfiguration) WithItems(values ...*KeyToPathApplyConfiguration) *SecretProjectionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithItems") + } + b.Items = append(b.Items, *values[i]) + } + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *SecretProjectionApplyConfiguration) WithOptional(value bool) *SecretProjectionApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/secretreference.go b/pkg/clients/applyconfiguration/core/v1/secretreference.go new file mode 100644 index 000000000..8b1370847 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/secretreference.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SecretReferenceApplyConfiguration represents an declarative configuration of the SecretReference type for use +// with apply. +type SecretReferenceApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// SecretReferenceApplyConfiguration constructs an declarative configuration of the SecretReference type for use with +// apply. +func SecretReference() *SecretReferenceApplyConfiguration { + return &SecretReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SecretReferenceApplyConfiguration) WithName(value string) *SecretReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *SecretReferenceApplyConfiguration) WithNamespace(value string) *SecretReferenceApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/secretvolumesource.go b/pkg/clients/applyconfiguration/core/v1/secretvolumesource.go new file mode 100644 index 000000000..0cdb6adad --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/secretvolumesource.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SecretVolumeSourceApplyConfiguration represents an declarative configuration of the SecretVolumeSource type for use +// with apply. +type SecretVolumeSourceApplyConfiguration struct { + SecretName *string `json:"secretName,omitempty"` + Items []KeyToPathApplyConfiguration `json:"items,omitempty"` + DefaultMode *int32 `json:"defaultMode,omitempty"` + Optional *bool `json:"optional,omitempty"` +} + +// SecretVolumeSourceApplyConfiguration constructs an declarative configuration of the SecretVolumeSource type for use with +// apply. +func SecretVolumeSource() *SecretVolumeSourceApplyConfiguration { + return &SecretVolumeSourceApplyConfiguration{} +} + +// WithSecretName sets the SecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretName field is set to the value of the last call. +func (b *SecretVolumeSourceApplyConfiguration) WithSecretName(value string) *SecretVolumeSourceApplyConfiguration { + b.SecretName = &value + return b +} + +// WithItems adds the given value to the Items field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Items field. +func (b *SecretVolumeSourceApplyConfiguration) WithItems(values ...*KeyToPathApplyConfiguration) *SecretVolumeSourceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithItems") + } + b.Items = append(b.Items, *values[i]) + } + return b +} + +// WithDefaultMode sets the DefaultMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultMode field is set to the value of the last call. +func (b *SecretVolumeSourceApplyConfiguration) WithDefaultMode(value int32) *SecretVolumeSourceApplyConfiguration { + b.DefaultMode = &value + return b +} + +// WithOptional sets the Optional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Optional field is set to the value of the last call. +func (b *SecretVolumeSourceApplyConfiguration) WithOptional(value bool) *SecretVolumeSourceApplyConfiguration { + b.Optional = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/securitycontext.go b/pkg/clients/applyconfiguration/core/v1/securitycontext.go new file mode 100644 index 000000000..378e5fe5e --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/securitycontext.go @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// SecurityContextApplyConfiguration represents an declarative configuration of the SecurityContext type for use +// with apply. +type SecurityContextApplyConfiguration struct { + Capabilities *CapabilitiesApplyConfiguration `json:"capabilities,omitempty"` + Privileged *bool `json:"privileged,omitempty"` + SELinuxOptions *SELinuxOptionsApplyConfiguration `json:"seLinuxOptions,omitempty"` + WindowsOptions *WindowsSecurityContextOptionsApplyConfiguration `json:"windowsOptions,omitempty"` + RunAsUser *int64 `json:"runAsUser,omitempty"` + RunAsGroup *int64 `json:"runAsGroup,omitempty"` + RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"` + ReadOnlyRootFilesystem *bool `json:"readOnlyRootFilesystem,omitempty"` + AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty"` + ProcMount *corev1.ProcMountType `json:"procMount,omitempty"` + SeccompProfile *SeccompProfileApplyConfiguration `json:"seccompProfile,omitempty"` +} + +// SecurityContextApplyConfiguration constructs an declarative configuration of the SecurityContext type for use with +// apply. +func SecurityContext() *SecurityContextApplyConfiguration { + return &SecurityContextApplyConfiguration{} +} + +// WithCapabilities sets the Capabilities field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capabilities field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithCapabilities(value *CapabilitiesApplyConfiguration) *SecurityContextApplyConfiguration { + b.Capabilities = value + return b +} + +// WithPrivileged sets the Privileged field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Privileged field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithPrivileged(value bool) *SecurityContextApplyConfiguration { + b.Privileged = &value + return b +} + +// WithSELinuxOptions sets the SELinuxOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SELinuxOptions field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithSELinuxOptions(value *SELinuxOptionsApplyConfiguration) *SecurityContextApplyConfiguration { + b.SELinuxOptions = value + return b +} + +// WithWindowsOptions sets the WindowsOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WindowsOptions field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithWindowsOptions(value *WindowsSecurityContextOptionsApplyConfiguration) *SecurityContextApplyConfiguration { + b.WindowsOptions = value + return b +} + +// WithRunAsUser sets the RunAsUser field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsUser field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithRunAsUser(value int64) *SecurityContextApplyConfiguration { + b.RunAsUser = &value + return b +} + +// WithRunAsGroup sets the RunAsGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsGroup field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithRunAsGroup(value int64) *SecurityContextApplyConfiguration { + b.RunAsGroup = &value + return b +} + +// WithRunAsNonRoot sets the RunAsNonRoot field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsNonRoot field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithRunAsNonRoot(value bool) *SecurityContextApplyConfiguration { + b.RunAsNonRoot = &value + return b +} + +// WithReadOnlyRootFilesystem sets the ReadOnlyRootFilesystem field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnlyRootFilesystem field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithReadOnlyRootFilesystem(value bool) *SecurityContextApplyConfiguration { + b.ReadOnlyRootFilesystem = &value + return b +} + +// WithAllowPrivilegeEscalation sets the AllowPrivilegeEscalation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllowPrivilegeEscalation field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithAllowPrivilegeEscalation(value bool) *SecurityContextApplyConfiguration { + b.AllowPrivilegeEscalation = &value + return b +} + +// WithProcMount sets the ProcMount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProcMount field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithProcMount(value corev1.ProcMountType) *SecurityContextApplyConfiguration { + b.ProcMount = &value + return b +} + +// WithSeccompProfile sets the SeccompProfile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SeccompProfile field is set to the value of the last call. +func (b *SecurityContextApplyConfiguration) WithSeccompProfile(value *SeccompProfileApplyConfiguration) *SecurityContextApplyConfiguration { + b.SeccompProfile = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/selinuxoptions.go b/pkg/clients/applyconfiguration/core/v1/selinuxoptions.go new file mode 100644 index 000000000..03641fa22 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/selinuxoptions.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SELinuxOptionsApplyConfiguration represents an declarative configuration of the SELinuxOptions type for use +// with apply. +type SELinuxOptionsApplyConfiguration struct { + User *string `json:"user,omitempty"` + Role *string `json:"role,omitempty"` + Type *string `json:"type,omitempty"` + Level *string `json:"level,omitempty"` +} + +// SELinuxOptionsApplyConfiguration constructs an declarative configuration of the SELinuxOptions type for use with +// apply. +func SELinuxOptions() *SELinuxOptionsApplyConfiguration { + return &SELinuxOptionsApplyConfiguration{} +} + +// WithUser sets the User field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the User field is set to the value of the last call. +func (b *SELinuxOptionsApplyConfiguration) WithUser(value string) *SELinuxOptionsApplyConfiguration { + b.User = &value + return b +} + +// WithRole sets the Role field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Role field is set to the value of the last call. +func (b *SELinuxOptionsApplyConfiguration) WithRole(value string) *SELinuxOptionsApplyConfiguration { + b.Role = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *SELinuxOptionsApplyConfiguration) WithType(value string) *SELinuxOptionsApplyConfiguration { + b.Type = &value + return b +} + +// WithLevel sets the Level field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Level field is set to the value of the last call. +func (b *SELinuxOptionsApplyConfiguration) WithLevel(value string) *SELinuxOptionsApplyConfiguration { + b.Level = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/service.go b/pkg/clients/applyconfiguration/core/v1/service.go new file mode 100644 index 000000000..8654e8be0 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/service.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ServiceApplyConfiguration represents an declarative configuration of the Service type for use +// with apply. +type ServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ServiceSpecApplyConfiguration `json:"spec,omitempty"` + Status *ServiceStatusApplyConfiguration `json:"status,omitempty"` +} + +// Service constructs an declarative configuration of the Service type for use with +// apply. +func Service(name, namespace string) *ServiceApplyConfiguration { + b := &ServiceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Service") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithKind(value string) *ServiceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithAPIVersion(value string) *ServiceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithName(value string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithGenerateName(value string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithNamespace(value string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithUID(value types.UID) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithResourceVersion(value string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithGeneration(value int64) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ServiceApplyConfiguration) WithLabels(entries map[string]string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ServiceApplyConfiguration) WithAnnotations(entries map[string]string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ServiceApplyConfiguration) WithFinalizers(values ...string) *ServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithSpec(value *ServiceSpecApplyConfiguration) *ServiceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithStatus(value *ServiceStatusApplyConfiguration) *ServiceApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/serviceaccount.go b/pkg/clients/applyconfiguration/core/v1/serviceaccount.go new file mode 100644 index 000000000..28571c305 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/serviceaccount.go @@ -0,0 +1,225 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ServiceAccountApplyConfiguration represents an declarative configuration of the ServiceAccount type for use +// with apply. +type ServiceAccountApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Secrets []ObjectReferenceApplyConfiguration `json:"secrets,omitempty"` + ImagePullSecrets []LocalObjectReferenceApplyConfiguration `json:"imagePullSecrets,omitempty"` + AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty"` +} + +// ServiceAccount constructs an declarative configuration of the ServiceAccount type for use with +// apply. +func ServiceAccount(name, namespace string) *ServiceAccountApplyConfiguration { + b := &ServiceAccountApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ServiceAccount") + b.WithAPIVersion("v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithKind(value string) *ServiceAccountApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithAPIVersion(value string) *ServiceAccountApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithName(value string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithGenerateName(value string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithNamespace(value string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithUID(value types.UID) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithResourceVersion(value string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithGeneration(value int64) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ServiceAccountApplyConfiguration) WithLabels(entries map[string]string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ServiceAccountApplyConfiguration) WithAnnotations(entries map[string]string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ServiceAccountApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ServiceAccountApplyConfiguration) WithFinalizers(values ...string) *ServiceAccountApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ServiceAccountApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSecrets adds the given value to the Secrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Secrets field. +func (b *ServiceAccountApplyConfiguration) WithSecrets(values ...*ObjectReferenceApplyConfiguration) *ServiceAccountApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSecrets") + } + b.Secrets = append(b.Secrets, *values[i]) + } + return b +} + +// WithImagePullSecrets adds the given value to the ImagePullSecrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ImagePullSecrets field. +func (b *ServiceAccountApplyConfiguration) WithImagePullSecrets(values ...*LocalObjectReferenceApplyConfiguration) *ServiceAccountApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithImagePullSecrets") + } + b.ImagePullSecrets = append(b.ImagePullSecrets, *values[i]) + } + return b +} + +// WithAutomountServiceAccountToken sets the AutomountServiceAccountToken field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AutomountServiceAccountToken field is set to the value of the last call. +func (b *ServiceAccountApplyConfiguration) WithAutomountServiceAccountToken(value bool) *ServiceAccountApplyConfiguration { + b.AutomountServiceAccountToken = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/serviceaccounttokenprojection.go b/pkg/clients/applyconfiguration/core/v1/serviceaccounttokenprojection.go new file mode 100644 index 000000000..2b77523a1 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/serviceaccounttokenprojection.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ServiceAccountTokenProjectionApplyConfiguration represents an declarative configuration of the ServiceAccountTokenProjection type for use +// with apply. +type ServiceAccountTokenProjectionApplyConfiguration struct { + Audience *string `json:"audience,omitempty"` + ExpirationSeconds *int64 `json:"expirationSeconds,omitempty"` + Path *string `json:"path,omitempty"` +} + +// ServiceAccountTokenProjectionApplyConfiguration constructs an declarative configuration of the ServiceAccountTokenProjection type for use with +// apply. +func ServiceAccountTokenProjection() *ServiceAccountTokenProjectionApplyConfiguration { + return &ServiceAccountTokenProjectionApplyConfiguration{} +} + +// WithAudience sets the Audience field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Audience field is set to the value of the last call. +func (b *ServiceAccountTokenProjectionApplyConfiguration) WithAudience(value string) *ServiceAccountTokenProjectionApplyConfiguration { + b.Audience = &value + return b +} + +// WithExpirationSeconds sets the ExpirationSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExpirationSeconds field is set to the value of the last call. +func (b *ServiceAccountTokenProjectionApplyConfiguration) WithExpirationSeconds(value int64) *ServiceAccountTokenProjectionApplyConfiguration { + b.ExpirationSeconds = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ServiceAccountTokenProjectionApplyConfiguration) WithPath(value string) *ServiceAccountTokenProjectionApplyConfiguration { + b.Path = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/serviceport.go b/pkg/clients/applyconfiguration/core/v1/serviceport.go new file mode 100644 index 000000000..3ebf8e762 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/serviceport.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ServicePortApplyConfiguration represents an declarative configuration of the ServicePort type for use +// with apply. +type ServicePortApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Protocol *v1.Protocol `json:"protocol,omitempty"` + AppProtocol *string `json:"appProtocol,omitempty"` + Port *int32 `json:"port,omitempty"` + TargetPort *intstr.IntOrString `json:"targetPort,omitempty"` + NodePort *int32 `json:"nodePort,omitempty"` +} + +// ServicePortApplyConfiguration constructs an declarative configuration of the ServicePort type for use with +// apply. +func ServicePort() *ServicePortApplyConfiguration { + return &ServicePortApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServicePortApplyConfiguration) WithName(value string) *ServicePortApplyConfiguration { + b.Name = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *ServicePortApplyConfiguration) WithProtocol(value v1.Protocol) *ServicePortApplyConfiguration { + b.Protocol = &value + return b +} + +// WithAppProtocol sets the AppProtocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AppProtocol field is set to the value of the last call. +func (b *ServicePortApplyConfiguration) WithAppProtocol(value string) *ServicePortApplyConfiguration { + b.AppProtocol = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServicePortApplyConfiguration) WithPort(value int32) *ServicePortApplyConfiguration { + b.Port = &value + return b +} + +// WithTargetPort sets the TargetPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetPort field is set to the value of the last call. +func (b *ServicePortApplyConfiguration) WithTargetPort(value intstr.IntOrString) *ServicePortApplyConfiguration { + b.TargetPort = &value + return b +} + +// WithNodePort sets the NodePort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePort field is set to the value of the last call. +func (b *ServicePortApplyConfiguration) WithNodePort(value int32) *ServicePortApplyConfiguration { + b.NodePort = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/servicespec.go b/pkg/clients/applyconfiguration/core/v1/servicespec.go new file mode 100644 index 000000000..9c14f7689 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/servicespec.go @@ -0,0 +1,211 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// ServiceSpecApplyConfiguration represents an declarative configuration of the ServiceSpec type for use +// with apply. +type ServiceSpecApplyConfiguration struct { + Ports []ServicePortApplyConfiguration `json:"ports,omitempty"` + Selector map[string]string `json:"selector,omitempty"` + ClusterIP *string `json:"clusterIP,omitempty"` + ClusterIPs []string `json:"clusterIPs,omitempty"` + Type *corev1.ServiceType `json:"type,omitempty"` + ExternalIPs []string `json:"externalIPs,omitempty"` + SessionAffinity *corev1.ServiceAffinity `json:"sessionAffinity,omitempty"` + LoadBalancerIP *string `json:"loadBalancerIP,omitempty"` + LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"` + ExternalName *string `json:"externalName,omitempty"` + ExternalTrafficPolicy *corev1.ServiceExternalTrafficPolicy `json:"externalTrafficPolicy,omitempty"` + HealthCheckNodePort *int32 `json:"healthCheckNodePort,omitempty"` + PublishNotReadyAddresses *bool `json:"publishNotReadyAddresses,omitempty"` + SessionAffinityConfig *SessionAffinityConfigApplyConfiguration `json:"sessionAffinityConfig,omitempty"` + IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"` + IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"` + AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"` + LoadBalancerClass *string `json:"loadBalancerClass,omitempty"` + InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"` +} + +// ServiceSpecApplyConfiguration constructs an declarative configuration of the ServiceSpec type for use with +// apply. +func ServiceSpec() *ServiceSpecApplyConfiguration { + return &ServiceSpecApplyConfiguration{} +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *ServiceSpecApplyConfiguration) WithPorts(values ...*ServicePortApplyConfiguration) *ServiceSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} + +// WithSelector puts the entries into the Selector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Selector field, +// overwriting an existing map entries in Selector field with the same key. +func (b *ServiceSpecApplyConfiguration) WithSelector(entries map[string]string) *ServiceSpecApplyConfiguration { + if b.Selector == nil && len(entries) > 0 { + b.Selector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Selector[k] = v + } + return b +} + +// WithClusterIP sets the ClusterIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterIP field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithClusterIP(value string) *ServiceSpecApplyConfiguration { + b.ClusterIP = &value + return b +} + +// WithClusterIPs adds the given value to the ClusterIPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ClusterIPs field. +func (b *ServiceSpecApplyConfiguration) WithClusterIPs(values ...string) *ServiceSpecApplyConfiguration { + for i := range values { + b.ClusterIPs = append(b.ClusterIPs, values[i]) + } + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithType(value corev1.ServiceType) *ServiceSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithExternalIPs adds the given value to the ExternalIPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ExternalIPs field. +func (b *ServiceSpecApplyConfiguration) WithExternalIPs(values ...string) *ServiceSpecApplyConfiguration { + for i := range values { + b.ExternalIPs = append(b.ExternalIPs, values[i]) + } + return b +} + +// WithSessionAffinity sets the SessionAffinity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SessionAffinity field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithSessionAffinity(value corev1.ServiceAffinity) *ServiceSpecApplyConfiguration { + b.SessionAffinity = &value + return b +} + +// WithLoadBalancerIP sets the LoadBalancerIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LoadBalancerIP field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithLoadBalancerIP(value string) *ServiceSpecApplyConfiguration { + b.LoadBalancerIP = &value + return b +} + +// WithLoadBalancerSourceRanges adds the given value to the LoadBalancerSourceRanges field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the LoadBalancerSourceRanges field. +func (b *ServiceSpecApplyConfiguration) WithLoadBalancerSourceRanges(values ...string) *ServiceSpecApplyConfiguration { + for i := range values { + b.LoadBalancerSourceRanges = append(b.LoadBalancerSourceRanges, values[i]) + } + return b +} + +// WithExternalName sets the ExternalName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalName field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithExternalName(value string) *ServiceSpecApplyConfiguration { + b.ExternalName = &value + return b +} + +// WithExternalTrafficPolicy sets the ExternalTrafficPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalTrafficPolicy field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithExternalTrafficPolicy(value corev1.ServiceExternalTrafficPolicy) *ServiceSpecApplyConfiguration { + b.ExternalTrafficPolicy = &value + return b +} + +// WithHealthCheckNodePort sets the HealthCheckNodePort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheckNodePort field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithHealthCheckNodePort(value int32) *ServiceSpecApplyConfiguration { + b.HealthCheckNodePort = &value + return b +} + +// WithPublishNotReadyAddresses sets the PublishNotReadyAddresses field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PublishNotReadyAddresses field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithPublishNotReadyAddresses(value bool) *ServiceSpecApplyConfiguration { + b.PublishNotReadyAddresses = &value + return b +} + +// WithSessionAffinityConfig sets the SessionAffinityConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SessionAffinityConfig field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithSessionAffinityConfig(value *SessionAffinityConfigApplyConfiguration) *ServiceSpecApplyConfiguration { + b.SessionAffinityConfig = value + return b +} + +// WithIPFamilies adds the given value to the IPFamilies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPFamilies field. +func (b *ServiceSpecApplyConfiguration) WithIPFamilies(values ...corev1.IPFamily) *ServiceSpecApplyConfiguration { + for i := range values { + b.IPFamilies = append(b.IPFamilies, values[i]) + } + return b +} + +// WithIPFamilyPolicy sets the IPFamilyPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPFamilyPolicy field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithIPFamilyPolicy(value corev1.IPFamilyPolicy) *ServiceSpecApplyConfiguration { + b.IPFamilyPolicy = &value + return b +} + +// WithAllocateLoadBalancerNodePorts sets the AllocateLoadBalancerNodePorts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocateLoadBalancerNodePorts field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithAllocateLoadBalancerNodePorts(value bool) *ServiceSpecApplyConfiguration { + b.AllocateLoadBalancerNodePorts = &value + return b +} + +// WithLoadBalancerClass sets the LoadBalancerClass field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LoadBalancerClass field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithLoadBalancerClass(value string) *ServiceSpecApplyConfiguration { + b.LoadBalancerClass = &value + return b +} + +// WithInternalTrafficPolicy sets the InternalTrafficPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalTrafficPolicy field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithInternalTrafficPolicy(value corev1.ServiceInternalTrafficPolicy) *ServiceSpecApplyConfiguration { + b.InternalTrafficPolicy = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/servicestatus.go b/pkg/clients/applyconfiguration/core/v1/servicestatus.go new file mode 100644 index 000000000..19241b70a --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/servicestatus.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ServiceStatusApplyConfiguration represents an declarative configuration of the ServiceStatus type for use +// with apply. +type ServiceStatusApplyConfiguration struct { + LoadBalancer *LoadBalancerStatusApplyConfiguration `json:"loadBalancer,omitempty"` + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// ServiceStatusApplyConfiguration constructs an declarative configuration of the ServiceStatus type for use with +// apply. +func ServiceStatus() *ServiceStatusApplyConfiguration { + return &ServiceStatusApplyConfiguration{} +} + +// WithLoadBalancer sets the LoadBalancer field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LoadBalancer field is set to the value of the last call. +func (b *ServiceStatusApplyConfiguration) WithLoadBalancer(value *LoadBalancerStatusApplyConfiguration) *ServiceStatusApplyConfiguration { + b.LoadBalancer = value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ServiceStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *ServiceStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/sessionaffinityconfig.go b/pkg/clients/applyconfiguration/core/v1/sessionaffinityconfig.go new file mode 100644 index 000000000..d53654bc6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/sessionaffinityconfig.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SessionAffinityConfigApplyConfiguration represents an declarative configuration of the SessionAffinityConfig type for use +// with apply. +type SessionAffinityConfigApplyConfiguration struct { + ClientIP *ClientIPConfigApplyConfiguration `json:"clientIP,omitempty"` +} + +// SessionAffinityConfigApplyConfiguration constructs an declarative configuration of the SessionAffinityConfig type for use with +// apply. +func SessionAffinityConfig() *SessionAffinityConfigApplyConfiguration { + return &SessionAffinityConfigApplyConfiguration{} +} + +// WithClientIP sets the ClientIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientIP field is set to the value of the last call. +func (b *SessionAffinityConfigApplyConfiguration) WithClientIP(value *ClientIPConfigApplyConfiguration) *SessionAffinityConfigApplyConfiguration { + b.ClientIP = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/sleepaction.go b/pkg/clients/applyconfiguration/core/v1/sleepaction.go new file mode 100644 index 000000000..0b683bc91 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/sleepaction.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SleepActionApplyConfiguration represents an declarative configuration of the SleepAction type for use +// with apply. +type SleepActionApplyConfiguration struct { + Seconds *int64 `json:"seconds,omitempty"` +} + +// SleepActionApplyConfiguration constructs an declarative configuration of the SleepAction type for use with +// apply. +func SleepAction() *SleepActionApplyConfiguration { + return &SleepActionApplyConfiguration{} +} + +// WithSeconds sets the Seconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Seconds field is set to the value of the last call. +func (b *SleepActionApplyConfiguration) WithSeconds(value int64) *SleepActionApplyConfiguration { + b.Seconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/storageospersistentvolumesource.go b/pkg/clients/applyconfiguration/core/v1/storageospersistentvolumesource.go new file mode 100644 index 000000000..f6b72a7bc --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/storageospersistentvolumesource.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// StorageOSPersistentVolumeSourceApplyConfiguration represents an declarative configuration of the StorageOSPersistentVolumeSource type for use +// with apply. +type StorageOSPersistentVolumeSourceApplyConfiguration struct { + VolumeName *string `json:"volumeName,omitempty"` + VolumeNamespace *string `json:"volumeNamespace,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SecretRef *ObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` +} + +// StorageOSPersistentVolumeSourceApplyConfiguration constructs an declarative configuration of the StorageOSPersistentVolumeSource type for use with +// apply. +func StorageOSPersistentVolumeSource() *StorageOSPersistentVolumeSourceApplyConfiguration { + return &StorageOSPersistentVolumeSourceApplyConfiguration{} +} + +// WithVolumeName sets the VolumeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeName field is set to the value of the last call. +func (b *StorageOSPersistentVolumeSourceApplyConfiguration) WithVolumeName(value string) *StorageOSPersistentVolumeSourceApplyConfiguration { + b.VolumeName = &value + return b +} + +// WithVolumeNamespace sets the VolumeNamespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeNamespace field is set to the value of the last call. +func (b *StorageOSPersistentVolumeSourceApplyConfiguration) WithVolumeNamespace(value string) *StorageOSPersistentVolumeSourceApplyConfiguration { + b.VolumeNamespace = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *StorageOSPersistentVolumeSourceApplyConfiguration) WithFSType(value string) *StorageOSPersistentVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *StorageOSPersistentVolumeSourceApplyConfiguration) WithReadOnly(value bool) *StorageOSPersistentVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *StorageOSPersistentVolumeSourceApplyConfiguration) WithSecretRef(value *ObjectReferenceApplyConfiguration) *StorageOSPersistentVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/storageosvolumesource.go b/pkg/clients/applyconfiguration/core/v1/storageosvolumesource.go new file mode 100644 index 000000000..14cfebf64 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/storageosvolumesource.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// StorageOSVolumeSourceApplyConfiguration represents an declarative configuration of the StorageOSVolumeSource type for use +// with apply. +type StorageOSVolumeSourceApplyConfiguration struct { + VolumeName *string `json:"volumeName,omitempty"` + VolumeNamespace *string `json:"volumeNamespace,omitempty"` + FSType *string `json:"fsType,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SecretRef *LocalObjectReferenceApplyConfiguration `json:"secretRef,omitempty"` +} + +// StorageOSVolumeSourceApplyConfiguration constructs an declarative configuration of the StorageOSVolumeSource type for use with +// apply. +func StorageOSVolumeSource() *StorageOSVolumeSourceApplyConfiguration { + return &StorageOSVolumeSourceApplyConfiguration{} +} + +// WithVolumeName sets the VolumeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeName field is set to the value of the last call. +func (b *StorageOSVolumeSourceApplyConfiguration) WithVolumeName(value string) *StorageOSVolumeSourceApplyConfiguration { + b.VolumeName = &value + return b +} + +// WithVolumeNamespace sets the VolumeNamespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeNamespace field is set to the value of the last call. +func (b *StorageOSVolumeSourceApplyConfiguration) WithVolumeNamespace(value string) *StorageOSVolumeSourceApplyConfiguration { + b.VolumeNamespace = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *StorageOSVolumeSourceApplyConfiguration) WithFSType(value string) *StorageOSVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *StorageOSVolumeSourceApplyConfiguration) WithReadOnly(value bool) *StorageOSVolumeSourceApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *StorageOSVolumeSourceApplyConfiguration) WithSecretRef(value *LocalObjectReferenceApplyConfiguration) *StorageOSVolumeSourceApplyConfiguration { + b.SecretRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/sysctl.go b/pkg/clients/applyconfiguration/core/v1/sysctl.go new file mode 100644 index 000000000..35747ee06 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/sysctl.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SysctlApplyConfiguration represents an declarative configuration of the Sysctl type for use +// with apply. +type SysctlApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// SysctlApplyConfiguration constructs an declarative configuration of the Sysctl type for use with +// apply. +func Sysctl() *SysctlApplyConfiguration { + return &SysctlApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SysctlApplyConfiguration) WithName(value string) *SysctlApplyConfiguration { + b.Name = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *SysctlApplyConfiguration) WithValue(value string) *SysctlApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/taint.go b/pkg/clients/applyconfiguration/core/v1/taint.go new file mode 100644 index 000000000..bfe2b96bb --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/taint.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TaintApplyConfiguration represents an declarative configuration of the Taint type for use +// with apply. +type TaintApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` + Effect *v1.TaintEffect `json:"effect,omitempty"` + TimeAdded *metav1.Time `json:"timeAdded,omitempty"` +} + +// TaintApplyConfiguration constructs an declarative configuration of the Taint type for use with +// apply. +func Taint() *TaintApplyConfiguration { + return &TaintApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithKey(value string) *TaintApplyConfiguration { + b.Key = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithValue(value string) *TaintApplyConfiguration { + b.Value = &value + return b +} + +// WithEffect sets the Effect field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Effect field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithEffect(value v1.TaintEffect) *TaintApplyConfiguration { + b.Effect = &value + return b +} + +// WithTimeAdded sets the TimeAdded field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TimeAdded field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithTimeAdded(value metav1.Time) *TaintApplyConfiguration { + b.TimeAdded = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/tcpsocketaction.go b/pkg/clients/applyconfiguration/core/v1/tcpsocketaction.go new file mode 100644 index 000000000..303606493 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/tcpsocketaction.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// TCPSocketActionApplyConfiguration represents an declarative configuration of the TCPSocketAction type for use +// with apply. +type TCPSocketActionApplyConfiguration struct { + Port *intstr.IntOrString `json:"port,omitempty"` + Host *string `json:"host,omitempty"` +} + +// TCPSocketActionApplyConfiguration constructs an declarative configuration of the TCPSocketAction type for use with +// apply. +func TCPSocketAction() *TCPSocketActionApplyConfiguration { + return &TCPSocketActionApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *TCPSocketActionApplyConfiguration) WithPort(value intstr.IntOrString) *TCPSocketActionApplyConfiguration { + b.Port = &value + return b +} + +// WithHost sets the Host field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Host field is set to the value of the last call. +func (b *TCPSocketActionApplyConfiguration) WithHost(value string) *TCPSocketActionApplyConfiguration { + b.Host = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/toleration.go b/pkg/clients/applyconfiguration/core/v1/toleration.go new file mode 100644 index 000000000..c8291c7fb --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/toleration.go @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// TolerationApplyConfiguration represents an declarative configuration of the Toleration type for use +// with apply. +type TolerationApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Operator *v1.TolerationOperator `json:"operator,omitempty"` + Value *string `json:"value,omitempty"` + Effect *v1.TaintEffect `json:"effect,omitempty"` + TolerationSeconds *int64 `json:"tolerationSeconds,omitempty"` +} + +// TolerationApplyConfiguration constructs an declarative configuration of the Toleration type for use with +// apply. +func Toleration() *TolerationApplyConfiguration { + return &TolerationApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithKey(value string) *TolerationApplyConfiguration { + b.Key = &value + return b +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithOperator(value v1.TolerationOperator) *TolerationApplyConfiguration { + b.Operator = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithValue(value string) *TolerationApplyConfiguration { + b.Value = &value + return b +} + +// WithEffect sets the Effect field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Effect field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithEffect(value v1.TaintEffect) *TolerationApplyConfiguration { + b.Effect = &value + return b +} + +// WithTolerationSeconds sets the TolerationSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TolerationSeconds field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithTolerationSeconds(value int64) *TolerationApplyConfiguration { + b.TolerationSeconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/topologyselectorlabelrequirement.go b/pkg/clients/applyconfiguration/core/v1/topologyselectorlabelrequirement.go new file mode 100644 index 000000000..e9040783e --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/topologyselectorlabelrequirement.go @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// TopologySelectorLabelRequirementApplyConfiguration represents an declarative configuration of the TopologySelectorLabelRequirement type for use +// with apply. +type TopologySelectorLabelRequirementApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Values []string `json:"values,omitempty"` +} + +// TopologySelectorLabelRequirementApplyConfiguration constructs an declarative configuration of the TopologySelectorLabelRequirement type for use with +// apply. +func TopologySelectorLabelRequirement() *TopologySelectorLabelRequirementApplyConfiguration { + return &TopologySelectorLabelRequirementApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TopologySelectorLabelRequirementApplyConfiguration) WithKey(value string) *TopologySelectorLabelRequirementApplyConfiguration { + b.Key = &value + return b +} + +// WithValues adds the given value to the Values field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Values field. +func (b *TopologySelectorLabelRequirementApplyConfiguration) WithValues(values ...string) *TopologySelectorLabelRequirementApplyConfiguration { + for i := range values { + b.Values = append(b.Values, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/topologyselectorterm.go b/pkg/clients/applyconfiguration/core/v1/topologyselectorterm.go new file mode 100644 index 000000000..cc84c2799 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/topologyselectorterm.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// TopologySelectorTermApplyConfiguration represents an declarative configuration of the TopologySelectorTerm type for use +// with apply. +type TopologySelectorTermApplyConfiguration struct { + MatchLabelExpressions []TopologySelectorLabelRequirementApplyConfiguration `json:"matchLabelExpressions,omitempty"` +} + +// TopologySelectorTermApplyConfiguration constructs an declarative configuration of the TopologySelectorTerm type for use with +// apply. +func TopologySelectorTerm() *TopologySelectorTermApplyConfiguration { + return &TopologySelectorTermApplyConfiguration{} +} + +// WithMatchLabelExpressions adds the given value to the MatchLabelExpressions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchLabelExpressions field. +func (b *TopologySelectorTermApplyConfiguration) WithMatchLabelExpressions(values ...*TopologySelectorLabelRequirementApplyConfiguration) *TopologySelectorTermApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchLabelExpressions") + } + b.MatchLabelExpressions = append(b.MatchLabelExpressions, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/topologyspreadconstraint.go b/pkg/clients/applyconfiguration/core/v1/topologyspreadconstraint.go new file mode 100644 index 000000000..f8b1010f6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/topologyspreadconstraint.go @@ -0,0 +1,96 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TopologySpreadConstraintApplyConfiguration represents an declarative configuration of the TopologySpreadConstraint type for use +// with apply. +type TopologySpreadConstraintApplyConfiguration struct { + MaxSkew *int32 `json:"maxSkew,omitempty"` + TopologyKey *string `json:"topologyKey,omitempty"` + WhenUnsatisfiable *v1.UnsatisfiableConstraintAction `json:"whenUnsatisfiable,omitempty"` + LabelSelector *metav1.LabelSelectorApplyConfiguration `json:"labelSelector,omitempty"` + MinDomains *int32 `json:"minDomains,omitempty"` + NodeAffinityPolicy *v1.NodeInclusionPolicy `json:"nodeAffinityPolicy,omitempty"` + NodeTaintsPolicy *v1.NodeInclusionPolicy `json:"nodeTaintsPolicy,omitempty"` + MatchLabelKeys []string `json:"matchLabelKeys,omitempty"` +} + +// TopologySpreadConstraintApplyConfiguration constructs an declarative configuration of the TopologySpreadConstraint type for use with +// apply. +func TopologySpreadConstraint() *TopologySpreadConstraintApplyConfiguration { + return &TopologySpreadConstraintApplyConfiguration{} +} + +// WithMaxSkew sets the MaxSkew field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxSkew field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithMaxSkew(value int32) *TopologySpreadConstraintApplyConfiguration { + b.MaxSkew = &value + return b +} + +// WithTopologyKey sets the TopologyKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TopologyKey field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithTopologyKey(value string) *TopologySpreadConstraintApplyConfiguration { + b.TopologyKey = &value + return b +} + +// WithWhenUnsatisfiable sets the WhenUnsatisfiable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WhenUnsatisfiable field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithWhenUnsatisfiable(value v1.UnsatisfiableConstraintAction) *TopologySpreadConstraintApplyConfiguration { + b.WhenUnsatisfiable = &value + return b +} + +// WithLabelSelector sets the LabelSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelector field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithLabelSelector(value *metav1.LabelSelectorApplyConfiguration) *TopologySpreadConstraintApplyConfiguration { + b.LabelSelector = value + return b +} + +// WithMinDomains sets the MinDomains field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinDomains field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithMinDomains(value int32) *TopologySpreadConstraintApplyConfiguration { + b.MinDomains = &value + return b +} + +// WithNodeAffinityPolicy sets the NodeAffinityPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeAffinityPolicy field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithNodeAffinityPolicy(value v1.NodeInclusionPolicy) *TopologySpreadConstraintApplyConfiguration { + b.NodeAffinityPolicy = &value + return b +} + +// WithNodeTaintsPolicy sets the NodeTaintsPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeTaintsPolicy field is set to the value of the last call. +func (b *TopologySpreadConstraintApplyConfiguration) WithNodeTaintsPolicy(value v1.NodeInclusionPolicy) *TopologySpreadConstraintApplyConfiguration { + b.NodeTaintsPolicy = &value + return b +} + +// WithMatchLabelKeys adds the given value to the MatchLabelKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchLabelKeys field. +func (b *TopologySpreadConstraintApplyConfiguration) WithMatchLabelKeys(values ...string) *TopologySpreadConstraintApplyConfiguration { + for i := range values { + b.MatchLabelKeys = append(b.MatchLabelKeys, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/typedlocalobjectreference.go b/pkg/clients/applyconfiguration/core/v1/typedlocalobjectreference.go new file mode 100644 index 000000000..358b643a9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/typedlocalobjectreference.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// TypedLocalObjectReferenceApplyConfiguration represents an declarative configuration of the TypedLocalObjectReference type for use +// with apply. +type TypedLocalObjectReferenceApplyConfiguration struct { + APIGroup *string `json:"apiGroup,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` +} + +// TypedLocalObjectReferenceApplyConfiguration constructs an declarative configuration of the TypedLocalObjectReference type for use with +// apply. +func TypedLocalObjectReference() *TypedLocalObjectReferenceApplyConfiguration { + return &TypedLocalObjectReferenceApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *TypedLocalObjectReferenceApplyConfiguration) WithAPIGroup(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TypedLocalObjectReferenceApplyConfiguration) WithKind(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TypedLocalObjectReferenceApplyConfiguration) WithName(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/typedobjectreference.go b/pkg/clients/applyconfiguration/core/v1/typedobjectreference.go new file mode 100644 index 000000000..f93874b72 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/typedobjectreference.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// TypedObjectReferenceApplyConfiguration represents an declarative configuration of the TypedObjectReference type for use +// with apply. +type TypedObjectReferenceApplyConfiguration struct { + APIGroup *string `json:"apiGroup,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// TypedObjectReferenceApplyConfiguration constructs an declarative configuration of the TypedObjectReference type for use with +// apply. +func TypedObjectReference() *TypedObjectReferenceApplyConfiguration { + return &TypedObjectReferenceApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *TypedObjectReferenceApplyConfiguration) WithAPIGroup(value string) *TypedObjectReferenceApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TypedObjectReferenceApplyConfiguration) WithKind(value string) *TypedObjectReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TypedObjectReferenceApplyConfiguration) WithName(value string) *TypedObjectReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TypedObjectReferenceApplyConfiguration) WithNamespace(value string) *TypedObjectReferenceApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volume.go b/pkg/clients/applyconfiguration/core/v1/volume.go new file mode 100644 index 000000000..ad0f5073b --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volume.go @@ -0,0 +1,259 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeApplyConfiguration represents an declarative configuration of the Volume type for use +// with apply. +type VolumeApplyConfiguration struct { + Name *string `json:"name,omitempty"` + VolumeSourceApplyConfiguration `json:",inline"` +} + +// VolumeApplyConfiguration constructs an declarative configuration of the Volume type for use with +// apply. +func Volume() *VolumeApplyConfiguration { + return &VolumeApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithName(value string) *VolumeApplyConfiguration { + b.Name = &value + return b +} + +// WithHostPath sets the HostPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostPath field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithHostPath(value *HostPathVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.HostPath = value + return b +} + +// WithEmptyDir sets the EmptyDir field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EmptyDir field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithEmptyDir(value *EmptyDirVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.EmptyDir = value + return b +} + +// WithGCEPersistentDisk sets the GCEPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GCEPersistentDisk field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithGCEPersistentDisk(value *GCEPersistentDiskVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.GCEPersistentDisk = value + return b +} + +// WithAWSElasticBlockStore sets the AWSElasticBlockStore field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AWSElasticBlockStore field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithAWSElasticBlockStore(value *AWSElasticBlockStoreVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.AWSElasticBlockStore = value + return b +} + +// WithGitRepo sets the GitRepo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GitRepo field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithGitRepo(value *GitRepoVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.GitRepo = value + return b +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithSecret(value *SecretVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Secret = value + return b +} + +// WithNFS sets the NFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NFS field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithNFS(value *NFSVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.NFS = value + return b +} + +// WithISCSI sets the ISCSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ISCSI field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithISCSI(value *ISCSIVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.ISCSI = value + return b +} + +// WithGlusterfs sets the Glusterfs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Glusterfs field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithGlusterfs(value *GlusterfsVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Glusterfs = value + return b +} + +// WithPersistentVolumeClaim sets the PersistentVolumeClaim field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PersistentVolumeClaim field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithPersistentVolumeClaim(value *PersistentVolumeClaimVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.PersistentVolumeClaim = value + return b +} + +// WithRBD sets the RBD field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBD field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithRBD(value *RBDVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.RBD = value + return b +} + +// WithFlexVolume sets the FlexVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FlexVolume field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithFlexVolume(value *FlexVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.FlexVolume = value + return b +} + +// WithCinder sets the Cinder field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Cinder field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithCinder(value *CinderVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Cinder = value + return b +} + +// WithCephFS sets the CephFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CephFS field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithCephFS(value *CephFSVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.CephFS = value + return b +} + +// WithFlocker sets the Flocker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Flocker field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithFlocker(value *FlockerVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Flocker = value + return b +} + +// WithDownwardAPI sets the DownwardAPI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DownwardAPI field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithDownwardAPI(value *DownwardAPIVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.DownwardAPI = value + return b +} + +// WithFC sets the FC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FC field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithFC(value *FCVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.FC = value + return b +} + +// WithAzureFile sets the AzureFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureFile field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithAzureFile(value *AzureFileVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.AzureFile = value + return b +} + +// WithConfigMap sets the ConfigMap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMap field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithConfigMap(value *ConfigMapVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.ConfigMap = value + return b +} + +// WithVsphereVolume sets the VsphereVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VsphereVolume field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithVsphereVolume(value *VsphereVirtualDiskVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.VsphereVolume = value + return b +} + +// WithQuobyte sets the Quobyte field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Quobyte field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithQuobyte(value *QuobyteVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Quobyte = value + return b +} + +// WithAzureDisk sets the AzureDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureDisk field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithAzureDisk(value *AzureDiskVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.AzureDisk = value + return b +} + +// WithPhotonPersistentDisk sets the PhotonPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PhotonPersistentDisk field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithPhotonPersistentDisk(value *PhotonPersistentDiskVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.PhotonPersistentDisk = value + return b +} + +// WithProjected sets the Projected field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Projected field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithProjected(value *ProjectedVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Projected = value + return b +} + +// WithPortworxVolume sets the PortworxVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PortworxVolume field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithPortworxVolume(value *PortworxVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.PortworxVolume = value + return b +} + +// WithScaleIO sets the ScaleIO field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleIO field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithScaleIO(value *ScaleIOVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.ScaleIO = value + return b +} + +// WithStorageOS sets the StorageOS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageOS field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithStorageOS(value *StorageOSVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.StorageOS = value + return b +} + +// WithCSI sets the CSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CSI field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithCSI(value *CSIVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.CSI = value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithEphemeral(value *EphemeralVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volumedevice.go b/pkg/clients/applyconfiguration/core/v1/volumedevice.go new file mode 100644 index 000000000..3c7ae558b --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volumedevice.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeDeviceApplyConfiguration represents an declarative configuration of the VolumeDevice type for use +// with apply. +type VolumeDeviceApplyConfiguration struct { + Name *string `json:"name,omitempty"` + DevicePath *string `json:"devicePath,omitempty"` +} + +// VolumeDeviceApplyConfiguration constructs an declarative configuration of the VolumeDevice type for use with +// apply. +func VolumeDevice() *VolumeDeviceApplyConfiguration { + return &VolumeDeviceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeDeviceApplyConfiguration) WithName(value string) *VolumeDeviceApplyConfiguration { + b.Name = &value + return b +} + +// WithDevicePath sets the DevicePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DevicePath field is set to the value of the last call. +func (b *VolumeDeviceApplyConfiguration) WithDevicePath(value string) *VolumeDeviceApplyConfiguration { + b.DevicePath = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volumemount.go b/pkg/clients/applyconfiguration/core/v1/volumemount.go new file mode 100644 index 000000000..f410f71ce --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volumemount.go @@ -0,0 +1,75 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VolumeMountApplyConfiguration represents an declarative configuration of the VolumeMount type for use +// with apply. +type VolumeMountApplyConfiguration struct { + Name *string `json:"name,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + MountPath *string `json:"mountPath,omitempty"` + SubPath *string `json:"subPath,omitempty"` + MountPropagation *v1.MountPropagationMode `json:"mountPropagation,omitempty"` + SubPathExpr *string `json:"subPathExpr,omitempty"` +} + +// VolumeMountApplyConfiguration constructs an declarative configuration of the VolumeMount type for use with +// apply. +func VolumeMount() *VolumeMountApplyConfiguration { + return &VolumeMountApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeMountApplyConfiguration) WithName(value string) *VolumeMountApplyConfiguration { + b.Name = &value + return b +} + +// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadOnly field is set to the value of the last call. +func (b *VolumeMountApplyConfiguration) WithReadOnly(value bool) *VolumeMountApplyConfiguration { + b.ReadOnly = &value + return b +} + +// WithMountPath sets the MountPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MountPath field is set to the value of the last call. +func (b *VolumeMountApplyConfiguration) WithMountPath(value string) *VolumeMountApplyConfiguration { + b.MountPath = &value + return b +} + +// WithSubPath sets the SubPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SubPath field is set to the value of the last call. +func (b *VolumeMountApplyConfiguration) WithSubPath(value string) *VolumeMountApplyConfiguration { + b.SubPath = &value + return b +} + +// WithMountPropagation sets the MountPropagation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MountPropagation field is set to the value of the last call. +func (b *VolumeMountApplyConfiguration) WithMountPropagation(value v1.MountPropagationMode) *VolumeMountApplyConfiguration { + b.MountPropagation = &value + return b +} + +// WithSubPathExpr sets the SubPathExpr field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SubPathExpr field is set to the value of the last call. +func (b *VolumeMountApplyConfiguration) WithSubPathExpr(value string) *VolumeMountApplyConfiguration { + b.SubPathExpr = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volumenodeaffinity.go b/pkg/clients/applyconfiguration/core/v1/volumenodeaffinity.go new file mode 100644 index 000000000..9e2400772 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volumenodeaffinity.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeNodeAffinityApplyConfiguration represents an declarative configuration of the VolumeNodeAffinity type for use +// with apply. +type VolumeNodeAffinityApplyConfiguration struct { + Required *NodeSelectorApplyConfiguration `json:"required,omitempty"` +} + +// VolumeNodeAffinityApplyConfiguration constructs an declarative configuration of the VolumeNodeAffinity type for use with +// apply. +func VolumeNodeAffinity() *VolumeNodeAffinityApplyConfiguration { + return &VolumeNodeAffinityApplyConfiguration{} +} + +// WithRequired sets the Required field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Required field is set to the value of the last call. +func (b *VolumeNodeAffinityApplyConfiguration) WithRequired(value *NodeSelectorApplyConfiguration) *VolumeNodeAffinityApplyConfiguration { + b.Required = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volumeprojection.go b/pkg/clients/applyconfiguration/core/v1/volumeprojection.go new file mode 100644 index 000000000..6a91ffcc4 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volumeprojection.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeProjectionApplyConfiguration represents an declarative configuration of the VolumeProjection type for use +// with apply. +type VolumeProjectionApplyConfiguration struct { + Secret *SecretProjectionApplyConfiguration `json:"secret,omitempty"` + DownwardAPI *DownwardAPIProjectionApplyConfiguration `json:"downwardAPI,omitempty"` + ConfigMap *ConfigMapProjectionApplyConfiguration `json:"configMap,omitempty"` + ServiceAccountToken *ServiceAccountTokenProjectionApplyConfiguration `json:"serviceAccountToken,omitempty"` + ClusterTrustBundle *ClusterTrustBundleProjectionApplyConfiguration `json:"clusterTrustBundle,omitempty"` +} + +// VolumeProjectionApplyConfiguration constructs an declarative configuration of the VolumeProjection type for use with +// apply. +func VolumeProjection() *VolumeProjectionApplyConfiguration { + return &VolumeProjectionApplyConfiguration{} +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *VolumeProjectionApplyConfiguration) WithSecret(value *SecretProjectionApplyConfiguration) *VolumeProjectionApplyConfiguration { + b.Secret = value + return b +} + +// WithDownwardAPI sets the DownwardAPI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DownwardAPI field is set to the value of the last call. +func (b *VolumeProjectionApplyConfiguration) WithDownwardAPI(value *DownwardAPIProjectionApplyConfiguration) *VolumeProjectionApplyConfiguration { + b.DownwardAPI = value + return b +} + +// WithConfigMap sets the ConfigMap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMap field is set to the value of the last call. +func (b *VolumeProjectionApplyConfiguration) WithConfigMap(value *ConfigMapProjectionApplyConfiguration) *VolumeProjectionApplyConfiguration { + b.ConfigMap = value + return b +} + +// WithServiceAccountToken sets the ServiceAccountToken field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServiceAccountToken field is set to the value of the last call. +func (b *VolumeProjectionApplyConfiguration) WithServiceAccountToken(value *ServiceAccountTokenProjectionApplyConfiguration) *VolumeProjectionApplyConfiguration { + b.ServiceAccountToken = value + return b +} + +// WithClusterTrustBundle sets the ClusterTrustBundle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClusterTrustBundle field is set to the value of the last call. +func (b *VolumeProjectionApplyConfiguration) WithClusterTrustBundle(value *ClusterTrustBundleProjectionApplyConfiguration) *VolumeProjectionApplyConfiguration { + b.ClusterTrustBundle = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volumeresourcerequirements.go b/pkg/clients/applyconfiguration/core/v1/volumeresourcerequirements.go new file mode 100644 index 000000000..b1c421d56 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volumeresourcerequirements.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VolumeResourceRequirementsApplyConfiguration represents an declarative configuration of the VolumeResourceRequirements type for use +// with apply. +type VolumeResourceRequirementsApplyConfiguration struct { + Limits *v1.ResourceList `json:"limits,omitempty"` + Requests *v1.ResourceList `json:"requests,omitempty"` +} + +// VolumeResourceRequirementsApplyConfiguration constructs an declarative configuration of the VolumeResourceRequirements type for use with +// apply. +func VolumeResourceRequirements() *VolumeResourceRequirementsApplyConfiguration { + return &VolumeResourceRequirementsApplyConfiguration{} +} + +// WithLimits sets the Limits field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Limits field is set to the value of the last call. +func (b *VolumeResourceRequirementsApplyConfiguration) WithLimits(value v1.ResourceList) *VolumeResourceRequirementsApplyConfiguration { + b.Limits = &value + return b +} + +// WithRequests sets the Requests field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Requests field is set to the value of the last call. +func (b *VolumeResourceRequirementsApplyConfiguration) WithRequests(value v1.ResourceList) *VolumeResourceRequirementsApplyConfiguration { + b.Requests = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/volumesource.go b/pkg/clients/applyconfiguration/core/v1/volumesource.go new file mode 100644 index 000000000..6606d71e9 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/volumesource.go @@ -0,0 +1,278 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeSourceApplyConfiguration represents an declarative configuration of the VolumeSource type for use +// with apply. +type VolumeSourceApplyConfiguration struct { + HostPath *HostPathVolumeSourceApplyConfiguration `json:"hostPath,omitempty"` + EmptyDir *EmptyDirVolumeSourceApplyConfiguration `json:"emptyDir,omitempty"` + GCEPersistentDisk *GCEPersistentDiskVolumeSourceApplyConfiguration `json:"gcePersistentDisk,omitempty"` + AWSElasticBlockStore *AWSElasticBlockStoreVolumeSourceApplyConfiguration `json:"awsElasticBlockStore,omitempty"` + GitRepo *GitRepoVolumeSourceApplyConfiguration `json:"gitRepo,omitempty"` + Secret *SecretVolumeSourceApplyConfiguration `json:"secret,omitempty"` + NFS *NFSVolumeSourceApplyConfiguration `json:"nfs,omitempty"` + ISCSI *ISCSIVolumeSourceApplyConfiguration `json:"iscsi,omitempty"` + Glusterfs *GlusterfsVolumeSourceApplyConfiguration `json:"glusterfs,omitempty"` + PersistentVolumeClaim *PersistentVolumeClaimVolumeSourceApplyConfiguration `json:"persistentVolumeClaim,omitempty"` + RBD *RBDVolumeSourceApplyConfiguration `json:"rbd,omitempty"` + FlexVolume *FlexVolumeSourceApplyConfiguration `json:"flexVolume,omitempty"` + Cinder *CinderVolumeSourceApplyConfiguration `json:"cinder,omitempty"` + CephFS *CephFSVolumeSourceApplyConfiguration `json:"cephfs,omitempty"` + Flocker *FlockerVolumeSourceApplyConfiguration `json:"flocker,omitempty"` + DownwardAPI *DownwardAPIVolumeSourceApplyConfiguration `json:"downwardAPI,omitempty"` + FC *FCVolumeSourceApplyConfiguration `json:"fc,omitempty"` + AzureFile *AzureFileVolumeSourceApplyConfiguration `json:"azureFile,omitempty"` + ConfigMap *ConfigMapVolumeSourceApplyConfiguration `json:"configMap,omitempty"` + VsphereVolume *VsphereVirtualDiskVolumeSourceApplyConfiguration `json:"vsphereVolume,omitempty"` + Quobyte *QuobyteVolumeSourceApplyConfiguration `json:"quobyte,omitempty"` + AzureDisk *AzureDiskVolumeSourceApplyConfiguration `json:"azureDisk,omitempty"` + PhotonPersistentDisk *PhotonPersistentDiskVolumeSourceApplyConfiguration `json:"photonPersistentDisk,omitempty"` + Projected *ProjectedVolumeSourceApplyConfiguration `json:"projected,omitempty"` + PortworxVolume *PortworxVolumeSourceApplyConfiguration `json:"portworxVolume,omitempty"` + ScaleIO *ScaleIOVolumeSourceApplyConfiguration `json:"scaleIO,omitempty"` + StorageOS *StorageOSVolumeSourceApplyConfiguration `json:"storageos,omitempty"` + CSI *CSIVolumeSourceApplyConfiguration `json:"csi,omitempty"` + Ephemeral *EphemeralVolumeSourceApplyConfiguration `json:"ephemeral,omitempty"` +} + +// VolumeSourceApplyConfiguration constructs an declarative configuration of the VolumeSource type for use with +// apply. +func VolumeSource() *VolumeSourceApplyConfiguration { + return &VolumeSourceApplyConfiguration{} +} + +// WithHostPath sets the HostPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostPath field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithHostPath(value *HostPathVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.HostPath = value + return b +} + +// WithEmptyDir sets the EmptyDir field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EmptyDir field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithEmptyDir(value *EmptyDirVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.EmptyDir = value + return b +} + +// WithGCEPersistentDisk sets the GCEPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GCEPersistentDisk field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithGCEPersistentDisk(value *GCEPersistentDiskVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.GCEPersistentDisk = value + return b +} + +// WithAWSElasticBlockStore sets the AWSElasticBlockStore field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AWSElasticBlockStore field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithAWSElasticBlockStore(value *AWSElasticBlockStoreVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.AWSElasticBlockStore = value + return b +} + +// WithGitRepo sets the GitRepo field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GitRepo field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithGitRepo(value *GitRepoVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.GitRepo = value + return b +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithSecret(value *SecretVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Secret = value + return b +} + +// WithNFS sets the NFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NFS field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithNFS(value *NFSVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.NFS = value + return b +} + +// WithISCSI sets the ISCSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ISCSI field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithISCSI(value *ISCSIVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.ISCSI = value + return b +} + +// WithGlusterfs sets the Glusterfs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Glusterfs field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithGlusterfs(value *GlusterfsVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Glusterfs = value + return b +} + +// WithPersistentVolumeClaim sets the PersistentVolumeClaim field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PersistentVolumeClaim field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithPersistentVolumeClaim(value *PersistentVolumeClaimVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.PersistentVolumeClaim = value + return b +} + +// WithRBD sets the RBD field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RBD field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithRBD(value *RBDVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.RBD = value + return b +} + +// WithFlexVolume sets the FlexVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FlexVolume field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithFlexVolume(value *FlexVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.FlexVolume = value + return b +} + +// WithCinder sets the Cinder field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Cinder field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithCinder(value *CinderVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Cinder = value + return b +} + +// WithCephFS sets the CephFS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CephFS field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithCephFS(value *CephFSVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.CephFS = value + return b +} + +// WithFlocker sets the Flocker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Flocker field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithFlocker(value *FlockerVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Flocker = value + return b +} + +// WithDownwardAPI sets the DownwardAPI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DownwardAPI field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithDownwardAPI(value *DownwardAPIVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.DownwardAPI = value + return b +} + +// WithFC sets the FC field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FC field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithFC(value *FCVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.FC = value + return b +} + +// WithAzureFile sets the AzureFile field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureFile field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithAzureFile(value *AzureFileVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.AzureFile = value + return b +} + +// WithConfigMap sets the ConfigMap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMap field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithConfigMap(value *ConfigMapVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.ConfigMap = value + return b +} + +// WithVsphereVolume sets the VsphereVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VsphereVolume field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithVsphereVolume(value *VsphereVirtualDiskVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.VsphereVolume = value + return b +} + +// WithQuobyte sets the Quobyte field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Quobyte field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithQuobyte(value *QuobyteVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Quobyte = value + return b +} + +// WithAzureDisk sets the AzureDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AzureDisk field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithAzureDisk(value *AzureDiskVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.AzureDisk = value + return b +} + +// WithPhotonPersistentDisk sets the PhotonPersistentDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PhotonPersistentDisk field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithPhotonPersistentDisk(value *PhotonPersistentDiskVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.PhotonPersistentDisk = value + return b +} + +// WithProjected sets the Projected field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Projected field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithProjected(value *ProjectedVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Projected = value + return b +} + +// WithPortworxVolume sets the PortworxVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PortworxVolume field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithPortworxVolume(value *PortworxVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.PortworxVolume = value + return b +} + +// WithScaleIO sets the ScaleIO field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ScaleIO field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithScaleIO(value *ScaleIOVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.ScaleIO = value + return b +} + +// WithStorageOS sets the StorageOS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageOS field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithStorageOS(value *StorageOSVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.StorageOS = value + return b +} + +// WithCSI sets the CSI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CSI field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithCSI(value *CSIVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.CSI = value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithEphemeral(value *EphemeralVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/vspherevirtualdiskvolumesource.go b/pkg/clients/applyconfiguration/core/v1/vspherevirtualdiskvolumesource.go new file mode 100644 index 000000000..994ef890c --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/vspherevirtualdiskvolumesource.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VsphereVirtualDiskVolumeSourceApplyConfiguration represents an declarative configuration of the VsphereVirtualDiskVolumeSource type for use +// with apply. +type VsphereVirtualDiskVolumeSourceApplyConfiguration struct { + VolumePath *string `json:"volumePath,omitempty"` + FSType *string `json:"fsType,omitempty"` + StoragePolicyName *string `json:"storagePolicyName,omitempty"` + StoragePolicyID *string `json:"storagePolicyID,omitempty"` +} + +// VsphereVirtualDiskVolumeSourceApplyConfiguration constructs an declarative configuration of the VsphereVirtualDiskVolumeSource type for use with +// apply. +func VsphereVirtualDiskVolumeSource() *VsphereVirtualDiskVolumeSourceApplyConfiguration { + return &VsphereVirtualDiskVolumeSourceApplyConfiguration{} +} + +// WithVolumePath sets the VolumePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumePath field is set to the value of the last call. +func (b *VsphereVirtualDiskVolumeSourceApplyConfiguration) WithVolumePath(value string) *VsphereVirtualDiskVolumeSourceApplyConfiguration { + b.VolumePath = &value + return b +} + +// WithFSType sets the FSType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSType field is set to the value of the last call. +func (b *VsphereVirtualDiskVolumeSourceApplyConfiguration) WithFSType(value string) *VsphereVirtualDiskVolumeSourceApplyConfiguration { + b.FSType = &value + return b +} + +// WithStoragePolicyName sets the StoragePolicyName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoragePolicyName field is set to the value of the last call. +func (b *VsphereVirtualDiskVolumeSourceApplyConfiguration) WithStoragePolicyName(value string) *VsphereVirtualDiskVolumeSourceApplyConfiguration { + b.StoragePolicyName = &value + return b +} + +// WithStoragePolicyID sets the StoragePolicyID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StoragePolicyID field is set to the value of the last call. +func (b *VsphereVirtualDiskVolumeSourceApplyConfiguration) WithStoragePolicyID(value string) *VsphereVirtualDiskVolumeSourceApplyConfiguration { + b.StoragePolicyID = &value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/weightedpodaffinityterm.go b/pkg/clients/applyconfiguration/core/v1/weightedpodaffinityterm.go new file mode 100644 index 000000000..ba9bffc92 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/weightedpodaffinityterm.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// WeightedPodAffinityTermApplyConfiguration represents an declarative configuration of the WeightedPodAffinityTerm type for use +// with apply. +type WeightedPodAffinityTermApplyConfiguration struct { + Weight *int32 `json:"weight,omitempty"` + PodAffinityTerm *PodAffinityTermApplyConfiguration `json:"podAffinityTerm,omitempty"` +} + +// WeightedPodAffinityTermApplyConfiguration constructs an declarative configuration of the WeightedPodAffinityTerm type for use with +// apply. +func WeightedPodAffinityTerm() *WeightedPodAffinityTermApplyConfiguration { + return &WeightedPodAffinityTermApplyConfiguration{} +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *WeightedPodAffinityTermApplyConfiguration) WithWeight(value int32) *WeightedPodAffinityTermApplyConfiguration { + b.Weight = &value + return b +} + +// WithPodAffinityTerm sets the PodAffinityTerm field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodAffinityTerm field is set to the value of the last call. +func (b *WeightedPodAffinityTermApplyConfiguration) WithPodAffinityTerm(value *PodAffinityTermApplyConfiguration) *WeightedPodAffinityTermApplyConfiguration { + b.PodAffinityTerm = value + return b +} diff --git a/pkg/clients/applyconfiguration/core/v1/windowssecuritycontextoptions.go b/pkg/clients/applyconfiguration/core/v1/windowssecuritycontextoptions.go new file mode 100644 index 000000000..61a08b8c6 --- /dev/null +++ b/pkg/clients/applyconfiguration/core/v1/windowssecuritycontextoptions.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// WindowsSecurityContextOptionsApplyConfiguration represents an declarative configuration of the WindowsSecurityContextOptions type for use +// with apply. +type WindowsSecurityContextOptionsApplyConfiguration struct { + GMSACredentialSpecName *string `json:"gmsaCredentialSpecName,omitempty"` + GMSACredentialSpec *string `json:"gmsaCredentialSpec,omitempty"` + RunAsUserName *string `json:"runAsUserName,omitempty"` + HostProcess *bool `json:"hostProcess,omitempty"` +} + +// WindowsSecurityContextOptionsApplyConfiguration constructs an declarative configuration of the WindowsSecurityContextOptions type for use with +// apply. +func WindowsSecurityContextOptions() *WindowsSecurityContextOptionsApplyConfiguration { + return &WindowsSecurityContextOptionsApplyConfiguration{} +} + +// WithGMSACredentialSpecName sets the GMSACredentialSpecName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GMSACredentialSpecName field is set to the value of the last call. +func (b *WindowsSecurityContextOptionsApplyConfiguration) WithGMSACredentialSpecName(value string) *WindowsSecurityContextOptionsApplyConfiguration { + b.GMSACredentialSpecName = &value + return b +} + +// WithGMSACredentialSpec sets the GMSACredentialSpec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GMSACredentialSpec field is set to the value of the last call. +func (b *WindowsSecurityContextOptionsApplyConfiguration) WithGMSACredentialSpec(value string) *WindowsSecurityContextOptionsApplyConfiguration { + b.GMSACredentialSpec = &value + return b +} + +// WithRunAsUserName sets the RunAsUserName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RunAsUserName field is set to the value of the last call. +func (b *WindowsSecurityContextOptionsApplyConfiguration) WithRunAsUserName(value string) *WindowsSecurityContextOptionsApplyConfiguration { + b.RunAsUserName = &value + return b +} + +// WithHostProcess sets the HostProcess field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HostProcess field is set to the value of the last call. +func (b *WindowsSecurityContextOptionsApplyConfiguration) WithHostProcess(value bool) *WindowsSecurityContextOptionsApplyConfiguration { + b.HostProcess = &value + return b +} diff --git a/pkg/clients/applyconfiguration/discovery/v1/endpoint.go b/pkg/clients/applyconfiguration/discovery/v1/endpoint.go new file mode 100644 index 000000000..f8023e3d4 --- /dev/null +++ b/pkg/clients/applyconfiguration/discovery/v1/endpoint.go @@ -0,0 +1,101 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" +) + +// EndpointApplyConfiguration represents an declarative configuration of the Endpoint type for use +// with apply. +type EndpointApplyConfiguration struct { + Addresses []string `json:"addresses,omitempty"` + Conditions *EndpointConditionsApplyConfiguration `json:"conditions,omitempty"` + Hostname *string `json:"hostname,omitempty"` + TargetRef *corev1.ObjectReferenceApplyConfiguration `json:"targetRef,omitempty"` + DeprecatedTopology map[string]string `json:"deprecatedTopology,omitempty"` + NodeName *string `json:"nodeName,omitempty"` + Zone *string `json:"zone,omitempty"` + Hints *EndpointHintsApplyConfiguration `json:"hints,omitempty"` +} + +// EndpointApplyConfiguration constructs an declarative configuration of the Endpoint type for use with +// apply. +func Endpoint() *EndpointApplyConfiguration { + return &EndpointApplyConfiguration{} +} + +// WithAddresses adds the given value to the Addresses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Addresses field. +func (b *EndpointApplyConfiguration) WithAddresses(values ...string) *EndpointApplyConfiguration { + for i := range values { + b.Addresses = append(b.Addresses, values[i]) + } + return b +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *EndpointApplyConfiguration) WithConditions(value *EndpointConditionsApplyConfiguration) *EndpointApplyConfiguration { + b.Conditions = value + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *EndpointApplyConfiguration) WithHostname(value string) *EndpointApplyConfiguration { + b.Hostname = &value + return b +} + +// WithTargetRef sets the TargetRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetRef field is set to the value of the last call. +func (b *EndpointApplyConfiguration) WithTargetRef(value *corev1.ObjectReferenceApplyConfiguration) *EndpointApplyConfiguration { + b.TargetRef = value + return b +} + +// WithDeprecatedTopology puts the entries into the DeprecatedTopology field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the DeprecatedTopology field, +// overwriting an existing map entries in DeprecatedTopology field with the same key. +func (b *EndpointApplyConfiguration) WithDeprecatedTopology(entries map[string]string) *EndpointApplyConfiguration { + if b.DeprecatedTopology == nil && len(entries) > 0 { + b.DeprecatedTopology = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.DeprecatedTopology[k] = v + } + return b +} + +// WithNodeName sets the NodeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeName field is set to the value of the last call. +func (b *EndpointApplyConfiguration) WithNodeName(value string) *EndpointApplyConfiguration { + b.NodeName = &value + return b +} + +// WithZone sets the Zone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Zone field is set to the value of the last call. +func (b *EndpointApplyConfiguration) WithZone(value string) *EndpointApplyConfiguration { + b.Zone = &value + return b +} + +// WithHints sets the Hints field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hints field is set to the value of the last call. +func (b *EndpointApplyConfiguration) WithHints(value *EndpointHintsApplyConfiguration) *EndpointApplyConfiguration { + b.Hints = value + return b +} diff --git a/pkg/clients/applyconfiguration/discovery/v1/endpointconditions.go b/pkg/clients/applyconfiguration/discovery/v1/endpointconditions.go new file mode 100644 index 000000000..b03a0dbb3 --- /dev/null +++ b/pkg/clients/applyconfiguration/discovery/v1/endpointconditions.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EndpointConditionsApplyConfiguration represents an declarative configuration of the EndpointConditions type for use +// with apply. +type EndpointConditionsApplyConfiguration struct { + Ready *bool `json:"ready,omitempty"` + Serving *bool `json:"serving,omitempty"` + Terminating *bool `json:"terminating,omitempty"` +} + +// EndpointConditionsApplyConfiguration constructs an declarative configuration of the EndpointConditions type for use with +// apply. +func EndpointConditions() *EndpointConditionsApplyConfiguration { + return &EndpointConditionsApplyConfiguration{} +} + +// WithReady sets the Ready field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ready field is set to the value of the last call. +func (b *EndpointConditionsApplyConfiguration) WithReady(value bool) *EndpointConditionsApplyConfiguration { + b.Ready = &value + return b +} + +// WithServing sets the Serving field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Serving field is set to the value of the last call. +func (b *EndpointConditionsApplyConfiguration) WithServing(value bool) *EndpointConditionsApplyConfiguration { + b.Serving = &value + return b +} + +// WithTerminating sets the Terminating field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Terminating field is set to the value of the last call. +func (b *EndpointConditionsApplyConfiguration) WithTerminating(value bool) *EndpointConditionsApplyConfiguration { + b.Terminating = &value + return b +} diff --git a/pkg/clients/applyconfiguration/discovery/v1/endpointhints.go b/pkg/clients/applyconfiguration/discovery/v1/endpointhints.go new file mode 100644 index 000000000..7a429090e --- /dev/null +++ b/pkg/clients/applyconfiguration/discovery/v1/endpointhints.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EndpointHintsApplyConfiguration represents an declarative configuration of the EndpointHints type for use +// with apply. +type EndpointHintsApplyConfiguration struct { + ForZones []ForZoneApplyConfiguration `json:"forZones,omitempty"` +} + +// EndpointHintsApplyConfiguration constructs an declarative configuration of the EndpointHints type for use with +// apply. +func EndpointHints() *EndpointHintsApplyConfiguration { + return &EndpointHintsApplyConfiguration{} +} + +// WithForZones adds the given value to the ForZones field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ForZones field. +func (b *EndpointHintsApplyConfiguration) WithForZones(values ...*ForZoneApplyConfiguration) *EndpointHintsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithForZones") + } + b.ForZones = append(b.ForZones, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/discovery/v1/endpointport.go b/pkg/clients/applyconfiguration/discovery/v1/endpointport.go new file mode 100644 index 000000000..119df7b76 --- /dev/null +++ b/pkg/clients/applyconfiguration/discovery/v1/endpointport.go @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// EndpointPortApplyConfiguration represents an declarative configuration of the EndpointPort type for use +// with apply. +type EndpointPortApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Protocol *v1.Protocol `json:"protocol,omitempty"` + Port *int32 `json:"port,omitempty"` + AppProtocol *string `json:"appProtocol,omitempty"` +} + +// EndpointPortApplyConfiguration constructs an declarative configuration of the EndpointPort type for use with +// apply. +func EndpointPort() *EndpointPortApplyConfiguration { + return &EndpointPortApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithName(value string) *EndpointPortApplyConfiguration { + b.Name = &value + return b +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithProtocol(value v1.Protocol) *EndpointPortApplyConfiguration { + b.Protocol = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithPort(value int32) *EndpointPortApplyConfiguration { + b.Port = &value + return b +} + +// WithAppProtocol sets the AppProtocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AppProtocol field is set to the value of the last call. +func (b *EndpointPortApplyConfiguration) WithAppProtocol(value string) *EndpointPortApplyConfiguration { + b.AppProtocol = &value + return b +} diff --git a/pkg/clients/applyconfiguration/discovery/v1/endpointslice.go b/pkg/clients/applyconfiguration/discovery/v1/endpointslice.go new file mode 100644 index 000000000..8e4751018 --- /dev/null +++ b/pkg/clients/applyconfiguration/discovery/v1/endpointslice.go @@ -0,0 +1,226 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + discoveryv1 "k8s.io/api/discovery/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EndpointSliceApplyConfiguration represents an declarative configuration of the EndpointSlice type for use +// with apply. +type EndpointSliceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + AddressType *discoveryv1.AddressType `json:"addressType,omitempty"` + Endpoints []EndpointApplyConfiguration `json:"endpoints,omitempty"` + Ports []EndpointPortApplyConfiguration `json:"ports,omitempty"` +} + +// EndpointSlice constructs an declarative configuration of the EndpointSlice type for use with +// apply. +func EndpointSlice(name, namespace string) *EndpointSliceApplyConfiguration { + b := &EndpointSliceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("EndpointSlice") + b.WithAPIVersion("discovery.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithKind(value string) *EndpointSliceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithAPIVersion(value string) *EndpointSliceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithName(value string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithGenerateName(value string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithNamespace(value string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithUID(value types.UID) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithResourceVersion(value string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithGeneration(value int64) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EndpointSliceApplyConfiguration) WithLabels(entries map[string]string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EndpointSliceApplyConfiguration) WithAnnotations(entries map[string]string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *EndpointSliceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *EndpointSliceApplyConfiguration) WithFinalizers(values ...string) *EndpointSliceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *EndpointSliceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithAddressType sets the AddressType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AddressType field is set to the value of the last call. +func (b *EndpointSliceApplyConfiguration) WithAddressType(value discoveryv1.AddressType) *EndpointSliceApplyConfiguration { + b.AddressType = &value + return b +} + +// WithEndpoints adds the given value to the Endpoints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Endpoints field. +func (b *EndpointSliceApplyConfiguration) WithEndpoints(values ...*EndpointApplyConfiguration) *EndpointSliceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEndpoints") + } + b.Endpoints = append(b.Endpoints, *values[i]) + } + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *EndpointSliceApplyConfiguration) WithPorts(values ...*EndpointPortApplyConfiguration) *EndpointSliceApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/discovery/v1/forzone.go b/pkg/clients/applyconfiguration/discovery/v1/forzone.go new file mode 100644 index 000000000..a04f4163e --- /dev/null +++ b/pkg/clients/applyconfiguration/discovery/v1/forzone.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ForZoneApplyConfiguration represents an declarative configuration of the ForZone type for use +// with apply. +type ForZoneApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// ForZoneApplyConfiguration constructs an declarative configuration of the ForZone type for use with +// apply. +func ForZone() *ForZoneApplyConfiguration { + return &ForZoneApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ForZoneApplyConfiguration) WithName(value string) *ForZoneApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/events/v1/event.go b/pkg/clients/applyconfiguration/events/v1/event.go new file mode 100644 index 000000000..6c7b433c3 --- /dev/null +++ b/pkg/clients/applyconfiguration/events/v1/event.go @@ -0,0 +1,315 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EventApplyConfiguration represents an declarative configuration of the Event type for use +// with apply. +type EventApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + EventTime *metav1.MicroTime `json:"eventTime,omitempty"` + Series *EventSeriesApplyConfiguration `json:"series,omitempty"` + ReportingController *string `json:"reportingController,omitempty"` + ReportingInstance *string `json:"reportingInstance,omitempty"` + Action *string `json:"action,omitempty"` + Reason *string `json:"reason,omitempty"` + Regarding *corev1.ObjectReferenceApplyConfiguration `json:"regarding,omitempty"` + Related *corev1.ObjectReferenceApplyConfiguration `json:"related,omitempty"` + Note *string `json:"note,omitempty"` + Type *string `json:"type,omitempty"` + DeprecatedSource *corev1.EventSourceApplyConfiguration `json:"deprecatedSource,omitempty"` + DeprecatedFirstTimestamp *metav1.Time `json:"deprecatedFirstTimestamp,omitempty"` + DeprecatedLastTimestamp *metav1.Time `json:"deprecatedLastTimestamp,omitempty"` + DeprecatedCount *int32 `json:"deprecatedCount,omitempty"` +} + +// Event constructs an declarative configuration of the Event type for use with +// apply. +func Event(name, namespace string) *EventApplyConfiguration { + b := &EventApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Event") + b.WithAPIVersion("events.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *EventApplyConfiguration) WithKind(value string) *EventApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *EventApplyConfiguration) WithAPIVersion(value string) *EventApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EventApplyConfiguration) WithName(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *EventApplyConfiguration) WithGenerateName(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *EventApplyConfiguration) WithNamespace(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *EventApplyConfiguration) WithUID(value types.UID) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *EventApplyConfiguration) WithResourceVersion(value string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *EventApplyConfiguration) WithGeneration(value int64) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EventApplyConfiguration) WithLabels(entries map[string]string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EventApplyConfiguration) WithAnnotations(entries map[string]string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *EventApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *EventApplyConfiguration) WithFinalizers(values ...string) *EventApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *EventApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithEventTime sets the EventTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EventTime field is set to the value of the last call. +func (b *EventApplyConfiguration) WithEventTime(value metav1.MicroTime) *EventApplyConfiguration { + b.EventTime = &value + return b +} + +// WithSeries sets the Series field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Series field is set to the value of the last call. +func (b *EventApplyConfiguration) WithSeries(value *EventSeriesApplyConfiguration) *EventApplyConfiguration { + b.Series = value + return b +} + +// WithReportingController sets the ReportingController field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReportingController field is set to the value of the last call. +func (b *EventApplyConfiguration) WithReportingController(value string) *EventApplyConfiguration { + b.ReportingController = &value + return b +} + +// WithReportingInstance sets the ReportingInstance field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReportingInstance field is set to the value of the last call. +func (b *EventApplyConfiguration) WithReportingInstance(value string) *EventApplyConfiguration { + b.ReportingInstance = &value + return b +} + +// WithAction sets the Action field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Action field is set to the value of the last call. +func (b *EventApplyConfiguration) WithAction(value string) *EventApplyConfiguration { + b.Action = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *EventApplyConfiguration) WithReason(value string) *EventApplyConfiguration { + b.Reason = &value + return b +} + +// WithRegarding sets the Regarding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Regarding field is set to the value of the last call. +func (b *EventApplyConfiguration) WithRegarding(value *corev1.ObjectReferenceApplyConfiguration) *EventApplyConfiguration { + b.Regarding = value + return b +} + +// WithRelated sets the Related field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Related field is set to the value of the last call. +func (b *EventApplyConfiguration) WithRelated(value *corev1.ObjectReferenceApplyConfiguration) *EventApplyConfiguration { + b.Related = value + return b +} + +// WithNote sets the Note field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Note field is set to the value of the last call. +func (b *EventApplyConfiguration) WithNote(value string) *EventApplyConfiguration { + b.Note = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *EventApplyConfiguration) WithType(value string) *EventApplyConfiguration { + b.Type = &value + return b +} + +// WithDeprecatedSource sets the DeprecatedSource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedSource field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeprecatedSource(value *corev1.EventSourceApplyConfiguration) *EventApplyConfiguration { + b.DeprecatedSource = value + return b +} + +// WithDeprecatedFirstTimestamp sets the DeprecatedFirstTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedFirstTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeprecatedFirstTimestamp(value metav1.Time) *EventApplyConfiguration { + b.DeprecatedFirstTimestamp = &value + return b +} + +// WithDeprecatedLastTimestamp sets the DeprecatedLastTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedLastTimestamp field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeprecatedLastTimestamp(value metav1.Time) *EventApplyConfiguration { + b.DeprecatedLastTimestamp = &value + return b +} + +// WithDeprecatedCount sets the DeprecatedCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecatedCount field is set to the value of the last call. +func (b *EventApplyConfiguration) WithDeprecatedCount(value int32) *EventApplyConfiguration { + b.DeprecatedCount = &value + return b +} diff --git a/pkg/clients/applyconfiguration/events/v1/eventseries.go b/pkg/clients/applyconfiguration/events/v1/eventseries.go new file mode 100644 index 000000000..c2430423a --- /dev/null +++ b/pkg/clients/applyconfiguration/events/v1/eventseries.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EventSeriesApplyConfiguration represents an declarative configuration of the EventSeries type for use +// with apply. +type EventSeriesApplyConfiguration struct { + Count *int32 `json:"count,omitempty"` + LastObservedTime *v1.MicroTime `json:"lastObservedTime,omitempty"` +} + +// EventSeriesApplyConfiguration constructs an declarative configuration of the EventSeries type for use with +// apply. +func EventSeries() *EventSeriesApplyConfiguration { + return &EventSeriesApplyConfiguration{} +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *EventSeriesApplyConfiguration) WithCount(value int32) *EventSeriesApplyConfiguration { + b.Count = &value + return b +} + +// WithLastObservedTime sets the LastObservedTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastObservedTime field is set to the value of the last call. +func (b *EventSeriesApplyConfiguration) WithLastObservedTime(value v1.MicroTime) *EventSeriesApplyConfiguration { + b.LastObservedTime = &value + return b +} diff --git a/pkg/clients/applyconfiguration/internal/internal.go b/pkg/clients/applyconfiguration/internal/internal.go new file mode 100644 index 000000000..60c47f96a --- /dev/null +++ b/pkg/clients/applyconfiguration/internal/internal.go @@ -0,0 +1,49 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package internal + +import ( + "fmt" + "sync" + + typed "sigs.k8s.io/structured-merge-diff/v4/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/pkg/clients/applyconfiguration/rbac/v1/aggregationrule.go b/pkg/clients/applyconfiguration/rbac/v1/aggregationrule.go new file mode 100644 index 000000000..146942f97 --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/aggregationrule.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// AggregationRuleApplyConfiguration represents an declarative configuration of the AggregationRule type for use +// with apply. +type AggregationRuleApplyConfiguration struct { + ClusterRoleSelectors []v1.LabelSelectorApplyConfiguration `json:"clusterRoleSelectors,omitempty"` +} + +// AggregationRuleApplyConfiguration constructs an declarative configuration of the AggregationRule type for use with +// apply. +func AggregationRule() *AggregationRuleApplyConfiguration { + return &AggregationRuleApplyConfiguration{} +} + +// WithClusterRoleSelectors adds the given value to the ClusterRoleSelectors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ClusterRoleSelectors field. +func (b *AggregationRuleApplyConfiguration) WithClusterRoleSelectors(values ...*v1.LabelSelectorApplyConfiguration) *AggregationRuleApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClusterRoleSelectors") + } + b.ClusterRoleSelectors = append(b.ClusterRoleSelectors, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/clusterrole.go b/pkg/clients/applyconfiguration/rbac/v1/clusterrole.go new file mode 100644 index 000000000..d90784a0d --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/clusterrole.go @@ -0,0 +1,210 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterRoleApplyConfiguration represents an declarative configuration of the ClusterRole type for use +// with apply. +type ClusterRoleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` + AggregationRule *AggregationRuleApplyConfiguration `json:"aggregationRule,omitempty"` +} + +// ClusterRole constructs an declarative configuration of the ClusterRole type for use with +// apply. +func ClusterRole(name string) *ClusterRoleApplyConfiguration { + b := &ClusterRoleApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterRole") + b.WithAPIVersion("rbac.authorization.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithKind(value string) *ClusterRoleApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithAPIVersion(value string) *ClusterRoleApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithName(value string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithGenerateName(value string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithNamespace(value string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithUID(value types.UID) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithResourceVersion(value string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithGeneration(value int64) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterRoleApplyConfiguration) WithLabels(entries map[string]string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterRoleApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterRoleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterRoleApplyConfiguration) WithFinalizers(values ...string) *ClusterRoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ClusterRoleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithRules adds the given value to the Rules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Rules field. +func (b *ClusterRoleApplyConfiguration) WithRules(values ...*PolicyRuleApplyConfiguration) *ClusterRoleApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRules") + } + b.Rules = append(b.Rules, *values[i]) + } + return b +} + +// WithAggregationRule sets the AggregationRule field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AggregationRule field is set to the value of the last call. +func (b *ClusterRoleApplyConfiguration) WithAggregationRule(value *AggregationRuleApplyConfiguration) *ClusterRoleApplyConfiguration { + b.AggregationRule = value + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/clusterrolebinding.go b/pkg/clients/applyconfiguration/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..2bcd6c861 --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/clusterrolebinding.go @@ -0,0 +1,210 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterRoleBindingApplyConfiguration represents an declarative configuration of the ClusterRoleBinding type for use +// with apply. +type ClusterRoleBindingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` + RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` +} + +// ClusterRoleBinding constructs an declarative configuration of the ClusterRoleBinding type for use with +// apply. +func ClusterRoleBinding(name string) *ClusterRoleBindingApplyConfiguration { + b := &ClusterRoleBindingApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterRoleBinding") + b.WithAPIVersion("rbac.authorization.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithKind(value string) *ClusterRoleBindingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithAPIVersion(value string) *ClusterRoleBindingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithName(value string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithGenerateName(value string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithNamespace(value string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithUID(value types.UID) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithResourceVersion(value string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithGeneration(value int64) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterRoleBindingApplyConfiguration) WithLabels(entries map[string]string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterRoleBindingApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterRoleBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterRoleBindingApplyConfiguration) WithFinalizers(values ...string) *ClusterRoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ClusterRoleBindingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSubjects adds the given value to the Subjects field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Subjects field. +func (b *ClusterRoleBindingApplyConfiguration) WithSubjects(values ...*SubjectApplyConfiguration) *ClusterRoleBindingApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSubjects") + } + b.Subjects = append(b.Subjects, *values[i]) + } + return b +} + +// WithRoleRef sets the RoleRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RoleRef field is set to the value of the last call. +func (b *ClusterRoleBindingApplyConfiguration) WithRoleRef(value *RoleRefApplyConfiguration) *ClusterRoleBindingApplyConfiguration { + b.RoleRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/policyrule.go b/pkg/clients/applyconfiguration/rbac/v1/policyrule.go new file mode 100644 index 000000000..cf849f7e6 --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/policyrule.go @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PolicyRuleApplyConfiguration represents an declarative configuration of the PolicyRule type for use +// with apply. +type PolicyRuleApplyConfiguration struct { + Verbs []string `json:"verbs,omitempty"` + APIGroups []string `json:"apiGroups,omitempty"` + Resources []string `json:"resources,omitempty"` + ResourceNames []string `json:"resourceNames,omitempty"` + NonResourceURLs []string `json:"nonResourceURLs,omitempty"` +} + +// PolicyRuleApplyConfiguration constructs an declarative configuration of the PolicyRule type for use with +// apply. +func PolicyRule() *PolicyRuleApplyConfiguration { + return &PolicyRuleApplyConfiguration{} +} + +// WithVerbs adds the given value to the Verbs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Verbs field. +func (b *PolicyRuleApplyConfiguration) WithVerbs(values ...string) *PolicyRuleApplyConfiguration { + for i := range values { + b.Verbs = append(b.Verbs, values[i]) + } + return b +} + +// WithAPIGroups adds the given value to the APIGroups field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the APIGroups field. +func (b *PolicyRuleApplyConfiguration) WithAPIGroups(values ...string) *PolicyRuleApplyConfiguration { + for i := range values { + b.APIGroups = append(b.APIGroups, values[i]) + } + return b +} + +// WithResources adds the given value to the Resources field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Resources field. +func (b *PolicyRuleApplyConfiguration) WithResources(values ...string) *PolicyRuleApplyConfiguration { + for i := range values { + b.Resources = append(b.Resources, values[i]) + } + return b +} + +// WithResourceNames adds the given value to the ResourceNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResourceNames field. +func (b *PolicyRuleApplyConfiguration) WithResourceNames(values ...string) *PolicyRuleApplyConfiguration { + for i := range values { + b.ResourceNames = append(b.ResourceNames, values[i]) + } + return b +} + +// WithNonResourceURLs adds the given value to the NonResourceURLs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NonResourceURLs field. +func (b *PolicyRuleApplyConfiguration) WithNonResourceURLs(values ...string) *PolicyRuleApplyConfiguration { + for i := range values { + b.NonResourceURLs = append(b.NonResourceURLs, values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/role.go b/pkg/clients/applyconfiguration/rbac/v1/role.go new file mode 100644 index 000000000..5c1178e92 --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/role.go @@ -0,0 +1,202 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// RoleApplyConfiguration represents an declarative configuration of the Role type for use +// with apply. +type RoleApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Rules []PolicyRuleApplyConfiguration `json:"rules,omitempty"` +} + +// Role constructs an declarative configuration of the Role type for use with +// apply. +func Role(name, namespace string) *RoleApplyConfiguration { + b := &RoleApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Role") + b.WithAPIVersion("rbac.authorization.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithKind(value string) *RoleApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithAPIVersion(value string) *RoleApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithName(value string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithGenerateName(value string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithNamespace(value string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithUID(value types.UID) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithResourceVersion(value string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithGeneration(value int64) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *RoleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *RoleApplyConfiguration) WithLabels(entries map[string]string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *RoleApplyConfiguration) WithAnnotations(entries map[string]string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *RoleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *RoleApplyConfiguration) WithFinalizers(values ...string) *RoleApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *RoleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithRules adds the given value to the Rules field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Rules field. +func (b *RoleApplyConfiguration) WithRules(values ...*PolicyRuleApplyConfiguration) *RoleApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRules") + } + b.Rules = append(b.Rules, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/rolebinding.go b/pkg/clients/applyconfiguration/rbac/v1/rolebinding.go new file mode 100644 index 000000000..27b37bd91 --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/rolebinding.go @@ -0,0 +1,211 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// RoleBindingApplyConfiguration represents an declarative configuration of the RoleBinding type for use +// with apply. +type RoleBindingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Subjects []SubjectApplyConfiguration `json:"subjects,omitempty"` + RoleRef *RoleRefApplyConfiguration `json:"roleRef,omitempty"` +} + +// RoleBinding constructs an declarative configuration of the RoleBinding type for use with +// apply. +func RoleBinding(name, namespace string) *RoleBindingApplyConfiguration { + b := &RoleBindingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("RoleBinding") + b.WithAPIVersion("rbac.authorization.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithKind(value string) *RoleBindingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithAPIVersion(value string) *RoleBindingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithName(value string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithGenerateName(value string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithNamespace(value string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithUID(value types.UID) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithResourceVersion(value string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithGeneration(value int64) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *RoleBindingApplyConfiguration) WithLabels(entries map[string]string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *RoleBindingApplyConfiguration) WithAnnotations(entries map[string]string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *RoleBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *RoleBindingApplyConfiguration) WithFinalizers(values ...string) *RoleBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *RoleBindingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSubjects adds the given value to the Subjects field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Subjects field. +func (b *RoleBindingApplyConfiguration) WithSubjects(values ...*SubjectApplyConfiguration) *RoleBindingApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSubjects") + } + b.Subjects = append(b.Subjects, *values[i]) + } + return b +} + +// WithRoleRef sets the RoleRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RoleRef field is set to the value of the last call. +func (b *RoleBindingApplyConfiguration) WithRoleRef(value *RoleRefApplyConfiguration) *RoleBindingApplyConfiguration { + b.RoleRef = value + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/roleref.go b/pkg/clients/applyconfiguration/rbac/v1/roleref.go new file mode 100644 index 000000000..a47a1e48c --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/roleref.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// RoleRefApplyConfiguration represents an declarative configuration of the RoleRef type for use +// with apply. +type RoleRefApplyConfiguration struct { + APIGroup *string `json:"apiGroup,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` +} + +// RoleRefApplyConfiguration constructs an declarative configuration of the RoleRef type for use with +// apply. +func RoleRef() *RoleRefApplyConfiguration { + return &RoleRefApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *RoleRefApplyConfiguration) WithAPIGroup(value string) *RoleRefApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RoleRefApplyConfiguration) WithKind(value string) *RoleRefApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *RoleRefApplyConfiguration) WithName(value string) *RoleRefApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/clients/applyconfiguration/rbac/v1/subject.go b/pkg/clients/applyconfiguration/rbac/v1/subject.go new file mode 100644 index 000000000..aa07e3efd --- /dev/null +++ b/pkg/clients/applyconfiguration/rbac/v1/subject.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SubjectApplyConfiguration represents an declarative configuration of the Subject type for use +// with apply. +type SubjectApplyConfiguration struct { + Kind *string `json:"kind,omitempty"` + APIGroup *string `json:"apiGroup,omitempty"` + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// SubjectApplyConfiguration constructs an declarative configuration of the Subject type for use with +// apply. +func Subject() *SubjectApplyConfiguration { + return &SubjectApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *SubjectApplyConfiguration) WithKind(value string) *SubjectApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIGroup sets the APIGroup field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIGroup field is set to the value of the last call. +func (b *SubjectApplyConfiguration) WithAPIGroup(value string) *SubjectApplyConfiguration { + b.APIGroup = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SubjectApplyConfiguration) WithName(value string) *SubjectApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *SubjectApplyConfiguration) WithNamespace(value string) *SubjectApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/clients/applyconfiguration/scheduling/v1/priorityclass.go b/pkg/clients/applyconfiguration/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..1d3b284ba --- /dev/null +++ b/pkg/clients/applyconfiguration/scheduling/v1/priorityclass.go @@ -0,0 +1,224 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PriorityClassApplyConfiguration represents an declarative configuration of the PriorityClass type for use +// with apply. +type PriorityClassApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Value *int32 `json:"value,omitempty"` + GlobalDefault *bool `json:"globalDefault,omitempty"` + Description *string `json:"description,omitempty"` + PreemptionPolicy *corev1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` +} + +// PriorityClass constructs an declarative configuration of the PriorityClass type for use with +// apply. +func PriorityClass(name string) *PriorityClassApplyConfiguration { + b := &PriorityClassApplyConfiguration{} + b.WithName(name) + b.WithKind("PriorityClass") + b.WithAPIVersion("scheduling.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithKind(value string) *PriorityClassApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithAPIVersion(value string) *PriorityClassApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithName(value string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithGenerateName(value string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithNamespace(value string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithUID(value types.UID) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithResourceVersion(value string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithGeneration(value int64) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PriorityClassApplyConfiguration) WithLabels(entries map[string]string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PriorityClassApplyConfiguration) WithAnnotations(entries map[string]string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PriorityClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PriorityClassApplyConfiguration) WithFinalizers(values ...string) *PriorityClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PriorityClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithValue(value int32) *PriorityClassApplyConfiguration { + b.Value = &value + return b +} + +// WithGlobalDefault sets the GlobalDefault field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GlobalDefault field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithGlobalDefault(value bool) *PriorityClassApplyConfiguration { + b.GlobalDefault = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithDescription(value string) *PriorityClassApplyConfiguration { + b.Description = &value + return b +} + +// WithPreemptionPolicy sets the PreemptionPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreemptionPolicy field is set to the value of the last call. +func (b *PriorityClassApplyConfiguration) WithPreemptionPolicy(value corev1.PreemptionPolicy) *PriorityClassApplyConfiguration { + b.PreemptionPolicy = &value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/csidriver.go b/pkg/clients/applyconfiguration/storage/v1/csidriver.go new file mode 100644 index 000000000..755ab1ef0 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/csidriver.go @@ -0,0 +1,196 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CSIDriverApplyConfiguration represents an declarative configuration of the CSIDriver type for use +// with apply. +type CSIDriverApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *CSIDriverSpecApplyConfiguration `json:"spec,omitempty"` +} + +// CSIDriver constructs an declarative configuration of the CSIDriver type for use with +// apply. +func CSIDriver(name string) *CSIDriverApplyConfiguration { + b := &CSIDriverApplyConfiguration{} + b.WithName(name) + b.WithKind("CSIDriver") + b.WithAPIVersion("storage.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithKind(value string) *CSIDriverApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithAPIVersion(value string) *CSIDriverApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithName(value string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithGenerateName(value string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithNamespace(value string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithUID(value types.UID) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithResourceVersion(value string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithGeneration(value int64) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CSIDriverApplyConfiguration) WithLabels(entries map[string]string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CSIDriverApplyConfiguration) WithAnnotations(entries map[string]string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CSIDriverApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CSIDriverApplyConfiguration) WithFinalizers(values ...string) *CSIDriverApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CSIDriverApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CSIDriverApplyConfiguration) WithSpec(value *CSIDriverSpecApplyConfiguration) *CSIDriverApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/csidriverspec.go b/pkg/clients/applyconfiguration/storage/v1/csidriverspec.go new file mode 100644 index 000000000..5436fc12e --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/csidriverspec.go @@ -0,0 +1,100 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" +) + +// CSIDriverSpecApplyConfiguration represents an declarative configuration of the CSIDriverSpec type for use +// with apply. +type CSIDriverSpecApplyConfiguration struct { + AttachRequired *bool `json:"attachRequired,omitempty"` + PodInfoOnMount *bool `json:"podInfoOnMount,omitempty"` + VolumeLifecycleModes []v1.VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty"` + StorageCapacity *bool `json:"storageCapacity,omitempty"` + FSGroupPolicy *v1.FSGroupPolicy `json:"fsGroupPolicy,omitempty"` + TokenRequests []TokenRequestApplyConfiguration `json:"tokenRequests,omitempty"` + RequiresRepublish *bool `json:"requiresRepublish,omitempty"` + SELinuxMount *bool `json:"seLinuxMount,omitempty"` +} + +// CSIDriverSpecApplyConfiguration constructs an declarative configuration of the CSIDriverSpec type for use with +// apply. +func CSIDriverSpec() *CSIDriverSpecApplyConfiguration { + return &CSIDriverSpecApplyConfiguration{} +} + +// WithAttachRequired sets the AttachRequired field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AttachRequired field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithAttachRequired(value bool) *CSIDriverSpecApplyConfiguration { + b.AttachRequired = &value + return b +} + +// WithPodInfoOnMount sets the PodInfoOnMount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodInfoOnMount field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithPodInfoOnMount(value bool) *CSIDriverSpecApplyConfiguration { + b.PodInfoOnMount = &value + return b +} + +// WithVolumeLifecycleModes adds the given value to the VolumeLifecycleModes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VolumeLifecycleModes field. +func (b *CSIDriverSpecApplyConfiguration) WithVolumeLifecycleModes(values ...v1.VolumeLifecycleMode) *CSIDriverSpecApplyConfiguration { + for i := range values { + b.VolumeLifecycleModes = append(b.VolumeLifecycleModes, values[i]) + } + return b +} + +// WithStorageCapacity sets the StorageCapacity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageCapacity field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithStorageCapacity(value bool) *CSIDriverSpecApplyConfiguration { + b.StorageCapacity = &value + return b +} + +// WithFSGroupPolicy sets the FSGroupPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FSGroupPolicy field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithFSGroupPolicy(value v1.FSGroupPolicy) *CSIDriverSpecApplyConfiguration { + b.FSGroupPolicy = &value + return b +} + +// WithTokenRequests adds the given value to the TokenRequests field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TokenRequests field. +func (b *CSIDriverSpecApplyConfiguration) WithTokenRequests(values ...*TokenRequestApplyConfiguration) *CSIDriverSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTokenRequests") + } + b.TokenRequests = append(b.TokenRequests, *values[i]) + } + return b +} + +// WithRequiresRepublish sets the RequiresRepublish field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RequiresRepublish field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithRequiresRepublish(value bool) *CSIDriverSpecApplyConfiguration { + b.RequiresRepublish = &value + return b +} + +// WithSELinuxMount sets the SELinuxMount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SELinuxMount field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithSELinuxMount(value bool) *CSIDriverSpecApplyConfiguration { + b.SELinuxMount = &value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/csinode.go b/pkg/clients/applyconfiguration/storage/v1/csinode.go new file mode 100644 index 000000000..6cbfdadd8 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/csinode.go @@ -0,0 +1,196 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CSINodeApplyConfiguration represents an declarative configuration of the CSINode type for use +// with apply. +type CSINodeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *CSINodeSpecApplyConfiguration `json:"spec,omitempty"` +} + +// CSINode constructs an declarative configuration of the CSINode type for use with +// apply. +func CSINode(name string) *CSINodeApplyConfiguration { + b := &CSINodeApplyConfiguration{} + b.WithName(name) + b.WithKind("CSINode") + b.WithAPIVersion("storage.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithKind(value string) *CSINodeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithAPIVersion(value string) *CSINodeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithName(value string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithGenerateName(value string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithNamespace(value string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithUID(value types.UID) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithResourceVersion(value string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithGeneration(value int64) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CSINodeApplyConfiguration) WithLabels(entries map[string]string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CSINodeApplyConfiguration) WithAnnotations(entries map[string]string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CSINodeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CSINodeApplyConfiguration) WithFinalizers(values ...string) *CSINodeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CSINodeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CSINodeApplyConfiguration) WithSpec(value *CSINodeSpecApplyConfiguration) *CSINodeApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/csinodedriver.go b/pkg/clients/applyconfiguration/storage/v1/csinodedriver.go new file mode 100644 index 000000000..c37f7cf4b --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/csinodedriver.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CSINodeDriverApplyConfiguration represents an declarative configuration of the CSINodeDriver type for use +// with apply. +type CSINodeDriverApplyConfiguration struct { + Name *string `json:"name,omitempty"` + NodeID *string `json:"nodeID,omitempty"` + TopologyKeys []string `json:"topologyKeys,omitempty"` + Allocatable *VolumeNodeResourcesApplyConfiguration `json:"allocatable,omitempty"` +} + +// CSINodeDriverApplyConfiguration constructs an declarative configuration of the CSINodeDriver type for use with +// apply. +func CSINodeDriver() *CSINodeDriverApplyConfiguration { + return &CSINodeDriverApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CSINodeDriverApplyConfiguration) WithName(value string) *CSINodeDriverApplyConfiguration { + b.Name = &value + return b +} + +// WithNodeID sets the NodeID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeID field is set to the value of the last call. +func (b *CSINodeDriverApplyConfiguration) WithNodeID(value string) *CSINodeDriverApplyConfiguration { + b.NodeID = &value + return b +} + +// WithTopologyKeys adds the given value to the TopologyKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the TopologyKeys field. +func (b *CSINodeDriverApplyConfiguration) WithTopologyKeys(values ...string) *CSINodeDriverApplyConfiguration { + for i := range values { + b.TopologyKeys = append(b.TopologyKeys, values[i]) + } + return b +} + +// WithAllocatable sets the Allocatable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Allocatable field is set to the value of the last call. +func (b *CSINodeDriverApplyConfiguration) WithAllocatable(value *VolumeNodeResourcesApplyConfiguration) *CSINodeDriverApplyConfiguration { + b.Allocatable = value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/csinodespec.go b/pkg/clients/applyconfiguration/storage/v1/csinodespec.go new file mode 100644 index 000000000..053f1960f --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/csinodespec.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CSINodeSpecApplyConfiguration represents an declarative configuration of the CSINodeSpec type for use +// with apply. +type CSINodeSpecApplyConfiguration struct { + Drivers []CSINodeDriverApplyConfiguration `json:"drivers,omitempty"` +} + +// CSINodeSpecApplyConfiguration constructs an declarative configuration of the CSINodeSpec type for use with +// apply. +func CSINodeSpec() *CSINodeSpecApplyConfiguration { + return &CSINodeSpecApplyConfiguration{} +} + +// WithDrivers adds the given value to the Drivers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Drivers field. +func (b *CSINodeSpecApplyConfiguration) WithDrivers(values ...*CSINodeDriverApplyConfiguration) *CSINodeSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDrivers") + } + b.Drivers = append(b.Drivers, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/csistoragecapacity.go b/pkg/clients/applyconfiguration/storage/v1/csistoragecapacity.go new file mode 100644 index 000000000..683c91f8d --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/csistoragecapacity.go @@ -0,0 +1,225 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CSIStorageCapacityApplyConfiguration represents an declarative configuration of the CSIStorageCapacity type for use +// with apply. +type CSIStorageCapacityApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + NodeTopology *v1.LabelSelectorApplyConfiguration `json:"nodeTopology,omitempty"` + StorageClassName *string `json:"storageClassName,omitempty"` + Capacity *resource.Quantity `json:"capacity,omitempty"` + MaximumVolumeSize *resource.Quantity `json:"maximumVolumeSize,omitempty"` +} + +// CSIStorageCapacity constructs an declarative configuration of the CSIStorageCapacity type for use with +// apply. +func CSIStorageCapacity(name, namespace string) *CSIStorageCapacityApplyConfiguration { + b := &CSIStorageCapacityApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("CSIStorageCapacity") + b.WithAPIVersion("storage.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithKind(value string) *CSIStorageCapacityApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithAPIVersion(value string) *CSIStorageCapacityApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithName(value string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithGenerateName(value string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithNamespace(value string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithUID(value types.UID) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithResourceVersion(value string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithGeneration(value int64) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CSIStorageCapacityApplyConfiguration) WithLabels(entries map[string]string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CSIStorageCapacityApplyConfiguration) WithAnnotations(entries map[string]string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CSIStorageCapacityApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CSIStorageCapacityApplyConfiguration) WithFinalizers(values ...string) *CSIStorageCapacityApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CSIStorageCapacityApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithNodeTopology sets the NodeTopology field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeTopology field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithNodeTopology(value *v1.LabelSelectorApplyConfiguration) *CSIStorageCapacityApplyConfiguration { + b.NodeTopology = value + return b +} + +// WithStorageClassName sets the StorageClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StorageClassName field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithStorageClassName(value string) *CSIStorageCapacityApplyConfiguration { + b.StorageClassName = &value + return b +} + +// WithCapacity sets the Capacity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capacity field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithCapacity(value resource.Quantity) *CSIStorageCapacityApplyConfiguration { + b.Capacity = &value + return b +} + +// WithMaximumVolumeSize sets the MaximumVolumeSize field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaximumVolumeSize field is set to the value of the last call. +func (b *CSIStorageCapacityApplyConfiguration) WithMaximumVolumeSize(value resource.Quantity) *CSIStorageCapacityApplyConfiguration { + b.MaximumVolumeSize = &value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/storageclass.go b/pkg/clients/applyconfiguration/storage/v1/storageclass.go new file mode 100644 index 000000000..5cea9b8e7 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/storageclass.go @@ -0,0 +1,266 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + applyconfigurationcorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + corev1 "k8s.io/api/core/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// StorageClassApplyConfiguration represents an declarative configuration of the StorageClass type for use +// with apply. +type StorageClassApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Provisioner *string `json:"provisioner,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` + ReclaimPolicy *corev1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty"` + MountOptions []string `json:"mountOptions,omitempty"` + AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty"` + VolumeBindingMode *storagev1.VolumeBindingMode `json:"volumeBindingMode,omitempty"` + AllowedTopologies []applyconfigurationcorev1.TopologySelectorTermApplyConfiguration `json:"allowedTopologies,omitempty"` +} + +// StorageClass constructs an declarative configuration of the StorageClass type for use with +// apply. +func StorageClass(name string) *StorageClassApplyConfiguration { + b := &StorageClassApplyConfiguration{} + b.WithName(name) + b.WithKind("StorageClass") + b.WithAPIVersion("storage.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithKind(value string) *StorageClassApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithAPIVersion(value string) *StorageClassApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithName(value string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithGenerateName(value string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithNamespace(value string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithUID(value types.UID) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithResourceVersion(value string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithGeneration(value int64) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *StorageClassApplyConfiguration) WithLabels(entries map[string]string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *StorageClassApplyConfiguration) WithAnnotations(entries map[string]string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *StorageClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *StorageClassApplyConfiguration) WithFinalizers(values ...string) *StorageClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *StorageClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithProvisioner sets the Provisioner field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Provisioner field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithProvisioner(value string) *StorageClassApplyConfiguration { + b.Provisioner = &value + return b +} + +// WithParameters puts the entries into the Parameters field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Parameters field, +// overwriting an existing map entries in Parameters field with the same key. +func (b *StorageClassApplyConfiguration) WithParameters(entries map[string]string) *StorageClassApplyConfiguration { + if b.Parameters == nil && len(entries) > 0 { + b.Parameters = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Parameters[k] = v + } + return b +} + +// WithReclaimPolicy sets the ReclaimPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReclaimPolicy field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithReclaimPolicy(value corev1.PersistentVolumeReclaimPolicy) *StorageClassApplyConfiguration { + b.ReclaimPolicy = &value + return b +} + +// WithMountOptions adds the given value to the MountOptions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MountOptions field. +func (b *StorageClassApplyConfiguration) WithMountOptions(values ...string) *StorageClassApplyConfiguration { + for i := range values { + b.MountOptions = append(b.MountOptions, values[i]) + } + return b +} + +// WithAllowVolumeExpansion sets the AllowVolumeExpansion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllowVolumeExpansion field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithAllowVolumeExpansion(value bool) *StorageClassApplyConfiguration { + b.AllowVolumeExpansion = &value + return b +} + +// WithVolumeBindingMode sets the VolumeBindingMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeBindingMode field is set to the value of the last call. +func (b *StorageClassApplyConfiguration) WithVolumeBindingMode(value storagev1.VolumeBindingMode) *StorageClassApplyConfiguration { + b.VolumeBindingMode = &value + return b +} + +// WithAllowedTopologies adds the given value to the AllowedTopologies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AllowedTopologies field. +func (b *StorageClassApplyConfiguration) WithAllowedTopologies(values ...*applyconfigurationcorev1.TopologySelectorTermApplyConfiguration) *StorageClassApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAllowedTopologies") + } + b.AllowedTopologies = append(b.AllowedTopologies, *values[i]) + } + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/tokenrequest.go b/pkg/clients/applyconfiguration/storage/v1/tokenrequest.go new file mode 100644 index 000000000..cb4cada91 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/tokenrequest.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// TokenRequestApplyConfiguration represents an declarative configuration of the TokenRequest type for use +// with apply. +type TokenRequestApplyConfiguration struct { + Audience *string `json:"audience,omitempty"` + ExpirationSeconds *int64 `json:"expirationSeconds,omitempty"` +} + +// TokenRequestApplyConfiguration constructs an declarative configuration of the TokenRequest type for use with +// apply. +func TokenRequest() *TokenRequestApplyConfiguration { + return &TokenRequestApplyConfiguration{} +} + +// WithAudience sets the Audience field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Audience field is set to the value of the last call. +func (b *TokenRequestApplyConfiguration) WithAudience(value string) *TokenRequestApplyConfiguration { + b.Audience = &value + return b +} + +// WithExpirationSeconds sets the ExpirationSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExpirationSeconds field is set to the value of the last call. +func (b *TokenRequestApplyConfiguration) WithExpirationSeconds(value int64) *TokenRequestApplyConfiguration { + b.ExpirationSeconds = &value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/volumeattachment.go b/pkg/clients/applyconfiguration/storage/v1/volumeattachment.go new file mode 100644 index 000000000..43e98e616 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/volumeattachment.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// VolumeAttachmentApplyConfiguration represents an declarative configuration of the VolumeAttachment type for use +// with apply. +type VolumeAttachmentApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VolumeAttachmentSpecApplyConfiguration `json:"spec,omitempty"` + Status *VolumeAttachmentStatusApplyConfiguration `json:"status,omitempty"` +} + +// VolumeAttachment constructs an declarative configuration of the VolumeAttachment type for use with +// apply. +func VolumeAttachment(name string) *VolumeAttachmentApplyConfiguration { + b := &VolumeAttachmentApplyConfiguration{} + b.WithName(name) + b.WithKind("VolumeAttachment") + b.WithAPIVersion("storage.k8s.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithKind(value string) *VolumeAttachmentApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithAPIVersion(value string) *VolumeAttachmentApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithName(value string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithGenerateName(value string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithNamespace(value string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithUID(value types.UID) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithResourceVersion(value string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithGeneration(value int64) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VolumeAttachmentApplyConfiguration) WithLabels(entries map[string]string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VolumeAttachmentApplyConfiguration) WithAnnotations(entries map[string]string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VolumeAttachmentApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VolumeAttachmentApplyConfiguration) WithFinalizers(values ...string) *VolumeAttachmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VolumeAttachmentApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithSpec(value *VolumeAttachmentSpecApplyConfiguration) *VolumeAttachmentApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VolumeAttachmentApplyConfiguration) WithStatus(value *VolumeAttachmentStatusApplyConfiguration) *VolumeAttachmentApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/volumeattachmentsource.go b/pkg/clients/applyconfiguration/storage/v1/volumeattachmentsource.go new file mode 100644 index 000000000..c23035157 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/volumeattachmentsource.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" +) + +// VolumeAttachmentSourceApplyConfiguration represents an declarative configuration of the VolumeAttachmentSource type for use +// with apply. +type VolumeAttachmentSourceApplyConfiguration struct { + PersistentVolumeName *string `json:"persistentVolumeName,omitempty"` + InlineVolumeSpec *v1.PersistentVolumeSpecApplyConfiguration `json:"inlineVolumeSpec,omitempty"` +} + +// VolumeAttachmentSourceApplyConfiguration constructs an declarative configuration of the VolumeAttachmentSource type for use with +// apply. +func VolumeAttachmentSource() *VolumeAttachmentSourceApplyConfiguration { + return &VolumeAttachmentSourceApplyConfiguration{} +} + +// WithPersistentVolumeName sets the PersistentVolumeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PersistentVolumeName field is set to the value of the last call. +func (b *VolumeAttachmentSourceApplyConfiguration) WithPersistentVolumeName(value string) *VolumeAttachmentSourceApplyConfiguration { + b.PersistentVolumeName = &value + return b +} + +// WithInlineVolumeSpec sets the InlineVolumeSpec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InlineVolumeSpec field is set to the value of the last call. +func (b *VolumeAttachmentSourceApplyConfiguration) WithInlineVolumeSpec(value *v1.PersistentVolumeSpecApplyConfiguration) *VolumeAttachmentSourceApplyConfiguration { + b.InlineVolumeSpec = value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/volumeattachmentspec.go b/pkg/clients/applyconfiguration/storage/v1/volumeattachmentspec.go new file mode 100644 index 000000000..d2a2e3eb0 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/volumeattachmentspec.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeAttachmentSpecApplyConfiguration represents an declarative configuration of the VolumeAttachmentSpec type for use +// with apply. +type VolumeAttachmentSpecApplyConfiguration struct { + Attacher *string `json:"attacher,omitempty"` + Source *VolumeAttachmentSourceApplyConfiguration `json:"source,omitempty"` + NodeName *string `json:"nodeName,omitempty"` +} + +// VolumeAttachmentSpecApplyConfiguration constructs an declarative configuration of the VolumeAttachmentSpec type for use with +// apply. +func VolumeAttachmentSpec() *VolumeAttachmentSpecApplyConfiguration { + return &VolumeAttachmentSpecApplyConfiguration{} +} + +// WithAttacher sets the Attacher field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Attacher field is set to the value of the last call. +func (b *VolumeAttachmentSpecApplyConfiguration) WithAttacher(value string) *VolumeAttachmentSpecApplyConfiguration { + b.Attacher = &value + return b +} + +// WithSource sets the Source field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Source field is set to the value of the last call. +func (b *VolumeAttachmentSpecApplyConfiguration) WithSource(value *VolumeAttachmentSourceApplyConfiguration) *VolumeAttachmentSpecApplyConfiguration { + b.Source = value + return b +} + +// WithNodeName sets the NodeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeName field is set to the value of the last call. +func (b *VolumeAttachmentSpecApplyConfiguration) WithNodeName(value string) *VolumeAttachmentSpecApplyConfiguration { + b.NodeName = &value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/volumeattachmentstatus.go b/pkg/clients/applyconfiguration/storage/v1/volumeattachmentstatus.go new file mode 100644 index 000000000..2db7f93de --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/volumeattachmentstatus.go @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeAttachmentStatusApplyConfiguration represents an declarative configuration of the VolumeAttachmentStatus type for use +// with apply. +type VolumeAttachmentStatusApplyConfiguration struct { + Attached *bool `json:"attached,omitempty"` + AttachmentMetadata map[string]string `json:"attachmentMetadata,omitempty"` + AttachError *VolumeErrorApplyConfiguration `json:"attachError,omitempty"` + DetachError *VolumeErrorApplyConfiguration `json:"detachError,omitempty"` +} + +// VolumeAttachmentStatusApplyConfiguration constructs an declarative configuration of the VolumeAttachmentStatus type for use with +// apply. +func VolumeAttachmentStatus() *VolumeAttachmentStatusApplyConfiguration { + return &VolumeAttachmentStatusApplyConfiguration{} +} + +// WithAttached sets the Attached field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Attached field is set to the value of the last call. +func (b *VolumeAttachmentStatusApplyConfiguration) WithAttached(value bool) *VolumeAttachmentStatusApplyConfiguration { + b.Attached = &value + return b +} + +// WithAttachmentMetadata puts the entries into the AttachmentMetadata field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the AttachmentMetadata field, +// overwriting an existing map entries in AttachmentMetadata field with the same key. +func (b *VolumeAttachmentStatusApplyConfiguration) WithAttachmentMetadata(entries map[string]string) *VolumeAttachmentStatusApplyConfiguration { + if b.AttachmentMetadata == nil && len(entries) > 0 { + b.AttachmentMetadata = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.AttachmentMetadata[k] = v + } + return b +} + +// WithAttachError sets the AttachError field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AttachError field is set to the value of the last call. +func (b *VolumeAttachmentStatusApplyConfiguration) WithAttachError(value *VolumeErrorApplyConfiguration) *VolumeAttachmentStatusApplyConfiguration { + b.AttachError = value + return b +} + +// WithDetachError sets the DetachError field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DetachError field is set to the value of the last call. +func (b *VolumeAttachmentStatusApplyConfiguration) WithDetachError(value *VolumeErrorApplyConfiguration) *VolumeAttachmentStatusApplyConfiguration { + b.DetachError = value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/volumeerror.go b/pkg/clients/applyconfiguration/storage/v1/volumeerror.go new file mode 100644 index 000000000..caa7f593e --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/volumeerror.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VolumeErrorApplyConfiguration represents an declarative configuration of the VolumeError type for use +// with apply. +type VolumeErrorApplyConfiguration struct { + Time *v1.Time `json:"time,omitempty"` + Message *string `json:"message,omitempty"` +} + +// VolumeErrorApplyConfiguration constructs an declarative configuration of the VolumeError type for use with +// apply. +func VolumeError() *VolumeErrorApplyConfiguration { + return &VolumeErrorApplyConfiguration{} +} + +// WithTime sets the Time field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Time field is set to the value of the last call. +func (b *VolumeErrorApplyConfiguration) WithTime(value v1.Time) *VolumeErrorApplyConfiguration { + b.Time = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *VolumeErrorApplyConfiguration) WithMessage(value string) *VolumeErrorApplyConfiguration { + b.Message = &value + return b +} diff --git a/pkg/clients/applyconfiguration/storage/v1/volumenoderesources.go b/pkg/clients/applyconfiguration/storage/v1/volumenoderesources.go new file mode 100644 index 000000000..c596c8279 --- /dev/null +++ b/pkg/clients/applyconfiguration/storage/v1/volumenoderesources.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VolumeNodeResourcesApplyConfiguration represents an declarative configuration of the VolumeNodeResources type for use +// with apply. +type VolumeNodeResourcesApplyConfiguration struct { + Count *int32 `json:"count,omitempty"` +} + +// VolumeNodeResourcesApplyConfiguration constructs an declarative configuration of the VolumeNodeResources type for use with +// apply. +func VolumeNodeResources() *VolumeNodeResourcesApplyConfiguration { + return &VolumeNodeResourcesApplyConfiguration{} +} + +// WithCount sets the Count field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Count field is set to the value of the last call. +func (b *VolumeNodeResourcesApplyConfiguration) WithCount(value int32) *VolumeNodeResourcesApplyConfiguration { + b.Count = &value + return b +} diff --git a/pkg/clients/applyconfiguration/utils.go b/pkg/clients/applyconfiguration/utils.go new file mode 100644 index 000000000..cb5310369 --- /dev/null +++ b/pkg/clients/applyconfiguration/utils.go @@ -0,0 +1,784 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package applyconfiguration + +import ( + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/admissionregistration/v1" + applyconfigurationapiextensionsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apiextensions/v1" + applyconfigurationapiregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apiregistration/v1" + applyconfigurationappsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + autoscalingv2 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v2" + applyconfigurationbatchv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/batch/v1" + applyconfigurationcertificatesv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/certificates/v1" + applyconfigurationcoordinationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/coordination/v1" + applyconfigurationcorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + applyconfigurationdiscoveryv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/discovery/v1" + applyconfigurationeventsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/events/v1" + applyconfigurationrbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + applyconfigurationschedulingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/scheduling/v1" + applyconfigurationstoragev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + applyconfigurationwalrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + applyconfigurationwalruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + v1 "k8s.io/api/admissionregistration/v1" + appsv1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v2 "k8s.io/api/autoscaling/v2" + batchv1 "k8s.io/api/batch/v1" + certificatesv1 "k8s.io/api/certificates/v1" + coordinationv1 "k8s.io/api/coordination/v1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + eventsv1 "k8s.io/api/events/v1" + rbacv1 "k8s.io/api/rbac/v1" + schedulingv1 "k8s.io/api/scheduling/v1" + storagev1 "k8s.io/api/storage/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=admissionregistration.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithKind("MatchCondition"): + return &admissionregistrationv1.MatchConditionApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MutatingWebhook"): + return &admissionregistrationv1.MutatingWebhookApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"): + return &admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("Rule"): + return &admissionregistrationv1.RuleApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RuleWithOperations"): + return &admissionregistrationv1.RuleWithOperationsApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ServiceReference"): + return &admissionregistrationv1.ServiceReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ValidatingWebhook"): + return &admissionregistrationv1.ValidatingWebhookApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration"): + return &admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("WebhookClientConfig"): + return &admissionregistrationv1.WebhookClientConfigApplyConfiguration{} + + // Group=apiextensions.k8s.io, Version=v1 + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceColumnDefinition"): + return &applyconfigurationapiextensionsv1.CustomResourceColumnDefinitionApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceConversion"): + return &applyconfigurationapiextensionsv1.CustomResourceConversionApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinition"): + return &applyconfigurationapiextensionsv1.CustomResourceDefinitionApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinitionCondition"): + return &applyconfigurationapiextensionsv1.CustomResourceDefinitionConditionApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinitionNames"): + return &applyconfigurationapiextensionsv1.CustomResourceDefinitionNamesApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinitionSpec"): + return &applyconfigurationapiextensionsv1.CustomResourceDefinitionSpecApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinitionStatus"): + return &applyconfigurationapiextensionsv1.CustomResourceDefinitionStatusApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceDefinitionVersion"): + return &applyconfigurationapiextensionsv1.CustomResourceDefinitionVersionApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceSubresources"): + return &applyconfigurationapiextensionsv1.CustomResourceSubresourcesApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceSubresourceScale"): + return &applyconfigurationapiextensionsv1.CustomResourceSubresourceScaleApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("CustomResourceValidation"): + return &applyconfigurationapiextensionsv1.CustomResourceValidationApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("ExternalDocumentation"): + return &applyconfigurationapiextensionsv1.ExternalDocumentationApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("JSONSchemaProps"): + return &applyconfigurationapiextensionsv1.JSONSchemaPropsApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("ServiceReference"): + return &applyconfigurationapiextensionsv1.ServiceReferenceApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("ValidationRule"): + return &applyconfigurationapiextensionsv1.ValidationRuleApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("WebhookClientConfig"): + return &applyconfigurationapiextensionsv1.WebhookClientConfigApplyConfiguration{} + case apiextensionsv1.SchemeGroupVersion.WithKind("WebhookConversion"): + return &applyconfigurationapiextensionsv1.WebhookConversionApplyConfiguration{} + + // Group=apiregistration.k8s.io, Version=v1 + case apiregistrationv1.SchemeGroupVersion.WithKind("APIService"): + return &applyconfigurationapiregistrationv1.APIServiceApplyConfiguration{} + case apiregistrationv1.SchemeGroupVersion.WithKind("APIServiceCondition"): + return &applyconfigurationapiregistrationv1.APIServiceConditionApplyConfiguration{} + case apiregistrationv1.SchemeGroupVersion.WithKind("APIServiceSpec"): + return &applyconfigurationapiregistrationv1.APIServiceSpecApplyConfiguration{} + case apiregistrationv1.SchemeGroupVersion.WithKind("APIServiceStatus"): + return &applyconfigurationapiregistrationv1.APIServiceStatusApplyConfiguration{} + case apiregistrationv1.SchemeGroupVersion.WithKind("ServiceReference"): + return &applyconfigurationapiregistrationv1.ServiceReferenceApplyConfiguration{} + + // Group=apps, Version=v1 + case appsv1.SchemeGroupVersion.WithKind("ControllerRevision"): + return &applyconfigurationappsv1.ControllerRevisionApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DaemonSet"): + return &applyconfigurationappsv1.DaemonSetApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DaemonSetCondition"): + return &applyconfigurationappsv1.DaemonSetConditionApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DaemonSetSpec"): + return &applyconfigurationappsv1.DaemonSetSpecApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DaemonSetStatus"): + return &applyconfigurationappsv1.DaemonSetStatusApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DaemonSetUpdateStrategy"): + return &applyconfigurationappsv1.DaemonSetUpdateStrategyApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("Deployment"): + return &applyconfigurationappsv1.DeploymentApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DeploymentCondition"): + return &applyconfigurationappsv1.DeploymentConditionApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DeploymentSpec"): + return &applyconfigurationappsv1.DeploymentSpecApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DeploymentStatus"): + return &applyconfigurationappsv1.DeploymentStatusApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("DeploymentStrategy"): + return &applyconfigurationappsv1.DeploymentStrategyApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("ReplicaSet"): + return &applyconfigurationappsv1.ReplicaSetApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("ReplicaSetCondition"): + return &applyconfigurationappsv1.ReplicaSetConditionApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("ReplicaSetSpec"): + return &applyconfigurationappsv1.ReplicaSetSpecApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("ReplicaSetStatus"): + return &applyconfigurationappsv1.ReplicaSetStatusApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("RollingUpdateDaemonSet"): + return &applyconfigurationappsv1.RollingUpdateDaemonSetApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("RollingUpdateDeployment"): + return &applyconfigurationappsv1.RollingUpdateDeploymentApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("RollingUpdateStatefulSetStrategy"): + return &applyconfigurationappsv1.RollingUpdateStatefulSetStrategyApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSet"): + return &applyconfigurationappsv1.StatefulSetApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSetCondition"): + return &applyconfigurationappsv1.StatefulSetConditionApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSetOrdinals"): + return &applyconfigurationappsv1.StatefulSetOrdinalsApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSetPersistentVolumeClaimRetentionPolicy"): + return &applyconfigurationappsv1.StatefulSetPersistentVolumeClaimRetentionPolicyApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSetSpec"): + return &applyconfigurationappsv1.StatefulSetSpecApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSetStatus"): + return &applyconfigurationappsv1.StatefulSetStatusApplyConfiguration{} + case appsv1.SchemeGroupVersion.WithKind("StatefulSetUpdateStrategy"): + return &applyconfigurationappsv1.StatefulSetUpdateStrategyApplyConfiguration{} + + // Group=autoscaling, Version=v1 + case autoscalingv1.SchemeGroupVersion.WithKind("CrossVersionObjectReference"): + return &applyconfigurationautoscalingv1.CrossVersionObjectReferenceApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"): + return &applyconfigurationautoscalingv1.HorizontalPodAutoscalerApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerSpec"): + return &applyconfigurationautoscalingv1.HorizontalPodAutoscalerSpecApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerStatus"): + return &applyconfigurationautoscalingv1.HorizontalPodAutoscalerStatusApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("Scale"): + return &applyconfigurationautoscalingv1.ScaleApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("ScaleSpec"): + return &applyconfigurationautoscalingv1.ScaleSpecApplyConfiguration{} + case autoscalingv1.SchemeGroupVersion.WithKind("ScaleStatus"): + return &applyconfigurationautoscalingv1.ScaleStatusApplyConfiguration{} + + // Group=autoscaling, Version=v2 + case v2.SchemeGroupVersion.WithKind("ContainerResourceMetricSource"): + return &autoscalingv2.ContainerResourceMetricSourceApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ContainerResourceMetricStatus"): + return &autoscalingv2.ContainerResourceMetricStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("CrossVersionObjectReference"): + return &autoscalingv2.CrossVersionObjectReferenceApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ExternalMetricSource"): + return &autoscalingv2.ExternalMetricSourceApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ExternalMetricStatus"): + return &autoscalingv2.ExternalMetricStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"): + return &autoscalingv2.HorizontalPodAutoscalerApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerBehavior"): + return &autoscalingv2.HorizontalPodAutoscalerBehaviorApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerCondition"): + return &autoscalingv2.HorizontalPodAutoscalerConditionApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerSpec"): + return &autoscalingv2.HorizontalPodAutoscalerSpecApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerStatus"): + return &autoscalingv2.HorizontalPodAutoscalerStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HPAScalingPolicy"): + return &autoscalingv2.HPAScalingPolicyApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("HPAScalingRules"): + return &autoscalingv2.HPAScalingRulesApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("MetricIdentifier"): + return &autoscalingv2.MetricIdentifierApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("MetricSpec"): + return &autoscalingv2.MetricSpecApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("MetricStatus"): + return &autoscalingv2.MetricStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("MetricTarget"): + return &autoscalingv2.MetricTargetApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("MetricValueStatus"): + return &autoscalingv2.MetricValueStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ObjectMetricSource"): + return &autoscalingv2.ObjectMetricSourceApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ObjectMetricStatus"): + return &autoscalingv2.ObjectMetricStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("PodsMetricSource"): + return &autoscalingv2.PodsMetricSourceApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("PodsMetricStatus"): + return &autoscalingv2.PodsMetricStatusApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ResourceMetricSource"): + return &autoscalingv2.ResourceMetricSourceApplyConfiguration{} + case v2.SchemeGroupVersion.WithKind("ResourceMetricStatus"): + return &autoscalingv2.ResourceMetricStatusApplyConfiguration{} + + // Group=batch, Version=v1 + case batchv1.SchemeGroupVersion.WithKind("CronJob"): + return &applyconfigurationbatchv1.CronJobApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("CronJobSpec"): + return &applyconfigurationbatchv1.CronJobSpecApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("CronJobStatus"): + return &applyconfigurationbatchv1.CronJobStatusApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("Job"): + return &applyconfigurationbatchv1.JobApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("JobCondition"): + return &applyconfigurationbatchv1.JobConditionApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("JobSpec"): + return &applyconfigurationbatchv1.JobSpecApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("JobStatus"): + return &applyconfigurationbatchv1.JobStatusApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("JobTemplateSpec"): + return &applyconfigurationbatchv1.JobTemplateSpecApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("PodFailurePolicy"): + return &applyconfigurationbatchv1.PodFailurePolicyApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("PodFailurePolicyOnExitCodesRequirement"): + return &applyconfigurationbatchv1.PodFailurePolicyOnExitCodesRequirementApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("PodFailurePolicyOnPodConditionsPattern"): + return &applyconfigurationbatchv1.PodFailurePolicyOnPodConditionsPatternApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("PodFailurePolicyRule"): + return &applyconfigurationbatchv1.PodFailurePolicyRuleApplyConfiguration{} + case batchv1.SchemeGroupVersion.WithKind("UncountedTerminatedPods"): + return &applyconfigurationbatchv1.UncountedTerminatedPodsApplyConfiguration{} + + // Group=certificates.k8s.io, Version=v1 + case certificatesv1.SchemeGroupVersion.WithKind("CertificateSigningRequest"): + return &applyconfigurationcertificatesv1.CertificateSigningRequestApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("CertificateSigningRequestCondition"): + return &applyconfigurationcertificatesv1.CertificateSigningRequestConditionApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("CertificateSigningRequestSpec"): + return &applyconfigurationcertificatesv1.CertificateSigningRequestSpecApplyConfiguration{} + case certificatesv1.SchemeGroupVersion.WithKind("CertificateSigningRequestStatus"): + return &applyconfigurationcertificatesv1.CertificateSigningRequestStatusApplyConfiguration{} + + // Group=coordination.k8s.io, Version=v1 + case coordinationv1.SchemeGroupVersion.WithKind("Lease"): + return &applyconfigurationcoordinationv1.LeaseApplyConfiguration{} + case coordinationv1.SchemeGroupVersion.WithKind("LeaseSpec"): + return &applyconfigurationcoordinationv1.LeaseSpecApplyConfiguration{} + + // Group=core, Version=v1 + case corev1.SchemeGroupVersion.WithKind("Affinity"): + return &applyconfigurationcorev1.AffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("AttachedVolume"): + return &applyconfigurationcorev1.AttachedVolumeApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("AWSElasticBlockStoreVolumeSource"): + return &applyconfigurationcorev1.AWSElasticBlockStoreVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("AzureDiskVolumeSource"): + return &applyconfigurationcorev1.AzureDiskVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("AzureFilePersistentVolumeSource"): + return &applyconfigurationcorev1.AzureFilePersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("AzureFileVolumeSource"): + return &applyconfigurationcorev1.AzureFileVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Capabilities"): + return &applyconfigurationcorev1.CapabilitiesApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("CephFSPersistentVolumeSource"): + return &applyconfigurationcorev1.CephFSPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("CephFSVolumeSource"): + return &applyconfigurationcorev1.CephFSVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("CinderPersistentVolumeSource"): + return &applyconfigurationcorev1.CinderPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("CinderVolumeSource"): + return &applyconfigurationcorev1.CinderVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ClaimSource"): + return &applyconfigurationcorev1.ClaimSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ClientIPConfig"): + return &applyconfigurationcorev1.ClientIPConfigApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ClusterTrustBundleProjection"): + return &applyconfigurationcorev1.ClusterTrustBundleProjectionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ComponentCondition"): + return &applyconfigurationcorev1.ComponentConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ComponentStatus"): + return &applyconfigurationcorev1.ComponentStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ConfigMap"): + return &applyconfigurationcorev1.ConfigMapApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ConfigMapEnvSource"): + return &applyconfigurationcorev1.ConfigMapEnvSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ConfigMapKeySelector"): + return &applyconfigurationcorev1.ConfigMapKeySelectorApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ConfigMapNodeConfigSource"): + return &applyconfigurationcorev1.ConfigMapNodeConfigSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ConfigMapProjection"): + return &applyconfigurationcorev1.ConfigMapProjectionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ConfigMapVolumeSource"): + return &applyconfigurationcorev1.ConfigMapVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Container"): + return &applyconfigurationcorev1.ContainerApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerImage"): + return &applyconfigurationcorev1.ContainerImageApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerPort"): + return &applyconfigurationcorev1.ContainerPortApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerResizePolicy"): + return &applyconfigurationcorev1.ContainerResizePolicyApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerState"): + return &applyconfigurationcorev1.ContainerStateApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerStateRunning"): + return &applyconfigurationcorev1.ContainerStateRunningApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerStateTerminated"): + return &applyconfigurationcorev1.ContainerStateTerminatedApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerStateWaiting"): + return &applyconfigurationcorev1.ContainerStateWaitingApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ContainerStatus"): + return &applyconfigurationcorev1.ContainerStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("CSIPersistentVolumeSource"): + return &applyconfigurationcorev1.CSIPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("CSIVolumeSource"): + return &applyconfigurationcorev1.CSIVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("DaemonEndpoint"): + return &applyconfigurationcorev1.DaemonEndpointApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("DownwardAPIProjection"): + return &applyconfigurationcorev1.DownwardAPIProjectionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("DownwardAPIVolumeFile"): + return &applyconfigurationcorev1.DownwardAPIVolumeFileApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("DownwardAPIVolumeSource"): + return &applyconfigurationcorev1.DownwardAPIVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EmptyDirVolumeSource"): + return &applyconfigurationcorev1.EmptyDirVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EndpointAddress"): + return &applyconfigurationcorev1.EndpointAddressApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EndpointPort"): + return &applyconfigurationcorev1.EndpointPortApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Endpoints"): + return &applyconfigurationcorev1.EndpointsApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EndpointSubset"): + return &applyconfigurationcorev1.EndpointSubsetApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EnvFromSource"): + return &applyconfigurationcorev1.EnvFromSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EnvVar"): + return &applyconfigurationcorev1.EnvVarApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EnvVarSource"): + return &applyconfigurationcorev1.EnvVarSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EphemeralContainer"): + return &applyconfigurationcorev1.EphemeralContainerApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EphemeralContainerCommon"): + return &applyconfigurationcorev1.EphemeralContainerCommonApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EphemeralVolumeSource"): + return &applyconfigurationcorev1.EphemeralVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Event"): + return &applyconfigurationcorev1.EventApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EventSeries"): + return &applyconfigurationcorev1.EventSeriesApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("EventSource"): + return &applyconfigurationcorev1.EventSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ExecAction"): + return &applyconfigurationcorev1.ExecActionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("FCVolumeSource"): + return &applyconfigurationcorev1.FCVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("FlexPersistentVolumeSource"): + return &applyconfigurationcorev1.FlexPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("FlexVolumeSource"): + return &applyconfigurationcorev1.FlexVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("FlockerVolumeSource"): + return &applyconfigurationcorev1.FlockerVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("GCEPersistentDiskVolumeSource"): + return &applyconfigurationcorev1.GCEPersistentDiskVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("GitRepoVolumeSource"): + return &applyconfigurationcorev1.GitRepoVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("GlusterfsPersistentVolumeSource"): + return &applyconfigurationcorev1.GlusterfsPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("GlusterfsVolumeSource"): + return &applyconfigurationcorev1.GlusterfsVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("GRPCAction"): + return &applyconfigurationcorev1.GRPCActionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("HostAlias"): + return &applyconfigurationcorev1.HostAliasApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("HostIP"): + return &applyconfigurationcorev1.HostIPApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("HostPathVolumeSource"): + return &applyconfigurationcorev1.HostPathVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("HTTPGetAction"): + return &applyconfigurationcorev1.HTTPGetActionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("HTTPHeader"): + return &applyconfigurationcorev1.HTTPHeaderApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ISCSIPersistentVolumeSource"): + return &applyconfigurationcorev1.ISCSIPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ISCSIVolumeSource"): + return &applyconfigurationcorev1.ISCSIVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("KeyToPath"): + return &applyconfigurationcorev1.KeyToPathApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Lifecycle"): + return &applyconfigurationcorev1.LifecycleApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LifecycleHandler"): + return &applyconfigurationcorev1.LifecycleHandlerApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LimitRange"): + return &applyconfigurationcorev1.LimitRangeApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LimitRangeItem"): + return &applyconfigurationcorev1.LimitRangeItemApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LimitRangeSpec"): + return &applyconfigurationcorev1.LimitRangeSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LoadBalancerIngress"): + return &applyconfigurationcorev1.LoadBalancerIngressApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LoadBalancerStatus"): + return &applyconfigurationcorev1.LoadBalancerStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LocalObjectReference"): + return &applyconfigurationcorev1.LocalObjectReferenceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("LocalVolumeSource"): + return &applyconfigurationcorev1.LocalVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ModifyVolumeStatus"): + return &applyconfigurationcorev1.ModifyVolumeStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Namespace"): + return &applyconfigurationcorev1.NamespaceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NamespaceCondition"): + return &applyconfigurationcorev1.NamespaceConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NamespaceSpec"): + return &applyconfigurationcorev1.NamespaceSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NamespaceStatus"): + return &applyconfigurationcorev1.NamespaceStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NFSVolumeSource"): + return &applyconfigurationcorev1.NFSVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Node"): + return &applyconfigurationcorev1.NodeApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeAddress"): + return &applyconfigurationcorev1.NodeAddressApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeAffinity"): + return &applyconfigurationcorev1.NodeAffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeCondition"): + return &applyconfigurationcorev1.NodeConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeConfigSource"): + return &applyconfigurationcorev1.NodeConfigSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeConfigStatus"): + return &applyconfigurationcorev1.NodeConfigStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeDaemonEndpoints"): + return &applyconfigurationcorev1.NodeDaemonEndpointsApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeSelector"): + return &applyconfigurationcorev1.NodeSelectorApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeSelectorRequirement"): + return &applyconfigurationcorev1.NodeSelectorRequirementApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeSelectorTerm"): + return &applyconfigurationcorev1.NodeSelectorTermApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeSpec"): + return &applyconfigurationcorev1.NodeSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeStatus"): + return &applyconfigurationcorev1.NodeStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeSystemInfo"): + return &applyconfigurationcorev1.NodeSystemInfoApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ObjectFieldSelector"): + return &applyconfigurationcorev1.ObjectFieldSelectorApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ObjectReference"): + return &applyconfigurationcorev1.ObjectReferenceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolume"): + return &applyconfigurationcorev1.PersistentVolumeApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeClaim"): + return &applyconfigurationcorev1.PersistentVolumeClaimApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeClaimCondition"): + return &applyconfigurationcorev1.PersistentVolumeClaimConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeClaimSpec"): + return &applyconfigurationcorev1.PersistentVolumeClaimSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeClaimStatus"): + return &applyconfigurationcorev1.PersistentVolumeClaimStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeClaimTemplate"): + return &applyconfigurationcorev1.PersistentVolumeClaimTemplateApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeClaimVolumeSource"): + return &applyconfigurationcorev1.PersistentVolumeClaimVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeSource"): + return &applyconfigurationcorev1.PersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeSpec"): + return &applyconfigurationcorev1.PersistentVolumeSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PersistentVolumeStatus"): + return &applyconfigurationcorev1.PersistentVolumeStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PhotonPersistentDiskVolumeSource"): + return &applyconfigurationcorev1.PhotonPersistentDiskVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Pod"): + return &applyconfigurationcorev1.PodApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodAffinity"): + return &applyconfigurationcorev1.PodAffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodAffinityTerm"): + return &applyconfigurationcorev1.PodAffinityTermApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodAntiAffinity"): + return &applyconfigurationcorev1.PodAntiAffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodCondition"): + return &applyconfigurationcorev1.PodConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodDNSConfig"): + return &applyconfigurationcorev1.PodDNSConfigApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodDNSConfigOption"): + return &applyconfigurationcorev1.PodDNSConfigOptionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodIP"): + return &applyconfigurationcorev1.PodIPApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodOS"): + return &applyconfigurationcorev1.PodOSApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodReadinessGate"): + return &applyconfigurationcorev1.PodReadinessGateApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodResourceClaim"): + return &applyconfigurationcorev1.PodResourceClaimApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodResourceClaimStatus"): + return &applyconfigurationcorev1.PodResourceClaimStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodSchedulingGate"): + return &applyconfigurationcorev1.PodSchedulingGateApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodSecurityContext"): + return &applyconfigurationcorev1.PodSecurityContextApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodSpec"): + return &applyconfigurationcorev1.PodSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodStatus"): + return &applyconfigurationcorev1.PodStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodTemplate"): + return &applyconfigurationcorev1.PodTemplateApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodTemplateSpec"): + return &applyconfigurationcorev1.PodTemplateSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PortStatus"): + return &applyconfigurationcorev1.PortStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PortworxVolumeSource"): + return &applyconfigurationcorev1.PortworxVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PreferredSchedulingTerm"): + return &applyconfigurationcorev1.PreferredSchedulingTermApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Probe"): + return &applyconfigurationcorev1.ProbeApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ProbeHandler"): + return &applyconfigurationcorev1.ProbeHandlerApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ProjectedVolumeSource"): + return &applyconfigurationcorev1.ProjectedVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("QuobyteVolumeSource"): + return &applyconfigurationcorev1.QuobyteVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("RBDPersistentVolumeSource"): + return &applyconfigurationcorev1.RBDPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("RBDVolumeSource"): + return &applyconfigurationcorev1.RBDVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ReplicationController"): + return &applyconfigurationcorev1.ReplicationControllerApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ReplicationControllerCondition"): + return &applyconfigurationcorev1.ReplicationControllerConditionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ReplicationControllerSpec"): + return &applyconfigurationcorev1.ReplicationControllerSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ReplicationControllerStatus"): + return &applyconfigurationcorev1.ReplicationControllerStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ResourceClaim"): + return &applyconfigurationcorev1.ResourceClaimApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ResourceFieldSelector"): + return &applyconfigurationcorev1.ResourceFieldSelectorApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ResourceQuota"): + return &applyconfigurationcorev1.ResourceQuotaApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ResourceQuotaSpec"): + return &applyconfigurationcorev1.ResourceQuotaSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ResourceQuotaStatus"): + return &applyconfigurationcorev1.ResourceQuotaStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ResourceRequirements"): + return &applyconfigurationcorev1.ResourceRequirementsApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ScaleIOPersistentVolumeSource"): + return &applyconfigurationcorev1.ScaleIOPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ScaleIOVolumeSource"): + return &applyconfigurationcorev1.ScaleIOVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ScopedResourceSelectorRequirement"): + return &applyconfigurationcorev1.ScopedResourceSelectorRequirementApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ScopeSelector"): + return &applyconfigurationcorev1.ScopeSelectorApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SeccompProfile"): + return &applyconfigurationcorev1.SeccompProfileApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Secret"): + return &applyconfigurationcorev1.SecretApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SecretEnvSource"): + return &applyconfigurationcorev1.SecretEnvSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SecretKeySelector"): + return &applyconfigurationcorev1.SecretKeySelectorApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SecretProjection"): + return &applyconfigurationcorev1.SecretProjectionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SecretReference"): + return &applyconfigurationcorev1.SecretReferenceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SecretVolumeSource"): + return &applyconfigurationcorev1.SecretVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SecurityContext"): + return &applyconfigurationcorev1.SecurityContextApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SELinuxOptions"): + return &applyconfigurationcorev1.SELinuxOptionsApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Service"): + return &applyconfigurationcorev1.ServiceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ServiceAccount"): + return &applyconfigurationcorev1.ServiceAccountApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ServiceAccountTokenProjection"): + return &applyconfigurationcorev1.ServiceAccountTokenProjectionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ServicePort"): + return &applyconfigurationcorev1.ServicePortApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ServiceSpec"): + return &applyconfigurationcorev1.ServiceSpecApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ServiceStatus"): + return &applyconfigurationcorev1.ServiceStatusApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SessionAffinityConfig"): + return &applyconfigurationcorev1.SessionAffinityConfigApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("SleepAction"): + return &applyconfigurationcorev1.SleepActionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("StorageOSPersistentVolumeSource"): + return &applyconfigurationcorev1.StorageOSPersistentVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("StorageOSVolumeSource"): + return &applyconfigurationcorev1.StorageOSVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Sysctl"): + return &applyconfigurationcorev1.SysctlApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Taint"): + return &applyconfigurationcorev1.TaintApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("TCPSocketAction"): + return &applyconfigurationcorev1.TCPSocketActionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Toleration"): + return &applyconfigurationcorev1.TolerationApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("TopologySelectorLabelRequirement"): + return &applyconfigurationcorev1.TopologySelectorLabelRequirementApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("TopologySelectorTerm"): + return &applyconfigurationcorev1.TopologySelectorTermApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("TopologySpreadConstraint"): + return &applyconfigurationcorev1.TopologySpreadConstraintApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): + return &applyconfigurationcorev1.TypedLocalObjectReferenceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("TypedObjectReference"): + return &applyconfigurationcorev1.TypedObjectReferenceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("Volume"): + return &applyconfigurationcorev1.VolumeApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeDevice"): + return &applyconfigurationcorev1.VolumeDeviceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeMount"): + return &applyconfigurationcorev1.VolumeMountApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeNodeAffinity"): + return &applyconfigurationcorev1.VolumeNodeAffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeProjection"): + return &applyconfigurationcorev1.VolumeProjectionApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeResourceRequirements"): + return &applyconfigurationcorev1.VolumeResourceRequirementsApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeSource"): + return &applyconfigurationcorev1.VolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VsphereVirtualDiskVolumeSource"): + return &applyconfigurationcorev1.VsphereVirtualDiskVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("WeightedPodAffinityTerm"): + return &applyconfigurationcorev1.WeightedPodAffinityTermApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("WindowsSecurityContextOptions"): + return &applyconfigurationcorev1.WindowsSecurityContextOptionsApplyConfiguration{} + + // Group=discovery.k8s.io, Version=v1 + case discoveryv1.SchemeGroupVersion.WithKind("Endpoint"): + return &applyconfigurationdiscoveryv1.EndpointApplyConfiguration{} + case discoveryv1.SchemeGroupVersion.WithKind("EndpointConditions"): + return &applyconfigurationdiscoveryv1.EndpointConditionsApplyConfiguration{} + case discoveryv1.SchemeGroupVersion.WithKind("EndpointHints"): + return &applyconfigurationdiscoveryv1.EndpointHintsApplyConfiguration{} + case discoveryv1.SchemeGroupVersion.WithKind("EndpointPort"): + return &applyconfigurationdiscoveryv1.EndpointPortApplyConfiguration{} + case discoveryv1.SchemeGroupVersion.WithKind("EndpointSlice"): + return &applyconfigurationdiscoveryv1.EndpointSliceApplyConfiguration{} + case discoveryv1.SchemeGroupVersion.WithKind("ForZone"): + return &applyconfigurationdiscoveryv1.ForZoneApplyConfiguration{} + + // Group=events.k8s.io, Version=v1 + case eventsv1.SchemeGroupVersion.WithKind("Event"): + return &applyconfigurationeventsv1.EventApplyConfiguration{} + case eventsv1.SchemeGroupVersion.WithKind("EventSeries"): + return &applyconfigurationeventsv1.EventSeriesApplyConfiguration{} + + // Group=rbac.authorization.k8s.io, Version=v1 + case rbacv1.SchemeGroupVersion.WithKind("AggregationRule"): + return &applyconfigurationrbacv1.AggregationRuleApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("ClusterRole"): + return &applyconfigurationrbacv1.ClusterRoleApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("ClusterRoleBinding"): + return &applyconfigurationrbacv1.ClusterRoleBindingApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("PolicyRule"): + return &applyconfigurationrbacv1.PolicyRuleApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("Role"): + return &applyconfigurationrbacv1.RoleApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("RoleBinding"): + return &applyconfigurationrbacv1.RoleBindingApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("RoleRef"): + return &applyconfigurationrbacv1.RoleRefApplyConfiguration{} + case rbacv1.SchemeGroupVersion.WithKind("Subject"): + return &applyconfigurationrbacv1.SubjectApplyConfiguration{} + + // Group=scheduling.k8s.io, Version=v1 + case schedulingv1.SchemeGroupVersion.WithKind("PriorityClass"): + return &applyconfigurationschedulingv1.PriorityClassApplyConfiguration{} + + // Group=storage.k8s.io, Version=v1 + case storagev1.SchemeGroupVersion.WithKind("CSIDriver"): + return &applyconfigurationstoragev1.CSIDriverApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("CSIDriverSpec"): + return &applyconfigurationstoragev1.CSIDriverSpecApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("CSINode"): + return &applyconfigurationstoragev1.CSINodeApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("CSINodeDriver"): + return &applyconfigurationstoragev1.CSINodeDriverApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("CSINodeSpec"): + return &applyconfigurationstoragev1.CSINodeSpecApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("CSIStorageCapacity"): + return &applyconfigurationstoragev1.CSIStorageCapacityApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("StorageClass"): + return &applyconfigurationstoragev1.StorageClassApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("TokenRequest"): + return &applyconfigurationstoragev1.TokenRequestApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("VolumeAttachment"): + return &applyconfigurationstoragev1.VolumeAttachmentApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("VolumeAttachmentSource"): + return &applyconfigurationstoragev1.VolumeAttachmentSourceApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("VolumeAttachmentSpec"): + return &applyconfigurationstoragev1.VolumeAttachmentSpecApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("VolumeAttachmentStatus"): + return &applyconfigurationstoragev1.VolumeAttachmentStatusApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("VolumeError"): + return &applyconfigurationstoragev1.VolumeErrorApplyConfiguration{} + case storagev1.SchemeGroupVersion.WithKind("VolumeNodeResources"): + return &applyconfigurationstoragev1.VolumeNodeResourcesApplyConfiguration{} + + // Group=walrus.seal.io, Version=v1 + case walrusv1.SchemeGroupVersion.WithKind("Catalog"): + return &applyconfigurationwalrusv1.CatalogApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Connector"): + return &applyconfigurationwalrusv1.ConnectorApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Environment"): + return &applyconfigurationwalrusv1.EnvironmentApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("EnvironmentSpec"): + return &applyconfigurationwalrusv1.EnvironmentSpecApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("EnvironmentStatus"): + return &applyconfigurationwalrusv1.EnvironmentStatusApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Project"): + return &applyconfigurationwalrusv1.ProjectApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("ProjectSpec"): + return &applyconfigurationwalrusv1.ProjectSpecApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("ProjectStatus"): + return &applyconfigurationwalrusv1.ProjectStatusApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Resource"): + return &applyconfigurationwalrusv1.ResourceApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("ResourceDefinition"): + return &applyconfigurationwalrusv1.ResourceDefinitionApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("ResourceRun"): + return &applyconfigurationwalrusv1.ResourceRunApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Setting"): + return &applyconfigurationwalrusv1.SettingApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("SettingSpec"): + return &applyconfigurationwalrusv1.SettingSpecApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("SettingStatus"): + return &applyconfigurationwalrusv1.SettingStatusApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Template"): + return &applyconfigurationwalrusv1.TemplateApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("Variable"): + return &applyconfigurationwalrusv1.VariableApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("VariableSpec"): + return &applyconfigurationwalrusv1.VariableSpecApplyConfiguration{} + case walrusv1.SchemeGroupVersion.WithKind("VariableStatus"): + return &applyconfigurationwalrusv1.VariableStatusApplyConfiguration{} + + // Group=walruscore.seal.io, Version=v1 + case walruscorev1.SchemeGroupVersion.WithKind("Catalog"): + return &applyconfigurationwalruscorev1.CatalogApplyConfiguration{} + case walruscorev1.SchemeGroupVersion.WithKind("Connector"): + return &applyconfigurationwalruscorev1.ConnectorApplyConfiguration{} + case walruscorev1.SchemeGroupVersion.WithKind("Resource"): + return &applyconfigurationwalruscorev1.ResourceApplyConfiguration{} + case walruscorev1.SchemeGroupVersion.WithKind("ResourceDefinition"): + return &applyconfigurationwalruscorev1.ResourceDefinitionApplyConfiguration{} + case walruscorev1.SchemeGroupVersion.WithKind("ResourceRun"): + return &applyconfigurationwalruscorev1.ResourceRunApplyConfiguration{} + case walruscorev1.SchemeGroupVersion.WithKind("Template"): + return &applyconfigurationwalruscorev1.TemplateApplyConfiguration{} + + } + return nil +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/catalog.go b/pkg/clients/applyconfiguration/walrus/v1/catalog.go new file mode 100644 index 000000000..88b3d18da --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/catalog.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CatalogApplyConfiguration represents an declarative configuration of the Catalog type for use +// with apply. +type CatalogApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.CatalogSpec `json:"spec,omitempty"` + Status *walruscorev1.CatalogStatus `json:"status,omitempty"` +} + +// Catalog constructs an declarative configuration of the Catalog type for use with +// apply. +func Catalog(name, namespace string) *CatalogApplyConfiguration { + b := &CatalogApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Catalog") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithKind(value string) *CatalogApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithAPIVersion(value string) *CatalogApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithName(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithGenerateName(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithNamespace(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithUID(value types.UID) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithResourceVersion(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithGeneration(value int64) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CatalogApplyConfiguration) WithLabels(entries map[string]string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CatalogApplyConfiguration) WithAnnotations(entries map[string]string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CatalogApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CatalogApplyConfiguration) WithFinalizers(values ...string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CatalogApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithSpec(value walruscorev1.CatalogSpec) *CatalogApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithStatus(value walruscorev1.CatalogStatus) *CatalogApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/connector.go b/pkg/clients/applyconfiguration/walrus/v1/connector.go new file mode 100644 index 000000000..18bb3ded7 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/connector.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ConnectorApplyConfiguration represents an declarative configuration of the Connector type for use +// with apply. +type ConnectorApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ConnectorSpec `json:"spec,omitempty"` + Status *walruscorev1.ConnectorStatus `json:"status,omitempty"` +} + +// Connector constructs an declarative configuration of the Connector type for use with +// apply. +func Connector(name, namespace string) *ConnectorApplyConfiguration { + b := &ConnectorApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Connector") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithKind(value string) *ConnectorApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithAPIVersion(value string) *ConnectorApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithName(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithGenerateName(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithNamespace(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithUID(value types.UID) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithResourceVersion(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithGeneration(value int64) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ConnectorApplyConfiguration) WithLabels(entries map[string]string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ConnectorApplyConfiguration) WithAnnotations(entries map[string]string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ConnectorApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ConnectorApplyConfiguration) WithFinalizers(values ...string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ConnectorApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithSpec(value walruscorev1.ConnectorSpec) *ConnectorApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithStatus(value walruscorev1.ConnectorStatus) *ConnectorApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/environment.go b/pkg/clients/applyconfiguration/walrus/v1/environment.go new file mode 100644 index 000000000..302fe20b4 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/environment.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EnvironmentApplyConfiguration represents an declarative configuration of the Environment type for use +// with apply. +type EnvironmentApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *EnvironmentSpecApplyConfiguration `json:"spec,omitempty"` + Status *EnvironmentStatusApplyConfiguration `json:"status,omitempty"` +} + +// Environment constructs an declarative configuration of the Environment type for use with +// apply. +func Environment(name, namespace string) *EnvironmentApplyConfiguration { + b := &EnvironmentApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Environment") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithKind(value string) *EnvironmentApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithAPIVersion(value string) *EnvironmentApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithName(value string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithGenerateName(value string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithNamespace(value string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithUID(value types.UID) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithResourceVersion(value string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithGeneration(value int64) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *EnvironmentApplyConfiguration) WithLabels(entries map[string]string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *EnvironmentApplyConfiguration) WithAnnotations(entries map[string]string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *EnvironmentApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *EnvironmentApplyConfiguration) WithFinalizers(values ...string) *EnvironmentApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *EnvironmentApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithSpec(value *EnvironmentSpecApplyConfiguration) *EnvironmentApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *EnvironmentApplyConfiguration) WithStatus(value *EnvironmentStatusApplyConfiguration) *EnvironmentApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/environmentspec.go b/pkg/clients/applyconfiguration/walrus/v1/environmentspec.go new file mode 100644 index 000000000..4cdf338ce --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/environmentspec.go @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" +) + +// EnvironmentSpecApplyConfiguration represents an declarative configuration of the EnvironmentSpec type for use +// with apply. +type EnvironmentSpecApplyConfiguration struct { + Type *v1.EnvironmentType `json:"type,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` +} + +// EnvironmentSpecApplyConfiguration constructs an declarative configuration of the EnvironmentSpec type for use with +// apply. +func EnvironmentSpec() *EnvironmentSpecApplyConfiguration { + return &EnvironmentSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *EnvironmentSpecApplyConfiguration) WithType(value v1.EnvironmentType) *EnvironmentSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithDisplayName sets the DisplayName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DisplayName field is set to the value of the last call. +func (b *EnvironmentSpecApplyConfiguration) WithDisplayName(value string) *EnvironmentSpecApplyConfiguration { + b.DisplayName = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *EnvironmentSpecApplyConfiguration) WithDescription(value string) *EnvironmentSpecApplyConfiguration { + b.Description = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/environmentstatus.go b/pkg/clients/applyconfiguration/walrus/v1/environmentstatus.go new file mode 100644 index 000000000..8a460fccc --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/environmentstatus.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// EnvironmentStatusApplyConfiguration represents an declarative configuration of the EnvironmentStatus type for use +// with apply. +type EnvironmentStatusApplyConfiguration struct { + Project *string `json:"project,omitempty"` + Phase *v1.NamespacePhase `json:"phase,omitempty"` +} + +// EnvironmentStatusApplyConfiguration constructs an declarative configuration of the EnvironmentStatus type for use with +// apply. +func EnvironmentStatus() *EnvironmentStatusApplyConfiguration { + return &EnvironmentStatusApplyConfiguration{} +} + +// WithProject sets the Project field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Project field is set to the value of the last call. +func (b *EnvironmentStatusApplyConfiguration) WithProject(value string) *EnvironmentStatusApplyConfiguration { + b.Project = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *EnvironmentStatusApplyConfiguration) WithPhase(value v1.NamespacePhase) *EnvironmentStatusApplyConfiguration { + b.Phase = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/project.go b/pkg/clients/applyconfiguration/walrus/v1/project.go new file mode 100644 index 000000000..18066cfa7 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/project.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ProjectApplyConfiguration represents an declarative configuration of the Project type for use +// with apply. +type ProjectApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ProjectSpecApplyConfiguration `json:"spec,omitempty"` + Status *ProjectStatusApplyConfiguration `json:"status,omitempty"` +} + +// Project constructs an declarative configuration of the Project type for use with +// apply. +func Project(name, namespace string) *ProjectApplyConfiguration { + b := &ProjectApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Project") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithKind(value string) *ProjectApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithAPIVersion(value string) *ProjectApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithName(value string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithGenerateName(value string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithNamespace(value string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithUID(value types.UID) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithResourceVersion(value string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithGeneration(value int64) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ProjectApplyConfiguration) WithLabels(entries map[string]string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ProjectApplyConfiguration) WithAnnotations(entries map[string]string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ProjectApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ProjectApplyConfiguration) WithFinalizers(values ...string) *ProjectApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ProjectApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithSpec(value *ProjectSpecApplyConfiguration) *ProjectApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ProjectApplyConfiguration) WithStatus(value *ProjectStatusApplyConfiguration) *ProjectApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/projectspec.go b/pkg/clients/applyconfiguration/walrus/v1/projectspec.go new file mode 100644 index 000000000..919d21225 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/projectspec.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ProjectSpecApplyConfiguration represents an declarative configuration of the ProjectSpec type for use +// with apply. +type ProjectSpecApplyConfiguration struct { + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ProjectSpecApplyConfiguration constructs an declarative configuration of the ProjectSpec type for use with +// apply. +func ProjectSpec() *ProjectSpecApplyConfiguration { + return &ProjectSpecApplyConfiguration{} +} + +// WithDisplayName sets the DisplayName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DisplayName field is set to the value of the last call. +func (b *ProjectSpecApplyConfiguration) WithDisplayName(value string) *ProjectSpecApplyConfiguration { + b.DisplayName = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *ProjectSpecApplyConfiguration) WithDescription(value string) *ProjectSpecApplyConfiguration { + b.Description = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/projectstatus.go b/pkg/clients/applyconfiguration/walrus/v1/projectstatus.go new file mode 100644 index 000000000..0d77c5d4c --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/projectstatus.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ProjectStatusApplyConfiguration represents an declarative configuration of the ProjectStatus type for use +// with apply. +type ProjectStatusApplyConfiguration struct { + Phase *v1.NamespacePhase `json:"phase,omitempty"` +} + +// ProjectStatusApplyConfiguration constructs an declarative configuration of the ProjectStatus type for use with +// apply. +func ProjectStatus() *ProjectStatusApplyConfiguration { + return &ProjectStatusApplyConfiguration{} +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *ProjectStatusApplyConfiguration) WithPhase(value v1.NamespacePhase) *ProjectStatusApplyConfiguration { + b.Phase = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/resource.go b/pkg/clients/applyconfiguration/walrus/v1/resource.go new file mode 100644 index 000000000..59470ab94 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/resource.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceApplyConfiguration represents an declarative configuration of the Resource type for use +// with apply. +type ResourceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ResourceSpec `json:"spec,omitempty"` + Status *walruscorev1.ResourceStatus `json:"status,omitempty"` +} + +// Resource constructs an declarative configuration of the Resource type for use with +// apply. +func Resource(name, namespace string) *ResourceApplyConfiguration { + b := &ResourceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Resource") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithKind(value string) *ResourceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithAPIVersion(value string) *ResourceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithName(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithGenerateName(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithNamespace(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithUID(value types.UID) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithResourceVersion(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithGeneration(value int64) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceApplyConfiguration) WithLabels(entries map[string]string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceApplyConfiguration) WithFinalizers(values ...string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithSpec(value walruscorev1.ResourceSpec) *ResourceApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithStatus(value walruscorev1.ResourceStatus) *ResourceApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/resourcedefinition.go b/pkg/clients/applyconfiguration/walrus/v1/resourcedefinition.go new file mode 100644 index 000000000..10a8e7e5c --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/resourcedefinition.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceDefinitionApplyConfiguration represents an declarative configuration of the ResourceDefinition type for use +// with apply. +type ResourceDefinitionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ResourceDefinitionSpec `json:"spec,omitempty"` + Status *walruscorev1.ResourceDefinitionStatus `json:"status,omitempty"` +} + +// ResourceDefinition constructs an declarative configuration of the ResourceDefinition type for use with +// apply. +func ResourceDefinition(name, namespace string) *ResourceDefinitionApplyConfiguration { + b := &ResourceDefinitionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceDefinition") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithKind(value string) *ResourceDefinitionApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithAPIVersion(value string) *ResourceDefinitionApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithName(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithGenerateName(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithNamespace(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithUID(value types.UID) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithResourceVersion(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithGeneration(value int64) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceDefinitionApplyConfiguration) WithLabels(entries map[string]string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceDefinitionApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceDefinitionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceDefinitionApplyConfiguration) WithFinalizers(values ...string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceDefinitionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithSpec(value walruscorev1.ResourceDefinitionSpec) *ResourceDefinitionApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithStatus(value walruscorev1.ResourceDefinitionStatus) *ResourceDefinitionApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/resourcerun.go b/pkg/clients/applyconfiguration/walrus/v1/resourcerun.go new file mode 100644 index 000000000..498d69661 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/resourcerun.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceRunApplyConfiguration represents an declarative configuration of the ResourceRun type for use +// with apply. +type ResourceRunApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ResourceDefinitionSpec `json:"spec,omitempty"` + Status *walruscorev1.ResourceDefinitionStatus `json:"status,omitempty"` +} + +// ResourceRun constructs an declarative configuration of the ResourceRun type for use with +// apply. +func ResourceRun(name, namespace string) *ResourceRunApplyConfiguration { + b := &ResourceRunApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceRun") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithKind(value string) *ResourceRunApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithAPIVersion(value string) *ResourceRunApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithName(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithGenerateName(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithNamespace(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithUID(value types.UID) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithResourceVersion(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithGeneration(value int64) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceRunApplyConfiguration) WithLabels(entries map[string]string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceRunApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceRunApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceRunApplyConfiguration) WithFinalizers(values ...string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceRunApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithSpec(value walruscorev1.ResourceDefinitionSpec) *ResourceRunApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithStatus(value walruscorev1.ResourceDefinitionStatus) *ResourceRunApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/setting.go b/pkg/clients/applyconfiguration/walrus/v1/setting.go new file mode 100644 index 000000000..85a9e6266 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/setting.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// SettingApplyConfiguration represents an declarative configuration of the Setting type for use +// with apply. +type SettingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *SettingSpecApplyConfiguration `json:"spec,omitempty"` + Status *SettingStatusApplyConfiguration `json:"status,omitempty"` +} + +// Setting constructs an declarative configuration of the Setting type for use with +// apply. +func Setting(name, namespace string) *SettingApplyConfiguration { + b := &SettingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Setting") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithKind(value string) *SettingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithAPIVersion(value string) *SettingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithName(value string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithGenerateName(value string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithNamespace(value string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithUID(value types.UID) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithResourceVersion(value string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithGeneration(value int64) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *SettingApplyConfiguration) WithLabels(entries map[string]string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *SettingApplyConfiguration) WithAnnotations(entries map[string]string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *SettingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *SettingApplyConfiguration) WithFinalizers(values ...string) *SettingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *SettingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithSpec(value *SettingSpecApplyConfiguration) *SettingApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *SettingApplyConfiguration) WithStatus(value *SettingStatusApplyConfiguration) *SettingApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/settingspec.go b/pkg/clients/applyconfiguration/walrus/v1/settingspec.go new file mode 100644 index 000000000..49992f485 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/settingspec.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SettingSpecApplyConfiguration represents an declarative configuration of the SettingSpec type for use +// with apply. +type SettingSpecApplyConfiguration struct { + Value *string `json:"value,omitempty"` +} + +// SettingSpecApplyConfiguration constructs an declarative configuration of the SettingSpec type for use with +// apply. +func SettingSpec() *SettingSpecApplyConfiguration { + return &SettingSpecApplyConfiguration{} +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *SettingSpecApplyConfiguration) WithValue(value string) *SettingSpecApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/settingstatus.go b/pkg/clients/applyconfiguration/walrus/v1/settingstatus.go new file mode 100644 index 000000000..36b0bcc91 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/settingstatus.go @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// SettingStatusApplyConfiguration represents an declarative configuration of the SettingStatus type for use +// with apply. +type SettingStatusApplyConfiguration struct { + Description *string `json:"description,omitempty"` + Hidden *bool `json:"hidden,omitempty"` + Editable *bool `json:"editable,omitempty"` + Sensitive *bool `json:"sensitive,omitempty"` + Value *string `json:"value,omitempty"` +} + +// SettingStatusApplyConfiguration constructs an declarative configuration of the SettingStatus type for use with +// apply. +func SettingStatus() *SettingStatusApplyConfiguration { + return &SettingStatusApplyConfiguration{} +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *SettingStatusApplyConfiguration) WithDescription(value string) *SettingStatusApplyConfiguration { + b.Description = &value + return b +} + +// WithHidden sets the Hidden field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hidden field is set to the value of the last call. +func (b *SettingStatusApplyConfiguration) WithHidden(value bool) *SettingStatusApplyConfiguration { + b.Hidden = &value + return b +} + +// WithEditable sets the Editable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Editable field is set to the value of the last call. +func (b *SettingStatusApplyConfiguration) WithEditable(value bool) *SettingStatusApplyConfiguration { + b.Editable = &value + return b +} + +// WithSensitive sets the Sensitive field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sensitive field is set to the value of the last call. +func (b *SettingStatusApplyConfiguration) WithSensitive(value bool) *SettingStatusApplyConfiguration { + b.Sensitive = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *SettingStatusApplyConfiguration) WithValue(value string) *SettingStatusApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/template.go b/pkg/clients/applyconfiguration/walrus/v1/template.go new file mode 100644 index 000000000..8ca6af25a --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/template.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TemplateApplyConfiguration represents an declarative configuration of the Template type for use +// with apply. +type TemplateApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.TemplateSpec `json:"spec,omitempty"` + Status *walruscorev1.TemplateStatus `json:"status,omitempty"` +} + +// Template constructs an declarative configuration of the Template type for use with +// apply. +func Template(name, namespace string) *TemplateApplyConfiguration { + b := &TemplateApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Template") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithKind(value string) *TemplateApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithAPIVersion(value string) *TemplateApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithName(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithGenerateName(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithNamespace(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithUID(value types.UID) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithResourceVersion(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithGeneration(value int64) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TemplateApplyConfiguration) WithLabels(entries map[string]string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TemplateApplyConfiguration) WithAnnotations(entries map[string]string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TemplateApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TemplateApplyConfiguration) WithFinalizers(values ...string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *TemplateApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithSpec(value walruscorev1.TemplateSpec) *TemplateApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithStatus(value walruscorev1.TemplateStatus) *TemplateApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/variable.go b/pkg/clients/applyconfiguration/walrus/v1/variable.go new file mode 100644 index 000000000..24daf3f3b --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/variable.go @@ -0,0 +1,206 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// VariableApplyConfiguration represents an declarative configuration of the Variable type for use +// with apply. +type VariableApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VariableSpecApplyConfiguration `json:"spec,omitempty"` + Status *VariableStatusApplyConfiguration `json:"status,omitempty"` +} + +// Variable constructs an declarative configuration of the Variable type for use with +// apply. +func Variable(name, namespace string) *VariableApplyConfiguration { + b := &VariableApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Variable") + b.WithAPIVersion("walrus.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithKind(value string) *VariableApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithAPIVersion(value string) *VariableApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithName(value string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithGenerateName(value string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithNamespace(value string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithUID(value types.UID) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithResourceVersion(value string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithGeneration(value int64) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VariableApplyConfiguration) WithLabels(entries map[string]string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VariableApplyConfiguration) WithAnnotations(entries map[string]string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VariableApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VariableApplyConfiguration) WithFinalizers(values ...string) *VariableApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VariableApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithSpec(value *VariableSpecApplyConfiguration) *VariableApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VariableApplyConfiguration) WithStatus(value *VariableStatusApplyConfiguration) *VariableApplyConfiguration { + b.Status = value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/variablespec.go b/pkg/clients/applyconfiguration/walrus/v1/variablespec.go new file mode 100644 index 000000000..9b612e4b8 --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/variablespec.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VariableSpecApplyConfiguration represents an declarative configuration of the VariableSpec type for use +// with apply. +type VariableSpecApplyConfiguration struct { + Value *string `json:"value,omitempty"` + Sensitive *bool `json:"sensitive,omitempty"` +} + +// VariableSpecApplyConfiguration constructs an declarative configuration of the VariableSpec type for use with +// apply. +func VariableSpec() *VariableSpecApplyConfiguration { + return &VariableSpecApplyConfiguration{} +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *VariableSpecApplyConfiguration) WithValue(value string) *VariableSpecApplyConfiguration { + b.Value = &value + return b +} + +// WithSensitive sets the Sensitive field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sensitive field is set to the value of the last call. +func (b *VariableSpecApplyConfiguration) WithSensitive(value bool) *VariableSpecApplyConfiguration { + b.Sensitive = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walrus/v1/variablestatus.go b/pkg/clients/applyconfiguration/walrus/v1/variablestatus.go new file mode 100644 index 000000000..12cee090b --- /dev/null +++ b/pkg/clients/applyconfiguration/walrus/v1/variablestatus.go @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// VariableStatusApplyConfiguration represents an declarative configuration of the VariableStatus type for use +// with apply. +type VariableStatusApplyConfiguration struct { + Project *string `json:"project,omitempty"` + Environment *string `json:"environment,omitempty"` + Value *string `json:"value,omitempty"` +} + +// VariableStatusApplyConfiguration constructs an declarative configuration of the VariableStatus type for use with +// apply. +func VariableStatus() *VariableStatusApplyConfiguration { + return &VariableStatusApplyConfiguration{} +} + +// WithProject sets the Project field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Project field is set to the value of the last call. +func (b *VariableStatusApplyConfiguration) WithProject(value string) *VariableStatusApplyConfiguration { + b.Project = &value + return b +} + +// WithEnvironment sets the Environment field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Environment field is set to the value of the last call. +func (b *VariableStatusApplyConfiguration) WithEnvironment(value string) *VariableStatusApplyConfiguration { + b.Environment = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *VariableStatusApplyConfiguration) WithValue(value string) *VariableStatusApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walruscore/v1/catalog.go b/pkg/clients/applyconfiguration/walruscore/v1/catalog.go new file mode 100644 index 000000000..9995d5169 --- /dev/null +++ b/pkg/clients/applyconfiguration/walruscore/v1/catalog.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CatalogApplyConfiguration represents an declarative configuration of the Catalog type for use +// with apply. +type CatalogApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.CatalogSpec `json:"spec,omitempty"` + Status *walruscorev1.CatalogStatus `json:"status,omitempty"` +} + +// Catalog constructs an declarative configuration of the Catalog type for use with +// apply. +func Catalog(name, namespace string) *CatalogApplyConfiguration { + b := &CatalogApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Catalog") + b.WithAPIVersion("walruscore.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithKind(value string) *CatalogApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithAPIVersion(value string) *CatalogApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithName(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithGenerateName(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithNamespace(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithUID(value types.UID) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithResourceVersion(value string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithGeneration(value int64) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CatalogApplyConfiguration) WithLabels(entries map[string]string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CatalogApplyConfiguration) WithAnnotations(entries map[string]string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CatalogApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CatalogApplyConfiguration) WithFinalizers(values ...string) *CatalogApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *CatalogApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithSpec(value walruscorev1.CatalogSpec) *CatalogApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CatalogApplyConfiguration) WithStatus(value walruscorev1.CatalogStatus) *CatalogApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walruscore/v1/connector.go b/pkg/clients/applyconfiguration/walruscore/v1/connector.go new file mode 100644 index 000000000..b58c360b7 --- /dev/null +++ b/pkg/clients/applyconfiguration/walruscore/v1/connector.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ConnectorApplyConfiguration represents an declarative configuration of the Connector type for use +// with apply. +type ConnectorApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ConnectorSpec `json:"spec,omitempty"` + Status *walruscorev1.ConnectorStatus `json:"status,omitempty"` +} + +// Connector constructs an declarative configuration of the Connector type for use with +// apply. +func Connector(name, namespace string) *ConnectorApplyConfiguration { + b := &ConnectorApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Connector") + b.WithAPIVersion("walruscore.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithKind(value string) *ConnectorApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithAPIVersion(value string) *ConnectorApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithName(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithGenerateName(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithNamespace(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithUID(value types.UID) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithResourceVersion(value string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithGeneration(value int64) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ConnectorApplyConfiguration) WithLabels(entries map[string]string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ConnectorApplyConfiguration) WithAnnotations(entries map[string]string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ConnectorApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ConnectorApplyConfiguration) WithFinalizers(values ...string) *ConnectorApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ConnectorApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithSpec(value walruscorev1.ConnectorSpec) *ConnectorApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ConnectorApplyConfiguration) WithStatus(value walruscorev1.ConnectorStatus) *ConnectorApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walruscore/v1/resource.go b/pkg/clients/applyconfiguration/walruscore/v1/resource.go new file mode 100644 index 000000000..0f3ae3ebf --- /dev/null +++ b/pkg/clients/applyconfiguration/walruscore/v1/resource.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceApplyConfiguration represents an declarative configuration of the Resource type for use +// with apply. +type ResourceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ResourceSpec `json:"spec,omitempty"` + Status *walruscorev1.ResourceStatus `json:"status,omitempty"` +} + +// Resource constructs an declarative configuration of the Resource type for use with +// apply. +func Resource(name, namespace string) *ResourceApplyConfiguration { + b := &ResourceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Resource") + b.WithAPIVersion("walruscore.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithKind(value string) *ResourceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithAPIVersion(value string) *ResourceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithName(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithGenerateName(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithNamespace(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithUID(value types.UID) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithResourceVersion(value string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithGeneration(value int64) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceApplyConfiguration) WithLabels(entries map[string]string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceApplyConfiguration) WithFinalizers(values ...string) *ResourceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithSpec(value walruscorev1.ResourceSpec) *ResourceApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceApplyConfiguration) WithStatus(value walruscorev1.ResourceStatus) *ResourceApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walruscore/v1/resourcedefinition.go b/pkg/clients/applyconfiguration/walruscore/v1/resourcedefinition.go new file mode 100644 index 000000000..68f9e3d31 --- /dev/null +++ b/pkg/clients/applyconfiguration/walruscore/v1/resourcedefinition.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceDefinitionApplyConfiguration represents an declarative configuration of the ResourceDefinition type for use +// with apply. +type ResourceDefinitionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ResourceDefinitionSpec `json:"spec,omitempty"` + Status *walruscorev1.ResourceDefinitionStatus `json:"status,omitempty"` +} + +// ResourceDefinition constructs an declarative configuration of the ResourceDefinition type for use with +// apply. +func ResourceDefinition(name, namespace string) *ResourceDefinitionApplyConfiguration { + b := &ResourceDefinitionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceDefinition") + b.WithAPIVersion("walruscore.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithKind(value string) *ResourceDefinitionApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithAPIVersion(value string) *ResourceDefinitionApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithName(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithGenerateName(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithNamespace(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithUID(value types.UID) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithResourceVersion(value string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithGeneration(value int64) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceDefinitionApplyConfiguration) WithLabels(entries map[string]string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceDefinitionApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceDefinitionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceDefinitionApplyConfiguration) WithFinalizers(values ...string) *ResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceDefinitionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithSpec(value walruscorev1.ResourceDefinitionSpec) *ResourceDefinitionApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceDefinitionApplyConfiguration) WithStatus(value walruscorev1.ResourceDefinitionStatus) *ResourceDefinitionApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walruscore/v1/resourcerun.go b/pkg/clients/applyconfiguration/walruscore/v1/resourcerun.go new file mode 100644 index 000000000..acf9f813d --- /dev/null +++ b/pkg/clients/applyconfiguration/walruscore/v1/resourcerun.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceRunApplyConfiguration represents an declarative configuration of the ResourceRun type for use +// with apply. +type ResourceRunApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.ResourceDefinitionSpec `json:"spec,omitempty"` + Status *walruscorev1.ResourceDefinitionStatus `json:"status,omitempty"` +} + +// ResourceRun constructs an declarative configuration of the ResourceRun type for use with +// apply. +func ResourceRun(name, namespace string) *ResourceRunApplyConfiguration { + b := &ResourceRunApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceRun") + b.WithAPIVersion("walruscore.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithKind(value string) *ResourceRunApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithAPIVersion(value string) *ResourceRunApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithName(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithGenerateName(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithNamespace(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithUID(value types.UID) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithResourceVersion(value string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithGeneration(value int64) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceRunApplyConfiguration) WithLabels(entries map[string]string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceRunApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceRunApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceRunApplyConfiguration) WithFinalizers(values ...string) *ResourceRunApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceRunApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithSpec(value walruscorev1.ResourceDefinitionSpec) *ResourceRunApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourceRunApplyConfiguration) WithStatus(value walruscorev1.ResourceDefinitionStatus) *ResourceRunApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/applyconfiguration/walruscore/v1/template.go b/pkg/clients/applyconfiguration/walruscore/v1/template.go new file mode 100644 index 000000000..527640379 --- /dev/null +++ b/pkg/clients/applyconfiguration/walruscore/v1/template.go @@ -0,0 +1,207 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TemplateApplyConfiguration represents an declarative configuration of the Template type for use +// with apply. +type TemplateApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *walruscorev1.TemplateSpec `json:"spec,omitempty"` + Status *walruscorev1.TemplateStatus `json:"status,omitempty"` +} + +// Template constructs an declarative configuration of the Template type for use with +// apply. +func Template(name, namespace string) *TemplateApplyConfiguration { + b := &TemplateApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Template") + b.WithAPIVersion("walruscore.seal.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithKind(value string) *TemplateApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithAPIVersion(value string) *TemplateApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithName(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithGenerateName(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithNamespace(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithUID(value types.UID) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithResourceVersion(value string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithGeneration(value int64) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TemplateApplyConfiguration) WithLabels(entries map[string]string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TemplateApplyConfiguration) WithAnnotations(entries map[string]string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TemplateApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TemplateApplyConfiguration) WithFinalizers(values ...string) *TemplateApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *TemplateApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithSpec(value walruscorev1.TemplateSpec) *TemplateApplyConfiguration { + b.Spec = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *TemplateApplyConfiguration) WithStatus(value walruscorev1.TemplateStatus) *TemplateApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/clients/clientset/clientset.go b/pkg/clients/clientset/clientset.go new file mode 100644 index 000000000..925ec024f --- /dev/null +++ b/pkg/clients/clientset/clientset.go @@ -0,0 +1,354 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package clientset + +import ( + "fmt" + "net/http" + + admissionv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admission/v1" + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admissionregistration/v1" + apiextensionsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiextensions/v1" + apiregistrationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiregistration/v1" + appsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apps/v1" + authenticationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authentication/v1" + authorizationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authorization/v1" + autoscalingv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v1" + autoscalingv2 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v2" + batchv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/batch/v1" + certificatesv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/certificates/v1" + coordinationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/coordination/v1" + corev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/core/v1" + discoveryv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/discovery/v1" + eventsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/events/v1" + rbacv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/rbac/v1" + schedulingv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/scheduling/v1" + storagev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/storage/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walrus/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walruscore/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + WalruscoreV1() walruscorev1.WalruscoreV1Interface + WalrusV1() walrusv1.WalrusV1Interface + AdmissionV1() admissionv1.AdmissionV1Interface + AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface + AppsV1() appsv1.AppsV1Interface + AuthenticationV1() authenticationv1.AuthenticationV1Interface + AuthorizationV1() authorizationv1.AuthorizationV1Interface + AutoscalingV1() autoscalingv1.AutoscalingV1Interface + AutoscalingV2() autoscalingv2.AutoscalingV2Interface + BatchV1() batchv1.BatchV1Interface + CertificatesV1() certificatesv1.CertificatesV1Interface + CoordinationV1() coordinationv1.CoordinationV1Interface + CoreV1() corev1.CoreV1Interface + DiscoveryV1() discoveryv1.DiscoveryV1Interface + EventsV1() eventsv1.EventsV1Interface + RbacV1() rbacv1.RbacV1Interface + SchedulingV1() schedulingv1.SchedulingV1Interface + StorageV1() storagev1.StorageV1Interface + ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface + ApiregistrationV1() apiregistrationv1.ApiregistrationV1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + walruscoreV1 *walruscorev1.WalruscoreV1Client + walrusV1 *walrusv1.WalrusV1Client + admissionV1 *admissionv1.AdmissionV1Client + admissionregistrationV1 *admissionregistrationv1.AdmissionregistrationV1Client + appsV1 *appsv1.AppsV1Client + authenticationV1 *authenticationv1.AuthenticationV1Client + authorizationV1 *authorizationv1.AuthorizationV1Client + autoscalingV1 *autoscalingv1.AutoscalingV1Client + autoscalingV2 *autoscalingv2.AutoscalingV2Client + batchV1 *batchv1.BatchV1Client + certificatesV1 *certificatesv1.CertificatesV1Client + coordinationV1 *coordinationv1.CoordinationV1Client + coreV1 *corev1.CoreV1Client + discoveryV1 *discoveryv1.DiscoveryV1Client + eventsV1 *eventsv1.EventsV1Client + rbacV1 *rbacv1.RbacV1Client + schedulingV1 *schedulingv1.SchedulingV1Client + storageV1 *storagev1.StorageV1Client + apiextensionsV1 *apiextensionsv1.ApiextensionsV1Client + apiregistrationV1 *apiregistrationv1.ApiregistrationV1Client +} + +// WalruscoreV1 retrieves the WalruscoreV1Client +func (c *Clientset) WalruscoreV1() walruscorev1.WalruscoreV1Interface { + return c.walruscoreV1 +} + +// WalrusV1 retrieves the WalrusV1Client +func (c *Clientset) WalrusV1() walrusv1.WalrusV1Interface { + return c.walrusV1 +} + +// AdmissionV1 retrieves the AdmissionV1Client +func (c *Clientset) AdmissionV1() admissionv1.AdmissionV1Interface { + return c.admissionV1 +} + +// AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client +func (c *Clientset) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface { + return c.admissionregistrationV1 +} + +// AppsV1 retrieves the AppsV1Client +func (c *Clientset) AppsV1() appsv1.AppsV1Interface { + return c.appsV1 +} + +// AuthenticationV1 retrieves the AuthenticationV1Client +func (c *Clientset) AuthenticationV1() authenticationv1.AuthenticationV1Interface { + return c.authenticationV1 +} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface { + return c.authorizationV1 +} + +// AutoscalingV1 retrieves the AutoscalingV1Client +func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { + return c.autoscalingV1 +} + +// AutoscalingV2 retrieves the AutoscalingV2Client +func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { + return c.autoscalingV2 +} + +// BatchV1 retrieves the BatchV1Client +func (c *Clientset) BatchV1() batchv1.BatchV1Interface { + return c.batchV1 +} + +// CertificatesV1 retrieves the CertificatesV1Client +func (c *Clientset) CertificatesV1() certificatesv1.CertificatesV1Interface { + return c.certificatesV1 +} + +// CoordinationV1 retrieves the CoordinationV1Client +func (c *Clientset) CoordinationV1() coordinationv1.CoordinationV1Interface { + return c.coordinationV1 +} + +// CoreV1 retrieves the CoreV1Client +func (c *Clientset) CoreV1() corev1.CoreV1Interface { + return c.coreV1 +} + +// DiscoveryV1 retrieves the DiscoveryV1Client +func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface { + return c.discoveryV1 +} + +// EventsV1 retrieves the EventsV1Client +func (c *Clientset) EventsV1() eventsv1.EventsV1Interface { + return c.eventsV1 +} + +// RbacV1 retrieves the RbacV1Client +func (c *Clientset) RbacV1() rbacv1.RbacV1Interface { + return c.rbacV1 +} + +// SchedulingV1 retrieves the SchedulingV1Client +func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { + return c.schedulingV1 +} + +// StorageV1 retrieves the StorageV1Client +func (c *Clientset) StorageV1() storagev1.StorageV1Interface { + return c.storageV1 +} + +// ApiextensionsV1 retrieves the ApiextensionsV1Client +func (c *Clientset) ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface { + return c.apiextensionsV1 +} + +// ApiregistrationV1 retrieves the ApiregistrationV1Client +func (c *Clientset) ApiregistrationV1() apiregistrationv1.ApiregistrationV1Interface { + return c.apiregistrationV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.walruscoreV1, err = walruscorev1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.walrusV1, err = walrusv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.admissionV1, err = admissionv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.admissionregistrationV1, err = admissionregistrationv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.appsV1, err = appsv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.authenticationV1, err = authenticationv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.authorizationV1, err = authorizationv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.autoscalingV1, err = autoscalingv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.autoscalingV2, err = autoscalingv2.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.batchV1, err = batchv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.certificatesV1, err = certificatesv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.coordinationV1, err = coordinationv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.coreV1, err = corev1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.discoveryV1, err = discoveryv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.eventsV1, err = eventsv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.rbacV1, err = rbacv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.schedulingV1, err = schedulingv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.storageV1, err = storagev1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.apiextensionsV1, err = apiextensionsv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.apiregistrationV1, err = apiregistrationv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.walruscoreV1 = walruscorev1.New(c) + cs.walrusV1 = walrusv1.New(c) + cs.admissionV1 = admissionv1.New(c) + cs.admissionregistrationV1 = admissionregistrationv1.New(c) + cs.appsV1 = appsv1.New(c) + cs.authenticationV1 = authenticationv1.New(c) + cs.authorizationV1 = authorizationv1.New(c) + cs.autoscalingV1 = autoscalingv1.New(c) + cs.autoscalingV2 = autoscalingv2.New(c) + cs.batchV1 = batchv1.New(c) + cs.certificatesV1 = certificatesv1.New(c) + cs.coordinationV1 = coordinationv1.New(c) + cs.coreV1 = corev1.New(c) + cs.discoveryV1 = discoveryv1.New(c) + cs.eventsV1 = eventsv1.New(c) + cs.rbacV1 = rbacv1.New(c) + cs.schedulingV1 = schedulingv1.New(c) + cs.storageV1 = storagev1.New(c) + cs.apiextensionsV1 = apiextensionsv1.New(c) + cs.apiregistrationV1 = apiregistrationv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/pkg/clients/clientset/fake/clientset_generated.go b/pkg/clients/clientset/fake/clientset_generated.go new file mode 100644 index 000000000..c82d74b16 --- /dev/null +++ b/pkg/clients/clientset/fake/clientset_generated.go @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + admissionv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admission/v1" + fakeadmissionv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admission/v1/fake" + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admissionregistration/v1" + fakeadmissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admissionregistration/v1/fake" + apiextensionsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiextensions/v1" + fakeapiextensionsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiextensions/v1/fake" + apiregistrationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiregistration/v1" + fakeapiregistrationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiregistration/v1/fake" + appsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apps/v1" + fakeappsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apps/v1/fake" + authenticationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authentication/v1" + fakeauthenticationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authentication/v1/fake" + authorizationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authorization/v1" + fakeauthorizationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authorization/v1/fake" + autoscalingv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v1" + fakeautoscalingv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v1/fake" + autoscalingv2 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v2" + fakeautoscalingv2 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v2/fake" + batchv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/batch/v1" + fakebatchv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/batch/v1/fake" + certificatesv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/certificates/v1" + fakecertificatesv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/certificates/v1/fake" + coordinationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/coordination/v1" + fakecoordinationv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/coordination/v1/fake" + corev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/core/v1" + fakecorev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/core/v1/fake" + discoveryv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/discovery/v1" + fakediscoveryv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/discovery/v1/fake" + eventsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/events/v1" + fakeeventsv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/events/v1/fake" + rbacv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/rbac/v1" + fakerbacv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/rbac/v1/fake" + schedulingv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/scheduling/v1" + fakeschedulingv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/scheduling/v1/fake" + storagev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/storage/v1" + fakestoragev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/storage/v1/fake" + walrusv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walrus/v1" + fakewalrusv1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walrus/v1/fake" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walruscore/v1" + fakewalruscorev1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walruscore/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// WalruscoreV1 retrieves the WalruscoreV1Client +func (c *Clientset) WalruscoreV1() walruscorev1.WalruscoreV1Interface { + return &fakewalruscorev1.FakeWalruscoreV1{Fake: &c.Fake} +} + +// WalrusV1 retrieves the WalrusV1Client +func (c *Clientset) WalrusV1() walrusv1.WalrusV1Interface { + return &fakewalrusv1.FakeWalrusV1{Fake: &c.Fake} +} + +// AdmissionV1 retrieves the AdmissionV1Client +func (c *Clientset) AdmissionV1() admissionv1.AdmissionV1Interface { + return &fakeadmissionv1.FakeAdmissionV1{Fake: &c.Fake} +} + +// AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client +func (c *Clientset) AdmissionregistrationV1() admissionregistrationv1.AdmissionregistrationV1Interface { + return &fakeadmissionregistrationv1.FakeAdmissionregistrationV1{Fake: &c.Fake} +} + +// AppsV1 retrieves the AppsV1Client +func (c *Clientset) AppsV1() appsv1.AppsV1Interface { + return &fakeappsv1.FakeAppsV1{Fake: &c.Fake} +} + +// AuthenticationV1 retrieves the AuthenticationV1Client +func (c *Clientset) AuthenticationV1() authenticationv1.AuthenticationV1Interface { + return &fakeauthenticationv1.FakeAuthenticationV1{Fake: &c.Fake} +} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface { + return &fakeauthorizationv1.FakeAuthorizationV1{Fake: &c.Fake} +} + +// AutoscalingV1 retrieves the AutoscalingV1Client +func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { + return &fakeautoscalingv1.FakeAutoscalingV1{Fake: &c.Fake} +} + +// AutoscalingV2 retrieves the AutoscalingV2Client +func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { + return &fakeautoscalingv2.FakeAutoscalingV2{Fake: &c.Fake} +} + +// BatchV1 retrieves the BatchV1Client +func (c *Clientset) BatchV1() batchv1.BatchV1Interface { + return &fakebatchv1.FakeBatchV1{Fake: &c.Fake} +} + +// CertificatesV1 retrieves the CertificatesV1Client +func (c *Clientset) CertificatesV1() certificatesv1.CertificatesV1Interface { + return &fakecertificatesv1.FakeCertificatesV1{Fake: &c.Fake} +} + +// CoordinationV1 retrieves the CoordinationV1Client +func (c *Clientset) CoordinationV1() coordinationv1.CoordinationV1Interface { + return &fakecoordinationv1.FakeCoordinationV1{Fake: &c.Fake} +} + +// CoreV1 retrieves the CoreV1Client +func (c *Clientset) CoreV1() corev1.CoreV1Interface { + return &fakecorev1.FakeCoreV1{Fake: &c.Fake} +} + +// DiscoveryV1 retrieves the DiscoveryV1Client +func (c *Clientset) DiscoveryV1() discoveryv1.DiscoveryV1Interface { + return &fakediscoveryv1.FakeDiscoveryV1{Fake: &c.Fake} +} + +// EventsV1 retrieves the EventsV1Client +func (c *Clientset) EventsV1() eventsv1.EventsV1Interface { + return &fakeeventsv1.FakeEventsV1{Fake: &c.Fake} +} + +// RbacV1 retrieves the RbacV1Client +func (c *Clientset) RbacV1() rbacv1.RbacV1Interface { + return &fakerbacv1.FakeRbacV1{Fake: &c.Fake} +} + +// SchedulingV1 retrieves the SchedulingV1Client +func (c *Clientset) SchedulingV1() schedulingv1.SchedulingV1Interface { + return &fakeschedulingv1.FakeSchedulingV1{Fake: &c.Fake} +} + +// StorageV1 retrieves the StorageV1Client +func (c *Clientset) StorageV1() storagev1.StorageV1Interface { + return &fakestoragev1.FakeStorageV1{Fake: &c.Fake} +} + +// ApiextensionsV1 retrieves the ApiextensionsV1Client +func (c *Clientset) ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface { + return &fakeapiextensionsv1.FakeApiextensionsV1{Fake: &c.Fake} +} + +// ApiregistrationV1 retrieves the ApiregistrationV1Client +func (c *Clientset) ApiregistrationV1() apiregistrationv1.ApiregistrationV1Interface { + return &fakeapiregistrationv1.FakeApiregistrationV1{Fake: &c.Fake} +} diff --git a/pkg/clients/clientset/fake/doc.go b/pkg/clients/clientset/fake/doc.go new file mode 100644 index 000000000..e36efa024 --- /dev/null +++ b/pkg/clients/clientset/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/pkg/clients/clientset/fake/register.go b/pkg/clients/clientset/fake/register.go new file mode 100644 index 000000000..2996e5a6c --- /dev/null +++ b/pkg/clients/clientset/fake/register.go @@ -0,0 +1,81 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + admissionv1 "k8s.io/api/admission/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + appsv1 "k8s.io/api/apps/v1" + authenticationv1 "k8s.io/api/authentication/v1" + authorizationv1 "k8s.io/api/authorization/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + autoscalingv2 "k8s.io/api/autoscaling/v2" + batchv1 "k8s.io/api/batch/v1" + certificatesv1 "k8s.io/api/certificates/v1" + coordinationv1 "k8s.io/api/coordination/v1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + eventsv1 "k8s.io/api/events/v1" + rbacv1 "k8s.io/api/rbac/v1" + schedulingv1 "k8s.io/api/scheduling/v1" + storagev1 "k8s.io/api/storage/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + walruscorev1.AddToScheme, + walrusv1.AddToScheme, + admissionv1.AddToScheme, + admissionregistrationv1.AddToScheme, + appsv1.AddToScheme, + authenticationv1.AddToScheme, + authorizationv1.AddToScheme, + autoscalingv1.AddToScheme, + autoscalingv2.AddToScheme, + batchv1.AddToScheme, + certificatesv1.AddToScheme, + coordinationv1.AddToScheme, + corev1.AddToScheme, + discoveryv1.AddToScheme, + eventsv1.AddToScheme, + rbacv1.AddToScheme, + schedulingv1.AddToScheme, + storagev1.AddToScheme, + apiextensionsv1.AddToScheme, + apiregistrationv1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/pkg/clients/clientset/scheme/doc.go b/pkg/clients/clientset/scheme/doc.go new file mode 100644 index 000000000..95b4da1e9 --- /dev/null +++ b/pkg/clients/clientset/scheme/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/pkg/clients/clientset/scheme/register.go b/pkg/clients/clientset/scheme/register.go new file mode 100644 index 000000000..6a04f2b4d --- /dev/null +++ b/pkg/clients/clientset/scheme/register.go @@ -0,0 +1,81 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package scheme + +import ( + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + admissionv1 "k8s.io/api/admission/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + appsv1 "k8s.io/api/apps/v1" + authenticationv1 "k8s.io/api/authentication/v1" + authorizationv1 "k8s.io/api/authorization/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + autoscalingv2 "k8s.io/api/autoscaling/v2" + batchv1 "k8s.io/api/batch/v1" + certificatesv1 "k8s.io/api/certificates/v1" + coordinationv1 "k8s.io/api/coordination/v1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + eventsv1 "k8s.io/api/events/v1" + rbacv1 "k8s.io/api/rbac/v1" + schedulingv1 "k8s.io/api/scheduling/v1" + storagev1 "k8s.io/api/storage/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + walruscorev1.AddToScheme, + walrusv1.AddToScheme, + admissionv1.AddToScheme, + admissionregistrationv1.AddToScheme, + appsv1.AddToScheme, + authenticationv1.AddToScheme, + authorizationv1.AddToScheme, + autoscalingv1.AddToScheme, + autoscalingv2.AddToScheme, + batchv1.AddToScheme, + certificatesv1.AddToScheme, + coordinationv1.AddToScheme, + corev1.AddToScheme, + discoveryv1.AddToScheme, + eventsv1.AddToScheme, + rbacv1.AddToScheme, + schedulingv1.AddToScheme, + storagev1.AddToScheme, + apiextensionsv1.AddToScheme, + apiregistrationv1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/pkg/clients/clientset/typed/admission/v1/admission_client.go b/pkg/clients/clientset/typed/admission/v1/admission_client.go new file mode 100644 index 000000000..bd9664de1 --- /dev/null +++ b/pkg/clients/clientset/typed/admission/v1/admission_client.go @@ -0,0 +1,89 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/admission/v1" + rest "k8s.io/client-go/rest" +) + +type AdmissionV1Interface interface { + RESTClient() rest.Interface +} + +// AdmissionV1Client is used to interact with features provided by the admission.k8s.io group. +type AdmissionV1Client struct { + restClient rest.Interface +} + +// NewForConfig creates a new AdmissionV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AdmissionV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AdmissionV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AdmissionV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AdmissionV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AdmissionV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AdmissionV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AdmissionV1Client for the given RESTClient. +func New(c rest.Interface) *AdmissionV1Client { + return &AdmissionV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AdmissionV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/admission/v1/doc.go b/pkg/clients/clientset/typed/admission/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/admission/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/admission/v1/fake/doc.go b/pkg/clients/clientset/typed/admission/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/admission/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/admission/v1/fake/fake_admission_client.go b/pkg/clients/clientset/typed/admission/v1/fake/fake_admission_client.go new file mode 100644 index 000000000..f45e88f07 --- /dev/null +++ b/pkg/clients/clientset/typed/admission/v1/fake/fake_admission_client.go @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAdmissionV1 struct { + *testing.Fake +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAdmissionV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/admission/v1/generated_expansion.go b/pkg/clients/clientset/typed/admission/v1/generated_expansion.go new file mode 100644 index 000000000..2fe0385ab --- /dev/null +++ b/pkg/clients/clientset/typed/admission/v1/generated_expansion.go @@ -0,0 +1,6 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/admissionregistration_client.go b/pkg/clients/clientset/typed/admissionregistration/v1/admissionregistration_client.go new file mode 100644 index 000000000..b3970d367 --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/admissionregistration_client.go @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/admissionregistration/v1" + rest "k8s.io/client-go/rest" +) + +type AdmissionregistrationV1Interface interface { + RESTClient() rest.Interface + MutatingWebhookConfigurationsGetter + ValidatingWebhookConfigurationsGetter +} + +// AdmissionregistrationV1Client is used to interact with features provided by the admissionregistration.k8s.io group. +type AdmissionregistrationV1Client struct { + restClient rest.Interface +} + +func (c *AdmissionregistrationV1Client) MutatingWebhookConfigurations() MutatingWebhookConfigurationInterface { + return newMutatingWebhookConfigurations(c) +} + +func (c *AdmissionregistrationV1Client) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInterface { + return newValidatingWebhookConfigurations(c) +} + +// NewForConfig creates a new AdmissionregistrationV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AdmissionregistrationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AdmissionregistrationV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AdmissionregistrationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AdmissionregistrationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AdmissionregistrationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AdmissionregistrationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AdmissionregistrationV1Client for the given RESTClient. +func New(c rest.Interface) *AdmissionregistrationV1Client { + return &AdmissionregistrationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AdmissionregistrationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/doc.go b/pkg/clients/clientset/typed/admissionregistration/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/fake/doc.go b/pkg/clients/clientset/typed/admissionregistration/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go b/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go new file mode 100644 index 000000000..f7a87f12f --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/admissionregistration/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAdmissionregistrationV1 struct { + *testing.Fake +} + +func (c *FakeAdmissionregistrationV1) MutatingWebhookConfigurations() v1.MutatingWebhookConfigurationInterface { + return &FakeMutatingWebhookConfigurations{c} +} + +func (c *FakeAdmissionregistrationV1) ValidatingWebhookConfigurations() v1.ValidatingWebhookConfigurationInterface { + return &FakeValidatingWebhookConfigurations{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAdmissionregistrationV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_mutatingwebhookconfiguration.go b/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_mutatingwebhookconfiguration.go new file mode 100644 index 000000000..79876778c --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_mutatingwebhookconfiguration.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/admissionregistration/v1" + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeMutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface +type FakeMutatingWebhookConfigurations struct { + Fake *FakeAdmissionregistrationV1 +} + +var mutatingwebhookconfigurationsResource = v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations") + +var mutatingwebhookconfigurationsKind = v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration") + +// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any. +func (c *FakeMutatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.MutatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(mutatingwebhookconfigurationsResource, name), &v1.MutatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.MutatingWebhookConfiguration), err +} + +// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors. +func (c *FakeMutatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.MutatingWebhookConfigurationList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(mutatingwebhookconfigurationsResource, mutatingwebhookconfigurationsKind, opts), &v1.MutatingWebhookConfigurationList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.MutatingWebhookConfigurationList{ListMeta: obj.(*v1.MutatingWebhookConfigurationList).ListMeta} + for _, item := range obj.(*v1.MutatingWebhookConfigurationList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations. +func (c *FakeMutatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(mutatingwebhookconfigurationsResource, opts)) +} + +// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any. +func (c *FakeMutatingWebhookConfigurations) Create(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.MutatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1.MutatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.MutatingWebhookConfiguration), err +} + +// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any. +func (c *FakeMutatingWebhookConfigurations) Update(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.MutatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1.MutatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.MutatingWebhookConfiguration), err +} + +// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs. +func (c *FakeMutatingWebhookConfigurations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(mutatingwebhookconfigurationsResource, name, opts), &v1.MutatingWebhookConfiguration{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMutatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(mutatingwebhookconfigurationsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.MutatingWebhookConfigurationList{}) + return err +} + +// Patch applies the patch and returns the patched mutatingWebhookConfiguration. +func (c *FakeMutatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(mutatingwebhookconfigurationsResource, name, pt, data, subresources...), &v1.MutatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.MutatingWebhookConfiguration), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingWebhookConfiguration. +func (c *FakeMutatingWebhookConfigurations) Apply(ctx context.Context, mutatingWebhookConfiguration *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MutatingWebhookConfiguration, err error) { + if mutatingWebhookConfiguration == nil { + return nil, fmt.Errorf("mutatingWebhookConfiguration provided to Apply must not be nil") + } + data, err := json.Marshal(mutatingWebhookConfiguration) + if err != nil { + return nil, err + } + name := mutatingWebhookConfiguration.Name + if name == nil { + return nil, fmt.Errorf("mutatingWebhookConfiguration.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(mutatingwebhookconfigurationsResource, *name, types.ApplyPatchType, data), &v1.MutatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.MutatingWebhookConfiguration), err +} diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_validatingwebhookconfiguration.go b/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_validatingwebhookconfiguration.go new file mode 100644 index 000000000..49d91f608 --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/fake/fake_validatingwebhookconfiguration.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/admissionregistration/v1" + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeValidatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface +type FakeValidatingWebhookConfigurations struct { + Fake *FakeAdmissionregistrationV1 +} + +var validatingwebhookconfigurationsResource = v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations") + +var validatingwebhookconfigurationsKind = v1.SchemeGroupVersion.WithKind("ValidatingWebhookConfiguration") + +// Get takes name of the validatingWebhookConfiguration, and returns the corresponding validatingWebhookConfiguration object, and an error if there is any. +func (c *FakeValidatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(validatingwebhookconfigurationsResource, name), &v1.ValidatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ValidatingWebhookConfiguration), err +} + +// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors. +func (c *FakeValidatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ValidatingWebhookConfigurationList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(validatingwebhookconfigurationsResource, validatingwebhookconfigurationsKind, opts), &v1.ValidatingWebhookConfigurationList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ValidatingWebhookConfigurationList{ListMeta: obj.(*v1.ValidatingWebhookConfigurationList).ListMeta} + for _, item := range obj.(*v1.ValidatingWebhookConfigurationList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations. +func (c *FakeValidatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(validatingwebhookconfigurationsResource, opts)) +} + +// Create takes the representation of a validatingWebhookConfiguration and creates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any. +func (c *FakeValidatingWebhookConfigurations) Create(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(validatingwebhookconfigurationsResource, validatingWebhookConfiguration), &v1.ValidatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ValidatingWebhookConfiguration), err +} + +// Update takes the representation of a validatingWebhookConfiguration and updates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any. +func (c *FakeValidatingWebhookConfigurations) Update(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(validatingwebhookconfigurationsResource, validatingWebhookConfiguration), &v1.ValidatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ValidatingWebhookConfiguration), err +} + +// Delete takes name of the validatingWebhookConfiguration and deletes it. Returns an error if one occurs. +func (c *FakeValidatingWebhookConfigurations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(validatingwebhookconfigurationsResource, name, opts), &v1.ValidatingWebhookConfiguration{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeValidatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(validatingwebhookconfigurationsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ValidatingWebhookConfigurationList{}) + return err +} + +// Patch applies the patch and returns the patched validatingWebhookConfiguration. +func (c *FakeValidatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingWebhookConfiguration, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(validatingwebhookconfigurationsResource, name, pt, data, subresources...), &v1.ValidatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ValidatingWebhookConfiguration), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied validatingWebhookConfiguration. +func (c *FakeValidatingWebhookConfigurations) Apply(ctx context.Context, validatingWebhookConfiguration *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + if validatingWebhookConfiguration == nil { + return nil, fmt.Errorf("validatingWebhookConfiguration provided to Apply must not be nil") + } + data, err := json.Marshal(validatingWebhookConfiguration) + if err != nil { + return nil, err + } + name := validatingWebhookConfiguration.Name + if name == nil { + return nil, fmt.Errorf("validatingWebhookConfiguration.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(validatingwebhookconfigurationsResource, *name, types.ApplyPatchType, data), &v1.ValidatingWebhookConfiguration{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ValidatingWebhookConfiguration), err +} diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/generated_expansion.go b/pkg/clients/clientset/typed/admissionregistration/v1/generated_expansion.go new file mode 100644 index 000000000..f7bd5a662 --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/generated_expansion.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type MutatingWebhookConfigurationExpansion interface{} + +type ValidatingWebhookConfigurationExpansion interface{} diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/mutatingwebhookconfiguration.go b/pkg/clients/clientset/typed/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..1b1843931 --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/admissionregistration/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MutatingWebhookConfigurationsGetter has a method to return a MutatingWebhookConfigurationInterface. +// A group's client should implement this interface. +type MutatingWebhookConfigurationsGetter interface { + MutatingWebhookConfigurations() MutatingWebhookConfigurationInterface +} + +// MutatingWebhookConfigurationInterface has methods to work with MutatingWebhookConfiguration resources. +type MutatingWebhookConfigurationInterface interface { + Create(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*v1.MutatingWebhookConfiguration, error) + Update(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.MutatingWebhookConfiguration, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.MutatingWebhookConfiguration, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.MutatingWebhookConfigurationList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error) + Apply(ctx context.Context, mutatingWebhookConfiguration *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MutatingWebhookConfiguration, err error) + MutatingWebhookConfigurationExpansion +} + +// mutatingWebhookConfigurations implements MutatingWebhookConfigurationInterface +type mutatingWebhookConfigurations struct { + client rest.Interface +} + +// newMutatingWebhookConfigurations returns a MutatingWebhookConfigurations +func newMutatingWebhookConfigurations(c *AdmissionregistrationV1Client) *mutatingWebhookConfigurations { + return &mutatingWebhookConfigurations{ + client: c.RESTClient(), + } +} + +// Get takes name of the mutatingWebhookConfiguration, and returns the corresponding mutatingWebhookConfiguration object, and an error if there is any. +func (c *mutatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.MutatingWebhookConfiguration, err error) { + result = &v1.MutatingWebhookConfiguration{} + err = c.client.Get(). + Resource("mutatingwebhookconfigurations"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors. +func (c *mutatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.MutatingWebhookConfigurationList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.MutatingWebhookConfigurationList{} + err = c.client.Get(). + Resource("mutatingwebhookconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations. +func (c *mutatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("mutatingwebhookconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a mutatingWebhookConfiguration and creates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any. +func (c *mutatingWebhookConfigurations) Create(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.MutatingWebhookConfiguration, err error) { + result = &v1.MutatingWebhookConfiguration{} + err = c.client.Post(). + Resource("mutatingwebhookconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(mutatingWebhookConfiguration). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a mutatingWebhookConfiguration and updates it. Returns the server's representation of the mutatingWebhookConfiguration, and an error, if there is any. +func (c *mutatingWebhookConfigurations) Update(ctx context.Context, mutatingWebhookConfiguration *v1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.MutatingWebhookConfiguration, err error) { + result = &v1.MutatingWebhookConfiguration{} + err = c.client.Put(). + Resource("mutatingwebhookconfigurations"). + Name(mutatingWebhookConfiguration.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(mutatingWebhookConfiguration). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the mutatingWebhookConfiguration and deletes it. Returns an error if one occurs. +func (c *mutatingWebhookConfigurations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("mutatingwebhookconfigurations"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *mutatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("mutatingwebhookconfigurations"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched mutatingWebhookConfiguration. +func (c *mutatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.MutatingWebhookConfiguration, err error) { + result = &v1.MutatingWebhookConfiguration{} + err = c.client.Patch(pt). + Resource("mutatingwebhookconfigurations"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied mutatingWebhookConfiguration. +func (c *mutatingWebhookConfigurations) Apply(ctx context.Context, mutatingWebhookConfiguration *admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.MutatingWebhookConfiguration, err error) { + if mutatingWebhookConfiguration == nil { + return nil, fmt.Errorf("mutatingWebhookConfiguration provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(mutatingWebhookConfiguration) + if err != nil { + return nil, err + } + name := mutatingWebhookConfiguration.Name + if name == nil { + return nil, fmt.Errorf("mutatingWebhookConfiguration.Name must be provided to Apply") + } + result = &v1.MutatingWebhookConfiguration{} + err = c.client.Patch(types.ApplyPatchType). + Resource("mutatingwebhookconfigurations"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/admissionregistration/v1/validatingwebhookconfiguration.go b/pkg/clients/clientset/typed/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..f2b494e3b --- /dev/null +++ b/pkg/clients/clientset/typed/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + admissionregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/admissionregistration/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ValidatingWebhookConfigurationsGetter has a method to return a ValidatingWebhookConfigurationInterface. +// A group's client should implement this interface. +type ValidatingWebhookConfigurationsGetter interface { + ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInterface +} + +// ValidatingWebhookConfigurationInterface has methods to work with ValidatingWebhookConfiguration resources. +type ValidatingWebhookConfigurationInterface interface { + Create(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*v1.ValidatingWebhookConfiguration, error) + Update(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*v1.ValidatingWebhookConfiguration, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ValidatingWebhookConfiguration, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ValidatingWebhookConfigurationList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingWebhookConfiguration, err error) + Apply(ctx context.Context, validatingWebhookConfiguration *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingWebhookConfiguration, err error) + ValidatingWebhookConfigurationExpansion +} + +// validatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface +type validatingWebhookConfigurations struct { + client rest.Interface +} + +// newValidatingWebhookConfigurations returns a ValidatingWebhookConfigurations +func newValidatingWebhookConfigurations(c *AdmissionregistrationV1Client) *validatingWebhookConfigurations { + return &validatingWebhookConfigurations{ + client: c.RESTClient(), + } +} + +// Get takes name of the validatingWebhookConfiguration, and returns the corresponding validatingWebhookConfiguration object, and an error if there is any. +func (c *validatingWebhookConfigurations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + result = &v1.ValidatingWebhookConfiguration{} + err = c.client.Get(). + Resource("validatingwebhookconfigurations"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors. +func (c *validatingWebhookConfigurations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ValidatingWebhookConfigurationList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ValidatingWebhookConfigurationList{} + err = c.client.Get(). + Resource("validatingwebhookconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations. +func (c *validatingWebhookConfigurations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("validatingwebhookconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a validatingWebhookConfiguration and creates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any. +func (c *validatingWebhookConfigurations) Create(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + result = &v1.ValidatingWebhookConfiguration{} + err = c.client.Post(). + Resource("validatingwebhookconfigurations"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(validatingWebhookConfiguration). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a validatingWebhookConfiguration and updates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any. +func (c *validatingWebhookConfigurations) Update(ctx context.Context, validatingWebhookConfiguration *v1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + result = &v1.ValidatingWebhookConfiguration{} + err = c.client.Put(). + Resource("validatingwebhookconfigurations"). + Name(validatingWebhookConfiguration.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(validatingWebhookConfiguration). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the validatingWebhookConfiguration and deletes it. Returns an error if one occurs. +func (c *validatingWebhookConfigurations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("validatingwebhookconfigurations"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *validatingWebhookConfigurations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("validatingwebhookconfigurations"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched validatingWebhookConfiguration. +func (c *validatingWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ValidatingWebhookConfiguration, err error) { + result = &v1.ValidatingWebhookConfiguration{} + err = c.client.Patch(pt). + Resource("validatingwebhookconfigurations"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied validatingWebhookConfiguration. +func (c *validatingWebhookConfigurations) Apply(ctx context.Context, validatingWebhookConfiguration *admissionregistrationv1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ValidatingWebhookConfiguration, err error) { + if validatingWebhookConfiguration == nil { + return nil, fmt.Errorf("validatingWebhookConfiguration provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(validatingWebhookConfiguration) + if err != nil { + return nil, err + } + name := validatingWebhookConfiguration.Name + if name == nil { + return nil, fmt.Errorf("validatingWebhookConfiguration.Name must be provided to Apply") + } + result = &v1.ValidatingWebhookConfiguration{} + err = c.client.Patch(types.ApplyPatchType). + Resource("validatingwebhookconfigurations"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apiextensions/v1/apiextensions_client.go b/pkg/clients/clientset/typed/apiextensions/v1/apiextensions_client.go new file mode 100644 index 000000000..2e2fa52fb --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/apiextensions_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + rest "k8s.io/client-go/rest" +) + +type ApiextensionsV1Interface interface { + RESTClient() rest.Interface + CustomResourceDefinitionsGetter +} + +// ApiextensionsV1Client is used to interact with features provided by the apiextensions.k8s.io group. +type ApiextensionsV1Client struct { + restClient rest.Interface +} + +func (c *ApiextensionsV1Client) CustomResourceDefinitions() CustomResourceDefinitionInterface { + return newCustomResourceDefinitions(c) +} + +// NewForConfig creates a new ApiextensionsV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*ApiextensionsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new ApiextensionsV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ApiextensionsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &ApiextensionsV1Client{client}, nil +} + +// NewForConfigOrDie creates a new ApiextensionsV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ApiextensionsV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ApiextensionsV1Client for the given RESTClient. +func New(c rest.Interface) *ApiextensionsV1Client { + return &ApiextensionsV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ApiextensionsV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/apiextensions/v1/customresourcedefinition.go b/pkg/clients/clientset/typed/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 000000000..244dcf38f --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,230 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + apiextensionsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apiextensions/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CustomResourceDefinitionsGetter has a method to return a CustomResourceDefinitionInterface. +// A group's client should implement this interface. +type CustomResourceDefinitionsGetter interface { + CustomResourceDefinitions() CustomResourceDefinitionInterface +} + +// CustomResourceDefinitionInterface has methods to work with CustomResourceDefinition resources. +type CustomResourceDefinitionInterface interface { + Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.CreateOptions) (*v1.CustomResourceDefinition, error) + Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (*v1.CustomResourceDefinition, error) + UpdateStatus(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (*v1.CustomResourceDefinition, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CustomResourceDefinition, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CustomResourceDefinitionList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CustomResourceDefinition, err error) + Apply(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) + ApplyStatus(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) + CustomResourceDefinitionExpansion +} + +// customResourceDefinitions implements CustomResourceDefinitionInterface +type customResourceDefinitions struct { + client rest.Interface +} + +// newCustomResourceDefinitions returns a CustomResourceDefinitions +func newCustomResourceDefinitions(c *ApiextensionsV1Client) *customResourceDefinitions { + return &customResourceDefinitions{ + client: c.RESTClient(), + } +} + +// Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any. +func (c *customResourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CustomResourceDefinition, err error) { + result = &v1.CustomResourceDefinition{} + err = c.client.Get(). + Resource("customresourcedefinitions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors. +func (c *customResourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CustomResourceDefinitionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CustomResourceDefinitionList{} + err = c.client.Get(). + Resource("customresourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested customResourceDefinitions. +func (c *customResourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("customresourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any. +func (c *customResourceDefinitions) Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.CreateOptions) (result *v1.CustomResourceDefinition, err error) { + result = &v1.CustomResourceDefinition{} + err = c.client.Post(). + Resource("customresourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(customResourceDefinition). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any. +func (c *customResourceDefinitions) Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (result *v1.CustomResourceDefinition, err error) { + result = &v1.CustomResourceDefinition{} + err = c.client.Put(). + Resource("customresourcedefinitions"). + Name(customResourceDefinition.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(customResourceDefinition). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *customResourceDefinitions) UpdateStatus(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (result *v1.CustomResourceDefinition, err error) { + result = &v1.CustomResourceDefinition{} + err = c.client.Put(). + Resource("customresourcedefinitions"). + Name(customResourceDefinition.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(customResourceDefinition). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs. +func (c *customResourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("customresourcedefinitions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *customResourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("customresourcedefinitions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched customResourceDefinition. +func (c *customResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CustomResourceDefinition, err error) { + result = &v1.CustomResourceDefinition{} + err = c.client.Patch(pt). + Resource("customresourcedefinitions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied customResourceDefinition. +func (c *customResourceDefinitions) Apply(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) { + if customResourceDefinition == nil { + return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(customResourceDefinition) + if err != nil { + return nil, err + } + name := customResourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply") + } + result = &v1.CustomResourceDefinition{} + err = c.client.Patch(types.ApplyPatchType). + Resource("customresourcedefinitions"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *customResourceDefinitions) ApplyStatus(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) { + if customResourceDefinition == nil { + return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(customResourceDefinition) + if err != nil { + return nil, err + } + + name := customResourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply") + } + + result = &v1.CustomResourceDefinition{} + err = c.client.Patch(types.ApplyPatchType). + Resource("customresourcedefinitions"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apiextensions/v1/doc.go b/pkg/clients/clientset/typed/apiextensions/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/apiextensions/v1/fake/doc.go b/pkg/clients/clientset/typed/apiextensions/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/apiextensions/v1/fake/fake_apiextensions_client.go b/pkg/clients/clientset/typed/apiextensions/v1/fake/fake_apiextensions_client.go new file mode 100644 index 000000000..0ae1879cd --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/fake/fake_apiextensions_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiextensions/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeApiextensionsV1 struct { + *testing.Fake +} + +func (c *FakeApiextensionsV1) CustomResourceDefinitions() v1.CustomResourceDefinitionInterface { + return &FakeCustomResourceDefinitions{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeApiextensionsV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/apiextensions/v1/fake/fake_customresourcedefinition.go b/pkg/clients/clientset/typed/apiextensions/v1/fake/fake_customresourcedefinition.go new file mode 100644 index 000000000..9a93707be --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/fake/fake_customresourcedefinition.go @@ -0,0 +1,165 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + apiextensionsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apiextensions/v1" + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCustomResourceDefinitions implements CustomResourceDefinitionInterface +type FakeCustomResourceDefinitions struct { + Fake *FakeApiextensionsV1 +} + +var customresourcedefinitionsResource = v1.SchemeGroupVersion.WithResource("customresourcedefinitions") + +var customresourcedefinitionsKind = v1.SchemeGroupVersion.WithKind("CustomResourceDefinition") + +// Get takes name of the customResourceDefinition, and returns the corresponding customResourceDefinition object, and an error if there is any. +func (c *FakeCustomResourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CustomResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(customresourcedefinitionsResource, name), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} + +// List takes label and field selectors, and returns the list of CustomResourceDefinitions that match those selectors. +func (c *FakeCustomResourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CustomResourceDefinitionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(customresourcedefinitionsResource, customresourcedefinitionsKind, opts), &v1.CustomResourceDefinitionList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CustomResourceDefinitionList{ListMeta: obj.(*v1.CustomResourceDefinitionList).ListMeta} + for _, item := range obj.(*v1.CustomResourceDefinitionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested customResourceDefinitions. +func (c *FakeCustomResourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(customresourcedefinitionsResource, opts)) +} + +// Create takes the representation of a customResourceDefinition and creates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any. +func (c *FakeCustomResourceDefinitions) Create(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.CreateOptions) (result *v1.CustomResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(customresourcedefinitionsResource, customResourceDefinition), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} + +// Update takes the representation of a customResourceDefinition and updates it. Returns the server's representation of the customResourceDefinition, and an error, if there is any. +func (c *FakeCustomResourceDefinitions) Update(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (result *v1.CustomResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(customresourcedefinitionsResource, customResourceDefinition), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCustomResourceDefinitions) UpdateStatus(ctx context.Context, customResourceDefinition *v1.CustomResourceDefinition, opts metav1.UpdateOptions) (*v1.CustomResourceDefinition, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(customresourcedefinitionsResource, "status", customResourceDefinition), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} + +// Delete takes name of the customResourceDefinition and deletes it. Returns an error if one occurs. +func (c *FakeCustomResourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(customresourcedefinitionsResource, name, opts), &v1.CustomResourceDefinition{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCustomResourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(customresourcedefinitionsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CustomResourceDefinitionList{}) + return err +} + +// Patch applies the patch and returns the patched customResourceDefinition. +func (c *FakeCustomResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CustomResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(customresourcedefinitionsResource, name, pt, data, subresources...), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied customResourceDefinition. +func (c *FakeCustomResourceDefinitions) Apply(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) { + if customResourceDefinition == nil { + return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil") + } + data, err := json.Marshal(customResourceDefinition) + if err != nil { + return nil, err + } + name := customResourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(customresourcedefinitionsResource, *name, types.ApplyPatchType, data), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeCustomResourceDefinitions) ApplyStatus(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CustomResourceDefinition, err error) { + if customResourceDefinition == nil { + return nil, fmt.Errorf("customResourceDefinition provided to Apply must not be nil") + } + data, err := json.Marshal(customResourceDefinition) + if err != nil { + return nil, err + } + name := customResourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("customResourceDefinition.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(customresourcedefinitionsResource, *name, types.ApplyPatchType, data, "status"), &v1.CustomResourceDefinition{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CustomResourceDefinition), err +} diff --git a/pkg/clients/clientset/typed/apiextensions/v1/generated_expansion.go b/pkg/clients/clientset/typed/apiextensions/v1/generated_expansion.go new file mode 100644 index 000000000..f019234af --- /dev/null +++ b/pkg/clients/clientset/typed/apiextensions/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type CustomResourceDefinitionExpansion interface{} diff --git a/pkg/clients/clientset/typed/apiregistration/v1/apiregistration_client.go b/pkg/clients/clientset/typed/apiregistration/v1/apiregistration_client.go new file mode 100644 index 000000000..02129bc8f --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/apiregistration_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + rest "k8s.io/client-go/rest" + v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +type ApiregistrationV1Interface interface { + RESTClient() rest.Interface + APIServicesGetter +} + +// ApiregistrationV1Client is used to interact with features provided by the apiregistration.k8s.io group. +type ApiregistrationV1Client struct { + restClient rest.Interface +} + +func (c *ApiregistrationV1Client) APIServices() APIServiceInterface { + return newAPIServices(c) +} + +// NewForConfig creates a new ApiregistrationV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*ApiregistrationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new ApiregistrationV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ApiregistrationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &ApiregistrationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new ApiregistrationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ApiregistrationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ApiregistrationV1Client for the given RESTClient. +func New(c rest.Interface) *ApiregistrationV1Client { + return &ApiregistrationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ApiregistrationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/apiregistration/v1/apiservice.go b/pkg/clients/clientset/typed/apiregistration/v1/apiservice.go new file mode 100644 index 000000000..b8c6aedee --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/apiservice.go @@ -0,0 +1,230 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + apiregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apiregistration/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// APIServicesGetter has a method to return a APIServiceInterface. +// A group's client should implement this interface. +type APIServicesGetter interface { + APIServices() APIServiceInterface +} + +// APIServiceInterface has methods to work with APIService resources. +type APIServiceInterface interface { + Create(ctx context.Context, aPIService *v1.APIService, opts metav1.CreateOptions) (*v1.APIService, error) + Update(ctx context.Context, aPIService *v1.APIService, opts metav1.UpdateOptions) (*v1.APIService, error) + UpdateStatus(ctx context.Context, aPIService *v1.APIService, opts metav1.UpdateOptions) (*v1.APIService, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.APIService, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.APIServiceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.APIService, err error) + Apply(ctx context.Context, aPIService *apiregistrationv1.APIServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.APIService, err error) + ApplyStatus(ctx context.Context, aPIService *apiregistrationv1.APIServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.APIService, err error) + APIServiceExpansion +} + +// aPIServices implements APIServiceInterface +type aPIServices struct { + client rest.Interface +} + +// newAPIServices returns a APIServices +func newAPIServices(c *ApiregistrationV1Client) *aPIServices { + return &aPIServices{ + client: c.RESTClient(), + } +} + +// Get takes name of the aPIService, and returns the corresponding aPIService object, and an error if there is any. +func (c *aPIServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.APIService, err error) { + result = &v1.APIService{} + err = c.client.Get(). + Resource("apiservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of APIServices that match those selectors. +func (c *aPIServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.APIServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.APIServiceList{} + err = c.client.Get(). + Resource("apiservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested aPIServices. +func (c *aPIServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("apiservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a aPIService and creates it. Returns the server's representation of the aPIService, and an error, if there is any. +func (c *aPIServices) Create(ctx context.Context, aPIService *v1.APIService, opts metav1.CreateOptions) (result *v1.APIService, err error) { + result = &v1.APIService{} + err = c.client.Post(). + Resource("apiservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(aPIService). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a aPIService and updates it. Returns the server's representation of the aPIService, and an error, if there is any. +func (c *aPIServices) Update(ctx context.Context, aPIService *v1.APIService, opts metav1.UpdateOptions) (result *v1.APIService, err error) { + result = &v1.APIService{} + err = c.client.Put(). + Resource("apiservices"). + Name(aPIService.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(aPIService). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *aPIServices) UpdateStatus(ctx context.Context, aPIService *v1.APIService, opts metav1.UpdateOptions) (result *v1.APIService, err error) { + result = &v1.APIService{} + err = c.client.Put(). + Resource("apiservices"). + Name(aPIService.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(aPIService). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the aPIService and deletes it. Returns an error if one occurs. +func (c *aPIServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("apiservices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *aPIServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("apiservices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched aPIService. +func (c *aPIServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.APIService, err error) { + result = &v1.APIService{} + err = c.client.Patch(pt). + Resource("apiservices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied aPIService. +func (c *aPIServices) Apply(ctx context.Context, aPIService *apiregistrationv1.APIServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.APIService, err error) { + if aPIService == nil { + return nil, fmt.Errorf("aPIService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(aPIService) + if err != nil { + return nil, err + } + name := aPIService.Name + if name == nil { + return nil, fmt.Errorf("aPIService.Name must be provided to Apply") + } + result = &v1.APIService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("apiservices"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *aPIServices) ApplyStatus(ctx context.Context, aPIService *apiregistrationv1.APIServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.APIService, err error) { + if aPIService == nil { + return nil, fmt.Errorf("aPIService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(aPIService) + if err != nil { + return nil, err + } + + name := aPIService.Name + if name == nil { + return nil, fmt.Errorf("aPIService.Name must be provided to Apply") + } + + result = &v1.APIService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("apiservices"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apiregistration/v1/doc.go b/pkg/clients/clientset/typed/apiregistration/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/apiregistration/v1/fake/doc.go b/pkg/clients/clientset/typed/apiregistration/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/apiregistration/v1/fake/fake_apiregistration_client.go b/pkg/clients/clientset/typed/apiregistration/v1/fake/fake_apiregistration_client.go new file mode 100644 index 000000000..045d9b6d6 --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/fake/fake_apiregistration_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apiregistration/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeApiregistrationV1 struct { + *testing.Fake +} + +func (c *FakeApiregistrationV1) APIServices() v1.APIServiceInterface { + return &FakeAPIServices{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeApiregistrationV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/apiregistration/v1/fake/fake_apiservice.go b/pkg/clients/clientset/typed/apiregistration/v1/fake/fake_apiservice.go new file mode 100644 index 000000000..8749ffd92 --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/fake/fake_apiservice.go @@ -0,0 +1,165 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + apiregistrationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apiregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// FakeAPIServices implements APIServiceInterface +type FakeAPIServices struct { + Fake *FakeApiregistrationV1 +} + +var apiservicesResource = v1.SchemeGroupVersion.WithResource("apiservices") + +var apiservicesKind = v1.SchemeGroupVersion.WithKind("APIService") + +// Get takes name of the aPIService, and returns the corresponding aPIService object, and an error if there is any. +func (c *FakeAPIServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.APIService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(apiservicesResource, name), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} + +// List takes label and field selectors, and returns the list of APIServices that match those selectors. +func (c *FakeAPIServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.APIServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(apiservicesResource, apiservicesKind, opts), &v1.APIServiceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.APIServiceList{ListMeta: obj.(*v1.APIServiceList).ListMeta} + for _, item := range obj.(*v1.APIServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested aPIServices. +func (c *FakeAPIServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(apiservicesResource, opts)) +} + +// Create takes the representation of a aPIService and creates it. Returns the server's representation of the aPIService, and an error, if there is any. +func (c *FakeAPIServices) Create(ctx context.Context, aPIService *v1.APIService, opts metav1.CreateOptions) (result *v1.APIService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(apiservicesResource, aPIService), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} + +// Update takes the representation of a aPIService and updates it. Returns the server's representation of the aPIService, and an error, if there is any. +func (c *FakeAPIServices) Update(ctx context.Context, aPIService *v1.APIService, opts metav1.UpdateOptions) (result *v1.APIService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(apiservicesResource, aPIService), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeAPIServices) UpdateStatus(ctx context.Context, aPIService *v1.APIService, opts metav1.UpdateOptions) (*v1.APIService, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(apiservicesResource, "status", aPIService), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} + +// Delete takes name of the aPIService and deletes it. Returns an error if one occurs. +func (c *FakeAPIServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(apiservicesResource, name, opts), &v1.APIService{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAPIServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(apiservicesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.APIServiceList{}) + return err +} + +// Patch applies the patch and returns the patched aPIService. +func (c *FakeAPIServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.APIService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(apiservicesResource, name, pt, data, subresources...), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied aPIService. +func (c *FakeAPIServices) Apply(ctx context.Context, aPIService *apiregistrationv1.APIServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.APIService, err error) { + if aPIService == nil { + return nil, fmt.Errorf("aPIService provided to Apply must not be nil") + } + data, err := json.Marshal(aPIService) + if err != nil { + return nil, err + } + name := aPIService.Name + if name == nil { + return nil, fmt.Errorf("aPIService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(apiservicesResource, *name, types.ApplyPatchType, data), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeAPIServices) ApplyStatus(ctx context.Context, aPIService *apiregistrationv1.APIServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.APIService, err error) { + if aPIService == nil { + return nil, fmt.Errorf("aPIService provided to Apply must not be nil") + } + data, err := json.Marshal(aPIService) + if err != nil { + return nil, err + } + name := aPIService.Name + if name == nil { + return nil, fmt.Errorf("aPIService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(apiservicesResource, *name, types.ApplyPatchType, data, "status"), &v1.APIService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.APIService), err +} diff --git a/pkg/clients/clientset/typed/apiregistration/v1/generated_expansion.go b/pkg/clients/clientset/typed/apiregistration/v1/generated_expansion.go new file mode 100644 index 000000000..f463add76 --- /dev/null +++ b/pkg/clients/clientset/typed/apiregistration/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type APIServiceExpansion interface{} diff --git a/pkg/clients/clientset/typed/apps/v1/apps_client.go b/pkg/clients/clientset/typed/apps/v1/apps_client.go new file mode 100644 index 000000000..6b3494968 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/apps_client.go @@ -0,0 +1,114 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/apps/v1" + rest "k8s.io/client-go/rest" +) + +type AppsV1Interface interface { + RESTClient() rest.Interface + ControllerRevisionsGetter + DaemonSetsGetter + DeploymentsGetter + ReplicaSetsGetter + StatefulSetsGetter +} + +// AppsV1Client is used to interact with features provided by the apps group. +type AppsV1Client struct { + restClient rest.Interface +} + +func (c *AppsV1Client) ControllerRevisions(namespace string) ControllerRevisionInterface { + return newControllerRevisions(c, namespace) +} + +func (c *AppsV1Client) DaemonSets(namespace string) DaemonSetInterface { + return newDaemonSets(c, namespace) +} + +func (c *AppsV1Client) Deployments(namespace string) DeploymentInterface { + return newDeployments(c, namespace) +} + +func (c *AppsV1Client) ReplicaSets(namespace string) ReplicaSetInterface { + return newReplicaSets(c, namespace) +} + +func (c *AppsV1Client) StatefulSets(namespace string) StatefulSetInterface { + return newStatefulSets(c, namespace) +} + +// NewForConfig creates a new AppsV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AppsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AppsV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AppsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AppsV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AppsV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AppsV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AppsV1Client for the given RESTClient. +func New(c rest.Interface) *AppsV1Client { + return &AppsV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AppsV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/apps/v1/controllerrevision.go b/pkg/clients/clientset/typed/apps/v1/controllerrevision.go new file mode 100644 index 000000000..385e8fbd4 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/controllerrevision.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ControllerRevisionsGetter has a method to return a ControllerRevisionInterface. +// A group's client should implement this interface. +type ControllerRevisionsGetter interface { + ControllerRevisions(namespace string) ControllerRevisionInterface +} + +// ControllerRevisionInterface has methods to work with ControllerRevision resources. +type ControllerRevisionInterface interface { + Create(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.CreateOptions) (*v1.ControllerRevision, error) + Update(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.UpdateOptions) (*v1.ControllerRevision, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ControllerRevision, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ControllerRevisionList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ControllerRevision, err error) + Apply(ctx context.Context, controllerRevision *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ControllerRevision, err error) + ControllerRevisionExpansion +} + +// controllerRevisions implements ControllerRevisionInterface +type controllerRevisions struct { + client rest.Interface + ns string +} + +// newControllerRevisions returns a ControllerRevisions +func newControllerRevisions(c *AppsV1Client, namespace string) *controllerRevisions { + return &controllerRevisions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any. +func (c *controllerRevisions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ControllerRevision, err error) { + result = &v1.ControllerRevision{} + err = c.client.Get(). + Namespace(c.ns). + Resource("controllerrevisions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors. +func (c *controllerRevisions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ControllerRevisionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ControllerRevisionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("controllerrevisions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested controllerRevisions. +func (c *controllerRevisions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("controllerrevisions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any. +func (c *controllerRevisions) Create(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.CreateOptions) (result *v1.ControllerRevision, err error) { + result = &v1.ControllerRevision{} + err = c.client.Post(). + Namespace(c.ns). + Resource("controllerrevisions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(controllerRevision). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any. +func (c *controllerRevisions) Update(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.UpdateOptions) (result *v1.ControllerRevision, err error) { + result = &v1.ControllerRevision{} + err = c.client.Put(). + Namespace(c.ns). + Resource("controllerrevisions"). + Name(controllerRevision.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(controllerRevision). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs. +func (c *controllerRevisions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("controllerrevisions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *controllerRevisions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("controllerrevisions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched controllerRevision. +func (c *controllerRevisions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ControllerRevision, err error) { + result = &v1.ControllerRevision{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("controllerrevisions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied controllerRevision. +func (c *controllerRevisions) Apply(ctx context.Context, controllerRevision *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ControllerRevision, err error) { + if controllerRevision == nil { + return nil, fmt.Errorf("controllerRevision provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(controllerRevision) + if err != nil { + return nil, err + } + name := controllerRevision.Name + if name == nil { + return nil, fmt.Errorf("controllerRevision.Name must be provided to Apply") + } + result = &v1.ControllerRevision{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("controllerrevisions"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apps/v1/daemonset.go b/pkg/clients/clientset/typed/apps/v1/daemonset.go new file mode 100644 index 000000000..c606fb351 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/daemonset.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// DaemonSetsGetter has a method to return a DaemonSetInterface. +// A group's client should implement this interface. +type DaemonSetsGetter interface { + DaemonSets(namespace string) DaemonSetInterface +} + +// DaemonSetInterface has methods to work with DaemonSet resources. +type DaemonSetInterface interface { + Create(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.CreateOptions) (*v1.DaemonSet, error) + Update(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (*v1.DaemonSet, error) + UpdateStatus(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (*v1.DaemonSet, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.DaemonSet, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.DaemonSetList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DaemonSet, err error) + Apply(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) + ApplyStatus(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) + DaemonSetExpansion +} + +// daemonSets implements DaemonSetInterface +type daemonSets struct { + client rest.Interface + ns string +} + +// newDaemonSets returns a DaemonSets +func newDaemonSets(c *AppsV1Client, namespace string) *daemonSets { + return &daemonSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any. +func (c *daemonSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.DaemonSet, err error) { + result = &v1.DaemonSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("daemonsets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DaemonSets that match those selectors. +func (c *daemonSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DaemonSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.DaemonSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested daemonSets. +func (c *daemonSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any. +func (c *daemonSets) Create(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.CreateOptions) (result *v1.DaemonSet, err error) { + result = &v1.DaemonSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(daemonSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any. +func (c *daemonSets) Update(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (result *v1.DaemonSet, err error) { + result = &v1.DaemonSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("daemonsets"). + Name(daemonSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(daemonSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *daemonSets) UpdateStatus(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (result *v1.DaemonSet, err error) { + result = &v1.DaemonSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("daemonsets"). + Name(daemonSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(daemonSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs. +func (c *daemonSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("daemonsets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *daemonSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("daemonsets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched daemonSet. +func (c *daemonSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DaemonSet, err error) { + result = &v1.DaemonSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("daemonsets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied daemonSet. +func (c *daemonSets) Apply(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) { + if daemonSet == nil { + return nil, fmt.Errorf("daemonSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(daemonSet) + if err != nil { + return nil, err + } + name := daemonSet.Name + if name == nil { + return nil, fmt.Errorf("daemonSet.Name must be provided to Apply") + } + result = &v1.DaemonSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("daemonsets"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *daemonSets) ApplyStatus(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) { + if daemonSet == nil { + return nil, fmt.Errorf("daemonSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(daemonSet) + if err != nil { + return nil, err + } + + name := daemonSet.Name + if name == nil { + return nil, fmt.Errorf("daemonSet.Name must be provided to Apply") + } + + result = &v1.DaemonSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("daemonsets"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apps/v1/deployment.go b/pkg/clients/clientset/typed/apps/v1/deployment.go new file mode 100644 index 000000000..e26575019 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/deployment.go @@ -0,0 +1,303 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// DeploymentsGetter has a method to return a DeploymentInterface. +// A group's client should implement this interface. +type DeploymentsGetter interface { + Deployments(namespace string) DeploymentInterface +} + +// DeploymentInterface has methods to work with Deployment resources. +type DeploymentInterface interface { + Create(ctx context.Context, deployment *v1.Deployment, opts metav1.CreateOptions) (*v1.Deployment, error) + Update(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (*v1.Deployment, error) + UpdateStatus(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (*v1.Deployment, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Deployment, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.DeploymentList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Deployment, err error) + Apply(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) + ApplyStatus(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) + GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) + UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) + + DeploymentExpansion +} + +// deployments implements DeploymentInterface +type deployments struct { + client rest.Interface + ns string +} + +// newDeployments returns a Deployments +func newDeployments(c *AppsV1Client, namespace string) *deployments { + return &deployments{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. +func (c *deployments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Deployment, err error) { + result = &v1.Deployment{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deployments"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Deployments that match those selectors. +func (c *deployments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DeploymentList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.DeploymentList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested deployments. +func (c *deployments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any. +func (c *deployments) Create(ctx context.Context, deployment *v1.Deployment, opts metav1.CreateOptions) (result *v1.Deployment, err error) { + result = &v1.Deployment{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(deployment). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any. +func (c *deployments) Update(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (result *v1.Deployment, err error) { + result = &v1.Deployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deployments"). + Name(deployment.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(deployment). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *deployments) UpdateStatus(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (result *v1.Deployment, err error) { + result = &v1.Deployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deployments"). + Name(deployment.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(deployment). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the deployment and deletes it. Returns an error if one occurs. +func (c *deployments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deployments"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *deployments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("deployments"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched deployment. +func (c *deployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Deployment, err error) { + result = &v1.Deployment{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("deployments"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied deployment. +func (c *deployments) Apply(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) { + if deployment == nil { + return nil, fmt.Errorf("deployment provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(deployment) + if err != nil { + return nil, err + } + name := deployment.Name + if name == nil { + return nil, fmt.Errorf("deployment.Name must be provided to Apply") + } + result = &v1.Deployment{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("deployments"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *deployments) ApplyStatus(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) { + if deployment == nil { + return nil, fmt.Errorf("deployment provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(deployment) + if err != nil { + return nil, err + } + + name := deployment.Name + if name == nil { + return nil, fmt.Errorf("deployment.Name must be provided to Apply") + } + + result = &v1.Deployment{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("deployments"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// GetScale takes name of the deployment, and returns the corresponding autoscalingv1.Scale object, and an error if there is any. +func (c *deployments) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deployments"). + Name(deploymentName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *deployments) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deployments"). + Name(deploymentName). + SubResource("scale"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(scale). + Do(ctx). + Into(result) + return +} + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *deployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &autoscalingv1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("deployments"). + Name(deploymentName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apps/v1/doc.go b/pkg/clients/clientset/typed/apps/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/apps/v1/fake/doc.go b/pkg/clients/clientset/typed/apps/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/apps/v1/fake/fake_apps_client.go b/pkg/clients/clientset/typed/apps/v1/fake/fake_apps_client.go new file mode 100644 index 000000000..a0ebbef5a --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/fake_apps_client.go @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/apps/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAppsV1 struct { + *testing.Fake +} + +func (c *FakeAppsV1) ControllerRevisions(namespace string) v1.ControllerRevisionInterface { + return &FakeControllerRevisions{c, namespace} +} + +func (c *FakeAppsV1) DaemonSets(namespace string) v1.DaemonSetInterface { + return &FakeDaemonSets{c, namespace} +} + +func (c *FakeAppsV1) Deployments(namespace string) v1.DeploymentInterface { + return &FakeDeployments{c, namespace} +} + +func (c *FakeAppsV1) ReplicaSets(namespace string) v1.ReplicaSetInterface { + return &FakeReplicaSets{c, namespace} +} + +func (c *FakeAppsV1) StatefulSets(namespace string) v1.StatefulSetInterface { + return &FakeStatefulSets{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAppsV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/apps/v1/fake/fake_controllerrevision.go b/pkg/clients/clientset/typed/apps/v1/fake/fake_controllerrevision.go new file mode 100644 index 000000000..bbe1e6d97 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/fake_controllerrevision.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeControllerRevisions implements ControllerRevisionInterface +type FakeControllerRevisions struct { + Fake *FakeAppsV1 + ns string +} + +var controllerrevisionsResource = v1.SchemeGroupVersion.WithResource("controllerrevisions") + +var controllerrevisionsKind = v1.SchemeGroupVersion.WithKind("ControllerRevision") + +// Get takes name of the controllerRevision, and returns the corresponding controllerRevision object, and an error if there is any. +func (c *FakeControllerRevisions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ControllerRevision, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(controllerrevisionsResource, c.ns, name), &v1.ControllerRevision{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ControllerRevision), err +} + +// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors. +func (c *FakeControllerRevisions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ControllerRevisionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(controllerrevisionsResource, controllerrevisionsKind, c.ns, opts), &v1.ControllerRevisionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ControllerRevisionList{ListMeta: obj.(*v1.ControllerRevisionList).ListMeta} + for _, item := range obj.(*v1.ControllerRevisionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested controllerRevisions. +func (c *FakeControllerRevisions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(controllerrevisionsResource, c.ns, opts)) + +} + +// Create takes the representation of a controllerRevision and creates it. Returns the server's representation of the controllerRevision, and an error, if there is any. +func (c *FakeControllerRevisions) Create(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.CreateOptions) (result *v1.ControllerRevision, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(controllerrevisionsResource, c.ns, controllerRevision), &v1.ControllerRevision{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ControllerRevision), err +} + +// Update takes the representation of a controllerRevision and updates it. Returns the server's representation of the controllerRevision, and an error, if there is any. +func (c *FakeControllerRevisions) Update(ctx context.Context, controllerRevision *v1.ControllerRevision, opts metav1.UpdateOptions) (result *v1.ControllerRevision, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(controllerrevisionsResource, c.ns, controllerRevision), &v1.ControllerRevision{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ControllerRevision), err +} + +// Delete takes name of the controllerRevision and deletes it. Returns an error if one occurs. +func (c *FakeControllerRevisions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(controllerrevisionsResource, c.ns, name, opts), &v1.ControllerRevision{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeControllerRevisions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(controllerrevisionsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ControllerRevisionList{}) + return err +} + +// Patch applies the patch and returns the patched controllerRevision. +func (c *FakeControllerRevisions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ControllerRevision, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(controllerrevisionsResource, c.ns, name, pt, data, subresources...), &v1.ControllerRevision{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ControllerRevision), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied controllerRevision. +func (c *FakeControllerRevisions) Apply(ctx context.Context, controllerRevision *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ControllerRevision, err error) { + if controllerRevision == nil { + return nil, fmt.Errorf("controllerRevision provided to Apply must not be nil") + } + data, err := json.Marshal(controllerRevision) + if err != nil { + return nil, err + } + name := controllerRevision.Name + if name == nil { + return nil, fmt.Errorf("controllerRevision.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(controllerrevisionsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ControllerRevision{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ControllerRevision), err +} diff --git a/pkg/clients/clientset/typed/apps/v1/fake/fake_daemonset.go b/pkg/clients/clientset/typed/apps/v1/fake/fake_daemonset.go new file mode 100644 index 000000000..b056ad536 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/fake_daemonset.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + v1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeDaemonSets implements DaemonSetInterface +type FakeDaemonSets struct { + Fake *FakeAppsV1 + ns string +} + +var daemonsetsResource = v1.SchemeGroupVersion.WithResource("daemonsets") + +var daemonsetsKind = v1.SchemeGroupVersion.WithKind("DaemonSet") + +// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any. +func (c *FakeDaemonSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(daemonsetsResource, c.ns, name), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} + +// List takes label and field selectors, and returns the list of DaemonSets that match those selectors. +func (c *FakeDaemonSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DaemonSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(daemonsetsResource, daemonsetsKind, c.ns, opts), &v1.DaemonSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.DaemonSetList{ListMeta: obj.(*v1.DaemonSetList).ListMeta} + for _, item := range obj.(*v1.DaemonSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested daemonSets. +func (c *FakeDaemonSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(daemonsetsResource, c.ns, opts)) + +} + +// Create takes the representation of a daemonSet and creates it. Returns the server's representation of the daemonSet, and an error, if there is any. +func (c *FakeDaemonSets) Create(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.CreateOptions) (result *v1.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(daemonsetsResource, c.ns, daemonSet), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} + +// Update takes the representation of a daemonSet and updates it. Returns the server's representation of the daemonSet, and an error, if there is any. +func (c *FakeDaemonSets) Update(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (result *v1.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(daemonsetsResource, c.ns, daemonSet), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeDaemonSets) UpdateStatus(ctx context.Context, daemonSet *v1.DaemonSet, opts metav1.UpdateOptions) (*v1.DaemonSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(daemonsetsResource, "status", c.ns, daemonSet), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} + +// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs. +func (c *FakeDaemonSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(daemonsetsResource, c.ns, name, opts), &v1.DaemonSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDaemonSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(daemonsetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.DaemonSetList{}) + return err +} + +// Patch applies the patch and returns the patched daemonSet. +func (c *FakeDaemonSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.DaemonSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, name, pt, data, subresources...), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied daemonSet. +func (c *FakeDaemonSets) Apply(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) { + if daemonSet == nil { + return nil, fmt.Errorf("daemonSet provided to Apply must not be nil") + } + data, err := json.Marshal(daemonSet) + if err != nil { + return nil, err + } + name := daemonSet.Name + if name == nil { + return nil, fmt.Errorf("daemonSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, *name, types.ApplyPatchType, data), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeDaemonSets) ApplyStatus(ctx context.Context, daemonSet *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.DaemonSet, err error) { + if daemonSet == nil { + return nil, fmt.Errorf("daemonSet provided to Apply must not be nil") + } + data, err := json.Marshal(daemonSet) + if err != nil { + return nil, err + } + name := daemonSet.Name + if name == nil { + return nil, fmt.Errorf("daemonSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(daemonsetsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.DaemonSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.DaemonSet), err +} diff --git a/pkg/clients/clientset/typed/apps/v1/fake/fake_deployment.go b/pkg/clients/clientset/typed/apps/v1/fake/fake_deployment.go new file mode 100644 index 000000000..d95a2aab2 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/fake_deployment.go @@ -0,0 +1,219 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + v1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeDeployments implements DeploymentInterface +type FakeDeployments struct { + Fake *FakeAppsV1 + ns string +} + +var deploymentsResource = v1.SchemeGroupVersion.WithResource("deployments") + +var deploymentsKind = v1.SchemeGroupVersion.WithKind("Deployment") + +// Get takes name of the deployment, and returns the corresponding deployment object, and an error if there is any. +func (c *FakeDeployments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Deployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(deploymentsResource, c.ns, name), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// List takes label and field selectors, and returns the list of Deployments that match those selectors. +func (c *FakeDeployments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.DeploymentList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(deploymentsResource, deploymentsKind, c.ns, opts), &v1.DeploymentList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.DeploymentList{ListMeta: obj.(*v1.DeploymentList).ListMeta} + for _, item := range obj.(*v1.DeploymentList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested deployments. +func (c *FakeDeployments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(deploymentsResource, c.ns, opts)) + +} + +// Create takes the representation of a deployment and creates it. Returns the server's representation of the deployment, and an error, if there is any. +func (c *FakeDeployments) Create(ctx context.Context, deployment *v1.Deployment, opts metav1.CreateOptions) (result *v1.Deployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(deploymentsResource, c.ns, deployment), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// Update takes the representation of a deployment and updates it. Returns the server's representation of the deployment, and an error, if there is any. +func (c *FakeDeployments) Update(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (result *v1.Deployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(deploymentsResource, c.ns, deployment), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeDeployments) UpdateStatus(ctx context.Context, deployment *v1.Deployment, opts metav1.UpdateOptions) (*v1.Deployment, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "status", c.ns, deployment), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// Delete takes name of the deployment and deletes it. Returns an error if one occurs. +func (c *FakeDeployments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(deploymentsResource, c.ns, name, opts), &v1.Deployment{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDeployments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(deploymentsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.DeploymentList{}) + return err +} + +// Patch applies the patch and returns the patched deployment. +func (c *FakeDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Deployment, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, name, pt, data, subresources...), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied deployment. +func (c *FakeDeployments) Apply(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) { + if deployment == nil { + return nil, fmt.Errorf("deployment provided to Apply must not be nil") + } + data, err := json.Marshal(deployment) + if err != nil { + return nil, err + } + name := deployment.Name + if name == nil { + return nil, fmt.Errorf("deployment.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeDeployments) ApplyStatus(ctx context.Context, deployment *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Deployment, err error) { + if deployment == nil { + return nil, fmt.Errorf("deployment provided to Apply must not be nil") + } + data, err := json.Marshal(deployment) + if err != nil { + return nil, err + } + name := deployment.Name + if name == nil { + return nil, fmt.Errorf("deployment.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Deployment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Deployment), err +} + +// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any. +func (c *FakeDeployments) GetScale(ctx context.Context, deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeDeployments) UpdateScale(ctx context.Context, deploymentName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeDeployments) ApplyScale(ctx context.Context, deploymentName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentsResource, c.ns, deploymentName, types.ApplyPatchType, data, "status"), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/pkg/clients/clientset/typed/apps/v1/fake/fake_replicaset.go b/pkg/clients/clientset/typed/apps/v1/fake/fake_replicaset.go new file mode 100644 index 000000000..5b123d329 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/fake_replicaset.go @@ -0,0 +1,219 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + v1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeReplicaSets implements ReplicaSetInterface +type FakeReplicaSets struct { + Fake *FakeAppsV1 + ns string +} + +var replicasetsResource = v1.SchemeGroupVersion.WithResource("replicasets") + +var replicasetsKind = v1.SchemeGroupVersion.WithKind("ReplicaSet") + +// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. +func (c *FakeReplicaSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(replicasetsResource, c.ns, name), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors. +func (c *FakeReplicaSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicaSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(replicasetsResource, replicasetsKind, c.ns, opts), &v1.ReplicaSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ReplicaSetList{ListMeta: obj.(*v1.ReplicaSetList).ListMeta} + for _, item := range obj.(*v1.ReplicaSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested replicaSets. +func (c *FakeReplicaSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(replicasetsResource, c.ns, opts)) + +} + +// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *FakeReplicaSets) Create(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.CreateOptions) (result *v1.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(replicasetsResource, c.ns, replicaSet), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *FakeReplicaSets) Update(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (result *v1.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(replicasetsResource, c.ns, replicaSet), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeReplicaSets) UpdateStatus(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (*v1.ReplicaSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "status", c.ns, replicaSet), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs. +func (c *FakeReplicaSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(replicasetsResource, c.ns, name, opts), &v1.ReplicaSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeReplicaSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(replicasetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ReplicaSetList{}) + return err +} + +// Patch applies the patch and returns the patched replicaSet. +func (c *FakeReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, name, pt, data, subresources...), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied replicaSet. +func (c *FakeReplicaSets) Apply(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) { + if replicaSet == nil { + return nil, fmt.Errorf("replicaSet provided to Apply must not be nil") + } + data, err := json.Marshal(replicaSet) + if err != nil { + return nil, err + } + name := replicaSet.Name + if name == nil { + return nil, fmt.Errorf("replicaSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeReplicaSets) ApplyStatus(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) { + if replicaSet == nil { + return nil, fmt.Errorf("replicaSet provided to Apply must not be nil") + } + data, err := json.Marshal(replicaSet) + if err != nil { + return nil, err + } + name := replicaSet.Name + if name == nil { + return nil, fmt.Errorf("replicaSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicaSet), err +} + +// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any. +func (c *FakeReplicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeReplicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeReplicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicasetsResource, c.ns, replicaSetName, types.ApplyPatchType, data, "status"), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/pkg/clients/clientset/typed/apps/v1/fake/fake_statefulset.go b/pkg/clients/clientset/typed/apps/v1/fake/fake_statefulset.go new file mode 100644 index 000000000..6b06ba468 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/fake/fake_statefulset.go @@ -0,0 +1,219 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + v1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeStatefulSets implements StatefulSetInterface +type FakeStatefulSets struct { + Fake *FakeAppsV1 + ns string +} + +var statefulsetsResource = v1.SchemeGroupVersion.WithResource("statefulsets") + +var statefulsetsKind = v1.SchemeGroupVersion.WithKind("StatefulSet") + +// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. +func (c *FakeStatefulSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.StatefulSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(statefulsetsResource, c.ns, name), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// List takes label and field selectors, and returns the list of StatefulSets that match those selectors. +func (c *FakeStatefulSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.StatefulSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(statefulsetsResource, statefulsetsKind, c.ns, opts), &v1.StatefulSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.StatefulSetList{ListMeta: obj.(*v1.StatefulSetList).ListMeta} + for _, item := range obj.(*v1.StatefulSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested statefulSets. +func (c *FakeStatefulSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(statefulsetsResource, c.ns, opts)) + +} + +// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any. +func (c *FakeStatefulSets) Create(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.CreateOptions) (result *v1.StatefulSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(statefulsetsResource, c.ns, statefulSet), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any. +func (c *FakeStatefulSets) Update(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (result *v1.StatefulSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeStatefulSets) UpdateStatus(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (*v1.StatefulSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs. +func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1.StatefulSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeStatefulSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(statefulsetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.StatefulSetList{}) + return err +} + +// Patch applies the patch and returns the patched statefulSet. +func (c *FakeStatefulSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StatefulSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, name, pt, data, subresources...), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied statefulSet. +func (c *FakeStatefulSets) Apply(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) { + if statefulSet == nil { + return nil, fmt.Errorf("statefulSet provided to Apply must not be nil") + } + data, err := json.Marshal(statefulSet) + if err != nil { + return nil, err + } + name := statefulSet.Name + if name == nil { + return nil, fmt.Errorf("statefulSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeStatefulSets) ApplyStatus(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) { + if statefulSet == nil { + return nil, fmt.Errorf("statefulSet provided to Apply must not be nil") + } + data, err := json.Marshal(statefulSet) + if err != nil { + return nil, err + } + name := statefulSet.Name + if name == nil { + return nil, fmt.Errorf("statefulSet.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.StatefulSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.StatefulSet), err +} + +// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any. +func (c *FakeStatefulSets) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeStatefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *FakeStatefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(statefulsetsResource, c.ns, statefulSetName, types.ApplyPatchType, data, "status"), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/pkg/clients/clientset/typed/apps/v1/generated_expansion.go b/pkg/clients/clientset/typed/apps/v1/generated_expansion.go new file mode 100644 index 000000000..27feae494 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/generated_expansion.go @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type ControllerRevisionExpansion interface{} + +type DaemonSetExpansion interface{} + +type DeploymentExpansion interface{} + +type ReplicaSetExpansion interface{} + +type StatefulSetExpansion interface{} diff --git a/pkg/clients/clientset/typed/apps/v1/replicaset.go b/pkg/clients/clientset/typed/apps/v1/replicaset.go new file mode 100644 index 000000000..98781eb24 --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/replicaset.go @@ -0,0 +1,303 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ReplicaSetsGetter has a method to return a ReplicaSetInterface. +// A group's client should implement this interface. +type ReplicaSetsGetter interface { + ReplicaSets(namespace string) ReplicaSetInterface +} + +// ReplicaSetInterface has methods to work with ReplicaSet resources. +type ReplicaSetInterface interface { + Create(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.CreateOptions) (*v1.ReplicaSet, error) + Update(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (*v1.ReplicaSet, error) + UpdateStatus(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (*v1.ReplicaSet, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ReplicaSet, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ReplicaSetList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicaSet, err error) + Apply(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) + ApplyStatus(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) + GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) + UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) + + ReplicaSetExpansion +} + +// replicaSets implements ReplicaSetInterface +type replicaSets struct { + client rest.Interface + ns string +} + +// newReplicaSets returns a ReplicaSets +func newReplicaSets(c *AppsV1Client, namespace string) *replicaSets { + return &replicaSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the replicaSet, and returns the corresponding replicaSet object, and an error if there is any. +func (c *replicaSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicaSet, err error) { + result = &v1.ReplicaSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors. +func (c *replicaSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicaSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ReplicaSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested replicaSets. +func (c *replicaSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a replicaSet and creates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *replicaSets) Create(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.CreateOptions) (result *v1.ReplicaSet, err error) { + result = &v1.ReplicaSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(replicaSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a replicaSet and updates it. Returns the server's representation of the replicaSet, and an error, if there is any. +func (c *replicaSets) Update(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (result *v1.ReplicaSet, err error) { + result = &v1.ReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(replicaSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *replicaSets) UpdateStatus(ctx context.Context, replicaSet *v1.ReplicaSet, opts metav1.UpdateOptions) (result *v1.ReplicaSet, err error) { + result = &v1.ReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(replicaSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the replicaSet and deletes it. Returns an error if one occurs. +func (c *replicaSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *replicaSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("replicasets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched replicaSet. +func (c *replicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicaSet, err error) { + result = &v1.ReplicaSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("replicasets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied replicaSet. +func (c *replicaSets) Apply(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) { + if replicaSet == nil { + return nil, fmt.Errorf("replicaSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(replicaSet) + if err != nil { + return nil, err + } + name := replicaSet.Name + if name == nil { + return nil, fmt.Errorf("replicaSet.Name must be provided to Apply") + } + result = &v1.ReplicaSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicasets"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *replicaSets) ApplyStatus(ctx context.Context, replicaSet *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicaSet, err error) { + if replicaSet == nil { + return nil, fmt.Errorf("replicaSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(replicaSet) + if err != nil { + return nil, err + } + + name := replicaSet.Name + if name == nil { + return nil, fmt.Errorf("replicaSet.Name must be provided to Apply") + } + + result = &v1.ReplicaSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicasets"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// GetScale takes name of the replicaSet, and returns the corresponding autoscalingv1.Scale object, and an error if there is any. +func (c *replicaSets) GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSetName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *replicaSets) UpdateScale(ctx context.Context, replicaSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSetName). + SubResource("scale"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(scale). + Do(ctx). + Into(result) + return +} + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *replicaSets) ApplyScale(ctx context.Context, replicaSetName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &autoscalingv1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicasets"). + Name(replicaSetName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/apps/v1/statefulset.go b/pkg/clients/clientset/typed/apps/v1/statefulset.go new file mode 100644 index 000000000..4fbebc1db --- /dev/null +++ b/pkg/clients/clientset/typed/apps/v1/statefulset.go @@ -0,0 +1,303 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + appsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/apps/v1" + applyconfigurationautoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// StatefulSetsGetter has a method to return a StatefulSetInterface. +// A group's client should implement this interface. +type StatefulSetsGetter interface { + StatefulSets(namespace string) StatefulSetInterface +} + +// StatefulSetInterface has methods to work with StatefulSet resources. +type StatefulSetInterface interface { + Create(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.CreateOptions) (*v1.StatefulSet, error) + Update(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (*v1.StatefulSet, error) + UpdateStatus(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (*v1.StatefulSet, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.StatefulSet, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.StatefulSetList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StatefulSet, err error) + Apply(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) + ApplyStatus(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) + GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) + UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (*autoscalingv1.Scale, error) + + StatefulSetExpansion +} + +// statefulSets implements StatefulSetInterface +type statefulSets struct { + client rest.Interface + ns string +} + +// newStatefulSets returns a StatefulSets +func newStatefulSets(c *AppsV1Client, namespace string) *statefulSets { + return &statefulSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. +func (c *statefulSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.StatefulSet, err error) { + result = &v1.StatefulSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("statefulsets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of StatefulSets that match those selectors. +func (c *statefulSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.StatefulSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.StatefulSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("statefulsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested statefulSets. +func (c *statefulSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("statefulsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a statefulSet and creates it. Returns the server's representation of the statefulSet, and an error, if there is any. +func (c *statefulSets) Create(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.CreateOptions) (result *v1.StatefulSet, err error) { + result = &v1.StatefulSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("statefulsets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(statefulSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a statefulSet and updates it. Returns the server's representation of the statefulSet, and an error, if there is any. +func (c *statefulSets) Update(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (result *v1.StatefulSet, err error) { + result = &v1.StatefulSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(statefulSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *statefulSets) UpdateStatus(ctx context.Context, statefulSet *v1.StatefulSet, opts metav1.UpdateOptions) (result *v1.StatefulSet, err error) { + result = &v1.StatefulSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(statefulSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs. +func (c *statefulSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("statefulsets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *statefulSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("statefulsets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched statefulSet. +func (c *statefulSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StatefulSet, err error) { + result = &v1.StatefulSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("statefulsets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied statefulSet. +func (c *statefulSets) Apply(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) { + if statefulSet == nil { + return nil, fmt.Errorf("statefulSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(statefulSet) + if err != nil { + return nil, err + } + name := statefulSet.Name + if name == nil { + return nil, fmt.Errorf("statefulSet.Name must be provided to Apply") + } + result = &v1.StatefulSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("statefulsets"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *statefulSets) ApplyStatus(ctx context.Context, statefulSet *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StatefulSet, err error) { + if statefulSet == nil { + return nil, fmt.Errorf("statefulSet provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(statefulSet) + if err != nil { + return nil, err + } + + name := statefulSet.Name + if name == nil { + return nil, fmt.Errorf("statefulSet.Name must be provided to Apply") + } + + result = &v1.StatefulSet{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("statefulsets"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// GetScale takes name of the statefulSet, and returns the corresponding autoscalingv1.Scale object, and an error if there is any. +func (c *statefulSets) GetScale(ctx context.Context, statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Get(). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSetName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *statefulSets) UpdateScale(ctx context.Context, statefulSetName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Put(). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSetName). + SubResource("scale"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(scale). + Do(ctx). + Into(result) + return +} + +// ApplyScale takes top resource name and the apply declarative configuration for scale, +// applies it and returns the applied scale, and an error, if there is any. +func (c *statefulSets) ApplyScale(ctx context.Context, statefulSetName string, scale *applyconfigurationautoscalingv1.ScaleApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.Scale, err error) { + if scale == nil { + return nil, fmt.Errorf("scale provided to ApplyScale must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(scale) + if err != nil { + return nil, err + } + + result = &autoscalingv1.Scale{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("statefulsets"). + Name(statefulSetName). + SubResource("scale"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/authentication/v1/authentication_client.go b/pkg/clients/clientset/typed/authentication/v1/authentication_client.go new file mode 100644 index 000000000..dd8404164 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/authentication_client.go @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authentication/v1" + rest "k8s.io/client-go/rest" +) + +type AuthenticationV1Interface interface { + RESTClient() rest.Interface + SelfSubjectReviewsGetter + TokenReviewsGetter +} + +// AuthenticationV1Client is used to interact with features provided by the authentication.k8s.io group. +type AuthenticationV1Client struct { + restClient rest.Interface +} + +func (c *AuthenticationV1Client) SelfSubjectReviews() SelfSubjectReviewInterface { + return newSelfSubjectReviews(c) +} + +func (c *AuthenticationV1Client) TokenReviews() TokenReviewInterface { + return newTokenReviews(c) +} + +// NewForConfig creates a new AuthenticationV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AuthenticationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AuthenticationV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AuthenticationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AuthenticationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AuthenticationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AuthenticationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AuthenticationV1Client for the given RESTClient. +func New(c rest.Interface) *AuthenticationV1Client { + return &AuthenticationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AuthenticationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/authentication/v1/doc.go b/pkg/clients/clientset/typed/authentication/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/authentication/v1/fake/doc.go b/pkg/clients/clientset/typed/authentication/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/authentication/v1/fake/fake_authentication_client.go b/pkg/clients/clientset/typed/authentication/v1/fake/fake_authentication_client.go new file mode 100644 index 000000000..f32c656aa --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/fake/fake_authentication_client.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authentication/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAuthenticationV1 struct { + *testing.Fake +} + +func (c *FakeAuthenticationV1) SelfSubjectReviews() v1.SelfSubjectReviewInterface { + return &FakeSelfSubjectReviews{c} +} + +func (c *FakeAuthenticationV1) TokenReviews() v1.TokenReviewInterface { + return &FakeTokenReviews{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAuthenticationV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/authentication/v1/fake/fake_selfsubjectreview.go b/pkg/clients/clientset/typed/authentication/v1/fake/fake_selfsubjectreview.go new file mode 100644 index 000000000..765c4a236 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/fake/fake_selfsubjectreview.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/api/authentication/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeSelfSubjectReviews implements SelfSubjectReviewInterface +type FakeSelfSubjectReviews struct { + Fake *FakeAuthenticationV1 +} + +var selfsubjectreviewsResource = v1.SchemeGroupVersion.WithResource("selfsubjectreviews") + +var selfsubjectreviewsKind = v1.SchemeGroupVersion.WithKind("SelfSubjectReview") + +// Create takes the representation of a selfSubjectReview and creates it. Returns the server's representation of the selfSubjectReview, and an error, if there is any. +func (c *FakeSelfSubjectReviews) Create(ctx context.Context, selfSubjectReview *v1.SelfSubjectReview, opts metav1.CreateOptions) (result *v1.SelfSubjectReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(selfsubjectreviewsResource, selfSubjectReview), &v1.SelfSubjectReview{}) + if obj == nil { + return nil, err + } + return obj.(*v1.SelfSubjectReview), err +} diff --git a/pkg/clients/clientset/typed/authentication/v1/fake/fake_tokenreview.go b/pkg/clients/clientset/typed/authentication/v1/fake/fake_tokenreview.go new file mode 100644 index 000000000..dd2d9f030 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/fake/fake_tokenreview.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/api/authentication/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeTokenReviews implements TokenReviewInterface +type FakeTokenReviews struct { + Fake *FakeAuthenticationV1 +} + +var tokenreviewsResource = v1.SchemeGroupVersion.WithResource("tokenreviews") + +var tokenreviewsKind = v1.SchemeGroupVersion.WithKind("TokenReview") + +// Create takes the representation of a tokenReview and creates it. Returns the server's representation of the tokenReview, and an error, if there is any. +func (c *FakeTokenReviews) Create(ctx context.Context, tokenReview *v1.TokenReview, opts metav1.CreateOptions) (result *v1.TokenReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(tokenreviewsResource, tokenReview), &v1.TokenReview{}) + if obj == nil { + return nil, err + } + return obj.(*v1.TokenReview), err +} diff --git a/pkg/clients/clientset/typed/authentication/v1/generated_expansion.go b/pkg/clients/clientset/typed/authentication/v1/generated_expansion.go new file mode 100644 index 000000000..27863a920 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/generated_expansion.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type SelfSubjectReviewExpansion interface{} + +type TokenReviewExpansion interface{} diff --git a/pkg/clients/clientset/typed/authentication/v1/selfsubjectreview.go b/pkg/clients/clientset/typed/authentication/v1/selfsubjectreview.go new file mode 100644 index 000000000..9aad62c8f --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/selfsubjectreview.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authentication/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// SelfSubjectReviewsGetter has a method to return a SelfSubjectReviewInterface. +// A group's client should implement this interface. +type SelfSubjectReviewsGetter interface { + SelfSubjectReviews() SelfSubjectReviewInterface +} + +// SelfSubjectReviewInterface has methods to work with SelfSubjectReview resources. +type SelfSubjectReviewInterface interface { + Create(ctx context.Context, selfSubjectReview *v1.SelfSubjectReview, opts metav1.CreateOptions) (*v1.SelfSubjectReview, error) + SelfSubjectReviewExpansion +} + +// selfSubjectReviews implements SelfSubjectReviewInterface +type selfSubjectReviews struct { + client rest.Interface +} + +// newSelfSubjectReviews returns a SelfSubjectReviews +func newSelfSubjectReviews(c *AuthenticationV1Client) *selfSubjectReviews { + return &selfSubjectReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a selfSubjectReview and creates it. Returns the server's representation of the selfSubjectReview, and an error, if there is any. +func (c *selfSubjectReviews) Create(ctx context.Context, selfSubjectReview *v1.SelfSubjectReview, opts metav1.CreateOptions) (result *v1.SelfSubjectReview, err error) { + result = &v1.SelfSubjectReview{} + err = c.client.Post(). + Resource("selfsubjectreviews"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(selfSubjectReview). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/authentication/v1/tokenreview.go b/pkg/clients/clientset/typed/authentication/v1/tokenreview.go new file mode 100644 index 000000000..bfcbe72e9 --- /dev/null +++ b/pkg/clients/clientset/typed/authentication/v1/tokenreview.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authentication/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// TokenReviewsGetter has a method to return a TokenReviewInterface. +// A group's client should implement this interface. +type TokenReviewsGetter interface { + TokenReviews() TokenReviewInterface +} + +// TokenReviewInterface has methods to work with TokenReview resources. +type TokenReviewInterface interface { + Create(ctx context.Context, tokenReview *v1.TokenReview, opts metav1.CreateOptions) (*v1.TokenReview, error) + TokenReviewExpansion +} + +// tokenReviews implements TokenReviewInterface +type tokenReviews struct { + client rest.Interface +} + +// newTokenReviews returns a TokenReviews +func newTokenReviews(c *AuthenticationV1Client) *tokenReviews { + return &tokenReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a tokenReview and creates it. Returns the server's representation of the tokenReview, and an error, if there is any. +func (c *tokenReviews) Create(ctx context.Context, tokenReview *v1.TokenReview, opts metav1.CreateOptions) (result *v1.TokenReview, err error) { + result = &v1.TokenReview{} + err = c.client.Post(). + Resource("tokenreviews"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(tokenReview). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/authorization/v1/authorization_client.go b/pkg/clients/clientset/typed/authorization/v1/authorization_client.go new file mode 100644 index 000000000..1bcd8aa13 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/authorization_client.go @@ -0,0 +1,109 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +type AuthorizationV1Interface interface { + RESTClient() rest.Interface + LocalSubjectAccessReviewsGetter + SelfSubjectAccessReviewsGetter + SelfSubjectRulesReviewsGetter + SubjectAccessReviewsGetter +} + +// AuthorizationV1Client is used to interact with features provided by the authorization.k8s.io group. +type AuthorizationV1Client struct { + restClient rest.Interface +} + +func (c *AuthorizationV1Client) LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface { + return newLocalSubjectAccessReviews(c, namespace) +} + +func (c *AuthorizationV1Client) SelfSubjectAccessReviews() SelfSubjectAccessReviewInterface { + return newSelfSubjectAccessReviews(c) +} + +func (c *AuthorizationV1Client) SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface { + return newSelfSubjectRulesReviews(c) +} + +func (c *AuthorizationV1Client) SubjectAccessReviews() SubjectAccessReviewInterface { + return newSubjectAccessReviews(c) +} + +// NewForConfig creates a new AuthorizationV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AuthorizationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AuthorizationV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AuthorizationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AuthorizationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AuthorizationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AuthorizationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AuthorizationV1Client for the given RESTClient. +func New(c rest.Interface) *AuthorizationV1Client { + return &AuthorizationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AuthorizationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/authorization/v1/doc.go b/pkg/clients/clientset/typed/authorization/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/authorization/v1/fake/doc.go b/pkg/clients/clientset/typed/authorization/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/authorization/v1/fake/fake_authorization_client.go b/pkg/clients/clientset/typed/authorization/v1/fake/fake_authorization_client.go new file mode 100644 index 000000000..36dc22c59 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/fake/fake_authorization_client.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/authorization/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAuthorizationV1 struct { + *testing.Fake +} + +func (c *FakeAuthorizationV1) LocalSubjectAccessReviews(namespace string) v1.LocalSubjectAccessReviewInterface { + return &FakeLocalSubjectAccessReviews{c, namespace} +} + +func (c *FakeAuthorizationV1) SelfSubjectAccessReviews() v1.SelfSubjectAccessReviewInterface { + return &FakeSelfSubjectAccessReviews{c} +} + +func (c *FakeAuthorizationV1) SelfSubjectRulesReviews() v1.SelfSubjectRulesReviewInterface { + return &FakeSelfSubjectRulesReviews{c} +} + +func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface { + return &FakeSubjectAccessReviews{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAuthorizationV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/authorization/v1/fake/fake_localsubjectaccessreview.go b/pkg/clients/clientset/typed/authorization/v1/fake/fake_localsubjectaccessreview.go new file mode 100644 index 000000000..1816a439c --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/fake/fake_localsubjectaccessreview.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface +type FakeLocalSubjectAccessReviews struct { + Fake *FakeAuthorizationV1 + ns string +} + +var localsubjectaccessreviewsResource = v1.SchemeGroupVersion.WithResource("localsubjectaccessreviews") + +var localsubjectaccessreviewsKind = v1.SchemeGroupVersion.WithKind("LocalSubjectAccessReview") + +// Create takes the representation of a localSubjectAccessReview and creates it. Returns the server's representation of the localSubjectAccessReview, and an error, if there is any. +func (c *FakeLocalSubjectAccessReviews) Create(ctx context.Context, localSubjectAccessReview *v1.LocalSubjectAccessReview, opts metav1.CreateOptions) (result *v1.LocalSubjectAccessReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(localsubjectaccessreviewsResource, c.ns, localSubjectAccessReview), &v1.LocalSubjectAccessReview{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.LocalSubjectAccessReview), err +} diff --git a/pkg/clients/clientset/typed/authorization/v1/fake/fake_selfsubjectaccessreview.go b/pkg/clients/clientset/typed/authorization/v1/fake/fake_selfsubjectaccessreview.go new file mode 100644 index 000000000..dc16a48c8 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/fake/fake_selfsubjectaccessreview.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeSelfSubjectAccessReviews implements SelfSubjectAccessReviewInterface +type FakeSelfSubjectAccessReviews struct { + Fake *FakeAuthorizationV1 +} + +var selfsubjectaccessreviewsResource = v1.SchemeGroupVersion.WithResource("selfsubjectaccessreviews") + +var selfsubjectaccessreviewsKind = v1.SchemeGroupVersion.WithKind("SelfSubjectAccessReview") + +// Create takes the representation of a selfSubjectAccessReview and creates it. Returns the server's representation of the selfSubjectAccessReview, and an error, if there is any. +func (c *FakeSelfSubjectAccessReviews) Create(ctx context.Context, selfSubjectAccessReview *v1.SelfSubjectAccessReview, opts metav1.CreateOptions) (result *v1.SelfSubjectAccessReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(selfsubjectaccessreviewsResource, selfSubjectAccessReview), &v1.SelfSubjectAccessReview{}) + if obj == nil { + return nil, err + } + return obj.(*v1.SelfSubjectAccessReview), err +} diff --git a/pkg/clients/clientset/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go b/pkg/clients/clientset/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go new file mode 100644 index 000000000..e965b1aa8 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface +type FakeSelfSubjectRulesReviews struct { + Fake *FakeAuthorizationV1 +} + +var selfsubjectrulesreviewsResource = v1.SchemeGroupVersion.WithResource("selfsubjectrulesreviews") + +var selfsubjectrulesreviewsKind = v1.SchemeGroupVersion.WithKind("SelfSubjectRulesReview") + +// Create takes the representation of a selfSubjectRulesReview and creates it. Returns the server's representation of the selfSubjectRulesReview, and an error, if there is any. +func (c *FakeSelfSubjectRulesReviews) Create(ctx context.Context, selfSubjectRulesReview *v1.SelfSubjectRulesReview, opts metav1.CreateOptions) (result *v1.SelfSubjectRulesReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(selfsubjectrulesreviewsResource, selfSubjectRulesReview), &v1.SelfSubjectRulesReview{}) + if obj == nil { + return nil, err + } + return obj.(*v1.SelfSubjectRulesReview), err +} diff --git a/pkg/clients/clientset/typed/authorization/v1/fake/fake_subjectaccessreview.go b/pkg/clients/clientset/typed/authorization/v1/fake/fake_subjectaccessreview.go new file mode 100644 index 000000000..7150452f6 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/fake/fake_subjectaccessreview.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + testing "k8s.io/client-go/testing" +) + +// FakeSubjectAccessReviews implements SubjectAccessReviewInterface +type FakeSubjectAccessReviews struct { + Fake *FakeAuthorizationV1 +} + +var subjectaccessreviewsResource = v1.SchemeGroupVersion.WithResource("subjectaccessreviews") + +var subjectaccessreviewsKind = v1.SchemeGroupVersion.WithKind("SubjectAccessReview") + +// Create takes the representation of a subjectAccessReview and creates it. Returns the server's representation of the subjectAccessReview, and an error, if there is any. +func (c *FakeSubjectAccessReviews) Create(ctx context.Context, subjectAccessReview *v1.SubjectAccessReview, opts metav1.CreateOptions) (result *v1.SubjectAccessReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(subjectaccessreviewsResource, subjectAccessReview), &v1.SubjectAccessReview{}) + if obj == nil { + return nil, err + } + return obj.(*v1.SubjectAccessReview), err +} diff --git a/pkg/clients/clientset/typed/authorization/v1/generated_expansion.go b/pkg/clients/clientset/typed/authorization/v1/generated_expansion.go new file mode 100644 index 000000000..e8a7dd94d --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/generated_expansion.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type LocalSubjectAccessReviewExpansion interface{} + +type SelfSubjectAccessReviewExpansion interface{} + +type SelfSubjectRulesReviewExpansion interface{} + +type SubjectAccessReviewExpansion interface{} diff --git a/pkg/clients/clientset/typed/authorization/v1/localsubjectaccessreview.go b/pkg/clients/clientset/typed/authorization/v1/localsubjectaccessreview.go new file mode 100644 index 000000000..fc7cf7d2b --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/localsubjectaccessreview.go @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// LocalSubjectAccessReviewsGetter has a method to return a LocalSubjectAccessReviewInterface. +// A group's client should implement this interface. +type LocalSubjectAccessReviewsGetter interface { + LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface +} + +// LocalSubjectAccessReviewInterface has methods to work with LocalSubjectAccessReview resources. +type LocalSubjectAccessReviewInterface interface { + Create(ctx context.Context, localSubjectAccessReview *v1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*v1.LocalSubjectAccessReview, error) + LocalSubjectAccessReviewExpansion +} + +// localSubjectAccessReviews implements LocalSubjectAccessReviewInterface +type localSubjectAccessReviews struct { + client rest.Interface + ns string +} + +// newLocalSubjectAccessReviews returns a LocalSubjectAccessReviews +func newLocalSubjectAccessReviews(c *AuthorizationV1Client, namespace string) *localSubjectAccessReviews { + return &localSubjectAccessReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a localSubjectAccessReview and creates it. Returns the server's representation of the localSubjectAccessReview, and an error, if there is any. +func (c *localSubjectAccessReviews) Create(ctx context.Context, localSubjectAccessReview *v1.LocalSubjectAccessReview, opts metav1.CreateOptions) (result *v1.LocalSubjectAccessReview, err error) { + result = &v1.LocalSubjectAccessReview{} + err = c.client.Post(). + Namespace(c.ns). + Resource("localsubjectaccessreviews"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(localSubjectAccessReview). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/authorization/v1/selfsubjectaccessreview.go b/pkg/clients/clientset/typed/authorization/v1/selfsubjectaccessreview.go new file mode 100644 index 000000000..ce4b71070 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/selfsubjectaccessreview.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// SelfSubjectAccessReviewsGetter has a method to return a SelfSubjectAccessReviewInterface. +// A group's client should implement this interface. +type SelfSubjectAccessReviewsGetter interface { + SelfSubjectAccessReviews() SelfSubjectAccessReviewInterface +} + +// SelfSubjectAccessReviewInterface has methods to work with SelfSubjectAccessReview resources. +type SelfSubjectAccessReviewInterface interface { + Create(ctx context.Context, selfSubjectAccessReview *v1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*v1.SelfSubjectAccessReview, error) + SelfSubjectAccessReviewExpansion +} + +// selfSubjectAccessReviews implements SelfSubjectAccessReviewInterface +type selfSubjectAccessReviews struct { + client rest.Interface +} + +// newSelfSubjectAccessReviews returns a SelfSubjectAccessReviews +func newSelfSubjectAccessReviews(c *AuthorizationV1Client) *selfSubjectAccessReviews { + return &selfSubjectAccessReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a selfSubjectAccessReview and creates it. Returns the server's representation of the selfSubjectAccessReview, and an error, if there is any. +func (c *selfSubjectAccessReviews) Create(ctx context.Context, selfSubjectAccessReview *v1.SelfSubjectAccessReview, opts metav1.CreateOptions) (result *v1.SelfSubjectAccessReview, err error) { + result = &v1.SelfSubjectAccessReview{} + err = c.client.Post(). + Resource("selfsubjectaccessreviews"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(selfSubjectAccessReview). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/authorization/v1/selfsubjectrulesreview.go b/pkg/clients/clientset/typed/authorization/v1/selfsubjectrulesreview.go new file mode 100644 index 000000000..a308fa301 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/selfsubjectrulesreview.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// SelfSubjectRulesReviewsGetter has a method to return a SelfSubjectRulesReviewInterface. +// A group's client should implement this interface. +type SelfSubjectRulesReviewsGetter interface { + SelfSubjectRulesReviews() SelfSubjectRulesReviewInterface +} + +// SelfSubjectRulesReviewInterface has methods to work with SelfSubjectRulesReview resources. +type SelfSubjectRulesReviewInterface interface { + Create(ctx context.Context, selfSubjectRulesReview *v1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*v1.SelfSubjectRulesReview, error) + SelfSubjectRulesReviewExpansion +} + +// selfSubjectRulesReviews implements SelfSubjectRulesReviewInterface +type selfSubjectRulesReviews struct { + client rest.Interface +} + +// newSelfSubjectRulesReviews returns a SelfSubjectRulesReviews +func newSelfSubjectRulesReviews(c *AuthorizationV1Client) *selfSubjectRulesReviews { + return &selfSubjectRulesReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a selfSubjectRulesReview and creates it. Returns the server's representation of the selfSubjectRulesReview, and an error, if there is any. +func (c *selfSubjectRulesReviews) Create(ctx context.Context, selfSubjectRulesReview *v1.SelfSubjectRulesReview, opts metav1.CreateOptions) (result *v1.SelfSubjectRulesReview, err error) { + result = &v1.SelfSubjectRulesReview{} + err = c.client.Post(). + Resource("selfsubjectrulesreviews"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(selfSubjectRulesReview). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/authorization/v1/subjectaccessreview.go b/pkg/clients/clientset/typed/authorization/v1/subjectaccessreview.go new file mode 100644 index 000000000..4fa624087 --- /dev/null +++ b/pkg/clients/clientset/typed/authorization/v1/subjectaccessreview.go @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/authorization/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// SubjectAccessReviewsGetter has a method to return a SubjectAccessReviewInterface. +// A group's client should implement this interface. +type SubjectAccessReviewsGetter interface { + SubjectAccessReviews() SubjectAccessReviewInterface +} + +// SubjectAccessReviewInterface has methods to work with SubjectAccessReview resources. +type SubjectAccessReviewInterface interface { + Create(ctx context.Context, subjectAccessReview *v1.SubjectAccessReview, opts metav1.CreateOptions) (*v1.SubjectAccessReview, error) + SubjectAccessReviewExpansion +} + +// subjectAccessReviews implements SubjectAccessReviewInterface +type subjectAccessReviews struct { + client rest.Interface +} + +// newSubjectAccessReviews returns a SubjectAccessReviews +func newSubjectAccessReviews(c *AuthorizationV1Client) *subjectAccessReviews { + return &subjectAccessReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a subjectAccessReview and creates it. Returns the server's representation of the subjectAccessReview, and an error, if there is any. +func (c *subjectAccessReviews) Create(ctx context.Context, subjectAccessReview *v1.SubjectAccessReview, opts metav1.CreateOptions) (result *v1.SubjectAccessReview, err error) { + result = &v1.SubjectAccessReview{} + err = c.client.Post(). + Resource("subjectaccessreviews"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(subjectAccessReview). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/autoscaling/v1/autoscaling_client.go b/pkg/clients/clientset/typed/autoscaling/v1/autoscaling_client.go new file mode 100644 index 000000000..db2b8457f --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/autoscaling_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/autoscaling/v1" + rest "k8s.io/client-go/rest" +) + +type AutoscalingV1Interface interface { + RESTClient() rest.Interface + HorizontalPodAutoscalersGetter +} + +// AutoscalingV1Client is used to interact with features provided by the autoscaling group. +type AutoscalingV1Client struct { + restClient rest.Interface +} + +func (c *AutoscalingV1Client) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { + return newHorizontalPodAutoscalers(c, namespace) +} + +// NewForConfig creates a new AutoscalingV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AutoscalingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AutoscalingV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AutoscalingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AutoscalingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AutoscalingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AutoscalingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AutoscalingV1Client for the given RESTClient. +func New(c rest.Interface) *AutoscalingV1Client { + return &AutoscalingV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AutoscalingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/autoscaling/v1/doc.go b/pkg/clients/clientset/typed/autoscaling/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/autoscaling/v1/fake/doc.go b/pkg/clients/clientset/typed/autoscaling/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/autoscaling/v1/fake/fake_autoscaling_client.go b/pkg/clients/clientset/typed/autoscaling/v1/fake/fake_autoscaling_client.go new file mode 100644 index 000000000..0babf2ba1 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/fake/fake_autoscaling_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAutoscalingV1 struct { + *testing.Fake +} + +func (c *FakeAutoscalingV1) HorizontalPodAutoscalers(namespace string) v1.HorizontalPodAutoscalerInterface { + return &FakeHorizontalPodAutoscalers{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAutoscalingV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/autoscaling/v1/fake/fake_horizontalpodautoscaler.go b/pkg/clients/clientset/typed/autoscaling/v1/fake/fake_horizontalpodautoscaler.go new file mode 100644 index 000000000..f1b1679d4 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/fake/fake_horizontalpodautoscaler.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + autoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + v1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface +type FakeHorizontalPodAutoscalers struct { + Fake *FakeAutoscalingV1 + ns string +} + +var horizontalpodautoscalersResource = v1.SchemeGroupVersion.WithResource("horizontalpodautoscalers") + +var horizontalpodautoscalersKind = v1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") + +// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. +func (c *FakeHorizontalPodAutoscalers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(horizontalpodautoscalersResource, c.ns, name), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} + +// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors. +func (c *FakeHorizontalPodAutoscalers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HorizontalPodAutoscalerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), &v1.HorizontalPodAutoscalerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.HorizontalPodAutoscalerList{ListMeta: obj.(*v1.HorizontalPodAutoscalerList).ListMeta} + for _, item := range obj.(*v1.HorizontalPodAutoscalerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. +func (c *FakeHorizontalPodAutoscalers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts)) + +} + +// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *FakeHorizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (result *v1.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} + +// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *FakeHorizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (result *v1.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeHorizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v1.HorizontalPodAutoscaler, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} + +// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs. +func (c *FakeHorizontalPodAutoscalers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(horizontalpodautoscalersResource, c.ns, name, opts), &v1.HorizontalPodAutoscaler{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeHorizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(horizontalpodautoscalersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.HorizontalPodAutoscalerList{}) + return err +} + +// Patch applies the patch and returns the patched horizontalPodAutoscaler. +func (c *FakeHorizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, name, pt, data, subresources...), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler. +func (c *FakeHorizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeHorizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HorizontalPodAutoscaler), err +} diff --git a/pkg/clients/clientset/typed/autoscaling/v1/generated_expansion.go b/pkg/clients/clientset/typed/autoscaling/v1/generated_expansion.go new file mode 100644 index 000000000..59826fe59 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type HorizontalPodAutoscalerExpansion interface{} diff --git a/pkg/clients/clientset/typed/autoscaling/v1/horizontalpodautoscaler.go b/pkg/clients/clientset/typed/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..37ed41cd9 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + autoscalingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface. +// A group's client should implement this interface. +type HorizontalPodAutoscalersGetter interface { + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface +} + +// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources. +type HorizontalPodAutoscalerInterface interface { + Create(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*v1.HorizontalPodAutoscaler, error) + Update(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v1.HorizontalPodAutoscaler, error) + UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*v1.HorizontalPodAutoscaler, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.HorizontalPodAutoscaler, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.HorizontalPodAutoscalerList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error) + Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) + ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) + HorizontalPodAutoscalerExpansion +} + +// horizontalPodAutoscalers implements HorizontalPodAutoscalerInterface +type horizontalPodAutoscalers struct { + client rest.Interface + ns string +} + +// newHorizontalPodAutoscalers returns a HorizontalPodAutoscalers +func newHorizontalPodAutoscalers(c *AutoscalingV1Client, namespace string) *horizontalPodAutoscalers { + return &horizontalPodAutoscalers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. +func (c *horizontalPodAutoscalers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HorizontalPodAutoscaler, err error) { + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors. +func (c *horizontalPodAutoscalers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HorizontalPodAutoscalerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.HorizontalPodAutoscalerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. +func (c *horizontalPodAutoscalers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *horizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (result *v1.HorizontalPodAutoscaler, err error) { + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Post(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(horizontalPodAutoscaler). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *horizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (result *v1.HorizontalPodAutoscaler, err error) { + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(horizontalPodAutoscaler.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(horizontalPodAutoscaler). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *horizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (result *v1.HorizontalPodAutoscaler, err error) { + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(horizontalPodAutoscaler.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(horizontalPodAutoscaler). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs. +func (c *horizontalPodAutoscalers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *horizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched horizontalPodAutoscaler. +func (c *horizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HorizontalPodAutoscaler, err error) { + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler. +func (c *horizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *horizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + + result = &v1.HorizontalPodAutoscaler{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/autoscaling/v2/autoscaling_client.go b/pkg/clients/clientset/typed/autoscaling/v2/autoscaling_client.go new file mode 100644 index 000000000..fafe1ab54 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/autoscaling_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v2 "k8s.io/api/autoscaling/v2" + rest "k8s.io/client-go/rest" +) + +type AutoscalingV2Interface interface { + RESTClient() rest.Interface + HorizontalPodAutoscalersGetter +} + +// AutoscalingV2Client is used to interact with features provided by the autoscaling group. +type AutoscalingV2Client struct { + restClient rest.Interface +} + +func (c *AutoscalingV2Client) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { + return newHorizontalPodAutoscalers(c, namespace) +} + +// NewForConfig creates a new AutoscalingV2Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AutoscalingV2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AutoscalingV2Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AutoscalingV2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AutoscalingV2Client{client}, nil +} + +// NewForConfigOrDie creates a new AutoscalingV2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AutoscalingV2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AutoscalingV2Client for the given RESTClient. +func New(c rest.Interface) *AutoscalingV2Client { + return &AutoscalingV2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AutoscalingV2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/autoscaling/v2/doc.go b/pkg/clients/clientset/typed/autoscaling/v2/doc.go new file mode 100644 index 000000000..c129cea7d --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v2 diff --git a/pkg/clients/clientset/typed/autoscaling/v2/fake/doc.go b/pkg/clients/clientset/typed/autoscaling/v2/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/autoscaling/v2/fake/fake_autoscaling_client.go b/pkg/clients/clientset/typed/autoscaling/v2/fake/fake_autoscaling_client.go new file mode 100644 index 000000000..f4f2becb4 --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/fake/fake_autoscaling_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v2 "github.com/seal-io/walrus/pkg/clients/clientset/typed/autoscaling/v2" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAutoscalingV2 struct { + *testing.Fake +} + +func (c *FakeAutoscalingV2) HorizontalPodAutoscalers(namespace string) v2.HorizontalPodAutoscalerInterface { + return &FakeHorizontalPodAutoscalers{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAutoscalingV2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/autoscaling/v2/fake/fake_horizontalpodautoscaler.go b/pkg/clients/clientset/typed/autoscaling/v2/fake/fake_horizontalpodautoscaler.go new file mode 100644 index 000000000..230ca820f --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/fake/fake_horizontalpodautoscaler.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + autoscalingv2 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v2" + v2 "k8s.io/api/autoscaling/v2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface +type FakeHorizontalPodAutoscalers struct { + Fake *FakeAutoscalingV2 + ns string +} + +var horizontalpodautoscalersResource = v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers") + +var horizontalpodautoscalersKind = v2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler") + +// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. +func (c *FakeHorizontalPodAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(horizontalpodautoscalersResource, c.ns, name), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} + +// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors. +func (c *FakeHorizontalPodAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v2.HorizontalPodAutoscalerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(horizontalpodautoscalersResource, horizontalpodautoscalersKind, c.ns, opts), &v2.HorizontalPodAutoscalerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2.HorizontalPodAutoscalerList{ListMeta: obj.(*v2.HorizontalPodAutoscalerList).ListMeta} + for _, item := range obj.(*v2.HorizontalPodAutoscalerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. +func (c *FakeHorizontalPodAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(horizontalpodautoscalersResource, c.ns, opts)) + +} + +// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *FakeHorizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.CreateOptions) (result *v2.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} + +// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *FakeHorizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(horizontalpodautoscalersResource, c.ns, horizontalPodAutoscaler), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeHorizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*v2.HorizontalPodAutoscaler, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(horizontalpodautoscalersResource, "status", c.ns, horizontalPodAutoscaler), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} + +// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs. +func (c *FakeHorizontalPodAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(horizontalpodautoscalersResource, c.ns, name, opts), &v2.HorizontalPodAutoscaler{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeHorizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(horizontalpodautoscalersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2.HorizontalPodAutoscalerList{}) + return err +} + +// Patch applies the patch and returns the patched horizontalPodAutoscaler. +func (c *FakeHorizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.HorizontalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, name, pt, data, subresources...), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler. +func (c *FakeHorizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeHorizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(horizontalpodautoscalersResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v2.HorizontalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v2.HorizontalPodAutoscaler), err +} diff --git a/pkg/clients/clientset/typed/autoscaling/v2/generated_expansion.go b/pkg/clients/clientset/typed/autoscaling/v2/generated_expansion.go new file mode 100644 index 000000000..8c712e70d --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +type HorizontalPodAutoscalerExpansion interface{} diff --git a/pkg/clients/clientset/typed/autoscaling/v2/horizontalpodautoscaler.go b/pkg/clients/clientset/typed/autoscaling/v2/horizontalpodautoscaler.go new file mode 100644 index 000000000..a5198e45f --- /dev/null +++ b/pkg/clients/clientset/typed/autoscaling/v2/horizontalpodautoscaler.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + autoscalingv2 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/autoscaling/v2" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v2 "k8s.io/api/autoscaling/v2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface. +// A group's client should implement this interface. +type HorizontalPodAutoscalersGetter interface { + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface +} + +// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources. +type HorizontalPodAutoscalerInterface interface { + Create(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.CreateOptions) (*v2.HorizontalPodAutoscaler, error) + Update(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*v2.HorizontalPodAutoscaler, error) + UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*v2.HorizontalPodAutoscaler, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2.HorizontalPodAutoscaler, error) + List(ctx context.Context, opts v1.ListOptions) (*v2.HorizontalPodAutoscalerList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.HorizontalPodAutoscaler, err error) + Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) + ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) + HorizontalPodAutoscalerExpansion +} + +// horizontalPodAutoscalers implements HorizontalPodAutoscalerInterface +type horizontalPodAutoscalers struct { + client rest.Interface + ns string +} + +// newHorizontalPodAutoscalers returns a HorizontalPodAutoscalers +func newHorizontalPodAutoscalers(c *AutoscalingV2Client, namespace string) *horizontalPodAutoscalers { + return &horizontalPodAutoscalers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the horizontalPodAutoscaler, and returns the corresponding horizontalPodAutoscaler object, and an error if there is any. +func (c *horizontalPodAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2.HorizontalPodAutoscaler, err error) { + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HorizontalPodAutoscalers that match those selectors. +func (c *horizontalPodAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v2.HorizontalPodAutoscalerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2.HorizontalPodAutoscalerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers. +func (c *horizontalPodAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a horizontalPodAutoscaler and creates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *horizontalPodAutoscalers) Create(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.CreateOptions) (result *v2.HorizontalPodAutoscaler, err error) { + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Post(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(horizontalPodAutoscaler). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a horizontalPodAutoscaler and updates it. Returns the server's representation of the horizontalPodAutoscaler, and an error, if there is any. +func (c *horizontalPodAutoscalers) Update(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2.HorizontalPodAutoscaler, err error) { + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(horizontalPodAutoscaler.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(horizontalPodAutoscaler). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *horizontalPodAutoscalers) UpdateStatus(ctx context.Context, horizontalPodAutoscaler *v2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (result *v2.HorizontalPodAutoscaler, err error) { + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(horizontalPodAutoscaler.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(horizontalPodAutoscaler). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the horizontalPodAutoscaler and deletes it. Returns an error if one occurs. +func (c *horizontalPodAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *horizontalPodAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched horizontalPodAutoscaler. +func (c *horizontalPodAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2.HorizontalPodAutoscaler, err error) { + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied horizontalPodAutoscaler. +func (c *horizontalPodAutoscalers) Apply(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *horizontalPodAutoscalers) ApplyStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *v2.HorizontalPodAutoscaler, err error) { + if horizontalPodAutoscaler == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(horizontalPodAutoscaler) + if err != nil { + return nil, err + } + + name := horizontalPodAutoscaler.Name + if name == nil { + return nil, fmt.Errorf("horizontalPodAutoscaler.Name must be provided to Apply") + } + + result = &v2.HorizontalPodAutoscaler{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("horizontalpodautoscalers"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/batch/v1/batch_client.go b/pkg/clients/clientset/typed/batch/v1/batch_client.go new file mode 100644 index 000000000..440715932 --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/batch_client.go @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/batch/v1" + rest "k8s.io/client-go/rest" +) + +type BatchV1Interface interface { + RESTClient() rest.Interface + CronJobsGetter + JobsGetter +} + +// BatchV1Client is used to interact with features provided by the batch group. +type BatchV1Client struct { + restClient rest.Interface +} + +func (c *BatchV1Client) CronJobs(namespace string) CronJobInterface { + return newCronJobs(c, namespace) +} + +func (c *BatchV1Client) Jobs(namespace string) JobInterface { + return newJobs(c, namespace) +} + +// NewForConfig creates a new BatchV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BatchV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BatchV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BatchV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BatchV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BatchV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BatchV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BatchV1Client for the given RESTClient. +func New(c rest.Interface) *BatchV1Client { + return &BatchV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BatchV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/batch/v1/cronjob.go b/pkg/clients/clientset/typed/batch/v1/cronjob.go new file mode 100644 index 000000000..e9c66f21e --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/cronjob.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + batchv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/batch/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CronJobsGetter has a method to return a CronJobInterface. +// A group's client should implement this interface. +type CronJobsGetter interface { + CronJobs(namespace string) CronJobInterface +} + +// CronJobInterface has methods to work with CronJob resources. +type CronJobInterface interface { + Create(ctx context.Context, cronJob *v1.CronJob, opts metav1.CreateOptions) (*v1.CronJob, error) + Update(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (*v1.CronJob, error) + UpdateStatus(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (*v1.CronJob, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CronJob, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CronJobList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CronJob, err error) + Apply(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) + ApplyStatus(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) + CronJobExpansion +} + +// cronJobs implements CronJobInterface +type cronJobs struct { + client rest.Interface + ns string +} + +// newCronJobs returns a CronJobs +func newCronJobs(c *BatchV1Client, namespace string) *cronJobs { + return &cronJobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any. +func (c *cronJobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CronJob, err error) { + result = &v1.CronJob{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cronjobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CronJobs that match those selectors. +func (c *cronJobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CronJobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CronJobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("cronjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cronJobs. +func (c *cronJobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("cronjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any. +func (c *cronJobs) Create(ctx context.Context, cronJob *v1.CronJob, opts metav1.CreateOptions) (result *v1.CronJob, err error) { + result = &v1.CronJob{} + err = c.client.Post(). + Namespace(c.ns). + Resource("cronjobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cronJob). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any. +func (c *cronJobs) Update(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) { + result = &v1.CronJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cronjobs"). + Name(cronJob.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cronJob). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *cronJobs) UpdateStatus(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) { + result = &v1.CronJob{} + err = c.client.Put(). + Namespace(c.ns). + Resource("cronjobs"). + Name(cronJob.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cronJob). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the cronJob and deletes it. Returns an error if one occurs. +func (c *cronJobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("cronjobs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cronJobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("cronjobs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched cronJob. +func (c *cronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CronJob, err error) { + result = &v1.CronJob{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("cronjobs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cronJob. +func (c *cronJobs) Apply(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) { + if cronJob == nil { + return nil, fmt.Errorf("cronJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(cronJob) + if err != nil { + return nil, err + } + name := cronJob.Name + if name == nil { + return nil, fmt.Errorf("cronJob.Name must be provided to Apply") + } + result = &v1.CronJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("cronjobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *cronJobs) ApplyStatus(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) { + if cronJob == nil { + return nil, fmt.Errorf("cronJob provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(cronJob) + if err != nil { + return nil, err + } + + name := cronJob.Name + if name == nil { + return nil, fmt.Errorf("cronJob.Name must be provided to Apply") + } + + result = &v1.CronJob{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("cronjobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/batch/v1/doc.go b/pkg/clients/clientset/typed/batch/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/batch/v1/fake/doc.go b/pkg/clients/clientset/typed/batch/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/batch/v1/fake/fake_batch_client.go b/pkg/clients/clientset/typed/batch/v1/fake/fake_batch_client.go new file mode 100644 index 000000000..bb754402f --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/fake/fake_batch_client.go @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/batch/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeBatchV1 struct { + *testing.Fake +} + +func (c *FakeBatchV1) CronJobs(namespace string) v1.CronJobInterface { + return &FakeCronJobs{c, namespace} +} + +func (c *FakeBatchV1) Jobs(namespace string) v1.JobInterface { + return &FakeJobs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBatchV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/batch/v1/fake/fake_cronjob.go b/pkg/clients/clientset/typed/batch/v1/fake/fake_cronjob.go new file mode 100644 index 000000000..8a371f1e7 --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/fake/fake_cronjob.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + batchv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/batch/v1" + v1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCronJobs implements CronJobInterface +type FakeCronJobs struct { + Fake *FakeBatchV1 + ns string +} + +var cronjobsResource = v1.SchemeGroupVersion.WithResource("cronjobs") + +var cronjobsKind = v1.SchemeGroupVersion.WithKind("CronJob") + +// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any. +func (c *FakeCronJobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CronJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(cronjobsResource, c.ns, name), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} + +// List takes label and field selectors, and returns the list of CronJobs that match those selectors. +func (c *FakeCronJobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CronJobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(cronjobsResource, cronjobsKind, c.ns, opts), &v1.CronJobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CronJobList{ListMeta: obj.(*v1.CronJobList).ListMeta} + for _, item := range obj.(*v1.CronJobList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cronJobs. +func (c *FakeCronJobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(cronjobsResource, c.ns, opts)) + +} + +// Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any. +func (c *FakeCronJobs) Create(ctx context.Context, cronJob *v1.CronJob, opts metav1.CreateOptions) (result *v1.CronJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(cronjobsResource, c.ns, cronJob), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} + +// Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any. +func (c *FakeCronJobs) Update(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (result *v1.CronJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(cronjobsResource, c.ns, cronJob), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCronJobs) UpdateStatus(ctx context.Context, cronJob *v1.CronJob, opts metav1.UpdateOptions) (*v1.CronJob, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, cronJob), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} + +// Delete takes name of the cronJob and deletes it. Returns an error if one occurs. +func (c *FakeCronJobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(cronjobsResource, c.ns, name, opts), &v1.CronJob{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCronJobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(cronjobsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CronJobList{}) + return err +} + +// Patch applies the patch and returns the patched cronJob. +func (c *FakeCronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CronJob, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cronjobsResource, c.ns, name, pt, data, subresources...), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cronJob. +func (c *FakeCronJobs) Apply(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) { + if cronJob == nil { + return nil, fmt.Errorf("cronJob provided to Apply must not be nil") + } + data, err := json.Marshal(cronJob) + if err != nil { + return nil, err + } + name := cronJob.Name + if name == nil { + return nil, fmt.Errorf("cronJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cronjobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeCronJobs) ApplyStatus(ctx context.Context, cronJob *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CronJob, err error) { + if cronJob == nil { + return nil, fmt.Errorf("cronJob provided to Apply must not be nil") + } + data, err := json.Marshal(cronJob) + if err != nil { + return nil, err + } + name := cronJob.Name + if name == nil { + return nil, fmt.Errorf("cronJob.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(cronjobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.CronJob{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CronJob), err +} diff --git a/pkg/clients/clientset/typed/batch/v1/fake/fake_job.go b/pkg/clients/clientset/typed/batch/v1/fake/fake_job.go new file mode 100644 index 000000000..87a056bcc --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/fake/fake_job.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + batchv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/batch/v1" + v1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeJobs implements JobInterface +type FakeJobs struct { + Fake *FakeBatchV1 + ns string +} + +var jobsResource = v1.SchemeGroupVersion.WithResource("jobs") + +var jobsKind = v1.SchemeGroupVersion.WithKind("Job") + +// Get takes name of the job, and returns the corresponding job object, and an error if there is any. +func (c *FakeJobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(jobsResource, c.ns, name), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} + +// List takes label and field selectors, and returns the list of Jobs that match those selectors. +func (c *FakeJobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.JobList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(jobsResource, jobsKind, c.ns, opts), &v1.JobList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.JobList{ListMeta: obj.(*v1.JobList).ListMeta} + for _, item := range obj.(*v1.JobList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested jobs. +func (c *FakeJobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(jobsResource, c.ns, opts)) + +} + +// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. +func (c *FakeJobs) Create(ctx context.Context, job *v1.Job, opts metav1.CreateOptions) (result *v1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(jobsResource, c.ns, job), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} + +// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. +func (c *FakeJobs) Update(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(jobsResource, c.ns, job), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeJobs) UpdateStatus(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (*v1.Job, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(jobsResource, "status", c.ns, job), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} + +// Delete takes name of the job and deletes it. Returns an error if one occurs. +func (c *FakeJobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(jobsResource, c.ns, name, opts), &v1.Job{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeJobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(jobsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.JobList{}) + return err +} + +// Patch applies the patch and returns the patched job. +func (c *FakeJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Job, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(jobsResource, c.ns, name, pt, data, subresources...), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied job. +func (c *FakeJobs) Apply(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) { + if job == nil { + return nil, fmt.Errorf("job provided to Apply must not be nil") + } + data, err := json.Marshal(job) + if err != nil { + return nil, err + } + name := job.Name + if name == nil { + return nil, fmt.Errorf("job.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(jobsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeJobs) ApplyStatus(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) { + if job == nil { + return nil, fmt.Errorf("job provided to Apply must not be nil") + } + data, err := json.Marshal(job) + if err != nil { + return nil, err + } + name := job.Name + if name == nil { + return nil, fmt.Errorf("job.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(jobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Job{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Job), err +} diff --git a/pkg/clients/clientset/typed/batch/v1/generated_expansion.go b/pkg/clients/clientset/typed/batch/v1/generated_expansion.go new file mode 100644 index 000000000..e63bc7c63 --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/generated_expansion.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type CronJobExpansion interface{} + +type JobExpansion interface{} diff --git a/pkg/clients/clientset/typed/batch/v1/job.go b/pkg/clients/clientset/typed/batch/v1/job.go new file mode 100644 index 000000000..25c40ddfa --- /dev/null +++ b/pkg/clients/clientset/typed/batch/v1/job.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + batchv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/batch/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// JobsGetter has a method to return a JobInterface. +// A group's client should implement this interface. +type JobsGetter interface { + Jobs(namespace string) JobInterface +} + +// JobInterface has methods to work with Job resources. +type JobInterface interface { + Create(ctx context.Context, job *v1.Job, opts metav1.CreateOptions) (*v1.Job, error) + Update(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (*v1.Job, error) + UpdateStatus(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (*v1.Job, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Job, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.JobList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Job, err error) + Apply(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) + ApplyStatus(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) + JobExpansion +} + +// jobs implements JobInterface +type jobs struct { + client rest.Interface + ns string +} + +// newJobs returns a Jobs +func newJobs(c *BatchV1Client, namespace string) *jobs { + return &jobs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the job, and returns the corresponding job object, and an error if there is any. +func (c *jobs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Jobs that match those selectors. +func (c *jobs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.JobList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.JobList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested jobs. +func (c *jobs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a job and creates it. Returns the server's representation of the job, and an error, if there is any. +func (c *jobs) Create(ctx context.Context, job *v1.Job, opts metav1.CreateOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Post(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(job). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a job and updates it. Returns the server's representation of the job, and an error, if there is any. +func (c *jobs) Update(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Put(). + Namespace(c.ns). + Resource("jobs"). + Name(job.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(job). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *jobs) UpdateStatus(ctx context.Context, job *v1.Job, opts metav1.UpdateOptions) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Put(). + Namespace(c.ns). + Resource("jobs"). + Name(job.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(job). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the job and deletes it. Returns an error if one occurs. +func (c *jobs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("jobs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *jobs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("jobs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched job. +func (c *jobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Job, err error) { + result = &v1.Job{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("jobs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied job. +func (c *jobs) Apply(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) { + if job == nil { + return nil, fmt.Errorf("job provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(job) + if err != nil { + return nil, err + } + name := job.Name + if name == nil { + return nil, fmt.Errorf("job.Name must be provided to Apply") + } + result = &v1.Job{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("jobs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *jobs) ApplyStatus(ctx context.Context, job *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Job, err error) { + if job == nil { + return nil, fmt.Errorf("job provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(job) + if err != nil { + return nil, err + } + + name := job.Name + if name == nil { + return nil, fmt.Errorf("job.Name must be provided to Apply") + } + + result = &v1.Job{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("jobs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/certificates/v1/certificates_client.go b/pkg/clients/clientset/typed/certificates/v1/certificates_client.go new file mode 100644 index 000000000..e1cff9d15 --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/certificates_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/certificates/v1" + rest "k8s.io/client-go/rest" +) + +type CertificatesV1Interface interface { + RESTClient() rest.Interface + CertificateSigningRequestsGetter +} + +// CertificatesV1Client is used to interact with features provided by the certificates.k8s.io group. +type CertificatesV1Client struct { + restClient rest.Interface +} + +func (c *CertificatesV1Client) CertificateSigningRequests() CertificateSigningRequestInterface { + return newCertificateSigningRequests(c) +} + +// NewForConfig creates a new CertificatesV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*CertificatesV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new CertificatesV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CertificatesV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &CertificatesV1Client{client}, nil +} + +// NewForConfigOrDie creates a new CertificatesV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CertificatesV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CertificatesV1Client for the given RESTClient. +func New(c rest.Interface) *CertificatesV1Client { + return &CertificatesV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *CertificatesV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/certificates/v1/certificatesigningrequest.go b/pkg/clients/clientset/typed/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..3ac6e0a45 --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,246 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + certificatesv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/certificates/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CertificateSigningRequestsGetter has a method to return a CertificateSigningRequestInterface. +// A group's client should implement this interface. +type CertificateSigningRequestsGetter interface { + CertificateSigningRequests() CertificateSigningRequestInterface +} + +// CertificateSigningRequestInterface has methods to work with CertificateSigningRequest resources. +type CertificateSigningRequestInterface interface { + Create(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.CreateOptions) (*v1.CertificateSigningRequest, error) + Update(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (*v1.CertificateSigningRequest, error) + UpdateStatus(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (*v1.CertificateSigningRequest, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CertificateSigningRequest, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CertificateSigningRequestList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CertificateSigningRequest, err error) + Apply(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) + ApplyStatus(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) + UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (*v1.CertificateSigningRequest, error) + + CertificateSigningRequestExpansion +} + +// certificateSigningRequests implements CertificateSigningRequestInterface +type certificateSigningRequests struct { + client rest.Interface +} + +// newCertificateSigningRequests returns a CertificateSigningRequests +func newCertificateSigningRequests(c *CertificatesV1Client) *certificateSigningRequests { + return &certificateSigningRequests{ + client: c.RESTClient(), + } +} + +// Get takes name of the certificateSigningRequest, and returns the corresponding certificateSigningRequest object, and an error if there is any. +func (c *certificateSigningRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CertificateSigningRequest, err error) { + result = &v1.CertificateSigningRequest{} + err = c.client.Get(). + Resource("certificatesigningrequests"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CertificateSigningRequests that match those selectors. +func (c *certificateSigningRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CertificateSigningRequestList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CertificateSigningRequestList{} + err = c.client.Get(). + Resource("certificatesigningrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested certificateSigningRequests. +func (c *certificateSigningRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("certificatesigningrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. +func (c *certificateSigningRequests) Create(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.CreateOptions) (result *v1.CertificateSigningRequest, err error) { + result = &v1.CertificateSigningRequest{} + err = c.client.Post(). + Resource("certificatesigningrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(certificateSigningRequest). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. +func (c *certificateSigningRequests) Update(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) { + result = &v1.CertificateSigningRequest{} + err = c.client.Put(). + Resource("certificatesigningrequests"). + Name(certificateSigningRequest.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(certificateSigningRequest). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *certificateSigningRequests) UpdateStatus(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) { + result = &v1.CertificateSigningRequest{} + err = c.client.Put(). + Resource("certificatesigningrequests"). + Name(certificateSigningRequest.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(certificateSigningRequest). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the certificateSigningRequest and deletes it. Returns an error if one occurs. +func (c *certificateSigningRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("certificatesigningrequests"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *certificateSigningRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("certificatesigningrequests"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched certificateSigningRequest. +func (c *certificateSigningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CertificateSigningRequest, err error) { + result = &v1.CertificateSigningRequest{} + err = c.client.Patch(pt). + Resource("certificatesigningrequests"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied certificateSigningRequest. +func (c *certificateSigningRequests) Apply(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) { + if certificateSigningRequest == nil { + return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(certificateSigningRequest) + if err != nil { + return nil, err + } + name := certificateSigningRequest.Name + if name == nil { + return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply") + } + result = &v1.CertificateSigningRequest{} + err = c.client.Patch(types.ApplyPatchType). + Resource("certificatesigningrequests"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *certificateSigningRequests) ApplyStatus(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) { + if certificateSigningRequest == nil { + return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(certificateSigningRequest) + if err != nil { + return nil, err + } + + name := certificateSigningRequest.Name + if name == nil { + return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply") + } + + result = &v1.CertificateSigningRequest{} + err = c.client.Patch(types.ApplyPatchType). + Resource("certificatesigningrequests"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// UpdateApproval takes the top resource name and the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. +func (c *certificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) { + result = &v1.CertificateSigningRequest{} + err = c.client.Put(). + Resource("certificatesigningrequests"). + Name(certificateSigningRequestName). + SubResource("approval"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(certificateSigningRequest). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/certificates/v1/doc.go b/pkg/clients/clientset/typed/certificates/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/certificates/v1/fake/doc.go b/pkg/clients/clientset/typed/certificates/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/certificates/v1/fake/fake_certificates_client.go b/pkg/clients/clientset/typed/certificates/v1/fake/fake_certificates_client.go new file mode 100644 index 000000000..c638c30e4 --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/fake/fake_certificates_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/certificates/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCertificatesV1 struct { + *testing.Fake +} + +func (c *FakeCertificatesV1) CertificateSigningRequests() v1.CertificateSigningRequestInterface { + return &FakeCertificateSigningRequests{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCertificatesV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/certificates/v1/fake/fake_certificatesigningrequest.go b/pkg/clients/clientset/typed/certificates/v1/fake/fake_certificatesigningrequest.go new file mode 100644 index 000000000..4611dd91a --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/fake/fake_certificatesigningrequest.go @@ -0,0 +1,175 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + certificatesv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/certificates/v1" + v1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCertificateSigningRequests implements CertificateSigningRequestInterface +type FakeCertificateSigningRequests struct { + Fake *FakeCertificatesV1 +} + +var certificatesigningrequestsResource = v1.SchemeGroupVersion.WithResource("certificatesigningrequests") + +var certificatesigningrequestsKind = v1.SchemeGroupVersion.WithKind("CertificateSigningRequest") + +// Get takes name of the certificateSigningRequest, and returns the corresponding certificateSigningRequest object, and an error if there is any. +func (c *FakeCertificateSigningRequests) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CertificateSigningRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(certificatesigningrequestsResource, name), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// List takes label and field selectors, and returns the list of CertificateSigningRequests that match those selectors. +func (c *FakeCertificateSigningRequests) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CertificateSigningRequestList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(certificatesigningrequestsResource, certificatesigningrequestsKind, opts), &v1.CertificateSigningRequestList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CertificateSigningRequestList{ListMeta: obj.(*v1.CertificateSigningRequestList).ListMeta} + for _, item := range obj.(*v1.CertificateSigningRequestList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested certificateSigningRequests. +func (c *FakeCertificateSigningRequests) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(certificatesigningrequestsResource, opts)) +} + +// Create takes the representation of a certificateSigningRequest and creates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. +func (c *FakeCertificateSigningRequests) Create(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.CreateOptions) (result *v1.CertificateSigningRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(certificatesigningrequestsResource, certificateSigningRequest), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// Update takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. +func (c *FakeCertificateSigningRequests) Update(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(certificatesigningrequestsResource, certificateSigningRequest), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCertificateSigningRequests) UpdateStatus(ctx context.Context, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (*v1.CertificateSigningRequest, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(certificatesigningrequestsResource, "status", certificateSigningRequest), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// Delete takes name of the certificateSigningRequest and deletes it. Returns an error if one occurs. +func (c *FakeCertificateSigningRequests) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(certificatesigningrequestsResource, name, opts), &v1.CertificateSigningRequest{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCertificateSigningRequests) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(certificatesigningrequestsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CertificateSigningRequestList{}) + return err +} + +// Patch applies the patch and returns the patched certificateSigningRequest. +func (c *FakeCertificateSigningRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CertificateSigningRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(certificatesigningrequestsResource, name, pt, data, subresources...), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied certificateSigningRequest. +func (c *FakeCertificateSigningRequests) Apply(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) { + if certificateSigningRequest == nil { + return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil") + } + data, err := json.Marshal(certificateSigningRequest) + if err != nil { + return nil, err + } + name := certificateSigningRequest.Name + if name == nil { + return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(certificatesigningrequestsResource, *name, types.ApplyPatchType, data), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeCertificateSigningRequests) ApplyStatus(ctx context.Context, certificateSigningRequest *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CertificateSigningRequest, err error) { + if certificateSigningRequest == nil { + return nil, fmt.Errorf("certificateSigningRequest provided to Apply must not be nil") + } + data, err := json.Marshal(certificateSigningRequest) + if err != nil { + return nil, err + } + name := certificateSigningRequest.Name + if name == nil { + return nil, fmt.Errorf("certificateSigningRequest.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(certificatesigningrequestsResource, *name, types.ApplyPatchType, data, "status"), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} + +// UpdateApproval takes the representation of a certificateSigningRequest and updates it. Returns the server's representation of the certificateSigningRequest, and an error, if there is any. +func (c *FakeCertificateSigningRequests) UpdateApproval(ctx context.Context, certificateSigningRequestName string, certificateSigningRequest *v1.CertificateSigningRequest, opts metav1.UpdateOptions) (result *v1.CertificateSigningRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(certificatesigningrequestsResource, "approval", certificateSigningRequest), &v1.CertificateSigningRequest{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CertificateSigningRequest), err +} diff --git a/pkg/clients/clientset/typed/certificates/v1/generated_expansion.go b/pkg/clients/clientset/typed/certificates/v1/generated_expansion.go new file mode 100644 index 000000000..ccca190ff --- /dev/null +++ b/pkg/clients/clientset/typed/certificates/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type CertificateSigningRequestExpansion interface{} diff --git a/pkg/clients/clientset/typed/coordination/v1/coordination_client.go b/pkg/clients/clientset/typed/coordination/v1/coordination_client.go new file mode 100644 index 000000000..36e9ad543 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/coordination_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/coordination/v1" + rest "k8s.io/client-go/rest" +) + +type CoordinationV1Interface interface { + RESTClient() rest.Interface + LeasesGetter +} + +// CoordinationV1Client is used to interact with features provided by the coordination.k8s.io group. +type CoordinationV1Client struct { + restClient rest.Interface +} + +func (c *CoordinationV1Client) Leases(namespace string) LeaseInterface { + return newLeases(c, namespace) +} + +// NewForConfig creates a new CoordinationV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*CoordinationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new CoordinationV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CoordinationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &CoordinationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new CoordinationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CoordinationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CoordinationV1Client for the given RESTClient. +func New(c rest.Interface) *CoordinationV1Client { + return &CoordinationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *CoordinationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/coordination/v1/doc.go b/pkg/clients/clientset/typed/coordination/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/coordination/v1/fake/doc.go b/pkg/clients/clientset/typed/coordination/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/coordination/v1/fake/fake_coordination_client.go b/pkg/clients/clientset/typed/coordination/v1/fake/fake_coordination_client.go new file mode 100644 index 000000000..9c47a4062 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/fake/fake_coordination_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/coordination/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCoordinationV1 struct { + *testing.Fake +} + +func (c *FakeCoordinationV1) Leases(namespace string) v1.LeaseInterface { + return &FakeLeases{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCoordinationV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/coordination/v1/fake/fake_lease.go b/pkg/clients/clientset/typed/coordination/v1/fake/fake_lease.go new file mode 100644 index 000000000..63be6d373 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/fake/fake_lease.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + coordinationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/coordination/v1" + v1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeLeases implements LeaseInterface +type FakeLeases struct { + Fake *FakeCoordinationV1 + ns string +} + +var leasesResource = v1.SchemeGroupVersion.WithResource("leases") + +var leasesKind = v1.SchemeGroupVersion.WithKind("Lease") + +// Get takes name of the lease, and returns the corresponding lease object, and an error if there is any. +func (c *FakeLeases) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Lease, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(leasesResource, c.ns, name), &v1.Lease{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Lease), err +} + +// List takes label and field selectors, and returns the list of Leases that match those selectors. +func (c *FakeLeases) List(ctx context.Context, opts metav1.ListOptions) (result *v1.LeaseList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(leasesResource, leasesKind, c.ns, opts), &v1.LeaseList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.LeaseList{ListMeta: obj.(*v1.LeaseList).ListMeta} + for _, item := range obj.(*v1.LeaseList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested leases. +func (c *FakeLeases) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(leasesResource, c.ns, opts)) + +} + +// Create takes the representation of a lease and creates it. Returns the server's representation of the lease, and an error, if there is any. +func (c *FakeLeases) Create(ctx context.Context, lease *v1.Lease, opts metav1.CreateOptions) (result *v1.Lease, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(leasesResource, c.ns, lease), &v1.Lease{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Lease), err +} + +// Update takes the representation of a lease and updates it. Returns the server's representation of the lease, and an error, if there is any. +func (c *FakeLeases) Update(ctx context.Context, lease *v1.Lease, opts metav1.UpdateOptions) (result *v1.Lease, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(leasesResource, c.ns, lease), &v1.Lease{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Lease), err +} + +// Delete takes name of the lease and deletes it. Returns an error if one occurs. +func (c *FakeLeases) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(leasesResource, c.ns, name, opts), &v1.Lease{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeLeases) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(leasesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.LeaseList{}) + return err +} + +// Patch applies the patch and returns the patched lease. +func (c *FakeLeases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Lease, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(leasesResource, c.ns, name, pt, data, subresources...), &v1.Lease{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Lease), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied lease. +func (c *FakeLeases) Apply(ctx context.Context, lease *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Lease, err error) { + if lease == nil { + return nil, fmt.Errorf("lease provided to Apply must not be nil") + } + data, err := json.Marshal(lease) + if err != nil { + return nil, err + } + name := lease.Name + if name == nil { + return nil, fmt.Errorf("lease.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(leasesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Lease{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Lease), err +} diff --git a/pkg/clients/clientset/typed/coordination/v1/generated_expansion.go b/pkg/clients/clientset/typed/coordination/v1/generated_expansion.go new file mode 100644 index 000000000..ca6a805e3 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type LeaseExpansion interface{} diff --git a/pkg/clients/clientset/typed/coordination/v1/lease.go b/pkg/clients/clientset/typed/coordination/v1/lease.go new file mode 100644 index 000000000..957ac61e0 --- /dev/null +++ b/pkg/clients/clientset/typed/coordination/v1/lease.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + coordinationv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/coordination/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// LeasesGetter has a method to return a LeaseInterface. +// A group's client should implement this interface. +type LeasesGetter interface { + Leases(namespace string) LeaseInterface +} + +// LeaseInterface has methods to work with Lease resources. +type LeaseInterface interface { + Create(ctx context.Context, lease *v1.Lease, opts metav1.CreateOptions) (*v1.Lease, error) + Update(ctx context.Context, lease *v1.Lease, opts metav1.UpdateOptions) (*v1.Lease, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Lease, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.LeaseList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Lease, err error) + Apply(ctx context.Context, lease *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Lease, err error) + LeaseExpansion +} + +// leases implements LeaseInterface +type leases struct { + client rest.Interface + ns string +} + +// newLeases returns a Leases +func newLeases(c *CoordinationV1Client, namespace string) *leases { + return &leases{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the lease, and returns the corresponding lease object, and an error if there is any. +func (c *leases) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Lease, err error) { + result = &v1.Lease{} + err = c.client.Get(). + Namespace(c.ns). + Resource("leases"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Leases that match those selectors. +func (c *leases) List(ctx context.Context, opts metav1.ListOptions) (result *v1.LeaseList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.LeaseList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("leases"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested leases. +func (c *leases) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("leases"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a lease and creates it. Returns the server's representation of the lease, and an error, if there is any. +func (c *leases) Create(ctx context.Context, lease *v1.Lease, opts metav1.CreateOptions) (result *v1.Lease, err error) { + result = &v1.Lease{} + err = c.client.Post(). + Namespace(c.ns). + Resource("leases"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(lease). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a lease and updates it. Returns the server's representation of the lease, and an error, if there is any. +func (c *leases) Update(ctx context.Context, lease *v1.Lease, opts metav1.UpdateOptions) (result *v1.Lease, err error) { + result = &v1.Lease{} + err = c.client.Put(). + Namespace(c.ns). + Resource("leases"). + Name(lease.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(lease). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the lease and deletes it. Returns an error if one occurs. +func (c *leases) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("leases"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *leases) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("leases"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched lease. +func (c *leases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Lease, err error) { + result = &v1.Lease{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("leases"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied lease. +func (c *leases) Apply(ctx context.Context, lease *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Lease, err error) { + if lease == nil { + return nil, fmt.Errorf("lease provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(lease) + if err != nil { + return nil, err + } + name := lease.Name + if name == nil { + return nil, fmt.Errorf("lease.Name must be provided to Apply") + } + result = &v1.Lease{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("leases"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/componentstatus.go b/pkg/clients/clientset/typed/core/v1/componentstatus.go new file mode 100644 index 000000000..163ef8471 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/componentstatus.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ComponentStatusesGetter has a method to return a ComponentStatusInterface. +// A group's client should implement this interface. +type ComponentStatusesGetter interface { + ComponentStatuses() ComponentStatusInterface +} + +// ComponentStatusInterface has methods to work with ComponentStatus resources. +type ComponentStatusInterface interface { + Create(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.CreateOptions) (*v1.ComponentStatus, error) + Update(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.UpdateOptions) (*v1.ComponentStatus, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ComponentStatus, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ComponentStatusList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ComponentStatus, err error) + Apply(ctx context.Context, componentStatus *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ComponentStatus, err error) + ComponentStatusExpansion +} + +// componentStatuses implements ComponentStatusInterface +type componentStatuses struct { + client rest.Interface +} + +// newComponentStatuses returns a ComponentStatuses +func newComponentStatuses(c *CoreV1Client) *componentStatuses { + return &componentStatuses{ + client: c.RESTClient(), + } +} + +// Get takes name of the componentStatus, and returns the corresponding componentStatus object, and an error if there is any. +func (c *componentStatuses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ComponentStatus, err error) { + result = &v1.ComponentStatus{} + err = c.client.Get(). + Resource("componentstatuses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ComponentStatuses that match those selectors. +func (c *componentStatuses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ComponentStatusList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ComponentStatusList{} + err = c.client.Get(). + Resource("componentstatuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested componentStatuses. +func (c *componentStatuses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("componentstatuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a componentStatus and creates it. Returns the server's representation of the componentStatus, and an error, if there is any. +func (c *componentStatuses) Create(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.CreateOptions) (result *v1.ComponentStatus, err error) { + result = &v1.ComponentStatus{} + err = c.client.Post(). + Resource("componentstatuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(componentStatus). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a componentStatus and updates it. Returns the server's representation of the componentStatus, and an error, if there is any. +func (c *componentStatuses) Update(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.UpdateOptions) (result *v1.ComponentStatus, err error) { + result = &v1.ComponentStatus{} + err = c.client.Put(). + Resource("componentstatuses"). + Name(componentStatus.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(componentStatus). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs. +func (c *componentStatuses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("componentstatuses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *componentStatuses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("componentstatuses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched componentStatus. +func (c *componentStatuses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ComponentStatus, err error) { + result = &v1.ComponentStatus{} + err = c.client.Patch(pt). + Resource("componentstatuses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied componentStatus. +func (c *componentStatuses) Apply(ctx context.Context, componentStatus *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ComponentStatus, err error) { + if componentStatus == nil { + return nil, fmt.Errorf("componentStatus provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(componentStatus) + if err != nil { + return nil, err + } + name := componentStatus.Name + if name == nil { + return nil, fmt.Errorf("componentStatus.Name must be provided to Apply") + } + result = &v1.ComponentStatus{} + err = c.client.Patch(types.ApplyPatchType). + Resource("componentstatuses"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/configmap.go b/pkg/clients/clientset/typed/core/v1/configmap.go new file mode 100644 index 000000000..d22d55254 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/configmap.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ConfigMapsGetter has a method to return a ConfigMapInterface. +// A group's client should implement this interface. +type ConfigMapsGetter interface { + ConfigMaps(namespace string) ConfigMapInterface +} + +// ConfigMapInterface has methods to work with ConfigMap resources. +type ConfigMapInterface interface { + Create(ctx context.Context, configMap *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error) + Update(ctx context.Context, configMap *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ConfigMapList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ConfigMap, err error) + Apply(ctx context.Context, configMap *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ConfigMap, err error) + ConfigMapExpansion +} + +// configMaps implements ConfigMapInterface +type configMaps struct { + client rest.Interface + ns string +} + +// newConfigMaps returns a ConfigMaps +func newConfigMaps(c *CoreV1Client, namespace string) *configMaps { + return &configMaps{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the configMap, and returns the corresponding configMap object, and an error if there is any. +func (c *configMaps) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ConfigMap, err error) { + result = &v1.ConfigMap{} + err = c.client.Get(). + Namespace(c.ns). + Resource("configmaps"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ConfigMaps that match those selectors. +func (c *configMaps) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConfigMapList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ConfigMapList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested configMaps. +func (c *configMaps) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a configMap and creates it. Returns the server's representation of the configMap, and an error, if there is any. +func (c *configMaps) Create(ctx context.Context, configMap *v1.ConfigMap, opts metav1.CreateOptions) (result *v1.ConfigMap, err error) { + result = &v1.ConfigMap{} + err = c.client.Post(). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(configMap). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a configMap and updates it. Returns the server's representation of the configMap, and an error, if there is any. +func (c *configMaps) Update(ctx context.Context, configMap *v1.ConfigMap, opts metav1.UpdateOptions) (result *v1.ConfigMap, err error) { + result = &v1.ConfigMap{} + err = c.client.Put(). + Namespace(c.ns). + Resource("configmaps"). + Name(configMap.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(configMap). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the configMap and deletes it. Returns an error if one occurs. +func (c *configMaps) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("configmaps"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *configMaps) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("configmaps"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched configMap. +func (c *configMaps) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ConfigMap, err error) { + result = &v1.ConfigMap{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("configmaps"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied configMap. +func (c *configMaps) Apply(ctx context.Context, configMap *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ConfigMap, err error) { + if configMap == nil { + return nil, fmt.Errorf("configMap provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(configMap) + if err != nil { + return nil, err + } + name := configMap.Name + if name == nil { + return nil, fmt.Errorf("configMap.Name must be provided to Apply") + } + result = &v1.ConfigMap{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("configmaps"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/core_client.go b/pkg/clients/clientset/typed/core/v1/core_client.go new file mode 100644 index 000000000..636083143 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/core_client.go @@ -0,0 +1,169 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + rest "k8s.io/client-go/rest" +) + +type CoreV1Interface interface { + RESTClient() rest.Interface + ComponentStatusesGetter + ConfigMapsGetter + EndpointsGetter + EventsGetter + LimitRangesGetter + NamespacesGetter + NodesGetter + PersistentVolumesGetter + PersistentVolumeClaimsGetter + PodsGetter + PodTemplatesGetter + ReplicationControllersGetter + ResourceQuotasGetter + SecretsGetter + ServicesGetter + ServiceAccountsGetter +} + +// CoreV1Client is used to interact with features provided by the group. +type CoreV1Client struct { + restClient rest.Interface +} + +func (c *CoreV1Client) ComponentStatuses() ComponentStatusInterface { + return newComponentStatuses(c) +} + +func (c *CoreV1Client) ConfigMaps(namespace string) ConfigMapInterface { + return newConfigMaps(c, namespace) +} + +func (c *CoreV1Client) Endpoints(namespace string) EndpointsInterface { + return newEndpoints(c, namespace) +} + +func (c *CoreV1Client) Events(namespace string) EventInterface { + return newEvents(c, namespace) +} + +func (c *CoreV1Client) LimitRanges(namespace string) LimitRangeInterface { + return newLimitRanges(c, namespace) +} + +func (c *CoreV1Client) Namespaces() NamespaceInterface { + return newNamespaces(c) +} + +func (c *CoreV1Client) Nodes() NodeInterface { + return newNodes(c) +} + +func (c *CoreV1Client) PersistentVolumes() PersistentVolumeInterface { + return newPersistentVolumes(c) +} + +func (c *CoreV1Client) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface { + return newPersistentVolumeClaims(c, namespace) +} + +func (c *CoreV1Client) Pods(namespace string) PodInterface { + return newPods(c, namespace) +} + +func (c *CoreV1Client) PodTemplates(namespace string) PodTemplateInterface { + return newPodTemplates(c, namespace) +} + +func (c *CoreV1Client) ReplicationControllers(namespace string) ReplicationControllerInterface { + return newReplicationControllers(c, namespace) +} + +func (c *CoreV1Client) ResourceQuotas(namespace string) ResourceQuotaInterface { + return newResourceQuotas(c, namespace) +} + +func (c *CoreV1Client) Secrets(namespace string) SecretInterface { + return newSecrets(c, namespace) +} + +func (c *CoreV1Client) Services(namespace string) ServiceInterface { + return newServices(c, namespace) +} + +func (c *CoreV1Client) ServiceAccounts(namespace string) ServiceAccountInterface { + return newServiceAccounts(c, namespace) +} + +// NewForConfig creates a new CoreV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*CoreV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new CoreV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CoreV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &CoreV1Client{client}, nil +} + +// NewForConfigOrDie creates a new CoreV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CoreV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CoreV1Client for the given RESTClient. +func New(c rest.Interface) *CoreV1Client { + return &CoreV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/api" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *CoreV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/core/v1/doc.go b/pkg/clients/clientset/typed/core/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/core/v1/endpoints.go b/pkg/clients/clientset/typed/core/v1/endpoints.go new file mode 100644 index 000000000..ca6fe0b5c --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/endpoints.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// EndpointsGetter has a method to return a EndpointsInterface. +// A group's client should implement this interface. +type EndpointsGetter interface { + Endpoints(namespace string) EndpointsInterface +} + +// EndpointsInterface has methods to work with Endpoints resources. +type EndpointsInterface interface { + Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (*v1.Endpoints, error) + Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (*v1.Endpoints, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Endpoints, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.EndpointsList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) + Apply(ctx context.Context, endpoints *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Endpoints, err error) + EndpointsExpansion +} + +// endpoints implements EndpointsInterface +type endpoints struct { + client rest.Interface + ns string +} + +// newEndpoints returns a Endpoints +func newEndpoints(c *CoreV1Client, namespace string) *endpoints { + return &endpoints{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any. +func (c *endpoints) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Endpoints, err error) { + result = &v1.Endpoints{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpoints"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Endpoints that match those selectors. +func (c *endpoints) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointsList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.EndpointsList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested endpoints. +func (c *endpoints) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any. +func (c *endpoints) Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (result *v1.Endpoints, err error) { + result = &v1.Endpoints{} + err = c.client.Post(). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(endpoints). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any. +func (c *endpoints) Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (result *v1.Endpoints, err error) { + result = &v1.Endpoints{} + err = c.client.Put(). + Namespace(c.ns). + Resource("endpoints"). + Name(endpoints.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(endpoints). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the endpoints and deletes it. Returns an error if one occurs. +func (c *endpoints) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("endpoints"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *endpoints) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("endpoints"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched endpoints. +func (c *endpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) { + result = &v1.Endpoints{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("endpoints"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied endpoints. +func (c *endpoints) Apply(ctx context.Context, endpoints *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Endpoints, err error) { + if endpoints == nil { + return nil, fmt.Errorf("endpoints provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(endpoints) + if err != nil { + return nil, err + } + name := endpoints.Name + if name == nil { + return nil, fmt.Errorf("endpoints.Name must be provided to Apply") + } + result = &v1.Endpoints{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("endpoints"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/event.go b/pkg/clients/clientset/typed/core/v1/event.go new file mode 100644 index 000000000..0caf69185 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/event.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// EventsGetter has a method to return a EventInterface. +// A group's client should implement this interface. +type EventsGetter interface { + Events(namespace string) EventInterface +} + +// EventInterface has methods to work with Event resources. +type EventInterface interface { + Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (*v1.Event, error) + Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (*v1.Event, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Event, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.EventList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) + Apply(ctx context.Context, event *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) + EventExpansion +} + +// events implements EventInterface +type events struct { + client rest.Interface + ns string +} + +// newEvents returns a Events +func newEvents(c *CoreV1Client, namespace string) *events { + return &events{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the event, and returns the corresponding event object, and an error if there is any. +func (c *events) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Get(). + Namespace(c.ns). + Resource("events"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Events that match those selectors. +func (c *events) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EventList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.EventList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested events. +func (c *events) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any. +func (c *events) Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Post(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(event). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any. +func (c *events) Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Put(). + Namespace(c.ns). + Resource("events"). + Name(event.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(event). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the event and deletes it. Returns an error if one occurs. +func (c *events) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("events"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *events) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched event. +func (c *events) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("events"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied event. +func (c *events) Apply(ctx context.Context, event *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) { + if event == nil { + return nil, fmt.Errorf("event provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(event) + if err != nil { + return nil, err + } + name := event.Name + if name == nil { + return nil, fmt.Errorf("event.Name must be provided to Apply") + } + result = &v1.Event{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("events"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/doc.go b/pkg/clients/clientset/typed/core/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_componentstatus.go b/pkg/clients/clientset/typed/core/v1/fake/fake_componentstatus.go new file mode 100644 index 000000000..693913d91 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_componentstatus.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeComponentStatuses implements ComponentStatusInterface +type FakeComponentStatuses struct { + Fake *FakeCoreV1 +} + +var componentstatusesResource = v1.SchemeGroupVersion.WithResource("componentstatuses") + +var componentstatusesKind = v1.SchemeGroupVersion.WithKind("ComponentStatus") + +// Get takes name of the componentStatus, and returns the corresponding componentStatus object, and an error if there is any. +func (c *FakeComponentStatuses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(componentstatusesResource, name), &v1.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ComponentStatus), err +} + +// List takes label and field selectors, and returns the list of ComponentStatuses that match those selectors. +func (c *FakeComponentStatuses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ComponentStatusList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(componentstatusesResource, componentstatusesKind, opts), &v1.ComponentStatusList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ComponentStatusList{ListMeta: obj.(*v1.ComponentStatusList).ListMeta} + for _, item := range obj.(*v1.ComponentStatusList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested componentStatuses. +func (c *FakeComponentStatuses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(componentstatusesResource, opts)) +} + +// Create takes the representation of a componentStatus and creates it. Returns the server's representation of the componentStatus, and an error, if there is any. +func (c *FakeComponentStatuses) Create(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.CreateOptions) (result *v1.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(componentstatusesResource, componentStatus), &v1.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ComponentStatus), err +} + +// Update takes the representation of a componentStatus and updates it. Returns the server's representation of the componentStatus, and an error, if there is any. +func (c *FakeComponentStatuses) Update(ctx context.Context, componentStatus *v1.ComponentStatus, opts metav1.UpdateOptions) (result *v1.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(componentstatusesResource, componentStatus), &v1.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ComponentStatus), err +} + +// Delete takes name of the componentStatus and deletes it. Returns an error if one occurs. +func (c *FakeComponentStatuses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(componentstatusesResource, name, opts), &v1.ComponentStatus{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeComponentStatuses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(componentstatusesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ComponentStatusList{}) + return err +} + +// Patch applies the patch and returns the patched componentStatus. +func (c *FakeComponentStatuses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ComponentStatus, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(componentstatusesResource, name, pt, data, subresources...), &v1.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ComponentStatus), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied componentStatus. +func (c *FakeComponentStatuses) Apply(ctx context.Context, componentStatus *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ComponentStatus, err error) { + if componentStatus == nil { + return nil, fmt.Errorf("componentStatus provided to Apply must not be nil") + } + data, err := json.Marshal(componentStatus) + if err != nil { + return nil, err + } + name := componentStatus.Name + if name == nil { + return nil, fmt.Errorf("componentStatus.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(componentstatusesResource, *name, types.ApplyPatchType, data), &v1.ComponentStatus{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ComponentStatus), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_configmap.go b/pkg/clients/clientset/typed/core/v1/fake/fake_configmap.go new file mode 100644 index 000000000..c365e101c --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_configmap.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeConfigMaps implements ConfigMapInterface +type FakeConfigMaps struct { + Fake *FakeCoreV1 + ns string +} + +var configmapsResource = v1.SchemeGroupVersion.WithResource("configmaps") + +var configmapsKind = v1.SchemeGroupVersion.WithKind("ConfigMap") + +// Get takes name of the configMap, and returns the corresponding configMap object, and an error if there is any. +func (c *FakeConfigMaps) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(configmapsResource, c.ns, name), &v1.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ConfigMap), err +} + +// List takes label and field selectors, and returns the list of ConfigMaps that match those selectors. +func (c *FakeConfigMaps) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConfigMapList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(configmapsResource, configmapsKind, c.ns, opts), &v1.ConfigMapList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ConfigMapList{ListMeta: obj.(*v1.ConfigMapList).ListMeta} + for _, item := range obj.(*v1.ConfigMapList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested configMaps. +func (c *FakeConfigMaps) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(configmapsResource, c.ns, opts)) + +} + +// Create takes the representation of a configMap and creates it. Returns the server's representation of the configMap, and an error, if there is any. +func (c *FakeConfigMaps) Create(ctx context.Context, configMap *v1.ConfigMap, opts metav1.CreateOptions) (result *v1.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(configmapsResource, c.ns, configMap), &v1.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ConfigMap), err +} + +// Update takes the representation of a configMap and updates it. Returns the server's representation of the configMap, and an error, if there is any. +func (c *FakeConfigMaps) Update(ctx context.Context, configMap *v1.ConfigMap, opts metav1.UpdateOptions) (result *v1.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(configmapsResource, c.ns, configMap), &v1.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ConfigMap), err +} + +// Delete takes name of the configMap and deletes it. Returns an error if one occurs. +func (c *FakeConfigMaps) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(configmapsResource, c.ns, name, opts), &v1.ConfigMap{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeConfigMaps) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(configmapsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ConfigMapList{}) + return err +} + +// Patch applies the patch and returns the patched configMap. +func (c *FakeConfigMaps) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ConfigMap, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(configmapsResource, c.ns, name, pt, data, subresources...), &v1.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ConfigMap), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied configMap. +func (c *FakeConfigMaps) Apply(ctx context.Context, configMap *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ConfigMap, err error) { + if configMap == nil { + return nil, fmt.Errorf("configMap provided to Apply must not be nil") + } + data, err := json.Marshal(configMap) + if err != nil { + return nil, err + } + name := configMap.Name + if name == nil { + return nil, fmt.Errorf("configMap.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(configmapsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ConfigMap{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ConfigMap), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_core_client.go b/pkg/clients/clientset/typed/core/v1/fake/fake_core_client.go new file mode 100644 index 000000000..6f255632b --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_core_client.go @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/core/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCoreV1 struct { + *testing.Fake +} + +func (c *FakeCoreV1) ComponentStatuses() v1.ComponentStatusInterface { + return &FakeComponentStatuses{c} +} + +func (c *FakeCoreV1) ConfigMaps(namespace string) v1.ConfigMapInterface { + return &FakeConfigMaps{c, namespace} +} + +func (c *FakeCoreV1) Endpoints(namespace string) v1.EndpointsInterface { + return &FakeEndpoints{c, namespace} +} + +func (c *FakeCoreV1) Events(namespace string) v1.EventInterface { + return &FakeEvents{c, namespace} +} + +func (c *FakeCoreV1) LimitRanges(namespace string) v1.LimitRangeInterface { + return &FakeLimitRanges{c, namespace} +} + +func (c *FakeCoreV1) Namespaces() v1.NamespaceInterface { + return &FakeNamespaces{c} +} + +func (c *FakeCoreV1) Nodes() v1.NodeInterface { + return &FakeNodes{c} +} + +func (c *FakeCoreV1) PersistentVolumes() v1.PersistentVolumeInterface { + return &FakePersistentVolumes{c} +} + +func (c *FakeCoreV1) PersistentVolumeClaims(namespace string) v1.PersistentVolumeClaimInterface { + return &FakePersistentVolumeClaims{c, namespace} +} + +func (c *FakeCoreV1) Pods(namespace string) v1.PodInterface { + return &FakePods{c, namespace} +} + +func (c *FakeCoreV1) PodTemplates(namespace string) v1.PodTemplateInterface { + return &FakePodTemplates{c, namespace} +} + +func (c *FakeCoreV1) ReplicationControllers(namespace string) v1.ReplicationControllerInterface { + return &FakeReplicationControllers{c, namespace} +} + +func (c *FakeCoreV1) ResourceQuotas(namespace string) v1.ResourceQuotaInterface { + return &FakeResourceQuotas{c, namespace} +} + +func (c *FakeCoreV1) Secrets(namespace string) v1.SecretInterface { + return &FakeSecrets{c, namespace} +} + +func (c *FakeCoreV1) Services(namespace string) v1.ServiceInterface { + return &FakeServices{c, namespace} +} + +func (c *FakeCoreV1) ServiceAccounts(namespace string) v1.ServiceAccountInterface { + return &FakeServiceAccounts{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCoreV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_endpoints.go b/pkg/clients/clientset/typed/core/v1/fake/fake_endpoints.go new file mode 100644 index 000000000..7d16ec63f --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_endpoints.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEndpoints implements EndpointsInterface +type FakeEndpoints struct { + Fake *FakeCoreV1 + ns string +} + +var endpointsResource = v1.SchemeGroupVersion.WithResource("endpoints") + +var endpointsKind = v1.SchemeGroupVersion.WithKind("Endpoints") + +// Get takes name of the endpoints, and returns the corresponding endpoints object, and an error if there is any. +func (c *FakeEndpoints) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Endpoints, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(endpointsResource, c.ns, name), &v1.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Endpoints), err +} + +// List takes label and field selectors, and returns the list of Endpoints that match those selectors. +func (c *FakeEndpoints) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointsList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(endpointsResource, endpointsKind, c.ns, opts), &v1.EndpointsList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.EndpointsList{ListMeta: obj.(*v1.EndpointsList).ListMeta} + for _, item := range obj.(*v1.EndpointsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested endpoints. +func (c *FakeEndpoints) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(endpointsResource, c.ns, opts)) + +} + +// Create takes the representation of a endpoints and creates it. Returns the server's representation of the endpoints, and an error, if there is any. +func (c *FakeEndpoints) Create(ctx context.Context, endpoints *v1.Endpoints, opts metav1.CreateOptions) (result *v1.Endpoints, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(endpointsResource, c.ns, endpoints), &v1.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Endpoints), err +} + +// Update takes the representation of a endpoints and updates it. Returns the server's representation of the endpoints, and an error, if there is any. +func (c *FakeEndpoints) Update(ctx context.Context, endpoints *v1.Endpoints, opts metav1.UpdateOptions) (result *v1.Endpoints, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(endpointsResource, c.ns, endpoints), &v1.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Endpoints), err +} + +// Delete takes name of the endpoints and deletes it. Returns an error if one occurs. +func (c *FakeEndpoints) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(endpointsResource, c.ns, name, opts), &v1.Endpoints{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEndpoints) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(endpointsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.EndpointsList{}) + return err +} + +// Patch applies the patch and returns the patched endpoints. +func (c *FakeEndpoints) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Endpoints, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(endpointsResource, c.ns, name, pt, data, subresources...), &v1.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Endpoints), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied endpoints. +func (c *FakeEndpoints) Apply(ctx context.Context, endpoints *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Endpoints, err error) { + if endpoints == nil { + return nil, fmt.Errorf("endpoints provided to Apply must not be nil") + } + data, err := json.Marshal(endpoints) + if err != nil { + return nil, err + } + name := endpoints.Name + if name == nil { + return nil, fmt.Errorf("endpoints.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(endpointsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Endpoints{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Endpoints), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_event.go b/pkg/clients/clientset/typed/core/v1/fake/fake_event.go new file mode 100644 index 000000000..163cc7c61 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_event.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEvents implements EventInterface +type FakeEvents struct { + Fake *FakeCoreV1 + ns string +} + +var eventsResource = v1.SchemeGroupVersion.WithResource("events") + +var eventsKind = v1.SchemeGroupVersion.WithKind("Event") + +// Get takes name of the event, and returns the corresponding event object, and an error if there is any. +func (c *FakeEvents) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(eventsResource, c.ns, name), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// List takes label and field selectors, and returns the list of Events that match those selectors. +func (c *FakeEvents) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EventList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(eventsResource, eventsKind, c.ns, opts), &v1.EventList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.EventList{ListMeta: obj.(*v1.EventList).ListMeta} + for _, item := range obj.(*v1.EventList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested events. +func (c *FakeEvents) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(eventsResource, c.ns, opts)) + +} + +// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any. +func (c *FakeEvents) Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(eventsResource, c.ns, event), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any. +func (c *FakeEvents) Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(eventsResource, c.ns, event), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// Delete takes name of the event and deletes it. Returns an error if one occurs. +func (c *FakeEvents) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(eventsResource, c.ns, name, opts), &v1.Event{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEvents) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(eventsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.EventList{}) + return err +} + +// Patch applies the patch and returns the patched event. +func (c *FakeEvents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(eventsResource, c.ns, name, pt, data, subresources...), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied event. +func (c *FakeEvents) Apply(ctx context.Context, event *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) { + if event == nil { + return nil, fmt.Errorf("event provided to Apply must not be nil") + } + data, err := json.Marshal(event) + if err != nil { + return nil, err + } + name := event.Name + if name == nil { + return nil, fmt.Errorf("event.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(eventsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_limitrange.go b/pkg/clients/clientset/typed/core/v1/fake/fake_limitrange.go new file mode 100644 index 000000000..b29ad73e1 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_limitrange.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeLimitRanges implements LimitRangeInterface +type FakeLimitRanges struct { + Fake *FakeCoreV1 + ns string +} + +var limitrangesResource = v1.SchemeGroupVersion.WithResource("limitranges") + +var limitrangesKind = v1.SchemeGroupVersion.WithKind("LimitRange") + +// Get takes name of the limitRange, and returns the corresponding limitRange object, and an error if there is any. +func (c *FakeLimitRanges) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.LimitRange, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(limitrangesResource, c.ns, name), &v1.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.LimitRange), err +} + +// List takes label and field selectors, and returns the list of LimitRanges that match those selectors. +func (c *FakeLimitRanges) List(ctx context.Context, opts metav1.ListOptions) (result *v1.LimitRangeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(limitrangesResource, limitrangesKind, c.ns, opts), &v1.LimitRangeList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.LimitRangeList{ListMeta: obj.(*v1.LimitRangeList).ListMeta} + for _, item := range obj.(*v1.LimitRangeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested limitRanges. +func (c *FakeLimitRanges) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(limitrangesResource, c.ns, opts)) + +} + +// Create takes the representation of a limitRange and creates it. Returns the server's representation of the limitRange, and an error, if there is any. +func (c *FakeLimitRanges) Create(ctx context.Context, limitRange *v1.LimitRange, opts metav1.CreateOptions) (result *v1.LimitRange, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(limitrangesResource, c.ns, limitRange), &v1.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.LimitRange), err +} + +// Update takes the representation of a limitRange and updates it. Returns the server's representation of the limitRange, and an error, if there is any. +func (c *FakeLimitRanges) Update(ctx context.Context, limitRange *v1.LimitRange, opts metav1.UpdateOptions) (result *v1.LimitRange, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(limitrangesResource, c.ns, limitRange), &v1.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.LimitRange), err +} + +// Delete takes name of the limitRange and deletes it. Returns an error if one occurs. +func (c *FakeLimitRanges) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(limitrangesResource, c.ns, name, opts), &v1.LimitRange{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeLimitRanges) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(limitrangesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.LimitRangeList{}) + return err +} + +// Patch applies the patch and returns the patched limitRange. +func (c *FakeLimitRanges) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.LimitRange, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(limitrangesResource, c.ns, name, pt, data, subresources...), &v1.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.LimitRange), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied limitRange. +func (c *FakeLimitRanges) Apply(ctx context.Context, limitRange *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.LimitRange, err error) { + if limitRange == nil { + return nil, fmt.Errorf("limitRange provided to Apply must not be nil") + } + data, err := json.Marshal(limitRange) + if err != nil { + return nil, err + } + name := limitRange.Name + if name == nil { + return nil, fmt.Errorf("limitRange.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(limitrangesResource, c.ns, *name, types.ApplyPatchType, data), &v1.LimitRange{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.LimitRange), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_namespace.go b/pkg/clients/clientset/typed/core/v1/fake/fake_namespace.go new file mode 100644 index 000000000..94f2e72c3 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_namespace.go @@ -0,0 +1,157 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeNamespaces implements NamespaceInterface +type FakeNamespaces struct { + Fake *FakeCoreV1 +} + +var namespacesResource = v1.SchemeGroupVersion.WithResource("namespaces") + +var namespacesKind = v1.SchemeGroupVersion.WithKind("Namespace") + +// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. +func (c *FakeNamespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Namespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(namespacesResource, name), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} + +// List takes label and field selectors, and returns the list of Namespaces that match those selectors. +func (c *FakeNamespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NamespaceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(namespacesResource, namespacesKind, opts), &v1.NamespaceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.NamespaceList{ListMeta: obj.(*v1.NamespaceList).ListMeta} + for _, item := range obj.(*v1.NamespaceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested namespaces. +func (c *FakeNamespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(namespacesResource, opts)) +} + +// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any. +func (c *FakeNamespaces) Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (result *v1.Namespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(namespacesResource, namespace), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} + +// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any. +func (c *FakeNamespaces) Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(namespacesResource, namespace), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeNamespaces) UpdateStatus(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(namespacesResource, "status", namespace), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} + +// Delete takes name of the namespace and deletes it. Returns an error if one occurs. +func (c *FakeNamespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(namespacesResource, name, opts), &v1.Namespace{}) + return err +} + +// Patch applies the patch and returns the patched namespace. +func (c *FakeNamespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(namespacesResource, name, pt, data, subresources...), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied namespace. +func (c *FakeNamespaces) Apply(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) { + if namespace == nil { + return nil, fmt.Errorf("namespace provided to Apply must not be nil") + } + data, err := json.Marshal(namespace) + if err != nil { + return nil, err + } + name := namespace.Name + if name == nil { + return nil, fmt.Errorf("namespace.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(namespacesResource, *name, types.ApplyPatchType, data), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeNamespaces) ApplyStatus(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) { + if namespace == nil { + return nil, fmt.Errorf("namespace provided to Apply must not be nil") + } + data, err := json.Marshal(namespace) + if err != nil { + return nil, err + } + name := namespace.Name + if name == nil { + return nil, fmt.Errorf("namespace.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(namespacesResource, *name, types.ApplyPatchType, data, "status"), &v1.Namespace{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Namespace), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_node.go b/pkg/clients/clientset/typed/core/v1/fake/fake_node.go new file mode 100644 index 000000000..654a90cf3 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_node.go @@ -0,0 +1,165 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeNodes implements NodeInterface +type FakeNodes struct { + Fake *FakeCoreV1 +} + +var nodesResource = v1.SchemeGroupVersion.WithResource("nodes") + +var nodesKind = v1.SchemeGroupVersion.WithKind("Node") + +// Get takes name of the node, and returns the corresponding node object, and an error if there is any. +func (c *FakeNodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Node, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(nodesResource, name), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} + +// List takes label and field selectors, and returns the list of Nodes that match those selectors. +func (c *FakeNodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NodeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(nodesResource, nodesKind, opts), &v1.NodeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.NodeList{ListMeta: obj.(*v1.NodeList).ListMeta} + for _, item := range obj.(*v1.NodeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested nodes. +func (c *FakeNodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(nodesResource, opts)) +} + +// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. +func (c *FakeNodes) Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (result *v1.Node, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(nodesResource, node), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} + +// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. +func (c *FakeNodes) Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(nodesResource, node), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeNodes) UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (*v1.Node, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(nodesResource, "status", node), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} + +// Delete takes name of the node and deletes it. Returns an error if one occurs. +func (c *FakeNodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(nodesResource, name, opts), &v1.Node{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeNodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(nodesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.NodeList{}) + return err +} + +// Patch applies the patch and returns the patched node. +func (c *FakeNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(nodesResource, name, pt, data, subresources...), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied node. +func (c *FakeNodes) Apply(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) { + if node == nil { + return nil, fmt.Errorf("node provided to Apply must not be nil") + } + data, err := json.Marshal(node) + if err != nil { + return nil, err + } + name := node.Name + if name == nil { + return nil, fmt.Errorf("node.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(nodesResource, *name, types.ApplyPatchType, data), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeNodes) ApplyStatus(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) { + if node == nil { + return nil, fmt.Errorf("node provided to Apply must not be nil") + } + data, err := json.Marshal(node) + if err != nil { + return nil, err + } + name := node.Name + if name == nil { + return nil, fmt.Errorf("node.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(nodesResource, *name, types.ApplyPatchType, data, "status"), &v1.Node{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Node), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_persistentvolume.go b/pkg/clients/clientset/typed/core/v1/fake/fake_persistentvolume.go new file mode 100644 index 000000000..2c0e956ac --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_persistentvolume.go @@ -0,0 +1,165 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePersistentVolumes implements PersistentVolumeInterface +type FakePersistentVolumes struct { + Fake *FakeCoreV1 +} + +var persistentvolumesResource = v1.SchemeGroupVersion.WithResource("persistentvolumes") + +var persistentvolumesKind = v1.SchemeGroupVersion.WithKind("PersistentVolume") + +// Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any. +func (c *FakePersistentVolumes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(persistentvolumesResource, name), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} + +// List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors. +func (c *FakePersistentVolumes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PersistentVolumeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(persistentvolumesResource, persistentvolumesKind, opts), &v1.PersistentVolumeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.PersistentVolumeList{ListMeta: obj.(*v1.PersistentVolumeList).ListMeta} + for _, item := range obj.(*v1.PersistentVolumeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested persistentVolumes. +func (c *FakePersistentVolumes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(persistentvolumesResource, opts)) +} + +// Create takes the representation of a persistentVolume and creates it. Returns the server's representation of the persistentVolume, and an error, if there is any. +func (c *FakePersistentVolumes) Create(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.CreateOptions) (result *v1.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(persistentvolumesResource, persistentVolume), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} + +// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any. +func (c *FakePersistentVolumes) Update(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (result *v1.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(persistentvolumesResource, persistentVolume), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePersistentVolumes) UpdateStatus(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (*v1.PersistentVolume, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(persistentvolumesResource, "status", persistentVolume), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} + +// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs. +func (c *FakePersistentVolumes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(persistentvolumesResource, name, opts), &v1.PersistentVolume{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePersistentVolumes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(persistentvolumesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.PersistentVolumeList{}) + return err +} + +// Patch applies the patch and returns the patched persistentVolume. +func (c *FakePersistentVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolume, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(persistentvolumesResource, name, pt, data, subresources...), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied persistentVolume. +func (c *FakePersistentVolumes) Apply(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) { + if persistentVolume == nil { + return nil, fmt.Errorf("persistentVolume provided to Apply must not be nil") + } + data, err := json.Marshal(persistentVolume) + if err != nil { + return nil, err + } + name := persistentVolume.Name + if name == nil { + return nil, fmt.Errorf("persistentVolume.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(persistentvolumesResource, *name, types.ApplyPatchType, data), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePersistentVolumes) ApplyStatus(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) { + if persistentVolume == nil { + return nil, fmt.Errorf("persistentVolume provided to Apply must not be nil") + } + data, err := json.Marshal(persistentVolume) + if err != nil { + return nil, err + } + name := persistentVolume.Name + if name == nil { + return nil, fmt.Errorf("persistentVolume.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(persistentvolumesResource, *name, types.ApplyPatchType, data, "status"), &v1.PersistentVolume{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolume), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_persistentvolumeclaim.go b/pkg/clients/clientset/typed/core/v1/fake/fake_persistentvolumeclaim.go new file mode 100644 index 000000000..e0e42db03 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_persistentvolumeclaim.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePersistentVolumeClaims implements PersistentVolumeClaimInterface +type FakePersistentVolumeClaims struct { + Fake *FakeCoreV1 + ns string +} + +var persistentvolumeclaimsResource = v1.SchemeGroupVersion.WithResource("persistentvolumeclaims") + +var persistentvolumeclaimsKind = v1.SchemeGroupVersion.WithKind("PersistentVolumeClaim") + +// Get takes name of the persistentVolumeClaim, and returns the corresponding persistentVolumeClaim object, and an error if there is any. +func (c *FakePersistentVolumeClaims) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(persistentvolumeclaimsResource, c.ns, name), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} + +// List takes label and field selectors, and returns the list of PersistentVolumeClaims that match those selectors. +func (c *FakePersistentVolumeClaims) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PersistentVolumeClaimList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(persistentvolumeclaimsResource, persistentvolumeclaimsKind, c.ns, opts), &v1.PersistentVolumeClaimList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.PersistentVolumeClaimList{ListMeta: obj.(*v1.PersistentVolumeClaimList).ListMeta} + for _, item := range obj.(*v1.PersistentVolumeClaimList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested persistentVolumeClaims. +func (c *FakePersistentVolumeClaims) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(persistentvolumeclaimsResource, c.ns, opts)) + +} + +// Create takes the representation of a persistentVolumeClaim and creates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. +func (c *FakePersistentVolumeClaims) Create(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.CreateOptions) (result *v1.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} + +// Update takes the representation of a persistentVolumeClaim and updates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. +func (c *FakePersistentVolumeClaims) Update(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (result *v1.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(persistentvolumeclaimsResource, c.ns, persistentVolumeClaim), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePersistentVolumeClaims) UpdateStatus(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*v1.PersistentVolumeClaim, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(persistentvolumeclaimsResource, "status", c.ns, persistentVolumeClaim), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} + +// Delete takes name of the persistentVolumeClaim and deletes it. Returns an error if one occurs. +func (c *FakePersistentVolumeClaims) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(persistentvolumeclaimsResource, c.ns, name, opts), &v1.PersistentVolumeClaim{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePersistentVolumeClaims) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(persistentvolumeclaimsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.PersistentVolumeClaimList{}) + return err +} + +// Patch applies the patch and returns the patched persistentVolumeClaim. +func (c *FakePersistentVolumeClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolumeClaim, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(persistentvolumeclaimsResource, c.ns, name, pt, data, subresources...), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied persistentVolumeClaim. +func (c *FakePersistentVolumeClaims) Apply(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) { + if persistentVolumeClaim == nil { + return nil, fmt.Errorf("persistentVolumeClaim provided to Apply must not be nil") + } + data, err := json.Marshal(persistentVolumeClaim) + if err != nil { + return nil, err + } + name := persistentVolumeClaim.Name + if name == nil { + return nil, fmt.Errorf("persistentVolumeClaim.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(persistentvolumeclaimsResource, c.ns, *name, types.ApplyPatchType, data), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePersistentVolumeClaims) ApplyStatus(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) { + if persistentVolumeClaim == nil { + return nil, fmt.Errorf("persistentVolumeClaim provided to Apply must not be nil") + } + data, err := json.Marshal(persistentVolumeClaim) + if err != nil { + return nil, err + } + name := persistentVolumeClaim.Name + if name == nil { + return nil, fmt.Errorf("persistentVolumeClaim.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(persistentvolumeclaimsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.PersistentVolumeClaim{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PersistentVolumeClaim), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_pod.go b/pkg/clients/clientset/typed/core/v1/fake/fake_pod.go new file mode 100644 index 000000000..4bd9407e5 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_pod.go @@ -0,0 +1,187 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePods implements PodInterface +type FakePods struct { + Fake *FakeCoreV1 + ns string +} + +var podsResource = v1.SchemeGroupVersion.WithResource("pods") + +var podsKind = v1.SchemeGroupVersion.WithKind("Pod") + +// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any. +func (c *FakePods) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Pod, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(podsResource, c.ns, name), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// List takes label and field selectors, and returns the list of Pods that match those selectors. +func (c *FakePods) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(podsResource, podsKind, c.ns, opts), &v1.PodList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.PodList{ListMeta: obj.(*v1.PodList).ListMeta} + for _, item := range obj.(*v1.PodList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested pods. +func (c *FakePods) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(podsResource, c.ns, opts)) + +} + +// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *FakePods) Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (result *v1.Pod, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(podsResource, c.ns, pod), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *FakePods) Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(podsResource, c.ns, pod), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePods) UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(podsResource, "status", c.ns, pod), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// Delete takes name of the pod and deletes it. Returns an error if one occurs. +func (c *FakePods) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(podsResource, c.ns, name, opts), &v1.Pod{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePods) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(podsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.PodList{}) + return err +} + +// Patch applies the patch and returns the patched pod. +func (c *FakePods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(podsResource, c.ns, name, pt, data, subresources...), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied pod. +func (c *FakePods) Apply(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) { + if pod == nil { + return nil, fmt.Errorf("pod provided to Apply must not be nil") + } + data, err := json.Marshal(pod) + if err != nil { + return nil, err + } + name := pod.Name + if name == nil { + return nil, fmt.Errorf("pod.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(podsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePods) ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) { + if pod == nil { + return nil, fmt.Errorf("pod provided to Apply must not be nil") + } + data, err := json.Marshal(pod) + if err != nil { + return nil, err + } + name := pod.Name + if name == nil { + return nil, fmt.Errorf("pod.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(podsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} + +// UpdateEphemeralContainers takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(podsResource, "ephemeralcontainers", c.ns, pod), &v1.Pod{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Pod), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_podtemplate.go b/pkg/clients/clientset/typed/core/v1/fake/fake_podtemplate.go new file mode 100644 index 000000000..8bd188a85 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_podtemplate.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePodTemplates implements PodTemplateInterface +type FakePodTemplates struct { + Fake *FakeCoreV1 + ns string +} + +var podtemplatesResource = v1.SchemeGroupVersion.WithResource("podtemplates") + +var podtemplatesKind = v1.SchemeGroupVersion.WithKind("PodTemplate") + +// Get takes name of the podTemplate, and returns the corresponding podTemplate object, and an error if there is any. +func (c *FakePodTemplates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(podtemplatesResource, c.ns, name), &v1.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodTemplate), err +} + +// List takes label and field selectors, and returns the list of PodTemplates that match those selectors. +func (c *FakePodTemplates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodTemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(podtemplatesResource, podtemplatesKind, c.ns, opts), &v1.PodTemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.PodTemplateList{ListMeta: obj.(*v1.PodTemplateList).ListMeta} + for _, item := range obj.(*v1.PodTemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested podTemplates. +func (c *FakePodTemplates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(podtemplatesResource, c.ns, opts)) + +} + +// Create takes the representation of a podTemplate and creates it. Returns the server's representation of the podTemplate, and an error, if there is any. +func (c *FakePodTemplates) Create(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.CreateOptions) (result *v1.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(podtemplatesResource, c.ns, podTemplate), &v1.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodTemplate), err +} + +// Update takes the representation of a podTemplate and updates it. Returns the server's representation of the podTemplate, and an error, if there is any. +func (c *FakePodTemplates) Update(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.UpdateOptions) (result *v1.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(podtemplatesResource, c.ns, podTemplate), &v1.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodTemplate), err +} + +// Delete takes name of the podTemplate and deletes it. Returns an error if one occurs. +func (c *FakePodTemplates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(podtemplatesResource, c.ns, name, opts), &v1.PodTemplate{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePodTemplates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(podtemplatesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.PodTemplateList{}) + return err +} + +// Patch applies the patch and returns the patched podTemplate. +func (c *FakePodTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodTemplate, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(podtemplatesResource, c.ns, name, pt, data, subresources...), &v1.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodTemplate), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied podTemplate. +func (c *FakePodTemplates) Apply(ctx context.Context, podTemplate *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PodTemplate, err error) { + if podTemplate == nil { + return nil, fmt.Errorf("podTemplate provided to Apply must not be nil") + } + data, err := json.Marshal(podTemplate) + if err != nil { + return nil, err + } + name := podTemplate.Name + if name == nil { + return nil, fmt.Errorf("podTemplate.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(podtemplatesResource, c.ns, *name, types.ApplyPatchType, data), &v1.PodTemplate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodTemplate), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_replicationcontroller.go b/pkg/clients/clientset/typed/core/v1/fake/fake_replicationcontroller.go new file mode 100644 index 000000000..3e1f95130 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_replicationcontroller.go @@ -0,0 +1,199 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeReplicationControllers implements ReplicationControllerInterface +type FakeReplicationControllers struct { + Fake *FakeCoreV1 + ns string +} + +var replicationcontrollersResource = v1.SchemeGroupVersion.WithResource("replicationcontrollers") + +var replicationcontrollersKind = v1.SchemeGroupVersion.WithKind("ReplicationController") + +// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any. +func (c *FakeReplicationControllers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(replicationcontrollersResource, c.ns, name), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors. +func (c *FakeReplicationControllers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicationControllerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(replicationcontrollersResource, replicationcontrollersKind, c.ns, opts), &v1.ReplicationControllerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ReplicationControllerList{ListMeta: obj.(*v1.ReplicationControllerList).ListMeta} + for _, item := range obj.(*v1.ReplicationControllerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested replicationControllers. +func (c *FakeReplicationControllers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(replicationcontrollersResource, c.ns, opts)) + +} + +// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any. +func (c *FakeReplicationControllers) Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (result *v1.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(replicationcontrollersResource, c.ns, replicationController), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any. +func (c *FakeReplicationControllers) Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(replicationcontrollersResource, c.ns, replicationController), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeReplicationControllers) UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(replicationcontrollersResource, "status", c.ns, replicationController), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// Delete takes name of the replicationController and deletes it. Returns an error if one occurs. +func (c *FakeReplicationControllers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(replicationcontrollersResource, c.ns, name, opts), &v1.ReplicationController{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeReplicationControllers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(replicationcontrollersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ReplicationControllerList{}) + return err +} + +// Patch applies the patch and returns the patched replicationController. +func (c *FakeReplicationControllers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicationcontrollersResource, c.ns, name, pt, data, subresources...), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied replicationController. +func (c *FakeReplicationControllers) Apply(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) { + if replicationController == nil { + return nil, fmt.Errorf("replicationController provided to Apply must not be nil") + } + data, err := json.Marshal(replicationController) + if err != nil { + return nil, err + } + name := replicationController.Name + if name == nil { + return nil, fmt.Errorf("replicationController.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicationcontrollersResource, c.ns, *name, types.ApplyPatchType, data), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeReplicationControllers) ApplyStatus(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) { + if replicationController == nil { + return nil, fmt.Errorf("replicationController provided to Apply must not be nil") + } + data, err := json.Marshal(replicationController) + if err != nil { + return nil, err + } + name := replicationController.Name + if name == nil { + return nil, fmt.Errorf("replicationController.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(replicationcontrollersResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ReplicationController{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ReplicationController), err +} + +// GetScale takes name of the replicationController, and returns the corresponding scale object, and an error if there is any. +func (c *FakeReplicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetSubresourceAction(replicationcontrollersResource, c.ns, "scale", replicationControllerName), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeReplicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(replicationcontrollersResource, "scale", c.ns, scale), &autoscalingv1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingv1.Scale), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_resourcequota.go b/pkg/clients/clientset/typed/core/v1/fake/fake_resourcequota.go new file mode 100644 index 000000000..c8ba5228d --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_resourcequota.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResourceQuotas implements ResourceQuotaInterface +type FakeResourceQuotas struct { + Fake *FakeCoreV1 + ns string +} + +var resourcequotasResource = v1.SchemeGroupVersion.WithResource("resourcequotas") + +var resourcequotasKind = v1.SchemeGroupVersion.WithKind("ResourceQuota") + +// Get takes name of the resourceQuota, and returns the corresponding resourceQuota object, and an error if there is any. +func (c *FakeResourceQuotas) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcequotasResource, c.ns, name), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} + +// List takes label and field selectors, and returns the list of ResourceQuotas that match those selectors. +func (c *FakeResourceQuotas) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceQuotaList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcequotasResource, resourcequotasKind, c.ns, opts), &v1.ResourceQuotaList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceQuotaList{ListMeta: obj.(*v1.ResourceQuotaList).ListMeta} + for _, item := range obj.(*v1.ResourceQuotaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resourceQuotas. +func (c *FakeResourceQuotas) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcequotasResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceQuota and creates it. Returns the server's representation of the resourceQuota, and an error, if there is any. +func (c *FakeResourceQuotas) Create(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.CreateOptions) (result *v1.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcequotasResource, c.ns, resourceQuota), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} + +// Update takes the representation of a resourceQuota and updates it. Returns the server's representation of the resourceQuota, and an error, if there is any. +func (c *FakeResourceQuotas) Update(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (result *v1.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcequotasResource, c.ns, resourceQuota), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResourceQuotas) UpdateStatus(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (*v1.ResourceQuota, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcequotasResource, "status", c.ns, resourceQuota), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} + +// Delete takes name of the resourceQuota and deletes it. Returns an error if one occurs. +func (c *FakeResourceQuotas) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcequotasResource, c.ns, name, opts), &v1.ResourceQuota{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceQuotas) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcequotasResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceQuotaList{}) + return err +} + +// Patch applies the patch and returns the patched resourceQuota. +func (c *FakeResourceQuotas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcequotasResource, c.ns, name, pt, data, subresources...), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceQuota. +func (c *FakeResourceQuotas) Apply(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) { + if resourceQuota == nil { + return nil, fmt.Errorf("resourceQuota provided to Apply must not be nil") + } + data, err := json.Marshal(resourceQuota) + if err != nil { + return nil, err + } + name := resourceQuota.Name + if name == nil { + return nil, fmt.Errorf("resourceQuota.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcequotasResource, c.ns, *name, types.ApplyPatchType, data), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceQuotas) ApplyStatus(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) { + if resourceQuota == nil { + return nil, fmt.Errorf("resourceQuota provided to Apply must not be nil") + } + data, err := json.Marshal(resourceQuota) + if err != nil { + return nil, err + } + name := resourceQuota.Name + if name == nil { + return nil, fmt.Errorf("resourceQuota.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcequotasResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceQuota), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_secret.go b/pkg/clients/clientset/typed/core/v1/fake/fake_secret.go new file mode 100644 index 000000000..e26484283 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_secret.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSecrets implements SecretInterface +type FakeSecrets struct { + Fake *FakeCoreV1 + ns string +} + +var secretsResource = v1.SchemeGroupVersion.WithResource("secrets") + +var secretsKind = v1.SchemeGroupVersion.WithKind("Secret") + +// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any. +func (c *FakeSecrets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Secret, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(secretsResource, c.ns, name), &v1.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Secret), err +} + +// List takes label and field selectors, and returns the list of Secrets that match those selectors. +func (c *FakeSecrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(secretsResource, secretsKind, c.ns, opts), &v1.SecretList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.SecretList{ListMeta: obj.(*v1.SecretList).ListMeta} + for _, item := range obj.(*v1.SecretList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested secrets. +func (c *FakeSecrets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(secretsResource, c.ns, opts)) + +} + +// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any. +func (c *FakeSecrets) Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (result *v1.Secret, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(secretsResource, c.ns, secret), &v1.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Secret), err +} + +// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any. +func (c *FakeSecrets) Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (result *v1.Secret, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(secretsResource, c.ns, secret), &v1.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Secret), err +} + +// Delete takes name of the secret and deletes it. Returns an error if one occurs. +func (c *FakeSecrets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(secretsResource, c.ns, name, opts), &v1.Secret{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSecrets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(secretsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.SecretList{}) + return err +} + +// Patch applies the patch and returns the patched secret. +func (c *FakeSecrets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(secretsResource, c.ns, name, pt, data, subresources...), &v1.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Secret), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied secret. +func (c *FakeSecrets) Apply(ctx context.Context, secret *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Secret, err error) { + if secret == nil { + return nil, fmt.Errorf("secret provided to Apply must not be nil") + } + data, err := json.Marshal(secret) + if err != nil { + return nil, err + } + name := secret.Name + if name == nil { + return nil, fmt.Errorf("secret.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(secretsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Secret{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Secret), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_service.go b/pkg/clients/clientset/typed/core/v1/fake/fake_service.go new file mode 100644 index 000000000..c4c1d9b3a --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_service.go @@ -0,0 +1,168 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeServices implements ServiceInterface +type FakeServices struct { + Fake *FakeCoreV1 + ns string +} + +var servicesResource = v1.SchemeGroupVersion.WithResource("services") + +var servicesKind = v1.SchemeGroupVersion.WithKind("Service") + +// Get takes name of the service, and returns the corresponding service object, and an error if there is any. +func (c *FakeServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Service, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(servicesResource, c.ns, name), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} + +// List takes label and field selectors, and returns the list of Services that match those selectors. +func (c *FakeServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(servicesResource, servicesKind, c.ns, opts), &v1.ServiceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ServiceList{ListMeta: obj.(*v1.ServiceList).ListMeta} + for _, item := range obj.(*v1.ServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested services. +func (c *FakeServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(servicesResource, c.ns, opts)) + +} + +// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any. +func (c *FakeServices) Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (result *v1.Service, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(servicesResource, c.ns, service), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} + +// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any. +func (c *FakeServices) Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(servicesResource, c.ns, service), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeServices) UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (*v1.Service, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} + +// Delete takes name of the service and deletes it. Returns an error if one occurs. +func (c *FakeServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(servicesResource, c.ns, name, opts), &v1.Service{}) + + return err +} + +// Patch applies the patch and returns the patched service. +func (c *FakeServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(servicesResource, c.ns, name, pt, data, subresources...), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied service. +func (c *FakeServices) Apply(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) { + if service == nil { + return nil, fmt.Errorf("service provided to Apply must not be nil") + } + data, err := json.Marshal(service) + if err != nil { + return nil, err + } + name := service.Name + if name == nil { + return nil, fmt.Errorf("service.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(servicesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeServices) ApplyStatus(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) { + if service == nil { + return nil, fmt.Errorf("service provided to Apply must not be nil") + } + data, err := json.Marshal(service) + if err != nil { + return nil, err + } + name := service.Name + if name == nil { + return nil, fmt.Errorf("service.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(servicesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Service{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Service), err +} diff --git a/pkg/clients/clientset/typed/core/v1/fake/fake_serviceaccount.go b/pkg/clients/clientset/typed/core/v1/fake/fake_serviceaccount.go new file mode 100644 index 000000000..ffeb1b275 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/fake/fake_serviceaccount.go @@ -0,0 +1,153 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + authenticationv1 "k8s.io/api/authentication/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeServiceAccounts implements ServiceAccountInterface +type FakeServiceAccounts struct { + Fake *FakeCoreV1 + ns string +} + +var serviceaccountsResource = v1.SchemeGroupVersion.WithResource("serviceaccounts") + +var serviceaccountsKind = v1.SchemeGroupVersion.WithKind("ServiceAccount") + +// Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any. +func (c *FakeServiceAccounts) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(serviceaccountsResource, c.ns, name), &v1.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ServiceAccount), err +} + +// List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors. +func (c *FakeServiceAccounts) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceAccountList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(serviceaccountsResource, serviceaccountsKind, c.ns, opts), &v1.ServiceAccountList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ServiceAccountList{ListMeta: obj.(*v1.ServiceAccountList).ListMeta} + for _, item := range obj.(*v1.ServiceAccountList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested serviceAccounts. +func (c *FakeServiceAccounts) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(serviceaccountsResource, c.ns, opts)) + +} + +// Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any. +func (c *FakeServiceAccounts) Create(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.CreateOptions) (result *v1.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(serviceaccountsResource, c.ns, serviceAccount), &v1.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ServiceAccount), err +} + +// Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any. +func (c *FakeServiceAccounts) Update(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.UpdateOptions) (result *v1.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(serviceaccountsResource, c.ns, serviceAccount), &v1.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ServiceAccount), err +} + +// Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs. +func (c *FakeServiceAccounts) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(serviceaccountsResource, c.ns, name, opts), &v1.ServiceAccount{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeServiceAccounts) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(serviceaccountsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ServiceAccountList{}) + return err +} + +// Patch applies the patch and returns the patched serviceAccount. +func (c *FakeServiceAccounts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceAccount, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(serviceaccountsResource, c.ns, name, pt, data, subresources...), &v1.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ServiceAccount), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied serviceAccount. +func (c *FakeServiceAccounts) Apply(ctx context.Context, serviceAccount *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ServiceAccount, err error) { + if serviceAccount == nil { + return nil, fmt.Errorf("serviceAccount provided to Apply must not be nil") + } + data, err := json.Marshal(serviceAccount) + if err != nil { + return nil, err + } + name := serviceAccount.Name + if name == nil { + return nil, fmt.Errorf("serviceAccount.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(serviceaccountsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ServiceAccount{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ServiceAccount), err +} + +// CreateToken takes the representation of a tokenRequest and creates it. Returns the server's representation of the tokenRequest, and an error, if there is any. +func (c *FakeServiceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateSubresourceAction(serviceaccountsResource, serviceAccountName, "token", c.ns, tokenRequest), &authenticationv1.TokenRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*authenticationv1.TokenRequest), err +} diff --git a/pkg/clients/clientset/typed/core/v1/generated_expansion.go b/pkg/clients/clientset/typed/core/v1/generated_expansion.go new file mode 100644 index 000000000..391a601aa --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/generated_expansion.go @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type ComponentStatusExpansion interface{} + +type ConfigMapExpansion interface{} + +type EndpointsExpansion interface{} + +type EventExpansion interface{} + +type LimitRangeExpansion interface{} + +type NamespaceExpansion interface{} + +type NodeExpansion interface{} + +type PersistentVolumeExpansion interface{} + +type PersistentVolumeClaimExpansion interface{} + +type PodExpansion interface{} + +type PodTemplateExpansion interface{} + +type ReplicationControllerExpansion interface{} + +type ResourceQuotaExpansion interface{} + +type SecretExpansion interface{} + +type ServiceExpansion interface{} + +type ServiceAccountExpansion interface{} diff --git a/pkg/clients/clientset/typed/core/v1/limitrange.go b/pkg/clients/clientset/typed/core/v1/limitrange.go new file mode 100644 index 000000000..70c7efe20 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/limitrange.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// LimitRangesGetter has a method to return a LimitRangeInterface. +// A group's client should implement this interface. +type LimitRangesGetter interface { + LimitRanges(namespace string) LimitRangeInterface +} + +// LimitRangeInterface has methods to work with LimitRange resources. +type LimitRangeInterface interface { + Create(ctx context.Context, limitRange *v1.LimitRange, opts metav1.CreateOptions) (*v1.LimitRange, error) + Update(ctx context.Context, limitRange *v1.LimitRange, opts metav1.UpdateOptions) (*v1.LimitRange, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.LimitRange, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.LimitRangeList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.LimitRange, err error) + Apply(ctx context.Context, limitRange *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.LimitRange, err error) + LimitRangeExpansion +} + +// limitRanges implements LimitRangeInterface +type limitRanges struct { + client rest.Interface + ns string +} + +// newLimitRanges returns a LimitRanges +func newLimitRanges(c *CoreV1Client, namespace string) *limitRanges { + return &limitRanges{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the limitRange, and returns the corresponding limitRange object, and an error if there is any. +func (c *limitRanges) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.LimitRange, err error) { + result = &v1.LimitRange{} + err = c.client.Get(). + Namespace(c.ns). + Resource("limitranges"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of LimitRanges that match those selectors. +func (c *limitRanges) List(ctx context.Context, opts metav1.ListOptions) (result *v1.LimitRangeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.LimitRangeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested limitRanges. +func (c *limitRanges) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a limitRange and creates it. Returns the server's representation of the limitRange, and an error, if there is any. +func (c *limitRanges) Create(ctx context.Context, limitRange *v1.LimitRange, opts metav1.CreateOptions) (result *v1.LimitRange, err error) { + result = &v1.LimitRange{} + err = c.client.Post(). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(limitRange). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a limitRange and updates it. Returns the server's representation of the limitRange, and an error, if there is any. +func (c *limitRanges) Update(ctx context.Context, limitRange *v1.LimitRange, opts metav1.UpdateOptions) (result *v1.LimitRange, err error) { + result = &v1.LimitRange{} + err = c.client.Put(). + Namespace(c.ns). + Resource("limitranges"). + Name(limitRange.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(limitRange). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the limitRange and deletes it. Returns an error if one occurs. +func (c *limitRanges) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("limitranges"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *limitRanges) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("limitranges"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched limitRange. +func (c *limitRanges) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.LimitRange, err error) { + result = &v1.LimitRange{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("limitranges"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied limitRange. +func (c *limitRanges) Apply(ctx context.Context, limitRange *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.LimitRange, err error) { + if limitRange == nil { + return nil, fmt.Errorf("limitRange provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(limitRange) + if err != nil { + return nil, err + } + name := limitRange.Name + if name == nil { + return nil, fmt.Errorf("limitRange.Name must be provided to Apply") + } + result = &v1.LimitRange{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("limitranges"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/namespace.go b/pkg/clients/clientset/typed/core/v1/namespace.go new file mode 100644 index 000000000..2336bb6aa --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/namespace.go @@ -0,0 +1,214 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// NamespacesGetter has a method to return a NamespaceInterface. +// A group's client should implement this interface. +type NamespacesGetter interface { + Namespaces() NamespaceInterface +} + +// NamespaceInterface has methods to work with Namespace resources. +type NamespaceInterface interface { + Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (*v1.Namespace, error) + Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) + UpdateStatus(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (*v1.Namespace, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Namespace, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.NamespaceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) + Apply(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) + ApplyStatus(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) + NamespaceExpansion +} + +// namespaces implements NamespaceInterface +type namespaces struct { + client rest.Interface +} + +// newNamespaces returns a Namespaces +func newNamespaces(c *CoreV1Client) *namespaces { + return &namespaces{ + client: c.RESTClient(), + } +} + +// Get takes name of the namespace, and returns the corresponding namespace object, and an error if there is any. +func (c *namespaces) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Namespace, err error) { + result = &v1.Namespace{} + err = c.client.Get(). + Resource("namespaces"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Namespaces that match those selectors. +func (c *namespaces) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NamespaceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.NamespaceList{} + err = c.client.Get(). + Resource("namespaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested namespaces. +func (c *namespaces) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("namespaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a namespace and creates it. Returns the server's representation of the namespace, and an error, if there is any. +func (c *namespaces) Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (result *v1.Namespace, err error) { + result = &v1.Namespace{} + err = c.client.Post(). + Resource("namespaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(namespace). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a namespace and updates it. Returns the server's representation of the namespace, and an error, if there is any. +func (c *namespaces) Update(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) { + result = &v1.Namespace{} + err = c.client.Put(). + Resource("namespaces"). + Name(namespace.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(namespace). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *namespaces) UpdateStatus(ctx context.Context, namespace *v1.Namespace, opts metav1.UpdateOptions) (result *v1.Namespace, err error) { + result = &v1.Namespace{} + err = c.client.Put(). + Resource("namespaces"). + Name(namespace.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(namespace). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the namespace and deletes it. Returns an error if one occurs. +func (c *namespaces) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("namespaces"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched namespace. +func (c *namespaces) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Namespace, err error) { + result = &v1.Namespace{} + err = c.client.Patch(pt). + Resource("namespaces"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied namespace. +func (c *namespaces) Apply(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) { + if namespace == nil { + return nil, fmt.Errorf("namespace provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(namespace) + if err != nil { + return nil, err + } + name := namespace.Name + if name == nil { + return nil, fmt.Errorf("namespace.Name must be provided to Apply") + } + result = &v1.Namespace{} + err = c.client.Patch(types.ApplyPatchType). + Resource("namespaces"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *namespaces) ApplyStatus(ctx context.Context, namespace *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Namespace, err error) { + if namespace == nil { + return nil, fmt.Errorf("namespace provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(namespace) + if err != nil { + return nil, err + } + + name := namespace.Name + if name == nil { + return nil, fmt.Errorf("namespace.Name must be provided to Apply") + } + + result = &v1.Namespace{} + err = c.client.Patch(types.ApplyPatchType). + Resource("namespaces"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/node.go b/pkg/clients/clientset/typed/core/v1/node.go new file mode 100644 index 000000000..982ce8745 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/node.go @@ -0,0 +1,230 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// NodesGetter has a method to return a NodeInterface. +// A group's client should implement this interface. +type NodesGetter interface { + Nodes() NodeInterface +} + +// NodeInterface has methods to work with Node resources. +type NodeInterface interface { + Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (*v1.Node, error) + Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (*v1.Node, error) + UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (*v1.Node, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Node, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.NodeList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) + Apply(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) + ApplyStatus(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) + NodeExpansion +} + +// nodes implements NodeInterface +type nodes struct { + client rest.Interface +} + +// newNodes returns a Nodes +func newNodes(c *CoreV1Client) *nodes { + return &nodes{ + client: c.RESTClient(), + } +} + +// Get takes name of the node, and returns the corresponding node object, and an error if there is any. +func (c *nodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Node, err error) { + result = &v1.Node{} + err = c.client.Get(). + Resource("nodes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Nodes that match those selectors. +func (c *nodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.NodeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.NodeList{} + err = c.client.Get(). + Resource("nodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested nodes. +func (c *nodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("nodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a node and creates it. Returns the server's representation of the node, and an error, if there is any. +func (c *nodes) Create(ctx context.Context, node *v1.Node, opts metav1.CreateOptions) (result *v1.Node, err error) { + result = &v1.Node{} + err = c.client.Post(). + Resource("nodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(node). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a node and updates it. Returns the server's representation of the node, and an error, if there is any. +func (c *nodes) Update(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) { + result = &v1.Node{} + err = c.client.Put(). + Resource("nodes"). + Name(node.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(node). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *nodes) UpdateStatus(ctx context.Context, node *v1.Node, opts metav1.UpdateOptions) (result *v1.Node, err error) { + result = &v1.Node{} + err = c.client.Put(). + Resource("nodes"). + Name(node.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(node). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the node and deletes it. Returns an error if one occurs. +func (c *nodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("nodes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *nodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("nodes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched node. +func (c *nodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error) { + result = &v1.Node{} + err = c.client.Patch(pt). + Resource("nodes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied node. +func (c *nodes) Apply(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) { + if node == nil { + return nil, fmt.Errorf("node provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(node) + if err != nil { + return nil, err + } + name := node.Name + if name == nil { + return nil, fmt.Errorf("node.Name must be provided to Apply") + } + result = &v1.Node{} + err = c.client.Patch(types.ApplyPatchType). + Resource("nodes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *nodes) ApplyStatus(ctx context.Context, node *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Node, err error) { + if node == nil { + return nil, fmt.Errorf("node provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(node) + if err != nil { + return nil, err + } + + name := node.Name + if name == nil { + return nil, fmt.Errorf("node.Name must be provided to Apply") + } + + result = &v1.Node{} + err = c.client.Patch(types.ApplyPatchType). + Resource("nodes"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/persistentvolume.go b/pkg/clients/clientset/typed/core/v1/persistentvolume.go new file mode 100644 index 000000000..e69f138ff --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/persistentvolume.go @@ -0,0 +1,230 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PersistentVolumesGetter has a method to return a PersistentVolumeInterface. +// A group's client should implement this interface. +type PersistentVolumesGetter interface { + PersistentVolumes() PersistentVolumeInterface +} + +// PersistentVolumeInterface has methods to work with PersistentVolume resources. +type PersistentVolumeInterface interface { + Create(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.CreateOptions) (*v1.PersistentVolume, error) + Update(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (*v1.PersistentVolume, error) + UpdateStatus(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (*v1.PersistentVolume, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PersistentVolume, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PersistentVolumeList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolume, err error) + Apply(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) + ApplyStatus(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) + PersistentVolumeExpansion +} + +// persistentVolumes implements PersistentVolumeInterface +type persistentVolumes struct { + client rest.Interface +} + +// newPersistentVolumes returns a PersistentVolumes +func newPersistentVolumes(c *CoreV1Client) *persistentVolumes { + return &persistentVolumes{ + client: c.RESTClient(), + } +} + +// Get takes name of the persistentVolume, and returns the corresponding persistentVolume object, and an error if there is any. +func (c *persistentVolumes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PersistentVolume, err error) { + result = &v1.PersistentVolume{} + err = c.client.Get(). + Resource("persistentvolumes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PersistentVolumes that match those selectors. +func (c *persistentVolumes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PersistentVolumeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PersistentVolumeList{} + err = c.client.Get(). + Resource("persistentvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested persistentVolumes. +func (c *persistentVolumes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("persistentvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a persistentVolume and creates it. Returns the server's representation of the persistentVolume, and an error, if there is any. +func (c *persistentVolumes) Create(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.CreateOptions) (result *v1.PersistentVolume, err error) { + result = &v1.PersistentVolume{} + err = c.client.Post(). + Resource("persistentvolumes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(persistentVolume). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any. +func (c *persistentVolumes) Update(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (result *v1.PersistentVolume, err error) { + result = &v1.PersistentVolume{} + err = c.client.Put(). + Resource("persistentvolumes"). + Name(persistentVolume.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(persistentVolume). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *persistentVolumes) UpdateStatus(ctx context.Context, persistentVolume *v1.PersistentVolume, opts metav1.UpdateOptions) (result *v1.PersistentVolume, err error) { + result = &v1.PersistentVolume{} + err = c.client.Put(). + Resource("persistentvolumes"). + Name(persistentVolume.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(persistentVolume). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the persistentVolume and deletes it. Returns an error if one occurs. +func (c *persistentVolumes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("persistentvolumes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *persistentVolumes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("persistentvolumes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched persistentVolume. +func (c *persistentVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolume, err error) { + result = &v1.PersistentVolume{} + err = c.client.Patch(pt). + Resource("persistentvolumes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied persistentVolume. +func (c *persistentVolumes) Apply(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) { + if persistentVolume == nil { + return nil, fmt.Errorf("persistentVolume provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(persistentVolume) + if err != nil { + return nil, err + } + name := persistentVolume.Name + if name == nil { + return nil, fmt.Errorf("persistentVolume.Name must be provided to Apply") + } + result = &v1.PersistentVolume{} + err = c.client.Patch(types.ApplyPatchType). + Resource("persistentvolumes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *persistentVolumes) ApplyStatus(ctx context.Context, persistentVolume *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolume, err error) { + if persistentVolume == nil { + return nil, fmt.Errorf("persistentVolume provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(persistentVolume) + if err != nil { + return nil, err + } + + name := persistentVolume.Name + if name == nil { + return nil, fmt.Errorf("persistentVolume.Name must be provided to Apply") + } + + result = &v1.PersistentVolume{} + err = c.client.Patch(types.ApplyPatchType). + Resource("persistentvolumes"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/persistentvolumeclaim.go b/pkg/clients/clientset/typed/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..5620f7e46 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/persistentvolumeclaim.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PersistentVolumeClaimsGetter has a method to return a PersistentVolumeClaimInterface. +// A group's client should implement this interface. +type PersistentVolumeClaimsGetter interface { + PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface +} + +// PersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources. +type PersistentVolumeClaimInterface interface { + Create(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.CreateOptions) (*v1.PersistentVolumeClaim, error) + Update(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*v1.PersistentVolumeClaim, error) + UpdateStatus(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*v1.PersistentVolumeClaim, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PersistentVolumeClaimList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolumeClaim, err error) + Apply(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) + ApplyStatus(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) + PersistentVolumeClaimExpansion +} + +// persistentVolumeClaims implements PersistentVolumeClaimInterface +type persistentVolumeClaims struct { + client rest.Interface + ns string +} + +// newPersistentVolumeClaims returns a PersistentVolumeClaims +func newPersistentVolumeClaims(c *CoreV1Client, namespace string) *persistentVolumeClaims { + return &persistentVolumeClaims{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the persistentVolumeClaim, and returns the corresponding persistentVolumeClaim object, and an error if there is any. +func (c *persistentVolumeClaims) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PersistentVolumeClaim, err error) { + result = &v1.PersistentVolumeClaim{} + err = c.client.Get(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PersistentVolumeClaims that match those selectors. +func (c *persistentVolumeClaims) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PersistentVolumeClaimList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PersistentVolumeClaimList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested persistentVolumeClaims. +func (c *persistentVolumeClaims) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a persistentVolumeClaim and creates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. +func (c *persistentVolumeClaims) Create(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.CreateOptions) (result *v1.PersistentVolumeClaim, err error) { + result = &v1.PersistentVolumeClaim{} + err = c.client.Post(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(persistentVolumeClaim). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a persistentVolumeClaim and updates it. Returns the server's representation of the persistentVolumeClaim, and an error, if there is any. +func (c *persistentVolumeClaims) Update(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (result *v1.PersistentVolumeClaim, err error) { + result = &v1.PersistentVolumeClaim{} + err = c.client.Put(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(persistentVolumeClaim.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(persistentVolumeClaim). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *persistentVolumeClaims) UpdateStatus(ctx context.Context, persistentVolumeClaim *v1.PersistentVolumeClaim, opts metav1.UpdateOptions) (result *v1.PersistentVolumeClaim, err error) { + result = &v1.PersistentVolumeClaim{} + err = c.client.Put(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(persistentVolumeClaim.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(persistentVolumeClaim). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the persistentVolumeClaim and deletes it. Returns an error if one occurs. +func (c *persistentVolumeClaims) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *persistentVolumeClaims) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched persistentVolumeClaim. +func (c *persistentVolumeClaims) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PersistentVolumeClaim, err error) { + result = &v1.PersistentVolumeClaim{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied persistentVolumeClaim. +func (c *persistentVolumeClaims) Apply(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) { + if persistentVolumeClaim == nil { + return nil, fmt.Errorf("persistentVolumeClaim provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(persistentVolumeClaim) + if err != nil { + return nil, err + } + name := persistentVolumeClaim.Name + if name == nil { + return nil, fmt.Errorf("persistentVolumeClaim.Name must be provided to Apply") + } + result = &v1.PersistentVolumeClaim{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *persistentVolumeClaims) ApplyStatus(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PersistentVolumeClaim, err error) { + if persistentVolumeClaim == nil { + return nil, fmt.Errorf("persistentVolumeClaim provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(persistentVolumeClaim) + if err != nil { + return nil, err + } + + name := persistentVolumeClaim.Name + if name == nil { + return nil, fmt.Errorf("persistentVolumeClaim.Name must be provided to Apply") + } + + result = &v1.PersistentVolumeClaim{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("persistentvolumeclaims"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/pod.go b/pkg/clients/clientset/typed/core/v1/pod.go new file mode 100644 index 000000000..39c3172dd --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/pod.go @@ -0,0 +1,260 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PodsGetter has a method to return a PodInterface. +// A group's client should implement this interface. +type PodsGetter interface { + Pods(namespace string) PodInterface +} + +// PodInterface has methods to work with Pod resources. +type PodInterface interface { + Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (*v1.Pod, error) + Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) + UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Pod, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PodList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) + Apply(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) + ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) + UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (*v1.Pod, error) + + PodExpansion +} + +// pods implements PodInterface +type pods struct { + client rest.Interface + ns string +} + +// newPods returns a Pods +func newPods(c *CoreV1Client, namespace string) *pods { + return &pods{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the pod, and returns the corresponding pod object, and an error if there is any. +func (c *pods) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Pod, err error) { + result = &v1.Pod{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pods"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Pods that match those selectors. +func (c *pods) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PodList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested pods. +func (c *pods) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a pod and creates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *pods) Create(ctx context.Context, pod *v1.Pod, opts metav1.CreateOptions) (result *v1.Pod, err error) { + result = &v1.Pod{} + err = c.client.Post(). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(pod). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *pods) Update(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { + result = &v1.Pod{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pods"). + Name(pod.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(pod). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *pods) UpdateStatus(ctx context.Context, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { + result = &v1.Pod{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pods"). + Name(pod.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(pod). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the pod and deletes it. Returns an error if one occurs. +func (c *pods) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("pods"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *pods) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("pods"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched pod. +func (c *pods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pod, err error) { + result = &v1.Pod{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("pods"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied pod. +func (c *pods) Apply(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) { + if pod == nil { + return nil, fmt.Errorf("pod provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(pod) + if err != nil { + return nil, err + } + name := pod.Name + if name == nil { + return nil, fmt.Errorf("pod.Name must be provided to Apply") + } + result = &v1.Pod{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("pods"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *pods) ApplyStatus(ctx context.Context, pod *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pod, err error) { + if pod == nil { + return nil, fmt.Errorf("pod provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(pod) + if err != nil { + return nil, err + } + + name := pod.Name + if name == nil { + return nil, fmt.Errorf("pod.Name must be provided to Apply") + } + + result = &v1.Pod{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("pods"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// UpdateEphemeralContainers takes the top resource name and the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any. +func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) { + result = &v1.Pod{} + err = c.client.Put(). + Namespace(c.ns). + Resource("pods"). + Name(podName). + SubResource("ephemeralcontainers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(pod). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/podtemplate.go b/pkg/clients/clientset/typed/core/v1/podtemplate.go new file mode 100644 index 000000000..4e7e910c2 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/podtemplate.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PodTemplatesGetter has a method to return a PodTemplateInterface. +// A group's client should implement this interface. +type PodTemplatesGetter interface { + PodTemplates(namespace string) PodTemplateInterface +} + +// PodTemplateInterface has methods to work with PodTemplate resources. +type PodTemplateInterface interface { + Create(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.CreateOptions) (*v1.PodTemplate, error) + Update(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.UpdateOptions) (*v1.PodTemplate, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PodTemplate, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PodTemplateList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodTemplate, err error) + Apply(ctx context.Context, podTemplate *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PodTemplate, err error) + PodTemplateExpansion +} + +// podTemplates implements PodTemplateInterface +type podTemplates struct { + client rest.Interface + ns string +} + +// newPodTemplates returns a PodTemplates +func newPodTemplates(c *CoreV1Client, namespace string) *podTemplates { + return &podTemplates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the podTemplate, and returns the corresponding podTemplate object, and an error if there is any. +func (c *podTemplates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PodTemplate, err error) { + result = &v1.PodTemplate{} + err = c.client.Get(). + Namespace(c.ns). + Resource("podtemplates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PodTemplates that match those selectors. +func (c *podTemplates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PodTemplateList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PodTemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested podTemplates. +func (c *podTemplates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a podTemplate and creates it. Returns the server's representation of the podTemplate, and an error, if there is any. +func (c *podTemplates) Create(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.CreateOptions) (result *v1.PodTemplate, err error) { + result = &v1.PodTemplate{} + err = c.client.Post(). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(podTemplate). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a podTemplate and updates it. Returns the server's representation of the podTemplate, and an error, if there is any. +func (c *podTemplates) Update(ctx context.Context, podTemplate *v1.PodTemplate, opts metav1.UpdateOptions) (result *v1.PodTemplate, err error) { + result = &v1.PodTemplate{} + err = c.client.Put(). + Namespace(c.ns). + Resource("podtemplates"). + Name(podTemplate.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(podTemplate). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the podTemplate and deletes it. Returns an error if one occurs. +func (c *podTemplates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("podtemplates"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *podTemplates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("podtemplates"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched podTemplate. +func (c *podTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PodTemplate, err error) { + result = &v1.PodTemplate{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("podtemplates"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied podTemplate. +func (c *podTemplates) Apply(ctx context.Context, podTemplate *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PodTemplate, err error) { + if podTemplate == nil { + return nil, fmt.Errorf("podTemplate provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(podTemplate) + if err != nil { + return nil, err + } + name := podTemplate.Name + if name == nil { + return nil, fmt.Errorf("podTemplate.Name must be provided to Apply") + } + result = &v1.PodTemplate{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("podtemplates"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/replicationcontroller.go b/pkg/clients/clientset/typed/core/v1/replicationcontroller.go new file mode 100644 index 000000000..a6276d2cf --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/replicationcontroller.go @@ -0,0 +1,276 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ReplicationControllersGetter has a method to return a ReplicationControllerInterface. +// A group's client should implement this interface. +type ReplicationControllersGetter interface { + ReplicationControllers(namespace string) ReplicationControllerInterface +} + +// ReplicationControllerInterface has methods to work with ReplicationController resources. +type ReplicationControllerInterface interface { + Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (*v1.ReplicationController, error) + Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error) + UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (*v1.ReplicationController, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ReplicationController, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ReplicationControllerList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error) + Apply(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) + ApplyStatus(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) + GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (*autoscalingv1.Scale, error) + UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) + + ReplicationControllerExpansion +} + +// replicationControllers implements ReplicationControllerInterface +type replicationControllers struct { + client rest.Interface + ns string +} + +// newReplicationControllers returns a ReplicationControllers +func newReplicationControllers(c *CoreV1Client, namespace string) *replicationControllers { + return &replicationControllers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the replicationController, and returns the corresponding replicationController object, and an error if there is any. +func (c *replicationControllers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ReplicationController, err error) { + result = &v1.ReplicationController{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ReplicationControllers that match those selectors. +func (c *replicationControllers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ReplicationControllerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ReplicationControllerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested replicationControllers. +func (c *replicationControllers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a replicationController and creates it. Returns the server's representation of the replicationController, and an error, if there is any. +func (c *replicationControllers) Create(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.CreateOptions) (result *v1.ReplicationController, err error) { + result = &v1.ReplicationController{} + err = c.client.Post(). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(replicationController). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a replicationController and updates it. Returns the server's representation of the replicationController, and an error, if there is any. +func (c *replicationControllers) Update(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) { + result = &v1.ReplicationController{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(replicationController.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(replicationController). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *replicationControllers) UpdateStatus(ctx context.Context, replicationController *v1.ReplicationController, opts metav1.UpdateOptions) (result *v1.ReplicationController, err error) { + result = &v1.ReplicationController{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(replicationController.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(replicationController). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the replicationController and deletes it. Returns an error if one occurs. +func (c *replicationControllers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *replicationControllers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("replicationcontrollers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched replicationController. +func (c *replicationControllers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ReplicationController, err error) { + result = &v1.ReplicationController{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied replicationController. +func (c *replicationControllers) Apply(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) { + if replicationController == nil { + return nil, fmt.Errorf("replicationController provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(replicationController) + if err != nil { + return nil, err + } + name := replicationController.Name + if name == nil { + return nil, fmt.Errorf("replicationController.Name must be provided to Apply") + } + result = &v1.ReplicationController{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *replicationControllers) ApplyStatus(ctx context.Context, replicationController *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ReplicationController, err error) { + if replicationController == nil { + return nil, fmt.Errorf("replicationController provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(replicationController) + if err != nil { + return nil, err + } + + name := replicationController.Name + if name == nil { + return nil, fmt.Errorf("replicationController.Name must be provided to Apply") + } + + result = &v1.ReplicationController{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// GetScale takes name of the replicationController, and returns the corresponding autoscalingv1.Scale object, and an error if there is any. +func (c *replicationControllers) GetScale(ctx context.Context, replicationControllerName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Get(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(replicationControllerName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *replicationControllers) UpdateScale(ctx context.Context, replicationControllerName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { + result = &autoscalingv1.Scale{} + err = c.client.Put(). + Namespace(c.ns). + Resource("replicationcontrollers"). + Name(replicationControllerName). + SubResource("scale"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(scale). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/resourcequota.go b/pkg/clients/clientset/typed/core/v1/resourcequota.go new file mode 100644 index 000000000..6b0fcdf45 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/resourcequota.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourceQuotasGetter has a method to return a ResourceQuotaInterface. +// A group's client should implement this interface. +type ResourceQuotasGetter interface { + ResourceQuotas(namespace string) ResourceQuotaInterface +} + +// ResourceQuotaInterface has methods to work with ResourceQuota resources. +type ResourceQuotaInterface interface { + Create(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.CreateOptions) (*v1.ResourceQuota, error) + Update(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (*v1.ResourceQuota, error) + UpdateStatus(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (*v1.ResourceQuota, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ResourceQuota, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceQuotaList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceQuota, err error) + Apply(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) + ApplyStatus(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) + ResourceQuotaExpansion +} + +// resourceQuotas implements ResourceQuotaInterface +type resourceQuotas struct { + client rest.Interface + ns string +} + +// newResourceQuotas returns a ResourceQuotas +func newResourceQuotas(c *CoreV1Client, namespace string) *resourceQuotas { + return &resourceQuotas{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceQuota, and returns the corresponding resourceQuota object, and an error if there is any. +func (c *resourceQuotas) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceQuota, err error) { + result = &v1.ResourceQuota{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceQuotas that match those selectors. +func (c *resourceQuotas) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceQuotaList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceQuotaList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceQuotas. +func (c *resourceQuotas) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceQuota and creates it. Returns the server's representation of the resourceQuota, and an error, if there is any. +func (c *resourceQuotas) Create(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.CreateOptions) (result *v1.ResourceQuota, err error) { + result = &v1.ResourceQuota{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceQuota). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceQuota and updates it. Returns the server's representation of the resourceQuota, and an error, if there is any. +func (c *resourceQuotas) Update(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (result *v1.ResourceQuota, err error) { + result = &v1.ResourceQuota{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(resourceQuota.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceQuota). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resourceQuotas) UpdateStatus(ctx context.Context, resourceQuota *v1.ResourceQuota, opts metav1.UpdateOptions) (result *v1.ResourceQuota, err error) { + result = &v1.ResourceQuota{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(resourceQuota.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceQuota). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceQuota and deletes it. Returns an error if one occurs. +func (c *resourceQuotas) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcequotas"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceQuotas) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcequotas"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceQuota. +func (c *resourceQuotas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceQuota, err error) { + result = &v1.ResourceQuota{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourcequotas"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceQuota. +func (c *resourceQuotas) Apply(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) { + if resourceQuota == nil { + return nil, fmt.Errorf("resourceQuota provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceQuota) + if err != nil { + return nil, err + } + name := resourceQuota.Name + if name == nil { + return nil, fmt.Errorf("resourceQuota.Name must be provided to Apply") + } + result = &v1.ResourceQuota{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourcequotas"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resourceQuotas) ApplyStatus(ctx context.Context, resourceQuota *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceQuota, err error) { + if resourceQuota == nil { + return nil, fmt.Errorf("resourceQuota provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceQuota) + if err != nil { + return nil, err + } + + name := resourceQuota.Name + if name == nil { + return nil, fmt.Errorf("resourceQuota.Name must be provided to Apply") + } + + result = &v1.ResourceQuota{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourcequotas"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/secret.go b/pkg/clients/clientset/typed/core/v1/secret.go new file mode 100644 index 000000000..4d54a93a5 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/secret.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// SecretsGetter has a method to return a SecretInterface. +// A group's client should implement this interface. +type SecretsGetter interface { + Secrets(namespace string) SecretInterface +} + +// SecretInterface has methods to work with Secret resources. +type SecretInterface interface { + Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error) + Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Secret, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.SecretList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) + Apply(ctx context.Context, secret *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Secret, err error) + SecretExpansion +} + +// secrets implements SecretInterface +type secrets struct { + client rest.Interface + ns string +} + +// newSecrets returns a Secrets +func newSecrets(c *CoreV1Client, namespace string) *secrets { + return &secrets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the secret, and returns the corresponding secret object, and an error if there is any. +func (c *secrets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Secret, err error) { + result = &v1.Secret{} + err = c.client.Get(). + Namespace(c.ns). + Resource("secrets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Secrets that match those selectors. +func (c *secrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.SecretList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested secrets. +func (c *secrets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a secret and creates it. Returns the server's representation of the secret, and an error, if there is any. +func (c *secrets) Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (result *v1.Secret, err error) { + result = &v1.Secret{} + err = c.client.Post(). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(secret). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a secret and updates it. Returns the server's representation of the secret, and an error, if there is any. +func (c *secrets) Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (result *v1.Secret, err error) { + result = &v1.Secret{} + err = c.client.Put(). + Namespace(c.ns). + Resource("secrets"). + Name(secret.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(secret). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the secret and deletes it. Returns an error if one occurs. +func (c *secrets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("secrets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *secrets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("secrets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched secret. +func (c *secrets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Secret, err error) { + result = &v1.Secret{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("secrets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied secret. +func (c *secrets) Apply(ctx context.Context, secret *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Secret, err error) { + if secret == nil { + return nil, fmt.Errorf("secret provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(secret) + if err != nil { + return nil, err + } + name := secret.Name + if name == nil { + return nil, fmt.Errorf("secret.Name must be provided to Apply") + } + result = &v1.Secret{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("secrets"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/service.go b/pkg/clients/clientset/typed/core/v1/service.go new file mode 100644 index 000000000..d72d57778 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/service.go @@ -0,0 +1,226 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ServicesGetter has a method to return a ServiceInterface. +// A group's client should implement this interface. +type ServicesGetter interface { + Services(namespace string) ServiceInterface +} + +// ServiceInterface has methods to work with Service resources. +type ServiceInterface interface { + Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (*v1.Service, error) + Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (*v1.Service, error) + UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (*v1.Service, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Service, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ServiceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) + Apply(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) + ApplyStatus(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) + ServiceExpansion +} + +// services implements ServiceInterface +type services struct { + client rest.Interface + ns string +} + +// newServices returns a Services +func newServices(c *CoreV1Client, namespace string) *services { + return &services{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the service, and returns the corresponding service object, and an error if there is any. +func (c *services) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Service, err error) { + result = &v1.Service{} + err = c.client.Get(). + Namespace(c.ns). + Resource("services"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Services that match those selectors. +func (c *services) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ServiceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("services"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested services. +func (c *services) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("services"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any. +func (c *services) Create(ctx context.Context, service *v1.Service, opts metav1.CreateOptions) (result *v1.Service, err error) { + result = &v1.Service{} + err = c.client.Post(). + Namespace(c.ns). + Resource("services"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(service). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any. +func (c *services) Update(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) { + result = &v1.Service{} + err = c.client.Put(). + Namespace(c.ns). + Resource("services"). + Name(service.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(service). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *services) UpdateStatus(ctx context.Context, service *v1.Service, opts metav1.UpdateOptions) (result *v1.Service, err error) { + result = &v1.Service{} + err = c.client.Put(). + Namespace(c.ns). + Resource("services"). + Name(service.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(service). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the service and deletes it. Returns an error if one occurs. +func (c *services) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("services"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched service. +func (c *services) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Service, err error) { + result = &v1.Service{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("services"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied service. +func (c *services) Apply(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) { + if service == nil { + return nil, fmt.Errorf("service provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(service) + if err != nil { + return nil, err + } + name := service.Name + if name == nil { + return nil, fmt.Errorf("service.Name must be provided to Apply") + } + result = &v1.Service{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("services"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *services) ApplyStatus(ctx context.Context, service *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Service, err error) { + if service == nil { + return nil, fmt.Errorf("service provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(service) + if err != nil { + return nil, err + } + + name := service.Name + if name == nil { + return nil, fmt.Errorf("service.Name must be provided to Apply") + } + + result = &v1.Service{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("services"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/core/v1/serviceaccount.go b/pkg/clients/clientset/typed/core/v1/serviceaccount.go new file mode 100644 index 000000000..f29a57255 --- /dev/null +++ b/pkg/clients/clientset/typed/core/v1/serviceaccount.go @@ -0,0 +1,213 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + corev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/core/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + authenticationv1 "k8s.io/api/authentication/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ServiceAccountsGetter has a method to return a ServiceAccountInterface. +// A group's client should implement this interface. +type ServiceAccountsGetter interface { + ServiceAccounts(namespace string) ServiceAccountInterface +} + +// ServiceAccountInterface has methods to work with ServiceAccount resources. +type ServiceAccountInterface interface { + Create(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.CreateOptions) (*v1.ServiceAccount, error) + Update(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.UpdateOptions) (*v1.ServiceAccount, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ServiceAccount, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ServiceAccountList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceAccount, err error) + Apply(ctx context.Context, serviceAccount *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ServiceAccount, err error) + CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (*authenticationv1.TokenRequest, error) + + ServiceAccountExpansion +} + +// serviceAccounts implements ServiceAccountInterface +type serviceAccounts struct { + client rest.Interface + ns string +} + +// newServiceAccounts returns a ServiceAccounts +func newServiceAccounts(c *CoreV1Client, namespace string) *serviceAccounts { + return &serviceAccounts{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the serviceAccount, and returns the corresponding serviceAccount object, and an error if there is any. +func (c *serviceAccounts) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ServiceAccount, err error) { + result = &v1.ServiceAccount{} + err = c.client.Get(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ServiceAccounts that match those selectors. +func (c *serviceAccounts) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ServiceAccountList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ServiceAccountList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested serviceAccounts. +func (c *serviceAccounts) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a serviceAccount and creates it. Returns the server's representation of the serviceAccount, and an error, if there is any. +func (c *serviceAccounts) Create(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.CreateOptions) (result *v1.ServiceAccount, err error) { + result = &v1.ServiceAccount{} + err = c.client.Post(). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(serviceAccount). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a serviceAccount and updates it. Returns the server's representation of the serviceAccount, and an error, if there is any. +func (c *serviceAccounts) Update(ctx context.Context, serviceAccount *v1.ServiceAccount, opts metav1.UpdateOptions) (result *v1.ServiceAccount, err error) { + result = &v1.ServiceAccount{} + err = c.client.Put(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(serviceAccount.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(serviceAccount). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the serviceAccount and deletes it. Returns an error if one occurs. +func (c *serviceAccounts) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *serviceAccounts) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("serviceaccounts"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched serviceAccount. +func (c *serviceAccounts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ServiceAccount, err error) { + result = &v1.ServiceAccount{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied serviceAccount. +func (c *serviceAccounts) Apply(ctx context.Context, serviceAccount *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ServiceAccount, err error) { + if serviceAccount == nil { + return nil, fmt.Errorf("serviceAccount provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(serviceAccount) + if err != nil { + return nil, err + } + name := serviceAccount.Name + if name == nil { + return nil, fmt.Errorf("serviceAccount.Name must be provided to Apply") + } + result = &v1.ServiceAccount{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// CreateToken takes the representation of a tokenRequest and creates it. Returns the server's representation of the tokenRequest, and an error, if there is any. +func (c *serviceAccounts) CreateToken(ctx context.Context, serviceAccountName string, tokenRequest *authenticationv1.TokenRequest, opts metav1.CreateOptions) (result *authenticationv1.TokenRequest, err error) { + result = &authenticationv1.TokenRequest{} + err = c.client.Post(). + Namespace(c.ns). + Resource("serviceaccounts"). + Name(serviceAccountName). + SubResource("token"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(tokenRequest). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/discovery/v1/discovery_client.go b/pkg/clients/clientset/typed/discovery/v1/discovery_client.go new file mode 100644 index 000000000..307086ff9 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/discovery_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/discovery/v1" + rest "k8s.io/client-go/rest" +) + +type DiscoveryV1Interface interface { + RESTClient() rest.Interface + EndpointSlicesGetter +} + +// DiscoveryV1Client is used to interact with features provided by the discovery.k8s.io group. +type DiscoveryV1Client struct { + restClient rest.Interface +} + +func (c *DiscoveryV1Client) EndpointSlices(namespace string) EndpointSliceInterface { + return newEndpointSlices(c, namespace) +} + +// NewForConfig creates a new DiscoveryV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*DiscoveryV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new DiscoveryV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*DiscoveryV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &DiscoveryV1Client{client}, nil +} + +// NewForConfigOrDie creates a new DiscoveryV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *DiscoveryV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new DiscoveryV1Client for the given RESTClient. +func New(c rest.Interface) *DiscoveryV1Client { + return &DiscoveryV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *DiscoveryV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/discovery/v1/doc.go b/pkg/clients/clientset/typed/discovery/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/discovery/v1/endpointslice.go b/pkg/clients/clientset/typed/discovery/v1/endpointslice.go new file mode 100644 index 000000000..fa1fcd0d9 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/endpointslice.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + discoveryv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/discovery/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/discovery/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// EndpointSlicesGetter has a method to return a EndpointSliceInterface. +// A group's client should implement this interface. +type EndpointSlicesGetter interface { + EndpointSlices(namespace string) EndpointSliceInterface +} + +// EndpointSliceInterface has methods to work with EndpointSlice resources. +type EndpointSliceInterface interface { + Create(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.CreateOptions) (*v1.EndpointSlice, error) + Update(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.UpdateOptions) (*v1.EndpointSlice, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.EndpointSlice, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.EndpointSliceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.EndpointSlice, err error) + Apply(ctx context.Context, endpointSlice *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.EndpointSlice, err error) + EndpointSliceExpansion +} + +// endpointSlices implements EndpointSliceInterface +type endpointSlices struct { + client rest.Interface + ns string +} + +// newEndpointSlices returns a EndpointSlices +func newEndpointSlices(c *DiscoveryV1Client, namespace string) *endpointSlices { + return &endpointSlices{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. +func (c *endpointSlices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.EndpointSlice, err error) { + result = &v1.EndpointSlice{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpointslices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. +func (c *endpointSlices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointSliceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.EndpointSliceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested endpointSlices. +func (c *endpointSlices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *endpointSlices) Create(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.CreateOptions) (result *v1.EndpointSlice, err error) { + result = &v1.EndpointSlice{} + err = c.client.Post(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(endpointSlice). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *endpointSlices) Update(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.UpdateOptions) (result *v1.EndpointSlice, err error) { + result = &v1.EndpointSlice{} + err = c.client.Put(). + Namespace(c.ns). + Resource("endpointslices"). + Name(endpointSlice.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(endpointSlice). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. +func (c *endpointSlices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("endpointslices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *endpointSlices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched endpointSlice. +func (c *endpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.EndpointSlice, err error) { + result = &v1.EndpointSlice{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("endpointslices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied endpointSlice. +func (c *endpointSlices) Apply(ctx context.Context, endpointSlice *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.EndpointSlice, err error) { + if endpointSlice == nil { + return nil, fmt.Errorf("endpointSlice provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(endpointSlice) + if err != nil { + return nil, err + } + name := endpointSlice.Name + if name == nil { + return nil, fmt.Errorf("endpointSlice.Name must be provided to Apply") + } + result = &v1.EndpointSlice{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("endpointslices"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/discovery/v1/fake/doc.go b/pkg/clients/clientset/typed/discovery/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/discovery/v1/fake/fake_discovery_client.go b/pkg/clients/clientset/typed/discovery/v1/fake/fake_discovery_client.go new file mode 100644 index 000000000..847fc1c31 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/fake/fake_discovery_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/discovery/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeDiscoveryV1 struct { + *testing.Fake +} + +func (c *FakeDiscoveryV1) EndpointSlices(namespace string) v1.EndpointSliceInterface { + return &FakeEndpointSlices{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeDiscoveryV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/discovery/v1/fake/fake_endpointslice.go b/pkg/clients/clientset/typed/discovery/v1/fake/fake_endpointslice.go new file mode 100644 index 000000000..651718698 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/fake/fake_endpointslice.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + discoveryv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/discovery/v1" + v1 "k8s.io/api/discovery/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEndpointSlices implements EndpointSliceInterface +type FakeEndpointSlices struct { + Fake *FakeDiscoveryV1 + ns string +} + +var endpointslicesResource = v1.SchemeGroupVersion.WithResource("endpointslices") + +var endpointslicesKind = v1.SchemeGroupVersion.WithKind("EndpointSlice") + +// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. +func (c *FakeEndpointSlices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(endpointslicesResource, c.ns, name), &v1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.EndpointSlice), err +} + +// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. +func (c *FakeEndpointSlices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EndpointSliceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(endpointslicesResource, endpointslicesKind, c.ns, opts), &v1.EndpointSliceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.EndpointSliceList{ListMeta: obj.(*v1.EndpointSliceList).ListMeta} + for _, item := range obj.(*v1.EndpointSliceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested endpointSlices. +func (c *FakeEndpointSlices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(endpointslicesResource, c.ns, opts)) + +} + +// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *FakeEndpointSlices) Create(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.CreateOptions) (result *v1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(endpointslicesResource, c.ns, endpointSlice), &v1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.EndpointSlice), err +} + +// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *FakeEndpointSlices) Update(ctx context.Context, endpointSlice *v1.EndpointSlice, opts metav1.UpdateOptions) (result *v1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(endpointslicesResource, c.ns, endpointSlice), &v1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.EndpointSlice), err +} + +// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. +func (c *FakeEndpointSlices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(endpointslicesResource, c.ns, name, opts), &v1.EndpointSlice{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEndpointSlices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(endpointslicesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.EndpointSliceList{}) + return err +} + +// Patch applies the patch and returns the patched endpointSlice. +func (c *FakeEndpointSlices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(endpointslicesResource, c.ns, name, pt, data, subresources...), &v1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.EndpointSlice), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied endpointSlice. +func (c *FakeEndpointSlices) Apply(ctx context.Context, endpointSlice *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.EndpointSlice, err error) { + if endpointSlice == nil { + return nil, fmt.Errorf("endpointSlice provided to Apply must not be nil") + } + data, err := json.Marshal(endpointSlice) + if err != nil { + return nil, err + } + name := endpointSlice.Name + if name == nil { + return nil, fmt.Errorf("endpointSlice.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(endpointslicesResource, c.ns, *name, types.ApplyPatchType, data), &v1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.EndpointSlice), err +} diff --git a/pkg/clients/clientset/typed/discovery/v1/generated_expansion.go b/pkg/clients/clientset/typed/discovery/v1/generated_expansion.go new file mode 100644 index 000000000..56fccfa23 --- /dev/null +++ b/pkg/clients/clientset/typed/discovery/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type EndpointSliceExpansion interface{} diff --git a/pkg/clients/clientset/typed/events/v1/doc.go b/pkg/clients/clientset/typed/events/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/events/v1/event.go b/pkg/clients/clientset/typed/events/v1/event.go new file mode 100644 index 000000000..71e3ded19 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/event.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + eventsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/events/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// EventsGetter has a method to return a EventInterface. +// A group's client should implement this interface. +type EventsGetter interface { + Events(namespace string) EventInterface +} + +// EventInterface has methods to work with Event resources. +type EventInterface interface { + Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (*v1.Event, error) + Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (*v1.Event, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Event, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.EventList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) + Apply(ctx context.Context, event *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) + EventExpansion +} + +// events implements EventInterface +type events struct { + client rest.Interface + ns string +} + +// newEvents returns a Events +func newEvents(c *EventsV1Client, namespace string) *events { + return &events{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the event, and returns the corresponding event object, and an error if there is any. +func (c *events) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Get(). + Namespace(c.ns). + Resource("events"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Events that match those selectors. +func (c *events) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EventList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.EventList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested events. +func (c *events) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any. +func (c *events) Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Post(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(event). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any. +func (c *events) Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Put(). + Namespace(c.ns). + Resource("events"). + Name(event.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(event). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the event and deletes it. Returns an error if one occurs. +func (c *events) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("events"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *events) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("events"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched event. +func (c *events) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) { + result = &v1.Event{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("events"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied event. +func (c *events) Apply(ctx context.Context, event *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) { + if event == nil { + return nil, fmt.Errorf("event provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(event) + if err != nil { + return nil, err + } + name := event.Name + if name == nil { + return nil, fmt.Errorf("event.Name must be provided to Apply") + } + result = &v1.Event{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("events"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/events/v1/events_client.go b/pkg/clients/clientset/typed/events/v1/events_client.go new file mode 100644 index 000000000..db4659376 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/events_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/events/v1" + rest "k8s.io/client-go/rest" +) + +type EventsV1Interface interface { + RESTClient() rest.Interface + EventsGetter +} + +// EventsV1Client is used to interact with features provided by the events.k8s.io group. +type EventsV1Client struct { + restClient rest.Interface +} + +func (c *EventsV1Client) Events(namespace string) EventInterface { + return newEvents(c, namespace) +} + +// NewForConfig creates a new EventsV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*EventsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new EventsV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*EventsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &EventsV1Client{client}, nil +} + +// NewForConfigOrDie creates a new EventsV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *EventsV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new EventsV1Client for the given RESTClient. +func New(c rest.Interface) *EventsV1Client { + return &EventsV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *EventsV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/events/v1/fake/doc.go b/pkg/clients/clientset/typed/events/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/events/v1/fake/fake_event.go b/pkg/clients/clientset/typed/events/v1/fake/fake_event.go new file mode 100644 index 000000000..8b6b3ed06 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/fake/fake_event.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + eventsv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/events/v1" + v1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEvents implements EventInterface +type FakeEvents struct { + Fake *FakeEventsV1 + ns string +} + +var eventsResource = v1.SchemeGroupVersion.WithResource("events") + +var eventsKind = v1.SchemeGroupVersion.WithKind("Event") + +// Get takes name of the event, and returns the corresponding event object, and an error if there is any. +func (c *FakeEvents) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(eventsResource, c.ns, name), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// List takes label and field selectors, and returns the list of Events that match those selectors. +func (c *FakeEvents) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EventList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(eventsResource, eventsKind, c.ns, opts), &v1.EventList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.EventList{ListMeta: obj.(*v1.EventList).ListMeta} + for _, item := range obj.(*v1.EventList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested events. +func (c *FakeEvents) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(eventsResource, c.ns, opts)) + +} + +// Create takes the representation of a event and creates it. Returns the server's representation of the event, and an error, if there is any. +func (c *FakeEvents) Create(ctx context.Context, event *v1.Event, opts metav1.CreateOptions) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(eventsResource, c.ns, event), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// Update takes the representation of a event and updates it. Returns the server's representation of the event, and an error, if there is any. +func (c *FakeEvents) Update(ctx context.Context, event *v1.Event, opts metav1.UpdateOptions) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(eventsResource, c.ns, event), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// Delete takes name of the event and deletes it. Returns an error if one occurs. +func (c *FakeEvents) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(eventsResource, c.ns, name, opts), &v1.Event{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEvents) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(eventsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.EventList{}) + return err +} + +// Patch applies the patch and returns the patched event. +func (c *FakeEvents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Event, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(eventsResource, c.ns, name, pt, data, subresources...), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied event. +func (c *FakeEvents) Apply(ctx context.Context, event *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Event, err error) { + if event == nil { + return nil, fmt.Errorf("event provided to Apply must not be nil") + } + data, err := json.Marshal(event) + if err != nil { + return nil, err + } + name := event.Name + if name == nil { + return nil, fmt.Errorf("event.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(eventsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Event{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Event), err +} diff --git a/pkg/clients/clientset/typed/events/v1/fake/fake_events_client.go b/pkg/clients/clientset/typed/events/v1/fake/fake_events_client.go new file mode 100644 index 000000000..9d99dd6e4 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/fake/fake_events_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/events/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeEventsV1 struct { + *testing.Fake +} + +func (c *FakeEventsV1) Events(namespace string) v1.EventInterface { + return &FakeEvents{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeEventsV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/events/v1/generated_expansion.go b/pkg/clients/clientset/typed/events/v1/generated_expansion.go new file mode 100644 index 000000000..407392fe2 --- /dev/null +++ b/pkg/clients/clientset/typed/events/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type EventExpansion interface{} diff --git a/pkg/clients/clientset/typed/rbac/v1/clusterrole.go b/pkg/clients/clientset/typed/rbac/v1/clusterrole.go new file mode 100644 index 000000000..a328cbbca --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/clusterrole.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterRolesGetter has a method to return a ClusterRoleInterface. +// A group's client should implement this interface. +type ClusterRolesGetter interface { + ClusterRoles() ClusterRoleInterface +} + +// ClusterRoleInterface has methods to work with ClusterRole resources. +type ClusterRoleInterface interface { + Create(ctx context.Context, clusterRole *v1.ClusterRole, opts metav1.CreateOptions) (*v1.ClusterRole, error) + Update(ctx context.Context, clusterRole *v1.ClusterRole, opts metav1.UpdateOptions) (*v1.ClusterRole, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ClusterRole, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterRoleList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterRole, err error) + Apply(ctx context.Context, clusterRole *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterRole, err error) + ClusterRoleExpansion +} + +// clusterRoles implements ClusterRoleInterface +type clusterRoles struct { + client rest.Interface +} + +// newClusterRoles returns a ClusterRoles +func newClusterRoles(c *RbacV1Client) *clusterRoles { + return &clusterRoles{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any. +func (c *clusterRoles) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Get(). + Resource("clusterroles"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. +func (c *clusterRoles) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterRoleList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ClusterRoleList{} + err = c.client.Get(). + Resource("clusterroles"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterRoles. +func (c *clusterRoles) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("clusterroles"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *clusterRoles) Create(ctx context.Context, clusterRole *v1.ClusterRole, opts metav1.CreateOptions) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Post(). + Resource("clusterroles"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterRole). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *clusterRoles) Update(ctx context.Context, clusterRole *v1.ClusterRole, opts metav1.UpdateOptions) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Put(). + Resource("clusterroles"). + Name(clusterRole.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterRole). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs. +func (c *clusterRoles) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterroles"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterRoles) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("clusterroles"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterRole. +func (c *clusterRoles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Patch(pt). + Resource("clusterroles"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterRole. +func (c *clusterRoles) Apply(ctx context.Context, clusterRole *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterRole, err error) { + if clusterRole == nil { + return nil, fmt.Errorf("clusterRole provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(clusterRole) + if err != nil { + return nil, err + } + name := clusterRole.Name + if name == nil { + return nil, fmt.Errorf("clusterRole.Name must be provided to Apply") + } + result = &v1.ClusterRole{} + err = c.client.Patch(types.ApplyPatchType). + Resource("clusterroles"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/rbac/v1/clusterrolebinding.go b/pkg/clients/clientset/typed/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..31b5e5319 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/clusterrolebinding.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterRoleBindingsGetter has a method to return a ClusterRoleBindingInterface. +// A group's client should implement this interface. +type ClusterRoleBindingsGetter interface { + ClusterRoleBindings() ClusterRoleBindingInterface +} + +// ClusterRoleBindingInterface has methods to work with ClusterRoleBinding resources. +type ClusterRoleBindingInterface interface { + Create(ctx context.Context, clusterRoleBinding *v1.ClusterRoleBinding, opts metav1.CreateOptions) (*v1.ClusterRoleBinding, error) + Update(ctx context.Context, clusterRoleBinding *v1.ClusterRoleBinding, opts metav1.UpdateOptions) (*v1.ClusterRoleBinding, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ClusterRoleBinding, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ClusterRoleBindingList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterRoleBinding, err error) + Apply(ctx context.Context, clusterRoleBinding *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterRoleBinding, err error) + ClusterRoleBindingExpansion +} + +// clusterRoleBindings implements ClusterRoleBindingInterface +type clusterRoleBindings struct { + client rest.Interface +} + +// newClusterRoleBindings returns a ClusterRoleBindings +func newClusterRoleBindings(c *RbacV1Client) *clusterRoleBindings { + return &clusterRoleBindings{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any. +func (c *clusterRoleBindings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Get(). + Resource("clusterrolebindings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors. +func (c *clusterRoleBindings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterRoleBindingList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ClusterRoleBindingList{} + err = c.client.Get(). + Resource("clusterrolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterRoleBindings. +func (c *clusterRoleBindings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("clusterrolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *clusterRoleBindings) Create(ctx context.Context, clusterRoleBinding *v1.ClusterRoleBinding, opts metav1.CreateOptions) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Post(). + Resource("clusterrolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterRoleBinding). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *clusterRoleBindings) Update(ctx context.Context, clusterRoleBinding *v1.ClusterRoleBinding, opts metav1.UpdateOptions) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Put(). + Resource("clusterrolebindings"). + Name(clusterRoleBinding.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterRoleBinding). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs. +func (c *clusterRoleBindings) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterrolebindings"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterRoleBindings) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("clusterrolebindings"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterRoleBinding. +func (c *clusterRoleBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Patch(pt). + Resource("clusterrolebindings"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterRoleBinding. +func (c *clusterRoleBindings) Apply(ctx context.Context, clusterRoleBinding *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterRoleBinding, err error) { + if clusterRoleBinding == nil { + return nil, fmt.Errorf("clusterRoleBinding provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(clusterRoleBinding) + if err != nil { + return nil, err + } + name := clusterRoleBinding.Name + if name == nil { + return nil, fmt.Errorf("clusterRoleBinding.Name must be provided to Apply") + } + result = &v1.ClusterRoleBinding{} + err = c.client.Patch(types.ApplyPatchType). + Resource("clusterrolebindings"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/rbac/v1/doc.go b/pkg/clients/clientset/typed/rbac/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/rbac/v1/fake/doc.go b/pkg/clients/clientset/typed/rbac/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/rbac/v1/fake/fake_clusterrole.go b/pkg/clients/clientset/typed/rbac/v1/fake/fake_clusterrole.go new file mode 100644 index 000000000..d35405021 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/fake/fake_clusterrole.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterRoles implements ClusterRoleInterface +type FakeClusterRoles struct { + Fake *FakeRbacV1 +} + +var clusterrolesResource = v1.SchemeGroupVersion.WithResource("clusterroles") + +var clusterrolesKind = v1.SchemeGroupVersion.WithKind("ClusterRole") + +// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any. +func (c *FakeClusterRoles) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterrolesResource, name), &v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRole), err +} + +// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. +func (c *FakeClusterRoles) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterRoleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterrolesResource, clusterrolesKind, opts), &v1.ClusterRoleList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ClusterRoleList{ListMeta: obj.(*v1.ClusterRoleList).ListMeta} + for _, item := range obj.(*v1.ClusterRoleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterRoles. +func (c *FakeClusterRoles) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts)) +} + +// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *FakeClusterRoles) Create(ctx context.Context, clusterRole *v1.ClusterRole, opts metav1.CreateOptions) (result *v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRole), err +} + +// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *FakeClusterRoles) Update(ctx context.Context, clusterRole *v1.ClusterRole, opts metav1.UpdateOptions) (result *v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRole), err +} + +// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs. +func (c *FakeClusterRoles) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(clusterrolesResource, name, opts), &v1.ClusterRole{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterRoles) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ClusterRoleList{}) + return err +} + +// Patch applies the patch and returns the patched clusterRole. +func (c *FakeClusterRoles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, pt, data, subresources...), &v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRole), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterRole. +func (c *FakeClusterRoles) Apply(ctx context.Context, clusterRole *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterRole, err error) { + if clusterRole == nil { + return nil, fmt.Errorf("clusterRole provided to Apply must not be nil") + } + data, err := json.Marshal(clusterRole) + if err != nil { + return nil, err + } + name := clusterRole.Name + if name == nil { + return nil, fmt.Errorf("clusterRole.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, *name, types.ApplyPatchType, data), &v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRole), err +} diff --git a/pkg/clients/clientset/typed/rbac/v1/fake/fake_clusterrolebinding.go b/pkg/clients/clientset/typed/rbac/v1/fake/fake_clusterrolebinding.go new file mode 100644 index 000000000..a97db9576 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/fake/fake_clusterrolebinding.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterRoleBindings implements ClusterRoleBindingInterface +type FakeClusterRoleBindings struct { + Fake *FakeRbacV1 +} + +var clusterrolebindingsResource = v1.SchemeGroupVersion.WithResource("clusterrolebindings") + +var clusterrolebindingsKind = v1.SchemeGroupVersion.WithKind("ClusterRoleBinding") + +// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any. +func (c *FakeClusterRoleBindings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterrolebindingsResource, name), &v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRoleBinding), err +} + +// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors. +func (c *FakeClusterRoleBindings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ClusterRoleBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterrolebindingsResource, clusterrolebindingsKind, opts), &v1.ClusterRoleBindingList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ClusterRoleBindingList{ListMeta: obj.(*v1.ClusterRoleBindingList).ListMeta} + for _, item := range obj.(*v1.ClusterRoleBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterRoleBindings. +func (c *FakeClusterRoleBindings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterrolebindingsResource, opts)) +} + +// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *FakeClusterRoleBindings) Create(ctx context.Context, clusterRoleBinding *v1.ClusterRoleBinding, opts metav1.CreateOptions) (result *v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterrolebindingsResource, clusterRoleBinding), &v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRoleBinding), err +} + +// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *FakeClusterRoleBindings) Update(ctx context.Context, clusterRoleBinding *v1.ClusterRoleBinding, opts metav1.UpdateOptions) (result *v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterrolebindingsResource, clusterRoleBinding), &v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRoleBinding), err +} + +// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs. +func (c *FakeClusterRoleBindings) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(clusterrolebindingsResource, name, opts), &v1.ClusterRoleBinding{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterRoleBindings) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterrolebindingsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ClusterRoleBindingList{}) + return err +} + +// Patch applies the patch and returns the patched clusterRoleBinding. +func (c *FakeClusterRoleBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, name, pt, data, subresources...), &v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRoleBinding), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterRoleBinding. +func (c *FakeClusterRoleBindings) Apply(ctx context.Context, clusterRoleBinding *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ClusterRoleBinding, err error) { + if clusterRoleBinding == nil { + return nil, fmt.Errorf("clusterRoleBinding provided to Apply must not be nil") + } + data, err := json.Marshal(clusterRoleBinding) + if err != nil { + return nil, err + } + name := clusterRoleBinding.Name + if name == nil { + return nil, fmt.Errorf("clusterRoleBinding.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, *name, types.ApplyPatchType, data), &v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ClusterRoleBinding), err +} diff --git a/pkg/clients/clientset/typed/rbac/v1/fake/fake_rbac_client.go b/pkg/clients/clientset/typed/rbac/v1/fake/fake_rbac_client.go new file mode 100644 index 000000000..45d6906eb --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/fake/fake_rbac_client.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/rbac/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeRbacV1 struct { + *testing.Fake +} + +func (c *FakeRbacV1) ClusterRoles() v1.ClusterRoleInterface { + return &FakeClusterRoles{c} +} + +func (c *FakeRbacV1) ClusterRoleBindings() v1.ClusterRoleBindingInterface { + return &FakeClusterRoleBindings{c} +} + +func (c *FakeRbacV1) Roles(namespace string) v1.RoleInterface { + return &FakeRoles{c, namespace} +} + +func (c *FakeRbacV1) RoleBindings(namespace string) v1.RoleBindingInterface { + return &FakeRoleBindings{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRbacV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/rbac/v1/fake/fake_role.go b/pkg/clients/clientset/typed/rbac/v1/fake/fake_role.go new file mode 100644 index 000000000..0956108c7 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/fake/fake_role.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRoles implements RoleInterface +type FakeRoles struct { + Fake *FakeRbacV1 + ns string +} + +var rolesResource = v1.SchemeGroupVersion.WithResource("roles") + +var rolesKind = v1.SchemeGroupVersion.WithKind("Role") + +// Get takes name of the role, and returns the corresponding role object, and an error if there is any. +func (c *FakeRoles) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolesResource, c.ns, name), &v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Role), err +} + +// List takes label and field selectors, and returns the list of Roles that match those selectors. +func (c *FakeRoles) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RoleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolesResource, rolesKind, c.ns, opts), &v1.RoleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.RoleList{ListMeta: obj.(*v1.RoleList).ListMeta} + for _, item := range obj.(*v1.RoleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roles. +func (c *FakeRoles) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolesResource, c.ns, opts)) + +} + +// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any. +func (c *FakeRoles) Create(ctx context.Context, role *v1.Role, opts metav1.CreateOptions) (result *v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolesResource, c.ns, role), &v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Role), err +} + +// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any. +func (c *FakeRoles) Update(ctx context.Context, role *v1.Role, opts metav1.UpdateOptions) (result *v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolesResource, c.ns, role), &v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Role), err +} + +// Delete takes name of the role and deletes it. Returns an error if one occurs. +func (c *FakeRoles) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(rolesResource, c.ns, name, opts), &v1.Role{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRoles) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.RoleList{}) + return err +} + +// Patch applies the patch and returns the patched role. +func (c *FakeRoles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, name, pt, data, subresources...), &v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Role), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied role. +func (c *FakeRoles) Apply(ctx context.Context, role *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Role, err error) { + if role == nil { + return nil, fmt.Errorf("role provided to Apply must not be nil") + } + data, err := json.Marshal(role) + if err != nil { + return nil, err + } + name := role.Name + if name == nil { + return nil, fmt.Errorf("role.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Role), err +} diff --git a/pkg/clients/clientset/typed/rbac/v1/fake/fake_rolebinding.go b/pkg/clients/clientset/typed/rbac/v1/fake/fake_rolebinding.go new file mode 100644 index 000000000..86b078573 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/fake/fake_rolebinding.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRoleBindings implements RoleBindingInterface +type FakeRoleBindings struct { + Fake *FakeRbacV1 + ns string +} + +var rolebindingsResource = v1.SchemeGroupVersion.WithResource("rolebindings") + +var rolebindingsKind = v1.SchemeGroupVersion.WithKind("RoleBinding") + +// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any. +func (c *FakeRoleBindings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolebindingsResource, c.ns, name), &v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.RoleBinding), err +} + +// List takes label and field selectors, and returns the list of RoleBindings that match those selectors. +func (c *FakeRoleBindings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RoleBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolebindingsResource, rolebindingsKind, c.ns, opts), &v1.RoleBindingList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.RoleBindingList{ListMeta: obj.(*v1.RoleBindingList).ListMeta} + for _, item := range obj.(*v1.RoleBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roleBindings. +func (c *FakeRoleBindings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolebindingsResource, c.ns, opts)) + +} + +// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *FakeRoleBindings) Create(ctx context.Context, roleBinding *v1.RoleBinding, opts metav1.CreateOptions) (result *v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolebindingsResource, c.ns, roleBinding), &v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.RoleBinding), err +} + +// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *FakeRoleBindings) Update(ctx context.Context, roleBinding *v1.RoleBinding, opts metav1.UpdateOptions) (result *v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolebindingsResource, c.ns, roleBinding), &v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.RoleBinding), err +} + +// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs. +func (c *FakeRoleBindings) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(rolebindingsResource, c.ns, name, opts), &v1.RoleBinding{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRoleBindings) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolebindingsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.RoleBindingList{}) + return err +} + +// Patch applies the patch and returns the patched roleBinding. +func (c *FakeRoleBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, name, pt, data, subresources...), &v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.RoleBinding), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied roleBinding. +func (c *FakeRoleBindings) Apply(ctx context.Context, roleBinding *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.RoleBinding, err error) { + if roleBinding == nil { + return nil, fmt.Errorf("roleBinding provided to Apply must not be nil") + } + data, err := json.Marshal(roleBinding) + if err != nil { + return nil, err + } + name := roleBinding.Name + if name == nil { + return nil, fmt.Errorf("roleBinding.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, *name, types.ApplyPatchType, data), &v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.RoleBinding), err +} diff --git a/pkg/clients/clientset/typed/rbac/v1/generated_expansion.go b/pkg/clients/clientset/typed/rbac/v1/generated_expansion.go new file mode 100644 index 000000000..55dbd724e --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/generated_expansion.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type ClusterRoleExpansion interface{} + +type ClusterRoleBindingExpansion interface{} + +type RoleExpansion interface{} + +type RoleBindingExpansion interface{} diff --git a/pkg/clients/clientset/typed/rbac/v1/rbac_client.go b/pkg/clients/clientset/typed/rbac/v1/rbac_client.go new file mode 100644 index 000000000..5b55034e3 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/rbac_client.go @@ -0,0 +1,109 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/rbac/v1" + rest "k8s.io/client-go/rest" +) + +type RbacV1Interface interface { + RESTClient() rest.Interface + ClusterRolesGetter + ClusterRoleBindingsGetter + RolesGetter + RoleBindingsGetter +} + +// RbacV1Client is used to interact with features provided by the rbac.authorization.k8s.io group. +type RbacV1Client struct { + restClient rest.Interface +} + +func (c *RbacV1Client) ClusterRoles() ClusterRoleInterface { + return newClusterRoles(c) +} + +func (c *RbacV1Client) ClusterRoleBindings() ClusterRoleBindingInterface { + return newClusterRoleBindings(c) +} + +func (c *RbacV1Client) Roles(namespace string) RoleInterface { + return newRoles(c, namespace) +} + +func (c *RbacV1Client) RoleBindings(namespace string) RoleBindingInterface { + return newRoleBindings(c, namespace) +} + +// NewForConfig creates a new RbacV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*RbacV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new RbacV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*RbacV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &RbacV1Client{client}, nil +} + +// NewForConfigOrDie creates a new RbacV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RbacV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RbacV1Client for the given RESTClient. +func New(c rest.Interface) *RbacV1Client { + return &RbacV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RbacV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/rbac/v1/role.go b/pkg/clients/clientset/typed/rbac/v1/role.go new file mode 100644 index 000000000..df266ed14 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/role.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RolesGetter has a method to return a RoleInterface. +// A group's client should implement this interface. +type RolesGetter interface { + Roles(namespace string) RoleInterface +} + +// RoleInterface has methods to work with Role resources. +type RoleInterface interface { + Create(ctx context.Context, role *v1.Role, opts metav1.CreateOptions) (*v1.Role, error) + Update(ctx context.Context, role *v1.Role, opts metav1.UpdateOptions) (*v1.Role, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Role, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.RoleList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Role, err error) + Apply(ctx context.Context, role *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Role, err error) + RoleExpansion +} + +// roles implements RoleInterface +type roles struct { + client rest.Interface + ns string +} + +// newRoles returns a Roles +func newRoles(c *RbacV1Client, namespace string) *roles { + return &roles{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the role, and returns the corresponding role object, and an error if there is any. +func (c *roles) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Get(). + Namespace(c.ns). + Resource("roles"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Roles that match those selectors. +func (c *roles) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RoleList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.RoleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roles. +func (c *roles) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any. +func (c *roles) Create(ctx context.Context, role *v1.Role, opts metav1.CreateOptions) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Post(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(role). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any. +func (c *roles) Update(ctx context.Context, role *v1.Role, opts metav1.UpdateOptions) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Put(). + Namespace(c.ns). + Resource("roles"). + Name(role.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(role). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the role and deletes it. Returns an error if one occurs. +func (c *roles) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("roles"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roles) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched role. +func (c *roles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("roles"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied role. +func (c *roles) Apply(ctx context.Context, role *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Role, err error) { + if role == nil { + return nil, fmt.Errorf("role provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(role) + if err != nil { + return nil, err + } + name := role.Name + if name == nil { + return nil, fmt.Errorf("role.Name must be provided to Apply") + } + result = &v1.Role{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("roles"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/rbac/v1/rolebinding.go b/pkg/clients/clientset/typed/rbac/v1/rolebinding.go new file mode 100644 index 000000000..869b24c60 --- /dev/null +++ b/pkg/clients/clientset/typed/rbac/v1/rolebinding.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + rbacv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/rbac/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RoleBindingsGetter has a method to return a RoleBindingInterface. +// A group's client should implement this interface. +type RoleBindingsGetter interface { + RoleBindings(namespace string) RoleBindingInterface +} + +// RoleBindingInterface has methods to work with RoleBinding resources. +type RoleBindingInterface interface { + Create(ctx context.Context, roleBinding *v1.RoleBinding, opts metav1.CreateOptions) (*v1.RoleBinding, error) + Update(ctx context.Context, roleBinding *v1.RoleBinding, opts metav1.UpdateOptions) (*v1.RoleBinding, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.RoleBinding, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.RoleBindingList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RoleBinding, err error) + Apply(ctx context.Context, roleBinding *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.RoleBinding, err error) + RoleBindingExpansion +} + +// roleBindings implements RoleBindingInterface +type roleBindings struct { + client rest.Interface + ns string +} + +// newRoleBindings returns a RoleBindings +func newRoleBindings(c *RbacV1Client, namespace string) *roleBindings { + return &roleBindings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any. +func (c *roleBindings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RoleBindings that match those selectors. +func (c *roleBindings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.RoleBindingList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.RoleBindingList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roleBindings. +func (c *roleBindings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *roleBindings) Create(ctx context.Context, roleBinding *v1.RoleBinding, opts metav1.CreateOptions) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(roleBinding). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *roleBindings) Update(ctx context.Context, roleBinding *v1.RoleBinding, opts metav1.UpdateOptions) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rolebindings"). + Name(roleBinding.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(roleBinding). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs. +func (c *roleBindings) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roleBindings) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched roleBinding. +func (c *roleBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied roleBinding. +func (c *roleBindings) Apply(ctx context.Context, roleBinding *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.RoleBinding, err error) { + if roleBinding == nil { + return nil, fmt.Errorf("roleBinding provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(roleBinding) + if err != nil { + return nil, err + } + name := roleBinding.Name + if name == nil { + return nil, fmt.Errorf("roleBinding.Name must be provided to Apply") + } + result = &v1.RoleBinding{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("rolebindings"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/scheduling/v1/doc.go b/pkg/clients/clientset/typed/scheduling/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/scheduling/v1/fake/doc.go b/pkg/clients/clientset/typed/scheduling/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/scheduling/v1/fake/fake_priorityclass.go b/pkg/clients/clientset/typed/scheduling/v1/fake/fake_priorityclass.go new file mode 100644 index 000000000..97705f5bd --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/fake/fake_priorityclass.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + schedulingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/scheduling/v1" + v1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePriorityClasses implements PriorityClassInterface +type FakePriorityClasses struct { + Fake *FakeSchedulingV1 +} + +var priorityclassesResource = v1.SchemeGroupVersion.WithResource("priorityclasses") + +var priorityclassesKind = v1.SchemeGroupVersion.WithKind("PriorityClass") + +// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any. +func (c *FakePriorityClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PriorityClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(priorityclassesResource, name), &v1.PriorityClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PriorityClass), err +} + +// List takes label and field selectors, and returns the list of PriorityClasses that match those selectors. +func (c *FakePriorityClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PriorityClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(priorityclassesResource, priorityclassesKind, opts), &v1.PriorityClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.PriorityClassList{ListMeta: obj.(*v1.PriorityClassList).ListMeta} + for _, item := range obj.(*v1.PriorityClassList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested priorityClasses. +func (c *FakePriorityClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(priorityclassesResource, opts)) +} + +// Create takes the representation of a priorityClass and creates it. Returns the server's representation of the priorityClass, and an error, if there is any. +func (c *FakePriorityClasses) Create(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.CreateOptions) (result *v1.PriorityClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(priorityclassesResource, priorityClass), &v1.PriorityClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PriorityClass), err +} + +// Update takes the representation of a priorityClass and updates it. Returns the server's representation of the priorityClass, and an error, if there is any. +func (c *FakePriorityClasses) Update(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.UpdateOptions) (result *v1.PriorityClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(priorityclassesResource, priorityClass), &v1.PriorityClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PriorityClass), err +} + +// Delete takes name of the priorityClass and deletes it. Returns an error if one occurs. +func (c *FakePriorityClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(priorityclassesResource, name, opts), &v1.PriorityClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePriorityClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(priorityclassesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.PriorityClassList{}) + return err +} + +// Patch applies the patch and returns the patched priorityClass. +func (c *FakePriorityClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PriorityClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, name, pt, data, subresources...), &v1.PriorityClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PriorityClass), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied priorityClass. +func (c *FakePriorityClasses) Apply(ctx context.Context, priorityClass *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PriorityClass, err error) { + if priorityClass == nil { + return nil, fmt.Errorf("priorityClass provided to Apply must not be nil") + } + data, err := json.Marshal(priorityClass) + if err != nil { + return nil, err + } + name := priorityClass.Name + if name == nil { + return nil, fmt.Errorf("priorityClass.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(priorityclassesResource, *name, types.ApplyPatchType, data), &v1.PriorityClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.PriorityClass), err +} diff --git a/pkg/clients/clientset/typed/scheduling/v1/fake/fake_scheduling_client.go b/pkg/clients/clientset/typed/scheduling/v1/fake/fake_scheduling_client.go new file mode 100644 index 000000000..0efc6377c --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/fake/fake_scheduling_client.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/scheduling/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeSchedulingV1 struct { + *testing.Fake +} + +func (c *FakeSchedulingV1) PriorityClasses() v1.PriorityClassInterface { + return &FakePriorityClasses{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSchedulingV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/scheduling/v1/generated_expansion.go b/pkg/clients/clientset/typed/scheduling/v1/generated_expansion.go new file mode 100644 index 000000000..c98d1ba1d --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/generated_expansion.go @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type PriorityClassExpansion interface{} diff --git a/pkg/clients/clientset/typed/scheduling/v1/priorityclass.go b/pkg/clients/clientset/typed/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..2a73fc945 --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/priorityclass.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + schedulingv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/scheduling/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PriorityClassesGetter has a method to return a PriorityClassInterface. +// A group's client should implement this interface. +type PriorityClassesGetter interface { + PriorityClasses() PriorityClassInterface +} + +// PriorityClassInterface has methods to work with PriorityClass resources. +type PriorityClassInterface interface { + Create(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.CreateOptions) (*v1.PriorityClass, error) + Update(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.UpdateOptions) (*v1.PriorityClass, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PriorityClass, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PriorityClassList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PriorityClass, err error) + Apply(ctx context.Context, priorityClass *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PriorityClass, err error) + PriorityClassExpansion +} + +// priorityClasses implements PriorityClassInterface +type priorityClasses struct { + client rest.Interface +} + +// newPriorityClasses returns a PriorityClasses +func newPriorityClasses(c *SchedulingV1Client) *priorityClasses { + return &priorityClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the priorityClass, and returns the corresponding priorityClass object, and an error if there is any. +func (c *priorityClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PriorityClass, err error) { + result = &v1.PriorityClass{} + err = c.client.Get(). + Resource("priorityclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PriorityClasses that match those selectors. +func (c *priorityClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PriorityClassList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PriorityClassList{} + err = c.client.Get(). + Resource("priorityclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested priorityClasses. +func (c *priorityClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("priorityclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a priorityClass and creates it. Returns the server's representation of the priorityClass, and an error, if there is any. +func (c *priorityClasses) Create(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.CreateOptions) (result *v1.PriorityClass, err error) { + result = &v1.PriorityClass{} + err = c.client.Post(). + Resource("priorityclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(priorityClass). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a priorityClass and updates it. Returns the server's representation of the priorityClass, and an error, if there is any. +func (c *priorityClasses) Update(ctx context.Context, priorityClass *v1.PriorityClass, opts metav1.UpdateOptions) (result *v1.PriorityClass, err error) { + result = &v1.PriorityClass{} + err = c.client.Put(). + Resource("priorityclasses"). + Name(priorityClass.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(priorityClass). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the priorityClass and deletes it. Returns an error if one occurs. +func (c *priorityClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("priorityclasses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *priorityClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("priorityclasses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched priorityClass. +func (c *priorityClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PriorityClass, err error) { + result = &v1.PriorityClass{} + err = c.client.Patch(pt). + Resource("priorityclasses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied priorityClass. +func (c *priorityClasses) Apply(ctx context.Context, priorityClass *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.PriorityClass, err error) { + if priorityClass == nil { + return nil, fmt.Errorf("priorityClass provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(priorityClass) + if err != nil { + return nil, err + } + name := priorityClass.Name + if name == nil { + return nil, fmt.Errorf("priorityClass.Name must be provided to Apply") + } + result = &v1.PriorityClass{} + err = c.client.Patch(types.ApplyPatchType). + Resource("priorityclasses"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/scheduling/v1/scheduling_client.go b/pkg/clients/clientset/typed/scheduling/v1/scheduling_client.go new file mode 100644 index 000000000..61a90e6d8 --- /dev/null +++ b/pkg/clients/clientset/typed/scheduling/v1/scheduling_client.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/scheduling/v1" + rest "k8s.io/client-go/rest" +) + +type SchedulingV1Interface interface { + RESTClient() rest.Interface + PriorityClassesGetter +} + +// SchedulingV1Client is used to interact with features provided by the scheduling.k8s.io group. +type SchedulingV1Client struct { + restClient rest.Interface +} + +func (c *SchedulingV1Client) PriorityClasses() PriorityClassInterface { + return newPriorityClasses(c) +} + +// NewForConfig creates a new SchedulingV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*SchedulingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new SchedulingV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &SchedulingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new SchedulingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *SchedulingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SchedulingV1Client for the given RESTClient. +func New(c rest.Interface) *SchedulingV1Client { + return &SchedulingV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SchedulingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/storage/v1/csidriver.go b/pkg/clients/clientset/typed/storage/v1/csidriver.go new file mode 100644 index 000000000..46293227f --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/csidriver.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CSIDriversGetter has a method to return a CSIDriverInterface. +// A group's client should implement this interface. +type CSIDriversGetter interface { + CSIDrivers() CSIDriverInterface +} + +// CSIDriverInterface has methods to work with CSIDriver resources. +type CSIDriverInterface interface { + Create(ctx context.Context, cSIDriver *v1.CSIDriver, opts metav1.CreateOptions) (*v1.CSIDriver, error) + Update(ctx context.Context, cSIDriver *v1.CSIDriver, opts metav1.UpdateOptions) (*v1.CSIDriver, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CSIDriver, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CSIDriverList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSIDriver, err error) + Apply(ctx context.Context, cSIDriver *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSIDriver, err error) + CSIDriverExpansion +} + +// cSIDrivers implements CSIDriverInterface +type cSIDrivers struct { + client rest.Interface +} + +// newCSIDrivers returns a CSIDrivers +func newCSIDrivers(c *StorageV1Client) *cSIDrivers { + return &cSIDrivers{ + client: c.RESTClient(), + } +} + +// Get takes name of the cSIDriver, and returns the corresponding cSIDriver object, and an error if there is any. +func (c *cSIDrivers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CSIDriver, err error) { + result = &v1.CSIDriver{} + err = c.client.Get(). + Resource("csidrivers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CSIDrivers that match those selectors. +func (c *cSIDrivers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CSIDriverList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CSIDriverList{} + err = c.client.Get(). + Resource("csidrivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cSIDrivers. +func (c *cSIDrivers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("csidrivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a cSIDriver and creates it. Returns the server's representation of the cSIDriver, and an error, if there is any. +func (c *cSIDrivers) Create(ctx context.Context, cSIDriver *v1.CSIDriver, opts metav1.CreateOptions) (result *v1.CSIDriver, err error) { + result = &v1.CSIDriver{} + err = c.client.Post(). + Resource("csidrivers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cSIDriver). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a cSIDriver and updates it. Returns the server's representation of the cSIDriver, and an error, if there is any. +func (c *cSIDrivers) Update(ctx context.Context, cSIDriver *v1.CSIDriver, opts metav1.UpdateOptions) (result *v1.CSIDriver, err error) { + result = &v1.CSIDriver{} + err = c.client.Put(). + Resource("csidrivers"). + Name(cSIDriver.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cSIDriver). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the cSIDriver and deletes it. Returns an error if one occurs. +func (c *cSIDrivers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("csidrivers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cSIDrivers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("csidrivers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched cSIDriver. +func (c *cSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSIDriver, err error) { + result = &v1.CSIDriver{} + err = c.client.Patch(pt). + Resource("csidrivers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cSIDriver. +func (c *cSIDrivers) Apply(ctx context.Context, cSIDriver *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSIDriver, err error) { + if cSIDriver == nil { + return nil, fmt.Errorf("cSIDriver provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(cSIDriver) + if err != nil { + return nil, err + } + name := cSIDriver.Name + if name == nil { + return nil, fmt.Errorf("cSIDriver.Name must be provided to Apply") + } + result = &v1.CSIDriver{} + err = c.client.Patch(types.ApplyPatchType). + Resource("csidrivers"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/storage/v1/csinode.go b/pkg/clients/clientset/typed/storage/v1/csinode.go new file mode 100644 index 000000000..8953e134a --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/csinode.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CSINodesGetter has a method to return a CSINodeInterface. +// A group's client should implement this interface. +type CSINodesGetter interface { + CSINodes() CSINodeInterface +} + +// CSINodeInterface has methods to work with CSINode resources. +type CSINodeInterface interface { + Create(ctx context.Context, cSINode *v1.CSINode, opts metav1.CreateOptions) (*v1.CSINode, error) + Update(ctx context.Context, cSINode *v1.CSINode, opts metav1.UpdateOptions) (*v1.CSINode, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CSINode, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CSINodeList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSINode, err error) + Apply(ctx context.Context, cSINode *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSINode, err error) + CSINodeExpansion +} + +// cSINodes implements CSINodeInterface +type cSINodes struct { + client rest.Interface +} + +// newCSINodes returns a CSINodes +func newCSINodes(c *StorageV1Client) *cSINodes { + return &cSINodes{ + client: c.RESTClient(), + } +} + +// Get takes name of the cSINode, and returns the corresponding cSINode object, and an error if there is any. +func (c *cSINodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CSINode, err error) { + result = &v1.CSINode{} + err = c.client.Get(). + Resource("csinodes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CSINodes that match those selectors. +func (c *cSINodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CSINodeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CSINodeList{} + err = c.client.Get(). + Resource("csinodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cSINodes. +func (c *cSINodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("csinodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a cSINode and creates it. Returns the server's representation of the cSINode, and an error, if there is any. +func (c *cSINodes) Create(ctx context.Context, cSINode *v1.CSINode, opts metav1.CreateOptions) (result *v1.CSINode, err error) { + result = &v1.CSINode{} + err = c.client.Post(). + Resource("csinodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cSINode). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a cSINode and updates it. Returns the server's representation of the cSINode, and an error, if there is any. +func (c *cSINodes) Update(ctx context.Context, cSINode *v1.CSINode, opts metav1.UpdateOptions) (result *v1.CSINode, err error) { + result = &v1.CSINode{} + err = c.client.Put(). + Resource("csinodes"). + Name(cSINode.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cSINode). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the cSINode and deletes it. Returns an error if one occurs. +func (c *cSINodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("csinodes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cSINodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("csinodes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched cSINode. +func (c *cSINodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSINode, err error) { + result = &v1.CSINode{} + err = c.client.Patch(pt). + Resource("csinodes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cSINode. +func (c *cSINodes) Apply(ctx context.Context, cSINode *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSINode, err error) { + if cSINode == nil { + return nil, fmt.Errorf("cSINode provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(cSINode) + if err != nil { + return nil, err + } + name := cSINode.Name + if name == nil { + return nil, fmt.Errorf("cSINode.Name must be provided to Apply") + } + result = &v1.CSINode{} + err = c.client.Patch(types.ApplyPatchType). + Resource("csinodes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/storage/v1/csistoragecapacity.go b/pkg/clients/clientset/typed/storage/v1/csistoragecapacity.go new file mode 100644 index 000000000..480ab856a --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/csistoragecapacity.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CSIStorageCapacitiesGetter has a method to return a CSIStorageCapacityInterface. +// A group's client should implement this interface. +type CSIStorageCapacitiesGetter interface { + CSIStorageCapacities(namespace string) CSIStorageCapacityInterface +} + +// CSIStorageCapacityInterface has methods to work with CSIStorageCapacity resources. +type CSIStorageCapacityInterface interface { + Create(ctx context.Context, cSIStorageCapacity *v1.CSIStorageCapacity, opts metav1.CreateOptions) (*v1.CSIStorageCapacity, error) + Update(ctx context.Context, cSIStorageCapacity *v1.CSIStorageCapacity, opts metav1.UpdateOptions) (*v1.CSIStorageCapacity, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.CSIStorageCapacity, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CSIStorageCapacityList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSIStorageCapacity, err error) + Apply(ctx context.Context, cSIStorageCapacity *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSIStorageCapacity, err error) + CSIStorageCapacityExpansion +} + +// cSIStorageCapacities implements CSIStorageCapacityInterface +type cSIStorageCapacities struct { + client rest.Interface + ns string +} + +// newCSIStorageCapacities returns a CSIStorageCapacities +func newCSIStorageCapacities(c *StorageV1Client, namespace string) *cSIStorageCapacities { + return &cSIStorageCapacities{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cSIStorageCapacity, and returns the corresponding cSIStorageCapacity object, and an error if there is any. +func (c *cSIStorageCapacities) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CSIStorageCapacity, err error) { + result = &v1.CSIStorageCapacity{} + err = c.client.Get(). + Namespace(c.ns). + Resource("csistoragecapacities"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CSIStorageCapacities that match those selectors. +func (c *cSIStorageCapacities) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CSIStorageCapacityList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CSIStorageCapacityList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("csistoragecapacities"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested cSIStorageCapacities. +func (c *cSIStorageCapacities) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("csistoragecapacities"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a cSIStorageCapacity and creates it. Returns the server's representation of the cSIStorageCapacity, and an error, if there is any. +func (c *cSIStorageCapacities) Create(ctx context.Context, cSIStorageCapacity *v1.CSIStorageCapacity, opts metav1.CreateOptions) (result *v1.CSIStorageCapacity, err error) { + result = &v1.CSIStorageCapacity{} + err = c.client.Post(). + Namespace(c.ns). + Resource("csistoragecapacities"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cSIStorageCapacity). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a cSIStorageCapacity and updates it. Returns the server's representation of the cSIStorageCapacity, and an error, if there is any. +func (c *cSIStorageCapacities) Update(ctx context.Context, cSIStorageCapacity *v1.CSIStorageCapacity, opts metav1.UpdateOptions) (result *v1.CSIStorageCapacity, err error) { + result = &v1.CSIStorageCapacity{} + err = c.client.Put(). + Namespace(c.ns). + Resource("csistoragecapacities"). + Name(cSIStorageCapacity.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(cSIStorageCapacity). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the cSIStorageCapacity and deletes it. Returns an error if one occurs. +func (c *cSIStorageCapacities) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("csistoragecapacities"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *cSIStorageCapacities) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("csistoragecapacities"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched cSIStorageCapacity. +func (c *cSIStorageCapacities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSIStorageCapacity, err error) { + result = &v1.CSIStorageCapacity{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("csistoragecapacities"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cSIStorageCapacity. +func (c *cSIStorageCapacities) Apply(ctx context.Context, cSIStorageCapacity *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSIStorageCapacity, err error) { + if cSIStorageCapacity == nil { + return nil, fmt.Errorf("cSIStorageCapacity provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(cSIStorageCapacity) + if err != nil { + return nil, err + } + name := cSIStorageCapacity.Name + if name == nil { + return nil, fmt.Errorf("cSIStorageCapacity.Name must be provided to Apply") + } + result = &v1.CSIStorageCapacity{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("csistoragecapacities"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/storage/v1/doc.go b/pkg/clients/clientset/typed/storage/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/storage/v1/fake/doc.go b/pkg/clients/clientset/typed/storage/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/storage/v1/fake/fake_csidriver.go b/pkg/clients/clientset/typed/storage/v1/fake/fake_csidriver.go new file mode 100644 index 000000000..3878e3aa9 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/fake_csidriver.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCSIDrivers implements CSIDriverInterface +type FakeCSIDrivers struct { + Fake *FakeStorageV1 +} + +var csidriversResource = v1.SchemeGroupVersion.WithResource("csidrivers") + +var csidriversKind = v1.SchemeGroupVersion.WithKind("CSIDriver") + +// Get takes name of the cSIDriver, and returns the corresponding cSIDriver object, and an error if there is any. +func (c *FakeCSIDrivers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(csidriversResource, name), &v1.CSIDriver{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSIDriver), err +} + +// List takes label and field selectors, and returns the list of CSIDrivers that match those selectors. +func (c *FakeCSIDrivers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CSIDriverList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(csidriversResource, csidriversKind, opts), &v1.CSIDriverList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CSIDriverList{ListMeta: obj.(*v1.CSIDriverList).ListMeta} + for _, item := range obj.(*v1.CSIDriverList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cSIDrivers. +func (c *FakeCSIDrivers) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(csidriversResource, opts)) +} + +// Create takes the representation of a cSIDriver and creates it. Returns the server's representation of the cSIDriver, and an error, if there is any. +func (c *FakeCSIDrivers) Create(ctx context.Context, cSIDriver *v1.CSIDriver, opts metav1.CreateOptions) (result *v1.CSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(csidriversResource, cSIDriver), &v1.CSIDriver{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSIDriver), err +} + +// Update takes the representation of a cSIDriver and updates it. Returns the server's representation of the cSIDriver, and an error, if there is any. +func (c *FakeCSIDrivers) Update(ctx context.Context, cSIDriver *v1.CSIDriver, opts metav1.UpdateOptions) (result *v1.CSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(csidriversResource, cSIDriver), &v1.CSIDriver{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSIDriver), err +} + +// Delete takes name of the cSIDriver and deletes it. Returns an error if one occurs. +func (c *FakeCSIDrivers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(csidriversResource, name, opts), &v1.CSIDriver{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCSIDrivers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(csidriversResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CSIDriverList{}) + return err +} + +// Patch applies the patch and returns the patched cSIDriver. +func (c *FakeCSIDrivers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSIDriver, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(csidriversResource, name, pt, data, subresources...), &v1.CSIDriver{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSIDriver), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cSIDriver. +func (c *FakeCSIDrivers) Apply(ctx context.Context, cSIDriver *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSIDriver, err error) { + if cSIDriver == nil { + return nil, fmt.Errorf("cSIDriver provided to Apply must not be nil") + } + data, err := json.Marshal(cSIDriver) + if err != nil { + return nil, err + } + name := cSIDriver.Name + if name == nil { + return nil, fmt.Errorf("cSIDriver.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(csidriversResource, *name, types.ApplyPatchType, data), &v1.CSIDriver{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSIDriver), err +} diff --git a/pkg/clients/clientset/typed/storage/v1/fake/fake_csinode.go b/pkg/clients/clientset/typed/storage/v1/fake/fake_csinode.go new file mode 100644 index 000000000..2b2353095 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/fake_csinode.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCSINodes implements CSINodeInterface +type FakeCSINodes struct { + Fake *FakeStorageV1 +} + +var csinodesResource = v1.SchemeGroupVersion.WithResource("csinodes") + +var csinodesKind = v1.SchemeGroupVersion.WithKind("CSINode") + +// Get takes name of the cSINode, and returns the corresponding cSINode object, and an error if there is any. +func (c *FakeCSINodes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CSINode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(csinodesResource, name), &v1.CSINode{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSINode), err +} + +// List takes label and field selectors, and returns the list of CSINodes that match those selectors. +func (c *FakeCSINodes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CSINodeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(csinodesResource, csinodesKind, opts), &v1.CSINodeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CSINodeList{ListMeta: obj.(*v1.CSINodeList).ListMeta} + for _, item := range obj.(*v1.CSINodeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cSINodes. +func (c *FakeCSINodes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(csinodesResource, opts)) +} + +// Create takes the representation of a cSINode and creates it. Returns the server's representation of the cSINode, and an error, if there is any. +func (c *FakeCSINodes) Create(ctx context.Context, cSINode *v1.CSINode, opts metav1.CreateOptions) (result *v1.CSINode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(csinodesResource, cSINode), &v1.CSINode{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSINode), err +} + +// Update takes the representation of a cSINode and updates it. Returns the server's representation of the cSINode, and an error, if there is any. +func (c *FakeCSINodes) Update(ctx context.Context, cSINode *v1.CSINode, opts metav1.UpdateOptions) (result *v1.CSINode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(csinodesResource, cSINode), &v1.CSINode{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSINode), err +} + +// Delete takes name of the cSINode and deletes it. Returns an error if one occurs. +func (c *FakeCSINodes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(csinodesResource, name, opts), &v1.CSINode{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCSINodes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(csinodesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CSINodeList{}) + return err +} + +// Patch applies the patch and returns the patched cSINode. +func (c *FakeCSINodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSINode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(csinodesResource, name, pt, data, subresources...), &v1.CSINode{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSINode), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cSINode. +func (c *FakeCSINodes) Apply(ctx context.Context, cSINode *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSINode, err error) { + if cSINode == nil { + return nil, fmt.Errorf("cSINode provided to Apply must not be nil") + } + data, err := json.Marshal(cSINode) + if err != nil { + return nil, err + } + name := cSINode.Name + if name == nil { + return nil, fmt.Errorf("cSINode.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(csinodesResource, *name, types.ApplyPatchType, data), &v1.CSINode{}) + if obj == nil { + return nil, err + } + return obj.(*v1.CSINode), err +} diff --git a/pkg/clients/clientset/typed/storage/v1/fake/fake_csistoragecapacity.go b/pkg/clients/clientset/typed/storage/v1/fake/fake_csistoragecapacity.go new file mode 100644 index 000000000..1b2a8b033 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/fake_csistoragecapacity.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCSIStorageCapacities implements CSIStorageCapacityInterface +type FakeCSIStorageCapacities struct { + Fake *FakeStorageV1 + ns string +} + +var csistoragecapacitiesResource = v1.SchemeGroupVersion.WithResource("csistoragecapacities") + +var csistoragecapacitiesKind = v1.SchemeGroupVersion.WithKind("CSIStorageCapacity") + +// Get takes name of the cSIStorageCapacity, and returns the corresponding cSIStorageCapacity object, and an error if there is any. +func (c *FakeCSIStorageCapacities) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CSIStorageCapacity, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(csistoragecapacitiesResource, c.ns, name), &v1.CSIStorageCapacity{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CSIStorageCapacity), err +} + +// List takes label and field selectors, and returns the list of CSIStorageCapacities that match those selectors. +func (c *FakeCSIStorageCapacities) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CSIStorageCapacityList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(csistoragecapacitiesResource, csistoragecapacitiesKind, c.ns, opts), &v1.CSIStorageCapacityList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CSIStorageCapacityList{ListMeta: obj.(*v1.CSIStorageCapacityList).ListMeta} + for _, item := range obj.(*v1.CSIStorageCapacityList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested cSIStorageCapacities. +func (c *FakeCSIStorageCapacities) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(csistoragecapacitiesResource, c.ns, opts)) + +} + +// Create takes the representation of a cSIStorageCapacity and creates it. Returns the server's representation of the cSIStorageCapacity, and an error, if there is any. +func (c *FakeCSIStorageCapacities) Create(ctx context.Context, cSIStorageCapacity *v1.CSIStorageCapacity, opts metav1.CreateOptions) (result *v1.CSIStorageCapacity, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(csistoragecapacitiesResource, c.ns, cSIStorageCapacity), &v1.CSIStorageCapacity{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CSIStorageCapacity), err +} + +// Update takes the representation of a cSIStorageCapacity and updates it. Returns the server's representation of the cSIStorageCapacity, and an error, if there is any. +func (c *FakeCSIStorageCapacities) Update(ctx context.Context, cSIStorageCapacity *v1.CSIStorageCapacity, opts metav1.UpdateOptions) (result *v1.CSIStorageCapacity, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(csistoragecapacitiesResource, c.ns, cSIStorageCapacity), &v1.CSIStorageCapacity{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CSIStorageCapacity), err +} + +// Delete takes name of the cSIStorageCapacity and deletes it. Returns an error if one occurs. +func (c *FakeCSIStorageCapacities) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(csistoragecapacitiesResource, c.ns, name, opts), &v1.CSIStorageCapacity{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCSIStorageCapacities) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(csistoragecapacitiesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CSIStorageCapacityList{}) + return err +} + +// Patch applies the patch and returns the patched cSIStorageCapacity. +func (c *FakeCSIStorageCapacities) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CSIStorageCapacity, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(csistoragecapacitiesResource, c.ns, name, pt, data, subresources...), &v1.CSIStorageCapacity{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CSIStorageCapacity), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied cSIStorageCapacity. +func (c *FakeCSIStorageCapacities) Apply(ctx context.Context, cSIStorageCapacity *storagev1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CSIStorageCapacity, err error) { + if cSIStorageCapacity == nil { + return nil, fmt.Errorf("cSIStorageCapacity provided to Apply must not be nil") + } + data, err := json.Marshal(cSIStorageCapacity) + if err != nil { + return nil, err + } + name := cSIStorageCapacity.Name + if name == nil { + return nil, fmt.Errorf("cSIStorageCapacity.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(csistoragecapacitiesResource, c.ns, *name, types.ApplyPatchType, data), &v1.CSIStorageCapacity{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.CSIStorageCapacity), err +} diff --git a/pkg/clients/clientset/typed/storage/v1/fake/fake_storage_client.go b/pkg/clients/clientset/typed/storage/v1/fake/fake_storage_client.go new file mode 100644 index 000000000..43ac69fe3 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/fake_storage_client.go @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/storage/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeStorageV1 struct { + *testing.Fake +} + +func (c *FakeStorageV1) CSIDrivers() v1.CSIDriverInterface { + return &FakeCSIDrivers{c} +} + +func (c *FakeStorageV1) CSINodes() v1.CSINodeInterface { + return &FakeCSINodes{c} +} + +func (c *FakeStorageV1) CSIStorageCapacities(namespace string) v1.CSIStorageCapacityInterface { + return &FakeCSIStorageCapacities{c, namespace} +} + +func (c *FakeStorageV1) StorageClasses() v1.StorageClassInterface { + return &FakeStorageClasses{c} +} + +func (c *FakeStorageV1) VolumeAttachments() v1.VolumeAttachmentInterface { + return &FakeVolumeAttachments{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeStorageV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/storage/v1/fake/fake_storageclass.go b/pkg/clients/clientset/typed/storage/v1/fake/fake_storageclass.go new file mode 100644 index 000000000..68d11461f --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/fake_storageclass.go @@ -0,0 +1,132 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeStorageClasses implements StorageClassInterface +type FakeStorageClasses struct { + Fake *FakeStorageV1 +} + +var storageclassesResource = v1.SchemeGroupVersion.WithResource("storageclasses") + +var storageclassesKind = v1.SchemeGroupVersion.WithKind("StorageClass") + +// Get takes name of the storageClass, and returns the corresponding storageClass object, and an error if there is any. +func (c *FakeStorageClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.StorageClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(storageclassesResource, name), &v1.StorageClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.StorageClass), err +} + +// List takes label and field selectors, and returns the list of StorageClasses that match those selectors. +func (c *FakeStorageClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.StorageClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(storageclassesResource, storageclassesKind, opts), &v1.StorageClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.StorageClassList{ListMeta: obj.(*v1.StorageClassList).ListMeta} + for _, item := range obj.(*v1.StorageClassList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested storageClasses. +func (c *FakeStorageClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(storageclassesResource, opts)) +} + +// Create takes the representation of a storageClass and creates it. Returns the server's representation of the storageClass, and an error, if there is any. +func (c *FakeStorageClasses) Create(ctx context.Context, storageClass *v1.StorageClass, opts metav1.CreateOptions) (result *v1.StorageClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(storageclassesResource, storageClass), &v1.StorageClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.StorageClass), err +} + +// Update takes the representation of a storageClass and updates it. Returns the server's representation of the storageClass, and an error, if there is any. +func (c *FakeStorageClasses) Update(ctx context.Context, storageClass *v1.StorageClass, opts metav1.UpdateOptions) (result *v1.StorageClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(storageclassesResource, storageClass), &v1.StorageClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.StorageClass), err +} + +// Delete takes name of the storageClass and deletes it. Returns an error if one occurs. +func (c *FakeStorageClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(storageclassesResource, name, opts), &v1.StorageClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeStorageClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(storageclassesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.StorageClassList{}) + return err +} + +// Patch applies the patch and returns the patched storageClass. +func (c *FakeStorageClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StorageClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(storageclassesResource, name, pt, data, subresources...), &v1.StorageClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.StorageClass), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied storageClass. +func (c *FakeStorageClasses) Apply(ctx context.Context, storageClass *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StorageClass, err error) { + if storageClass == nil { + return nil, fmt.Errorf("storageClass provided to Apply must not be nil") + } + data, err := json.Marshal(storageClass) + if err != nil { + return nil, err + } + name := storageClass.Name + if name == nil { + return nil, fmt.Errorf("storageClass.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(storageclassesResource, *name, types.ApplyPatchType, data), &v1.StorageClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.StorageClass), err +} diff --git a/pkg/clients/clientset/typed/storage/v1/fake/fake_volumeattachment.go b/pkg/clients/clientset/typed/storage/v1/fake/fake_volumeattachment.go new file mode 100644 index 000000000..797af4e4a --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/fake/fake_volumeattachment.go @@ -0,0 +1,165 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeVolumeAttachments implements VolumeAttachmentInterface +type FakeVolumeAttachments struct { + Fake *FakeStorageV1 +} + +var volumeattachmentsResource = v1.SchemeGroupVersion.WithResource("volumeattachments") + +var volumeattachmentsKind = v1.SchemeGroupVersion.WithKind("VolumeAttachment") + +// Get takes name of the volumeAttachment, and returns the corresponding volumeAttachment object, and an error if there is any. +func (c *FakeVolumeAttachments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VolumeAttachment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(volumeattachmentsResource, name), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} + +// List takes label and field selectors, and returns the list of VolumeAttachments that match those selectors. +func (c *FakeVolumeAttachments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VolumeAttachmentList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(volumeattachmentsResource, volumeattachmentsKind, opts), &v1.VolumeAttachmentList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.VolumeAttachmentList{ListMeta: obj.(*v1.VolumeAttachmentList).ListMeta} + for _, item := range obj.(*v1.VolumeAttachmentList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested volumeAttachments. +func (c *FakeVolumeAttachments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(volumeattachmentsResource, opts)) +} + +// Create takes the representation of a volumeAttachment and creates it. Returns the server's representation of the volumeAttachment, and an error, if there is any. +func (c *FakeVolumeAttachments) Create(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.CreateOptions) (result *v1.VolumeAttachment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(volumeattachmentsResource, volumeAttachment), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} + +// Update takes the representation of a volumeAttachment and updates it. Returns the server's representation of the volumeAttachment, and an error, if there is any. +func (c *FakeVolumeAttachments) Update(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.UpdateOptions) (result *v1.VolumeAttachment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(volumeattachmentsResource, volumeAttachment), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeVolumeAttachments) UpdateStatus(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.UpdateOptions) (*v1.VolumeAttachment, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(volumeattachmentsResource, "status", volumeAttachment), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} + +// Delete takes name of the volumeAttachment and deletes it. Returns an error if one occurs. +func (c *FakeVolumeAttachments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(volumeattachmentsResource, name, opts), &v1.VolumeAttachment{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVolumeAttachments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(volumeattachmentsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.VolumeAttachmentList{}) + return err +} + +// Patch applies the patch and returns the patched volumeAttachment. +func (c *FakeVolumeAttachments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeAttachment, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumeattachmentsResource, name, pt, data, subresources...), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied volumeAttachment. +func (c *FakeVolumeAttachments) Apply(ctx context.Context, volumeAttachment *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.VolumeAttachment, err error) { + if volumeAttachment == nil { + return nil, fmt.Errorf("volumeAttachment provided to Apply must not be nil") + } + data, err := json.Marshal(volumeAttachment) + if err != nil { + return nil, err + } + name := volumeAttachment.Name + if name == nil { + return nil, fmt.Errorf("volumeAttachment.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumeattachmentsResource, *name, types.ApplyPatchType, data), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVolumeAttachments) ApplyStatus(ctx context.Context, volumeAttachment *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.VolumeAttachment, err error) { + if volumeAttachment == nil { + return nil, fmt.Errorf("volumeAttachment provided to Apply must not be nil") + } + data, err := json.Marshal(volumeAttachment) + if err != nil { + return nil, err + } + name := volumeAttachment.Name + if name == nil { + return nil, fmt.Errorf("volumeAttachment.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumeattachmentsResource, *name, types.ApplyPatchType, data, "status"), &v1.VolumeAttachment{}) + if obj == nil { + return nil, err + } + return obj.(*v1.VolumeAttachment), err +} diff --git a/pkg/clients/clientset/typed/storage/v1/generated_expansion.go b/pkg/clients/clientset/typed/storage/v1/generated_expansion.go new file mode 100644 index 000000000..30356e35f --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/generated_expansion.go @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type CSIDriverExpansion interface{} + +type CSINodeExpansion interface{} + +type CSIStorageCapacityExpansion interface{} + +type StorageClassExpansion interface{} + +type VolumeAttachmentExpansion interface{} diff --git a/pkg/clients/clientset/typed/storage/v1/storage_client.go b/pkg/clients/clientset/typed/storage/v1/storage_client.go new file mode 100644 index 000000000..d7bbf9f9a --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/storage_client.go @@ -0,0 +1,114 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/storage/v1" + rest "k8s.io/client-go/rest" +) + +type StorageV1Interface interface { + RESTClient() rest.Interface + CSIDriversGetter + CSINodesGetter + CSIStorageCapacitiesGetter + StorageClassesGetter + VolumeAttachmentsGetter +} + +// StorageV1Client is used to interact with features provided by the storage.k8s.io group. +type StorageV1Client struct { + restClient rest.Interface +} + +func (c *StorageV1Client) CSIDrivers() CSIDriverInterface { + return newCSIDrivers(c) +} + +func (c *StorageV1Client) CSINodes() CSINodeInterface { + return newCSINodes(c) +} + +func (c *StorageV1Client) CSIStorageCapacities(namespace string) CSIStorageCapacityInterface { + return newCSIStorageCapacities(c, namespace) +} + +func (c *StorageV1Client) StorageClasses() StorageClassInterface { + return newStorageClasses(c) +} + +func (c *StorageV1Client) VolumeAttachments() VolumeAttachmentInterface { + return newVolumeAttachments(c) +} + +// NewForConfig creates a new StorageV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*StorageV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new StorageV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*StorageV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &StorageV1Client{client}, nil +} + +// NewForConfigOrDie creates a new StorageV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *StorageV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new StorageV1Client for the given RESTClient. +func New(c rest.Interface) *StorageV1Client { + return &StorageV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *StorageV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/storage/v1/storageclass.go b/pkg/clients/clientset/typed/storage/v1/storageclass.go new file mode 100644 index 000000000..9632845b5 --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/storageclass.go @@ -0,0 +1,184 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// StorageClassesGetter has a method to return a StorageClassInterface. +// A group's client should implement this interface. +type StorageClassesGetter interface { + StorageClasses() StorageClassInterface +} + +// StorageClassInterface has methods to work with StorageClass resources. +type StorageClassInterface interface { + Create(ctx context.Context, storageClass *v1.StorageClass, opts metav1.CreateOptions) (*v1.StorageClass, error) + Update(ctx context.Context, storageClass *v1.StorageClass, opts metav1.UpdateOptions) (*v1.StorageClass, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.StorageClass, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.StorageClassList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StorageClass, err error) + Apply(ctx context.Context, storageClass *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StorageClass, err error) + StorageClassExpansion +} + +// storageClasses implements StorageClassInterface +type storageClasses struct { + client rest.Interface +} + +// newStorageClasses returns a StorageClasses +func newStorageClasses(c *StorageV1Client) *storageClasses { + return &storageClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the storageClass, and returns the corresponding storageClass object, and an error if there is any. +func (c *storageClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.StorageClass, err error) { + result = &v1.StorageClass{} + err = c.client.Get(). + Resource("storageclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of StorageClasses that match those selectors. +func (c *storageClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.StorageClassList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.StorageClassList{} + err = c.client.Get(). + Resource("storageclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested storageClasses. +func (c *storageClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("storageclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a storageClass and creates it. Returns the server's representation of the storageClass, and an error, if there is any. +func (c *storageClasses) Create(ctx context.Context, storageClass *v1.StorageClass, opts metav1.CreateOptions) (result *v1.StorageClass, err error) { + result = &v1.StorageClass{} + err = c.client.Post(). + Resource("storageclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(storageClass). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a storageClass and updates it. Returns the server's representation of the storageClass, and an error, if there is any. +func (c *storageClasses) Update(ctx context.Context, storageClass *v1.StorageClass, opts metav1.UpdateOptions) (result *v1.StorageClass, err error) { + result = &v1.StorageClass{} + err = c.client.Put(). + Resource("storageclasses"). + Name(storageClass.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(storageClass). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the storageClass and deletes it. Returns an error if one occurs. +func (c *storageClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("storageclasses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *storageClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("storageclasses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched storageClass. +func (c *storageClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.StorageClass, err error) { + result = &v1.StorageClass{} + err = c.client.Patch(pt). + Resource("storageclasses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied storageClass. +func (c *storageClasses) Apply(ctx context.Context, storageClass *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.StorageClass, err error) { + if storageClass == nil { + return nil, fmt.Errorf("storageClass provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(storageClass) + if err != nil { + return nil, err + } + name := storageClass.Name + if name == nil { + return nil, fmt.Errorf("storageClass.Name must be provided to Apply") + } + result = &v1.StorageClass{} + err = c.client.Patch(types.ApplyPatchType). + Resource("storageclasses"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/storage/v1/volumeattachment.go b/pkg/clients/clientset/typed/storage/v1/volumeattachment.go new file mode 100644 index 000000000..8a914221e --- /dev/null +++ b/pkg/clients/clientset/typed/storage/v1/volumeattachment.go @@ -0,0 +1,230 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + storagev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/storage/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// VolumeAttachmentsGetter has a method to return a VolumeAttachmentInterface. +// A group's client should implement this interface. +type VolumeAttachmentsGetter interface { + VolumeAttachments() VolumeAttachmentInterface +} + +// VolumeAttachmentInterface has methods to work with VolumeAttachment resources. +type VolumeAttachmentInterface interface { + Create(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.CreateOptions) (*v1.VolumeAttachment, error) + Update(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.UpdateOptions) (*v1.VolumeAttachment, error) + UpdateStatus(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.UpdateOptions) (*v1.VolumeAttachment, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VolumeAttachment, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.VolumeAttachmentList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeAttachment, err error) + Apply(ctx context.Context, volumeAttachment *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.VolumeAttachment, err error) + ApplyStatus(ctx context.Context, volumeAttachment *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.VolumeAttachment, err error) + VolumeAttachmentExpansion +} + +// volumeAttachments implements VolumeAttachmentInterface +type volumeAttachments struct { + client rest.Interface +} + +// newVolumeAttachments returns a VolumeAttachments +func newVolumeAttachments(c *StorageV1Client) *volumeAttachments { + return &volumeAttachments{ + client: c.RESTClient(), + } +} + +// Get takes name of the volumeAttachment, and returns the corresponding volumeAttachment object, and an error if there is any. +func (c *volumeAttachments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VolumeAttachment, err error) { + result = &v1.VolumeAttachment{} + err = c.client.Get(). + Resource("volumeattachments"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VolumeAttachments that match those selectors. +func (c *volumeAttachments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VolumeAttachmentList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.VolumeAttachmentList{} + err = c.client.Get(). + Resource("volumeattachments"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested volumeAttachments. +func (c *volumeAttachments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("volumeattachments"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a volumeAttachment and creates it. Returns the server's representation of the volumeAttachment, and an error, if there is any. +func (c *volumeAttachments) Create(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.CreateOptions) (result *v1.VolumeAttachment, err error) { + result = &v1.VolumeAttachment{} + err = c.client.Post(). + Resource("volumeattachments"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(volumeAttachment). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a volumeAttachment and updates it. Returns the server's representation of the volumeAttachment, and an error, if there is any. +func (c *volumeAttachments) Update(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.UpdateOptions) (result *v1.VolumeAttachment, err error) { + result = &v1.VolumeAttachment{} + err = c.client.Put(). + Resource("volumeattachments"). + Name(volumeAttachment.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(volumeAttachment). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *volumeAttachments) UpdateStatus(ctx context.Context, volumeAttachment *v1.VolumeAttachment, opts metav1.UpdateOptions) (result *v1.VolumeAttachment, err error) { + result = &v1.VolumeAttachment{} + err = c.client.Put(). + Resource("volumeattachments"). + Name(volumeAttachment.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(volumeAttachment). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the volumeAttachment and deletes it. Returns an error if one occurs. +func (c *volumeAttachments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("volumeattachments"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *volumeAttachments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("volumeattachments"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched volumeAttachment. +func (c *volumeAttachments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VolumeAttachment, err error) { + result = &v1.VolumeAttachment{} + err = c.client.Patch(pt). + Resource("volumeattachments"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied volumeAttachment. +func (c *volumeAttachments) Apply(ctx context.Context, volumeAttachment *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.VolumeAttachment, err error) { + if volumeAttachment == nil { + return nil, fmt.Errorf("volumeAttachment provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volumeAttachment) + if err != nil { + return nil, err + } + name := volumeAttachment.Name + if name == nil { + return nil, fmt.Errorf("volumeAttachment.Name must be provided to Apply") + } + result = &v1.VolumeAttachment{} + err = c.client.Patch(types.ApplyPatchType). + Resource("volumeattachments"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *volumeAttachments) ApplyStatus(ctx context.Context, volumeAttachment *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.VolumeAttachment, err error) { + if volumeAttachment == nil { + return nil, fmt.Errorf("volumeAttachment provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volumeAttachment) + if err != nil { + return nil, err + } + + name := volumeAttachment.Name + if name == nil { + return nil, fmt.Errorf("volumeAttachment.Name must be provided to Apply") + } + + result = &v1.VolumeAttachment{} + err = c.client.Patch(types.ApplyPatchType). + Resource("volumeattachments"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/catalog.go b/pkg/clients/clientset/typed/walrus/v1/catalog.go new file mode 100644 index 000000000..2ec98fed4 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/catalog.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CatalogsGetter has a method to return a CatalogInterface. +// A group's client should implement this interface. +type CatalogsGetter interface { + Catalogs(namespace string) CatalogInterface +} + +// CatalogInterface has methods to work with Catalog resources. +type CatalogInterface interface { + Create(ctx context.Context, catalog *v1.Catalog, opts metav1.CreateOptions) (*v1.Catalog, error) + Update(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (*v1.Catalog, error) + UpdateStatus(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (*v1.Catalog, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Catalog, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CatalogList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Catalog, err error) + Apply(ctx context.Context, catalog *walrusv1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) + ApplyStatus(ctx context.Context, catalog *walrusv1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) + CatalogExpansion +} + +// catalogs implements CatalogInterface +type catalogs struct { + client rest.Interface + ns string +} + +// newCatalogs returns a Catalogs +func newCatalogs(c *WalrusV1Client, namespace string) *catalogs { + return &catalogs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the catalog, and returns the corresponding catalog object, and an error if there is any. +func (c *catalogs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Get(). + Namespace(c.ns). + Resource("catalogs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Catalogs that match those selectors. +func (c *catalogs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CatalogList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CatalogList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested catalogs. +func (c *catalogs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a catalog and creates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *catalogs) Create(ctx context.Context, catalog *v1.Catalog, opts metav1.CreateOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Post(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(catalog). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a catalog and updates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *catalogs) Update(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Put(). + Namespace(c.ns). + Resource("catalogs"). + Name(catalog.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(catalog). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *catalogs) UpdateStatus(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Put(). + Namespace(c.ns). + Resource("catalogs"). + Name(catalog.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(catalog). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the catalog and deletes it. Returns an error if one occurs. +func (c *catalogs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("catalogs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *catalogs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched catalog. +func (c *catalogs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("catalogs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied catalog. +func (c *catalogs) Apply(ctx context.Context, catalog *walrusv1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + result = &v1.Catalog{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("catalogs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *catalogs) ApplyStatus(ctx context.Context, catalog *walrusv1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + + result = &v1.Catalog{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("catalogs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/connector.go b/pkg/clients/clientset/typed/walrus/v1/connector.go new file mode 100644 index 000000000..9bd4c1be5 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/connector.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ConnectorsGetter has a method to return a ConnectorInterface. +// A group's client should implement this interface. +type ConnectorsGetter interface { + Connectors(namespace string) ConnectorInterface +} + +// ConnectorInterface has methods to work with Connector resources. +type ConnectorInterface interface { + Create(ctx context.Context, connector *v1.Connector, opts metav1.CreateOptions) (*v1.Connector, error) + Update(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (*v1.Connector, error) + UpdateStatus(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (*v1.Connector, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Connector, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ConnectorList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Connector, err error) + Apply(ctx context.Context, connector *walrusv1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) + ApplyStatus(ctx context.Context, connector *walrusv1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) + ConnectorExpansion +} + +// connectors implements ConnectorInterface +type connectors struct { + client rest.Interface + ns string +} + +// newConnectors returns a Connectors +func newConnectors(c *WalrusV1Client, namespace string) *connectors { + return &connectors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the connector, and returns the corresponding connector object, and an error if there is any. +func (c *connectors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Get(). + Namespace(c.ns). + Resource("connectors"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Connectors that match those selectors. +func (c *connectors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConnectorList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ConnectorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested connectors. +func (c *connectors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a connector and creates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *connectors) Create(ctx context.Context, connector *v1.Connector, opts metav1.CreateOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Post(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(connector). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a connector and updates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *connectors) Update(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("connectors"). + Name(connector.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(connector). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *connectors) UpdateStatus(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("connectors"). + Name(connector.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(connector). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the connector and deletes it. Returns an error if one occurs. +func (c *connectors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("connectors"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *connectors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched connector. +func (c *connectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("connectors"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied connector. +func (c *connectors) Apply(ctx context.Context, connector *walrusv1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + result = &v1.Connector{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("connectors"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *connectors) ApplyStatus(ctx context.Context, connector *walrusv1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + + result = &v1.Connector{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("connectors"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/doc.go b/pkg/clients/clientset/typed/walrus/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/walrus/v1/environment.go b/pkg/clients/clientset/typed/walrus/v1/environment.go new file mode 100644 index 000000000..98808098d --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/environment.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// EnvironmentsGetter has a method to return a EnvironmentInterface. +// A group's client should implement this interface. +type EnvironmentsGetter interface { + Environments(namespace string) EnvironmentInterface +} + +// EnvironmentInterface has methods to work with Environment resources. +type EnvironmentInterface interface { + Create(ctx context.Context, environment *v1.Environment, opts metav1.CreateOptions) (*v1.Environment, error) + Update(ctx context.Context, environment *v1.Environment, opts metav1.UpdateOptions) (*v1.Environment, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Environment, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.EnvironmentList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Environment, err error) + Apply(ctx context.Context, environment *walrusv1.EnvironmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Environment, err error) + EnvironmentExpansion +} + +// environments implements EnvironmentInterface +type environments struct { + client rest.Interface + ns string +} + +// newEnvironments returns a Environments +func newEnvironments(c *WalrusV1Client, namespace string) *environments { + return &environments{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the environment, and returns the corresponding environment object, and an error if there is any. +func (c *environments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Environment, err error) { + result = &v1.Environment{} + err = c.client.Get(). + Namespace(c.ns). + Resource("environments"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Environments that match those selectors. +func (c *environments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EnvironmentList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.EnvironmentList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("environments"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested environments. +func (c *environments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("environments"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a environment and creates it. Returns the server's representation of the environment, and an error, if there is any. +func (c *environments) Create(ctx context.Context, environment *v1.Environment, opts metav1.CreateOptions) (result *v1.Environment, err error) { + result = &v1.Environment{} + err = c.client.Post(). + Namespace(c.ns). + Resource("environments"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(environment). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a environment and updates it. Returns the server's representation of the environment, and an error, if there is any. +func (c *environments) Update(ctx context.Context, environment *v1.Environment, opts metav1.UpdateOptions) (result *v1.Environment, err error) { + result = &v1.Environment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("environments"). + Name(environment.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(environment). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the environment and deletes it. Returns an error if one occurs. +func (c *environments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("environments"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *environments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("environments"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched environment. +func (c *environments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Environment, err error) { + result = &v1.Environment{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("environments"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied environment. +func (c *environments) Apply(ctx context.Context, environment *walrusv1.EnvironmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Environment, err error) { + if environment == nil { + return nil, fmt.Errorf("environment provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(environment) + if err != nil { + return nil, err + } + name := environment.Name + if name == nil { + return nil, fmt.Errorf("environment.Name must be provided to Apply") + } + result = &v1.Environment{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("environments"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/doc.go b/pkg/clients/clientset/typed/walrus/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_catalog.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_catalog.go new file mode 100644 index 000000000..6d2aee5da --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_catalog.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCatalogs implements CatalogInterface +type FakeCatalogs struct { + Fake *FakeWalrusV1 + ns string +} + +var catalogsResource = v1.SchemeGroupVersion.WithResource("catalogs") + +var catalogsKind = v1.SchemeGroupVersion.WithKind("Catalog") + +// Get takes name of the catalog, and returns the corresponding catalog object, and an error if there is any. +func (c *FakeCatalogs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(catalogsResource, c.ns, name), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// List takes label and field selectors, and returns the list of Catalogs that match those selectors. +func (c *FakeCatalogs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CatalogList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(catalogsResource, catalogsKind, c.ns, opts), &v1.CatalogList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CatalogList{ListMeta: obj.(*v1.CatalogList).ListMeta} + for _, item := range obj.(*v1.CatalogList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested catalogs. +func (c *FakeCatalogs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(catalogsResource, c.ns, opts)) + +} + +// Create takes the representation of a catalog and creates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *FakeCatalogs) Create(ctx context.Context, catalog *v1.Catalog, opts metav1.CreateOptions) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(catalogsResource, c.ns, catalog), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// Update takes the representation of a catalog and updates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *FakeCatalogs) Update(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(catalogsResource, c.ns, catalog), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCatalogs) UpdateStatus(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (*v1.Catalog, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(catalogsResource, "status", c.ns, catalog), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// Delete takes name of the catalog and deletes it. Returns an error if one occurs. +func (c *FakeCatalogs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(catalogsResource, c.ns, name, opts), &v1.Catalog{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCatalogs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(catalogsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CatalogList{}) + return err +} + +// Patch applies the patch and returns the patched catalog. +func (c *FakeCatalogs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsResource, c.ns, name, pt, data, subresources...), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied catalog. +func (c *FakeCatalogs) Apply(ctx context.Context, catalog *walrusv1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeCatalogs) ApplyStatus(ctx context.Context, catalog *walrusv1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_connector.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_connector.go new file mode 100644 index 000000000..d4d24036c --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_connector.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeConnectors implements ConnectorInterface +type FakeConnectors struct { + Fake *FakeWalrusV1 + ns string +} + +var connectorsResource = v1.SchemeGroupVersion.WithResource("connectors") + +var connectorsKind = v1.SchemeGroupVersion.WithKind("Connector") + +// Get takes name of the connector, and returns the corresponding connector object, and an error if there is any. +func (c *FakeConnectors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(connectorsResource, c.ns, name), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// List takes label and field selectors, and returns the list of Connectors that match those selectors. +func (c *FakeConnectors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConnectorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(connectorsResource, connectorsKind, c.ns, opts), &v1.ConnectorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ConnectorList{ListMeta: obj.(*v1.ConnectorList).ListMeta} + for _, item := range obj.(*v1.ConnectorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested connectors. +func (c *FakeConnectors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(connectorsResource, c.ns, opts)) + +} + +// Create takes the representation of a connector and creates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *FakeConnectors) Create(ctx context.Context, connector *v1.Connector, opts metav1.CreateOptions) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(connectorsResource, c.ns, connector), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// Update takes the representation of a connector and updates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *FakeConnectors) Update(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(connectorsResource, c.ns, connector), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeConnectors) UpdateStatus(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (*v1.Connector, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(connectorsResource, "status", c.ns, connector), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// Delete takes name of the connector and deletes it. Returns an error if one occurs. +func (c *FakeConnectors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(connectorsResource, c.ns, name, opts), &v1.Connector{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeConnectors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(connectorsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ConnectorList{}) + return err +} + +// Patch applies the patch and returns the patched connector. +func (c *FakeConnectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(connectorsResource, c.ns, name, pt, data, subresources...), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied connector. +func (c *FakeConnectors) Apply(ctx context.Context, connector *walrusv1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(connectorsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeConnectors) ApplyStatus(ctx context.Context, connector *walrusv1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(connectorsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_environment.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_environment.go new file mode 100644 index 000000000..c0b5bb4ee --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_environment.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEnvironments implements EnvironmentInterface +type FakeEnvironments struct { + Fake *FakeWalrusV1 + ns string +} + +var environmentsResource = v1.SchemeGroupVersion.WithResource("environments") + +var environmentsKind = v1.SchemeGroupVersion.WithKind("Environment") + +// Get takes name of the environment, and returns the corresponding environment object, and an error if there is any. +func (c *FakeEnvironments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Environment, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(environmentsResource, c.ns, name), &v1.Environment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Environment), err +} + +// List takes label and field selectors, and returns the list of Environments that match those selectors. +func (c *FakeEnvironments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.EnvironmentList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(environmentsResource, environmentsKind, c.ns, opts), &v1.EnvironmentList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.EnvironmentList{ListMeta: obj.(*v1.EnvironmentList).ListMeta} + for _, item := range obj.(*v1.EnvironmentList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested environments. +func (c *FakeEnvironments) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(environmentsResource, c.ns, opts)) + +} + +// Create takes the representation of a environment and creates it. Returns the server's representation of the environment, and an error, if there is any. +func (c *FakeEnvironments) Create(ctx context.Context, environment *v1.Environment, opts metav1.CreateOptions) (result *v1.Environment, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(environmentsResource, c.ns, environment), &v1.Environment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Environment), err +} + +// Update takes the representation of a environment and updates it. Returns the server's representation of the environment, and an error, if there is any. +func (c *FakeEnvironments) Update(ctx context.Context, environment *v1.Environment, opts metav1.UpdateOptions) (result *v1.Environment, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(environmentsResource, c.ns, environment), &v1.Environment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Environment), err +} + +// Delete takes name of the environment and deletes it. Returns an error if one occurs. +func (c *FakeEnvironments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(environmentsResource, c.ns, name, opts), &v1.Environment{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEnvironments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(environmentsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.EnvironmentList{}) + return err +} + +// Patch applies the patch and returns the patched environment. +func (c *FakeEnvironments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Environment, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(environmentsResource, c.ns, name, pt, data, subresources...), &v1.Environment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Environment), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied environment. +func (c *FakeEnvironments) Apply(ctx context.Context, environment *walrusv1.EnvironmentApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Environment, err error) { + if environment == nil { + return nil, fmt.Errorf("environment provided to Apply must not be nil") + } + data, err := json.Marshal(environment) + if err != nil { + return nil, err + } + name := environment.Name + if name == nil { + return nil, fmt.Errorf("environment.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(environmentsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Environment{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Environment), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_fileexample.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_fileexample.go new file mode 100644 index 000000000..5dc58a032 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_fileexample.go @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + testing "k8s.io/client-go/testing" +) + +// FakeFileExamples implements FileExampleInterface +type FakeFileExamples struct { + Fake *FakeWalrusV1 + ns string +} + +var fileexamplesResource = v1.SchemeGroupVersion.WithResource("fileexamples") + +var fileexamplesKind = v1.SchemeGroupVersion.WithKind("FileExample") + +// Get takes name of the fileExample, and returns the corresponding fileExample object, and an error if there is any. +func (c *FakeFileExamples) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.FileExample, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(fileexamplesResource, c.ns, name), &v1.FileExample{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.FileExample), err +} + +// List takes label and field selectors, and returns the list of FileExamples that match those selectors. +func (c *FakeFileExamples) List(ctx context.Context, opts metav1.ListOptions) (result *v1.FileExampleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(fileexamplesResource, fileexamplesKind, c.ns, opts), &v1.FileExampleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.FileExampleList{ListMeta: obj.(*v1.FileExampleList).ListMeta} + for _, item := range obj.(*v1.FileExampleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_project.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_project.go new file mode 100644 index 000000000..29a6c8999 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_project.go @@ -0,0 +1,174 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeProjects implements ProjectInterface +type FakeProjects struct { + Fake *FakeWalrusV1 + ns string +} + +var projectsResource = v1.SchemeGroupVersion.WithResource("projects") + +var projectsKind = v1.SchemeGroupVersion.WithKind("Project") + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *FakeProjects) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(projectsResource, c.ns, name), &v1.Project{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *FakeProjects) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ProjectList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(projectsResource, projectsKind, c.ns, opts), &v1.ProjectList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ProjectList{ListMeta: obj.(*v1.ProjectList).ListMeta} + for _, item := range obj.(*v1.ProjectList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *FakeProjects) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(projectsResource, c.ns, opts)) + +} + +// Create takes the representation of a project and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *FakeProjects) Create(ctx context.Context, project *v1.Project, opts metav1.CreateOptions) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(projectsResource, c.ns, project), &v1.Project{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +// Update takes the representation of a project and updates it. Returns the server's representation of the project, and an error, if there is any. +func (c *FakeProjects) Update(ctx context.Context, project *v1.Project, opts metav1.UpdateOptions) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(projectsResource, c.ns, project), &v1.Project{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +// Delete takes name of the project and deletes it. Returns an error if one occurs. +func (c *FakeProjects) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(projectsResource, c.ns, name, opts), &v1.Project{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeProjects) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(projectsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ProjectList{}) + return err +} + +// Patch applies the patch and returns the patched project. +func (c *FakeProjects) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(projectsResource, c.ns, name, pt, data, subresources...), &v1.Project{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied project. +func (c *FakeProjects) Apply(ctx context.Context, project *walrusv1.ProjectApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Project, err error) { + if project == nil { + return nil, fmt.Errorf("project provided to Apply must not be nil") + } + data, err := json.Marshal(project) + if err != nil { + return nil, err + } + name := project.Name + if name == nil { + return nil, fmt.Errorf("project.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(projectsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Project{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} + +// GetSubjects takes name of the project, and returns the corresponding projectSubjects object, and an error if there is any. +func (c *FakeProjects) GetSubjects(ctx context.Context, projectName string, options metav1.GetOptions) (result *v1.ProjectSubjects, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetSubresourceAction(projectsResource, c.ns, "subjects", projectName), &v1.ProjectSubjects{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ProjectSubjects), err +} + +// UpdateSubjects takes the representation of a projectSubjects and updates it. Returns the server's representation of the projectSubjects, and an error, if there is any. +func (c *FakeProjects) UpdateSubjects(ctx context.Context, projectName string, projectSubjects *v1.ProjectSubjects, opts metav1.UpdateOptions) (result *v1.ProjectSubjects, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(projectsResource, "subjects", c.ns, projectSubjects), &v1.ProjectSubjects{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ProjectSubjects), err +} + +// PatchSubjects takes the representation of a projectSubjects and updates it. Returns the server's representation of the projectSubjects, and an error, if there is any. +func (c *FakeProjects) PatchSubjects(ctx context.Context, projectName string, projectSubjects *v1.ProjectSubjects, opts metav1.UpdateOptions) (result *v1.ProjectSubjects, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(projectsResource, "subjects", c.ns, projectSubjects), &v1.ProjectSubjects{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ProjectSubjects), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_resource.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_resource.go new file mode 100644 index 000000000..d7af9412b --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_resource.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResources implements ResourceInterface +type FakeResources struct { + Fake *FakeWalrusV1 + ns string +} + +var resourcesResource = v1.SchemeGroupVersion.WithResource("resources") + +var resourcesKind = v1.SchemeGroupVersion.WithKind("Resource") + +// Get takes name of the resource, and returns the corresponding resource object, and an error if there is any. +func (c *FakeResources) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcesResource, c.ns, name), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// List takes label and field selectors, and returns the list of Resources that match those selectors. +func (c *FakeResources) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcesResource, resourcesKind, c.ns, opts), &v1.ResourceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceList{ListMeta: obj.(*v1.ResourceList).ListMeta} + for _, item := range obj.(*v1.ResourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resources. +func (c *FakeResources) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcesResource, c.ns, opts)) + +} + +// Create takes the representation of a resource and creates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *FakeResources) Create(ctx context.Context, resource *v1.Resource, opts metav1.CreateOptions) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcesResource, c.ns, resource), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// Update takes the representation of a resource and updates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *FakeResources) Update(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcesResource, c.ns, resource), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResources) UpdateStatus(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (*v1.Resource, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcesResource, "status", c.ns, resource), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// Delete takes name of the resource and deletes it. Returns an error if one occurs. +func (c *FakeResources) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcesResource, c.ns, name, opts), &v1.Resource{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResources) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceList{}) + return err +} + +// Patch applies the patch and returns the patched resource. +func (c *FakeResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcesResource, c.ns, name, pt, data, subresources...), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resource. +func (c *FakeResources) Apply(ctx context.Context, resource *walrusv1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResources) ApplyStatus(ctx context.Context, resource *walrusv1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_resourcedefinition.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_resourcedefinition.go new file mode 100644 index 000000000..532f5a1ff --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_resourcedefinition.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResourceDefinitions implements ResourceDefinitionInterface +type FakeResourceDefinitions struct { + Fake *FakeWalrusV1 + ns string +} + +var resourcedefinitionsResource = v1.SchemeGroupVersion.WithResource("resourcedefinitions") + +var resourcedefinitionsKind = v1.SchemeGroupVersion.WithKind("ResourceDefinition") + +// Get takes name of the resourceDefinition, and returns the corresponding resourceDefinition object, and an error if there is any. +func (c *FakeResourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcedefinitionsResource, c.ns, name), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// List takes label and field selectors, and returns the list of ResourceDefinitions that match those selectors. +func (c *FakeResourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceDefinitionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcedefinitionsResource, resourcedefinitionsKind, c.ns, opts), &v1.ResourceDefinitionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceDefinitionList{ListMeta: obj.(*v1.ResourceDefinitionList).ListMeta} + for _, item := range obj.(*v1.ResourceDefinitionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resourceDefinitions. +func (c *FakeResourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcedefinitionsResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceDefinition and creates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *FakeResourceDefinitions) Create(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.CreateOptions) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcedefinitionsResource, c.ns, resourceDefinition), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// Update takes the representation of a resourceDefinition and updates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *FakeResourceDefinitions) Update(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcedefinitionsResource, c.ns, resourceDefinition), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResourceDefinitions) UpdateStatus(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (*v1.ResourceDefinition, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcedefinitionsResource, "status", c.ns, resourceDefinition), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// Delete takes name of the resourceDefinition and deletes it. Returns an error if one occurs. +func (c *FakeResourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcedefinitionsResource, c.ns, name, opts), &v1.ResourceDefinition{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcedefinitionsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceDefinitionList{}) + return err +} + +// Patch applies the patch and returns the patched resourceDefinition. +func (c *FakeResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcedefinitionsResource, c.ns, name, pt, data, subresources...), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceDefinition. +func (c *FakeResourceDefinitions) Apply(ctx context.Context, resourceDefinition *walrusv1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcedefinitionsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceDefinitions) ApplyStatus(ctx context.Context, resourceDefinition *walrusv1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcedefinitionsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_resourcerun.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_resourcerun.go new file mode 100644 index 000000000..3ddb022b5 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_resourcerun.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResourceRuns implements ResourceRunInterface +type FakeResourceRuns struct { + Fake *FakeWalrusV1 + ns string +} + +var resourcerunsResource = v1.SchemeGroupVersion.WithResource("resourceruns") + +var resourcerunsKind = v1.SchemeGroupVersion.WithKind("ResourceRun") + +// Get takes name of the resourceRun, and returns the corresponding resourceRun object, and an error if there is any. +func (c *FakeResourceRuns) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcerunsResource, c.ns, name), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// List takes label and field selectors, and returns the list of ResourceRuns that match those selectors. +func (c *FakeResourceRuns) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceRunList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcerunsResource, resourcerunsKind, c.ns, opts), &v1.ResourceRunList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceRunList{ListMeta: obj.(*v1.ResourceRunList).ListMeta} + for _, item := range obj.(*v1.ResourceRunList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resourceRuns. +func (c *FakeResourceRuns) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcerunsResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceRun and creates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *FakeResourceRuns) Create(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.CreateOptions) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcerunsResource, c.ns, resourceRun), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// Update takes the representation of a resourceRun and updates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *FakeResourceRuns) Update(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcerunsResource, c.ns, resourceRun), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResourceRuns) UpdateStatus(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (*v1.ResourceRun, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcerunsResource, "status", c.ns, resourceRun), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// Delete takes name of the resourceRun and deletes it. Returns an error if one occurs. +func (c *FakeResourceRuns) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcerunsResource, c.ns, name, opts), &v1.ResourceRun{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceRuns) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcerunsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceRunList{}) + return err +} + +// Patch applies the patch and returns the patched resourceRun. +func (c *FakeResourceRuns) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcerunsResource, c.ns, name, pt, data, subresources...), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceRun. +func (c *FakeResourceRuns) Apply(ctx context.Context, resourceRun *walrusv1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcerunsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceRuns) ApplyStatus(ctx context.Context, resourceRun *walrusv1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcerunsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_setting.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_setting.go new file mode 100644 index 000000000..dbe4b9780 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_setting.go @@ -0,0 +1,114 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSettings implements SettingInterface +type FakeSettings struct { + Fake *FakeWalrusV1 + ns string +} + +var settingsResource = v1.SchemeGroupVersion.WithResource("settings") + +var settingsKind = v1.SchemeGroupVersion.WithKind("Setting") + +// Get takes name of the setting, and returns the corresponding setting object, and an error if there is any. +func (c *FakeSettings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Setting, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(settingsResource, c.ns, name), &v1.Setting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Setting), err +} + +// List takes label and field selectors, and returns the list of Settings that match those selectors. +func (c *FakeSettings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SettingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(settingsResource, settingsKind, c.ns, opts), &v1.SettingList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.SettingList{ListMeta: obj.(*v1.SettingList).ListMeta} + for _, item := range obj.(*v1.SettingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested settings. +func (c *FakeSettings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(settingsResource, c.ns, opts)) + +} + +// Update takes the representation of a setting and updates it. Returns the server's representation of the setting, and an error, if there is any. +func (c *FakeSettings) Update(ctx context.Context, setting *v1.Setting, opts metav1.UpdateOptions) (result *v1.Setting, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(settingsResource, c.ns, setting), &v1.Setting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Setting), err +} + +// Patch applies the patch and returns the patched setting. +func (c *FakeSettings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Setting, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(settingsResource, c.ns, name, pt, data, subresources...), &v1.Setting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Setting), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied setting. +func (c *FakeSettings) Apply(ctx context.Context, setting *walrusv1.SettingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Setting, err error) { + if setting == nil { + return nil, fmt.Errorf("setting provided to Apply must not be nil") + } + data, err := json.Marshal(setting) + if err != nil { + return nil, err + } + name := setting.Name + if name == nil { + return nil, fmt.Errorf("setting.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(settingsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Setting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Setting), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_template.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_template.go new file mode 100644 index 000000000..32fd8fd8c --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_template.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTemplates implements TemplateInterface +type FakeTemplates struct { + Fake *FakeWalrusV1 + ns string +} + +var templatesResource = v1.SchemeGroupVersion.WithResource("templates") + +var templatesKind = v1.SchemeGroupVersion.WithKind("Template") + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *FakeTemplates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(templatesResource, c.ns, name), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *FakeTemplates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(templatesResource, templatesKind, c.ns, opts), &v1.TemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.TemplateList{ListMeta: obj.(*v1.TemplateList).ListMeta} + for _, item := range obj.(*v1.TemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *FakeTemplates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(templatesResource, c.ns, opts)) + +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *FakeTemplates) Create(ctx context.Context, template *v1.Template, opts metav1.CreateOptions) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(templatesResource, c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *FakeTemplates) Update(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(templatesResource, c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeTemplates) UpdateStatus(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (*v1.Template, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(templatesResource, "status", c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *FakeTemplates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(templatesResource, c.ns, name, opts), &v1.Template{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTemplates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(templatesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.TemplateList{}) + return err +} + +// Patch applies the patch and returns the patched template. +func (c *FakeTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, name, pt, data, subresources...), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied template. +func (c *FakeTemplates) Apply(ctx context.Context, template *walrusv1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeTemplates) ApplyStatus(ctx context.Context, template *walrusv1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_variable.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_variable.go new file mode 100644 index 000000000..6f1110606 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_variable.go @@ -0,0 +1,141 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeVariables implements VariableInterface +type FakeVariables struct { + Fake *FakeWalrusV1 + ns string +} + +var variablesResource = v1.SchemeGroupVersion.WithResource("variables") + +var variablesKind = v1.SchemeGroupVersion.WithKind("Variable") + +// Get takes name of the variable, and returns the corresponding variable object, and an error if there is any. +func (c *FakeVariables) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Variable, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(variablesResource, c.ns, name), &v1.Variable{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Variable), err +} + +// List takes label and field selectors, and returns the list of Variables that match those selectors. +func (c *FakeVariables) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VariableList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(variablesResource, variablesKind, c.ns, opts), &v1.VariableList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.VariableList{ListMeta: obj.(*v1.VariableList).ListMeta} + for _, item := range obj.(*v1.VariableList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested variables. +func (c *FakeVariables) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(variablesResource, c.ns, opts)) + +} + +// Create takes the representation of a variable and creates it. Returns the server's representation of the variable, and an error, if there is any. +func (c *FakeVariables) Create(ctx context.Context, variable *v1.Variable, opts metav1.CreateOptions) (result *v1.Variable, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(variablesResource, c.ns, variable), &v1.Variable{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Variable), err +} + +// Update takes the representation of a variable and updates it. Returns the server's representation of the variable, and an error, if there is any. +func (c *FakeVariables) Update(ctx context.Context, variable *v1.Variable, opts metav1.UpdateOptions) (result *v1.Variable, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(variablesResource, c.ns, variable), &v1.Variable{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Variable), err +} + +// Delete takes name of the variable and deletes it. Returns an error if one occurs. +func (c *FakeVariables) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(variablesResource, c.ns, name, opts), &v1.Variable{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVariables) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(variablesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.VariableList{}) + return err +} + +// Patch applies the patch and returns the patched variable. +func (c *FakeVariables) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Variable, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(variablesResource, c.ns, name, pt, data, subresources...), &v1.Variable{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Variable), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied variable. +func (c *FakeVariables) Apply(ctx context.Context, variable *walrusv1.VariableApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Variable, err error) { + if variable == nil { + return nil, fmt.Errorf("variable provided to Apply must not be nil") + } + data, err := json.Marshal(variable) + if err != nil { + return nil, err + } + name := variable.Name + if name == nil { + return nil, fmt.Errorf("variable.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(variablesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Variable{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Variable), err +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fake/fake_walrus_client.go b/pkg/clients/clientset/typed/walrus/v1/fake/fake_walrus_client.go new file mode 100644 index 000000000..26e96bc3f --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fake/fake_walrus_client.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walrus/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeWalrusV1 struct { + *testing.Fake +} + +func (c *FakeWalrusV1) Catalogs(namespace string) v1.CatalogInterface { + return &FakeCatalogs{c, namespace} +} + +func (c *FakeWalrusV1) Connectors(namespace string) v1.ConnectorInterface { + return &FakeConnectors{c, namespace} +} + +func (c *FakeWalrusV1) Environments(namespace string) v1.EnvironmentInterface { + return &FakeEnvironments{c, namespace} +} + +func (c *FakeWalrusV1) FileExamples(namespace string) v1.FileExampleInterface { + return &FakeFileExamples{c, namespace} +} + +func (c *FakeWalrusV1) Projects(namespace string) v1.ProjectInterface { + return &FakeProjects{c, namespace} +} + +func (c *FakeWalrusV1) Resources(namespace string) v1.ResourceInterface { + return &FakeResources{c, namespace} +} + +func (c *FakeWalrusV1) ResourceDefinitions(namespace string) v1.ResourceDefinitionInterface { + return &FakeResourceDefinitions{c, namespace} +} + +func (c *FakeWalrusV1) ResourceRuns(namespace string) v1.ResourceRunInterface { + return &FakeResourceRuns{c, namespace} +} + +func (c *FakeWalrusV1) Settings(namespace string) v1.SettingInterface { + return &FakeSettings{c, namespace} +} + +func (c *FakeWalrusV1) Templates(namespace string) v1.TemplateInterface { + return &FakeTemplates{c, namespace} +} + +func (c *FakeWalrusV1) Variables(namespace string) v1.VariableInterface { + return &FakeVariables{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeWalrusV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/walrus/v1/fileexample.go b/pkg/clients/clientset/typed/walrus/v1/fileexample.go new file mode 100644 index 000000000..260c94c16 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/fileexample.go @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// FileExamplesGetter has a method to return a FileExampleInterface. +// A group's client should implement this interface. +type FileExamplesGetter interface { + FileExamples(namespace string) FileExampleInterface +} + +// FileExampleInterface has methods to work with FileExample resources. +type FileExampleInterface interface { + Get(ctx context.Context, name string, opts v1.GetOptions) (*walrusv1.FileExample, error) + List(ctx context.Context, opts v1.ListOptions) (*walrusv1.FileExampleList, error) + FileExampleExpansion +} + +// fileExamples implements FileExampleInterface +type fileExamples struct { + client rest.Interface + ns string +} + +// newFileExamples returns a FileExamples +func newFileExamples(c *WalrusV1Client, namespace string) *fileExamples { + return &fileExamples{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the fileExample, and returns the corresponding fileExample object, and an error if there is any. +func (c *fileExamples) Get(ctx context.Context, name string, options v1.GetOptions) (result *walrusv1.FileExample, err error) { + result = &walrusv1.FileExample{} + err = c.client.Get(). + Namespace(c.ns). + Resource("fileexamples"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of FileExamples that match those selectors. +func (c *fileExamples) List(ctx context.Context, opts v1.ListOptions) (result *walrusv1.FileExampleList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &walrusv1.FileExampleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("fileexamples"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/generated_expansion.go b/pkg/clients/clientset/typed/walrus/v1/generated_expansion.go new file mode 100644 index 000000000..e51b95887 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/generated_expansion.go @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type CatalogExpansion interface{} + +type ConnectorExpansion interface{} + +type EnvironmentExpansion interface{} + +type FileExampleExpansion interface{} + +type ProjectExpansion interface{} + +type ResourceExpansion interface{} + +type ResourceDefinitionExpansion interface{} + +type ResourceRunExpansion interface{} + +type SettingExpansion interface{} + +type TemplateExpansion interface{} + +type VariableExpansion interface{} diff --git a/pkg/clients/clientset/typed/walrus/v1/project.go b/pkg/clients/clientset/typed/walrus/v1/project.go new file mode 100644 index 000000000..6134824d4 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/project.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ProjectsGetter has a method to return a ProjectInterface. +// A group's client should implement this interface. +type ProjectsGetter interface { + Projects(namespace string) ProjectInterface +} + +// ProjectInterface has methods to work with Project resources. +type ProjectInterface interface { + Create(ctx context.Context, project *v1.Project, opts metav1.CreateOptions) (*v1.Project, error) + Update(ctx context.Context, project *v1.Project, opts metav1.UpdateOptions) (*v1.Project, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Project, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ProjectList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Project, err error) + Apply(ctx context.Context, project *walrusv1.ProjectApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Project, err error) + GetSubjects(ctx context.Context, projectName string, options metav1.GetOptions) (*v1.ProjectSubjects, error) + UpdateSubjects(ctx context.Context, projectName string, projectSubjects *v1.ProjectSubjects, opts metav1.UpdateOptions) (*v1.ProjectSubjects, error) + PatchSubjects(ctx context.Context, projectName string, projectSubjects *v1.ProjectSubjects, opts metav1.UpdateOptions) (*v1.ProjectSubjects, error) + + ProjectExpansion +} + +// projects implements ProjectInterface +type projects struct { + client rest.Interface + ns string +} + +// newProjects returns a Projects +func newProjects(c *WalrusV1Client, namespace string) *projects { + return &projects{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *projects) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Get(). + Namespace(c.ns). + Resource("projects"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *projects) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ProjectList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ProjectList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("projects"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *projects) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("projects"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a project and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Create(ctx context.Context, project *v1.Project, opts metav1.CreateOptions) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Post(). + Namespace(c.ns). + Resource("projects"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(project). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a project and updates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Update(ctx context.Context, project *v1.Project, opts metav1.UpdateOptions) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Put(). + Namespace(c.ns). + Resource("projects"). + Name(project.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(project). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the project and deletes it. Returns an error if one occurs. +func (c *projects) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("projects"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *projects) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("projects"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched project. +func (c *projects) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("projects"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied project. +func (c *projects) Apply(ctx context.Context, project *walrusv1.ProjectApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Project, err error) { + if project == nil { + return nil, fmt.Errorf("project provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(project) + if err != nil { + return nil, err + } + name := project.Name + if name == nil { + return nil, fmt.Errorf("project.Name must be provided to Apply") + } + result = &v1.Project{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("projects"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// GetSubjects takes name of the project, and returns the corresponding v1.ProjectSubjects object, and an error if there is any. +func (c *projects) GetSubjects(ctx context.Context, projectName string, options metav1.GetOptions) (result *v1.ProjectSubjects, err error) { + result = &v1.ProjectSubjects{} + err = c.client.Get(). + Namespace(c.ns). + Resource("projects"). + Name(projectName). + SubResource("subjects"). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// UpdateSubjects takes the top resource name and the representation of a projectSubjects and updates it. Returns the server's representation of the projectSubjects, and an error, if there is any. +func (c *projects) UpdateSubjects(ctx context.Context, projectName string, projectSubjects *v1.ProjectSubjects, opts metav1.UpdateOptions) (result *v1.ProjectSubjects, err error) { + result = &v1.ProjectSubjects{} + err = c.client.Put(). + Namespace(c.ns). + Resource("projects"). + Name(projectName). + SubResource("subjects"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(projectSubjects). + Do(ctx). + Into(result) + return +} + +// PatchSubjects takes the top resource name and the representation of a projectSubjects and updates it. Returns the server's representation of the projectSubjects, and an error, if there is any. +func (c *projects) PatchSubjects(ctx context.Context, projectName string, projectSubjects *v1.ProjectSubjects, opts metav1.UpdateOptions) (result *v1.ProjectSubjects, err error) { + result = &v1.ProjectSubjects{} + err = c.client.Put(). + Namespace(c.ns). + Resource("projects"). + Name(projectName). + SubResource("subjects"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(projectSubjects). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/resource.go b/pkg/clients/clientset/typed/walrus/v1/resource.go new file mode 100644 index 000000000..44b32d6a2 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/resource.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourcesGetter has a method to return a ResourceInterface. +// A group's client should implement this interface. +type ResourcesGetter interface { + Resources(namespace string) ResourceInterface +} + +// ResourceInterface has methods to work with Resource resources. +type ResourceInterface interface { + Create(ctx context.Context, resource *v1.Resource, opts metav1.CreateOptions) (*v1.Resource, error) + Update(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (*v1.Resource, error) + UpdateStatus(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (*v1.Resource, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Resource, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Resource, err error) + Apply(ctx context.Context, resource *walrusv1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) + ApplyStatus(ctx context.Context, resource *walrusv1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) + ResourceExpansion +} + +// resources implements ResourceInterface +type resources struct { + client rest.Interface + ns string +} + +// newResources returns a Resources +func newResources(c *WalrusV1Client, namespace string) *resources { + return &resources{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resource, and returns the corresponding resource object, and an error if there is any. +func (c *resources) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resources"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Resources that match those selectors. +func (c *resources) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resources. +func (c *resources) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resource and creates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *resources) Create(ctx context.Context, resource *v1.Resource, opts metav1.CreateOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resource). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resource and updates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *resources) Update(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resources"). + Name(resource.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resource). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resources) UpdateStatus(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resources"). + Name(resource.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resource). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resource and deletes it. Returns an error if one occurs. +func (c *resources) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resources"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resources) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resource. +func (c *resources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resources"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resource. +func (c *resources) Apply(ctx context.Context, resource *walrusv1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + result = &v1.Resource{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resources"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resources) ApplyStatus(ctx context.Context, resource *walrusv1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + + result = &v1.Resource{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resources"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/resourcedefinition.go b/pkg/clients/clientset/typed/walrus/v1/resourcedefinition.go new file mode 100644 index 000000000..31d0e5857 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/resourcedefinition.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourceDefinitionsGetter has a method to return a ResourceDefinitionInterface. +// A group's client should implement this interface. +type ResourceDefinitionsGetter interface { + ResourceDefinitions(namespace string) ResourceDefinitionInterface +} + +// ResourceDefinitionInterface has methods to work with ResourceDefinition resources. +type ResourceDefinitionInterface interface { + Create(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.CreateOptions) (*v1.ResourceDefinition, error) + Update(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (*v1.ResourceDefinition, error) + UpdateStatus(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (*v1.ResourceDefinition, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ResourceDefinition, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceDefinitionList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceDefinition, err error) + Apply(ctx context.Context, resourceDefinition *walrusv1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) + ApplyStatus(ctx context.Context, resourceDefinition *walrusv1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) + ResourceDefinitionExpansion +} + +// resourceDefinitions implements ResourceDefinitionInterface +type resourceDefinitions struct { + client rest.Interface + ns string +} + +// newResourceDefinitions returns a ResourceDefinitions +func newResourceDefinitions(c *WalrusV1Client, namespace string) *resourceDefinitions { + return &resourceDefinitions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceDefinition, and returns the corresponding resourceDefinition object, and an error if there is any. +func (c *resourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceDefinitions that match those selectors. +func (c *resourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceDefinitionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceDefinitionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceDefinitions. +func (c *resourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceDefinition and creates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *resourceDefinitions) Create(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.CreateOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceDefinition). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceDefinition and updates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *resourceDefinitions) Update(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(resourceDefinition.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceDefinition). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resourceDefinitions) UpdateStatus(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(resourceDefinition.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceDefinition). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceDefinition and deletes it. Returns an error if one occurs. +func (c *resourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceDefinition. +func (c *resourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceDefinition. +func (c *resourceDefinitions) Apply(ctx context.Context, resourceDefinition *walrusv1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + result = &v1.ResourceDefinition{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resourceDefinitions) ApplyStatus(ctx context.Context, resourceDefinition *walrusv1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + + result = &v1.ResourceDefinition{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/resourcerun.go b/pkg/clients/clientset/typed/walrus/v1/resourcerun.go new file mode 100644 index 000000000..39447d715 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/resourcerun.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourceRunsGetter has a method to return a ResourceRunInterface. +// A group's client should implement this interface. +type ResourceRunsGetter interface { + ResourceRuns(namespace string) ResourceRunInterface +} + +// ResourceRunInterface has methods to work with ResourceRun resources. +type ResourceRunInterface interface { + Create(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.CreateOptions) (*v1.ResourceRun, error) + Update(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (*v1.ResourceRun, error) + UpdateStatus(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (*v1.ResourceRun, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ResourceRun, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceRunList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceRun, err error) + Apply(ctx context.Context, resourceRun *walrusv1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) + ApplyStatus(ctx context.Context, resourceRun *walrusv1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) + ResourceRunExpansion +} + +// resourceRuns implements ResourceRunInterface +type resourceRuns struct { + client rest.Interface + ns string +} + +// newResourceRuns returns a ResourceRuns +func newResourceRuns(c *WalrusV1Client, namespace string) *resourceRuns { + return &resourceRuns{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceRun, and returns the corresponding resourceRun object, and an error if there is any. +func (c *resourceRuns) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceruns"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceRuns that match those selectors. +func (c *resourceRuns) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceRunList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceRunList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceRuns. +func (c *resourceRuns) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceRun and creates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *resourceRuns) Create(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.CreateOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceRun). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceRun and updates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *resourceRuns) Update(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceruns"). + Name(resourceRun.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceRun). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resourceRuns) UpdateStatus(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceruns"). + Name(resourceRun.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceRun). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceRun and deletes it. Returns an error if one occurs. +func (c *resourceRuns) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceruns"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceRuns) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceRun. +func (c *resourceRuns) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourceruns"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceRun. +func (c *resourceRuns) Apply(ctx context.Context, resourceRun *walrusv1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + result = &v1.ResourceRun{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourceruns"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resourceRuns) ApplyStatus(ctx context.Context, resourceRun *walrusv1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + + result = &v1.ResourceRun{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourceruns"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/setting.go b/pkg/clients/clientset/typed/walrus/v1/setting.go new file mode 100644 index 000000000..fc1028e9b --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/setting.go @@ -0,0 +1,152 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// SettingsGetter has a method to return a SettingInterface. +// A group's client should implement this interface. +type SettingsGetter interface { + Settings(namespace string) SettingInterface +} + +// SettingInterface has methods to work with Setting resources. +type SettingInterface interface { + Update(ctx context.Context, setting *v1.Setting, opts metav1.UpdateOptions) (*v1.Setting, error) + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Setting, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.SettingList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Setting, err error) + Apply(ctx context.Context, setting *walrusv1.SettingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Setting, err error) + SettingExpansion +} + +// settings implements SettingInterface +type settings struct { + client rest.Interface + ns string +} + +// newSettings returns a Settings +func newSettings(c *WalrusV1Client, namespace string) *settings { + return &settings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the setting, and returns the corresponding setting object, and an error if there is any. +func (c *settings) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Setting, err error) { + result = &v1.Setting{} + err = c.client.Get(). + Namespace(c.ns). + Resource("settings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Settings that match those selectors. +func (c *settings) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SettingList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.SettingList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("settings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested settings. +func (c *settings) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("settings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Update takes the representation of a setting and updates it. Returns the server's representation of the setting, and an error, if there is any. +func (c *settings) Update(ctx context.Context, setting *v1.Setting, opts metav1.UpdateOptions) (result *v1.Setting, err error) { + result = &v1.Setting{} + err = c.client.Put(). + Namespace(c.ns). + Resource("settings"). + Name(setting.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(setting). + Do(ctx). + Into(result) + return +} + +// Patch applies the patch and returns the patched setting. +func (c *settings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Setting, err error) { + result = &v1.Setting{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("settings"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied setting. +func (c *settings) Apply(ctx context.Context, setting *walrusv1.SettingApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Setting, err error) { + if setting == nil { + return nil, fmt.Errorf("setting provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(setting) + if err != nil { + return nil, err + } + name := setting.Name + if name == nil { + return nil, fmt.Errorf("setting.Name must be provided to Apply") + } + result = &v1.Setting{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("settings"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/template.go b/pkg/clients/clientset/typed/walrus/v1/template.go new file mode 100644 index 000000000..e6ed4b6c8 --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/template.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TemplatesGetter has a method to return a TemplateInterface. +// A group's client should implement this interface. +type TemplatesGetter interface { + Templates(namespace string) TemplateInterface +} + +// TemplateInterface has methods to work with Template resources. +type TemplateInterface interface { + Create(ctx context.Context, template *v1.Template, opts metav1.CreateOptions) (*v1.Template, error) + Update(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (*v1.Template, error) + UpdateStatus(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (*v1.Template, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Template, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.TemplateList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Template, err error) + Apply(ctx context.Context, template *walrusv1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) + ApplyStatus(ctx context.Context, template *walrusv1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) + TemplateExpansion +} + +// templates implements TemplateInterface +type templates struct { + client rest.Interface + ns string +} + +// newTemplates returns a Templates +func newTemplates(c *WalrusV1Client, namespace string) *templates { + return &templates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *templates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *templates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TemplateList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.TemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *templates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Create(ctx context.Context, template *v1.Template, opts metav1.CreateOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(template). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Update(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(template). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *templates) UpdateStatus(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(template). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *templates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched template. +func (c *templates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templates"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied template. +func (c *templates) Apply(ctx context.Context, template *walrusv1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + result = &v1.Template{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("templates"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *templates) ApplyStatus(ctx context.Context, template *walrusv1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + + result = &v1.Template{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("templates"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/variable.go b/pkg/clients/clientset/typed/walrus/v1/variable.go new file mode 100644 index 000000000..23d21489f --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/variable.go @@ -0,0 +1,195 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walrusv1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walrus/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// VariablesGetter has a method to return a VariableInterface. +// A group's client should implement this interface. +type VariablesGetter interface { + Variables(namespace string) VariableInterface +} + +// VariableInterface has methods to work with Variable resources. +type VariableInterface interface { + Create(ctx context.Context, variable *v1.Variable, opts metav1.CreateOptions) (*v1.Variable, error) + Update(ctx context.Context, variable *v1.Variable, opts metav1.UpdateOptions) (*v1.Variable, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Variable, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.VariableList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Variable, err error) + Apply(ctx context.Context, variable *walrusv1.VariableApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Variable, err error) + VariableExpansion +} + +// variables implements VariableInterface +type variables struct { + client rest.Interface + ns string +} + +// newVariables returns a Variables +func newVariables(c *WalrusV1Client, namespace string) *variables { + return &variables{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the variable, and returns the corresponding variable object, and an error if there is any. +func (c *variables) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Variable, err error) { + result = &v1.Variable{} + err = c.client.Get(). + Namespace(c.ns). + Resource("variables"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Variables that match those selectors. +func (c *variables) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VariableList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.VariableList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("variables"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested variables. +func (c *variables) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("variables"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a variable and creates it. Returns the server's representation of the variable, and an error, if there is any. +func (c *variables) Create(ctx context.Context, variable *v1.Variable, opts metav1.CreateOptions) (result *v1.Variable, err error) { + result = &v1.Variable{} + err = c.client.Post(). + Namespace(c.ns). + Resource("variables"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(variable). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a variable and updates it. Returns the server's representation of the variable, and an error, if there is any. +func (c *variables) Update(ctx context.Context, variable *v1.Variable, opts metav1.UpdateOptions) (result *v1.Variable, err error) { + result = &v1.Variable{} + err = c.client.Put(). + Namespace(c.ns). + Resource("variables"). + Name(variable.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(variable). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the variable and deletes it. Returns an error if one occurs. +func (c *variables) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("variables"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *variables) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("variables"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched variable. +func (c *variables) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Variable, err error) { + result = &v1.Variable{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("variables"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied variable. +func (c *variables) Apply(ctx context.Context, variable *walrusv1.VariableApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Variable, err error) { + if variable == nil { + return nil, fmt.Errorf("variable provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(variable) + if err != nil { + return nil, err + } + name := variable.Name + if name == nil { + return nil, fmt.Errorf("variable.Name must be provided to Apply") + } + result = &v1.Variable{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("variables"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walrus/v1/walrus_client.go b/pkg/clients/clientset/typed/walrus/v1/walrus_client.go new file mode 100644 index 000000000..852bc9b4e --- /dev/null +++ b/pkg/clients/clientset/typed/walrus/v1/walrus_client.go @@ -0,0 +1,144 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + rest "k8s.io/client-go/rest" +) + +type WalrusV1Interface interface { + RESTClient() rest.Interface + CatalogsGetter + ConnectorsGetter + EnvironmentsGetter + FileExamplesGetter + ProjectsGetter + ResourcesGetter + ResourceDefinitionsGetter + ResourceRunsGetter + SettingsGetter + TemplatesGetter + VariablesGetter +} + +// WalrusV1Client is used to interact with features provided by the walrus.seal.io group. +type WalrusV1Client struct { + restClient rest.Interface +} + +func (c *WalrusV1Client) Catalogs(namespace string) CatalogInterface { + return newCatalogs(c, namespace) +} + +func (c *WalrusV1Client) Connectors(namespace string) ConnectorInterface { + return newConnectors(c, namespace) +} + +func (c *WalrusV1Client) Environments(namespace string) EnvironmentInterface { + return newEnvironments(c, namespace) +} + +func (c *WalrusV1Client) FileExamples(namespace string) FileExampleInterface { + return newFileExamples(c, namespace) +} + +func (c *WalrusV1Client) Projects(namespace string) ProjectInterface { + return newProjects(c, namespace) +} + +func (c *WalrusV1Client) Resources(namespace string) ResourceInterface { + return newResources(c, namespace) +} + +func (c *WalrusV1Client) ResourceDefinitions(namespace string) ResourceDefinitionInterface { + return newResourceDefinitions(c, namespace) +} + +func (c *WalrusV1Client) ResourceRuns(namespace string) ResourceRunInterface { + return newResourceRuns(c, namespace) +} + +func (c *WalrusV1Client) Settings(namespace string) SettingInterface { + return newSettings(c, namespace) +} + +func (c *WalrusV1Client) Templates(namespace string) TemplateInterface { + return newTemplates(c, namespace) +} + +func (c *WalrusV1Client) Variables(namespace string) VariableInterface { + return newVariables(c, namespace) +} + +// NewForConfig creates a new WalrusV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*WalrusV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new WalrusV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*WalrusV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &WalrusV1Client{client}, nil +} + +// NewForConfigOrDie creates a new WalrusV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *WalrusV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new WalrusV1Client for the given RESTClient. +func New(c rest.Interface) *WalrusV1Client { + return &WalrusV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *WalrusV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/catalog.go b/pkg/clients/clientset/typed/walruscore/v1/catalog.go new file mode 100644 index 000000000..e46f501b2 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/catalog.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CatalogsGetter has a method to return a CatalogInterface. +// A group's client should implement this interface. +type CatalogsGetter interface { + Catalogs(namespace string) CatalogInterface +} + +// CatalogInterface has methods to work with Catalog resources. +type CatalogInterface interface { + Create(ctx context.Context, catalog *v1.Catalog, opts metav1.CreateOptions) (*v1.Catalog, error) + Update(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (*v1.Catalog, error) + UpdateStatus(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (*v1.Catalog, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Catalog, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.CatalogList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Catalog, err error) + Apply(ctx context.Context, catalog *walruscorev1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) + ApplyStatus(ctx context.Context, catalog *walruscorev1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) + CatalogExpansion +} + +// catalogs implements CatalogInterface +type catalogs struct { + client rest.Interface + ns string +} + +// newCatalogs returns a Catalogs +func newCatalogs(c *WalruscoreV1Client, namespace string) *catalogs { + return &catalogs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the catalog, and returns the corresponding catalog object, and an error if there is any. +func (c *catalogs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Get(). + Namespace(c.ns). + Resource("catalogs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Catalogs that match those selectors. +func (c *catalogs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CatalogList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.CatalogList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested catalogs. +func (c *catalogs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a catalog and creates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *catalogs) Create(ctx context.Context, catalog *v1.Catalog, opts metav1.CreateOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Post(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(catalog). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a catalog and updates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *catalogs) Update(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Put(). + Namespace(c.ns). + Resource("catalogs"). + Name(catalog.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(catalog). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *catalogs) UpdateStatus(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Put(). + Namespace(c.ns). + Resource("catalogs"). + Name(catalog.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(catalog). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the catalog and deletes it. Returns an error if one occurs. +func (c *catalogs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("catalogs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *catalogs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("catalogs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched catalog. +func (c *catalogs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Catalog, err error) { + result = &v1.Catalog{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("catalogs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied catalog. +func (c *catalogs) Apply(ctx context.Context, catalog *walruscorev1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + result = &v1.Catalog{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("catalogs"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *catalogs) ApplyStatus(ctx context.Context, catalog *walruscorev1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + + result = &v1.Catalog{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("catalogs"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/connector.go b/pkg/clients/clientset/typed/walruscore/v1/connector.go new file mode 100644 index 000000000..f9a2e6f2f --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/connector.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ConnectorsGetter has a method to return a ConnectorInterface. +// A group's client should implement this interface. +type ConnectorsGetter interface { + Connectors(namespace string) ConnectorInterface +} + +// ConnectorInterface has methods to work with Connector resources. +type ConnectorInterface interface { + Create(ctx context.Context, connector *v1.Connector, opts metav1.CreateOptions) (*v1.Connector, error) + Update(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (*v1.Connector, error) + UpdateStatus(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (*v1.Connector, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Connector, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ConnectorList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Connector, err error) + Apply(ctx context.Context, connector *walruscorev1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) + ApplyStatus(ctx context.Context, connector *walruscorev1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) + ConnectorExpansion +} + +// connectors implements ConnectorInterface +type connectors struct { + client rest.Interface + ns string +} + +// newConnectors returns a Connectors +func newConnectors(c *WalruscoreV1Client, namespace string) *connectors { + return &connectors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the connector, and returns the corresponding connector object, and an error if there is any. +func (c *connectors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Get(). + Namespace(c.ns). + Resource("connectors"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Connectors that match those selectors. +func (c *connectors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConnectorList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ConnectorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested connectors. +func (c *connectors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a connector and creates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *connectors) Create(ctx context.Context, connector *v1.Connector, opts metav1.CreateOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Post(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(connector). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a connector and updates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *connectors) Update(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("connectors"). + Name(connector.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(connector). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *connectors) UpdateStatus(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Put(). + Namespace(c.ns). + Resource("connectors"). + Name(connector.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(connector). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the connector and deletes it. Returns an error if one occurs. +func (c *connectors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("connectors"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *connectors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("connectors"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched connector. +func (c *connectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Connector, err error) { + result = &v1.Connector{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("connectors"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied connector. +func (c *connectors) Apply(ctx context.Context, connector *walruscorev1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + result = &v1.Connector{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("connectors"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *connectors) ApplyStatus(ctx context.Context, connector *walruscorev1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + + result = &v1.Connector{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("connectors"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/doc.go b/pkg/clients/clientset/typed/walruscore/v1/doc.go new file mode 100644 index 000000000..2921c6a99 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/doc.go b/pkg/clients/clientset/typed/walruscore/v1/fake/doc.go new file mode 100644 index 000000000..71786d465 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/doc.go @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_catalog.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_catalog.go new file mode 100644 index 000000000..3fd1d3dc1 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_catalog.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCatalogs implements CatalogInterface +type FakeCatalogs struct { + Fake *FakeWalruscoreV1 + ns string +} + +var catalogsResource = v1.SchemeGroupVersion.WithResource("catalogs") + +var catalogsKind = v1.SchemeGroupVersion.WithKind("Catalog") + +// Get takes name of the catalog, and returns the corresponding catalog object, and an error if there is any. +func (c *FakeCatalogs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(catalogsResource, c.ns, name), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// List takes label and field selectors, and returns the list of Catalogs that match those selectors. +func (c *FakeCatalogs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CatalogList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(catalogsResource, catalogsKind, c.ns, opts), &v1.CatalogList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.CatalogList{ListMeta: obj.(*v1.CatalogList).ListMeta} + for _, item := range obj.(*v1.CatalogList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested catalogs. +func (c *FakeCatalogs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(catalogsResource, c.ns, opts)) + +} + +// Create takes the representation of a catalog and creates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *FakeCatalogs) Create(ctx context.Context, catalog *v1.Catalog, opts metav1.CreateOptions) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(catalogsResource, c.ns, catalog), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// Update takes the representation of a catalog and updates it. Returns the server's representation of the catalog, and an error, if there is any. +func (c *FakeCatalogs) Update(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(catalogsResource, c.ns, catalog), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCatalogs) UpdateStatus(ctx context.Context, catalog *v1.Catalog, opts metav1.UpdateOptions) (*v1.Catalog, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(catalogsResource, "status", c.ns, catalog), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// Delete takes name of the catalog and deletes it. Returns an error if one occurs. +func (c *FakeCatalogs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(catalogsResource, c.ns, name, opts), &v1.Catalog{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCatalogs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(catalogsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.CatalogList{}) + return err +} + +// Patch applies the patch and returns the patched catalog. +func (c *FakeCatalogs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Catalog, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsResource, c.ns, name, pt, data, subresources...), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied catalog. +func (c *FakeCatalogs) Apply(ctx context.Context, catalog *walruscorev1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeCatalogs) ApplyStatus(ctx context.Context, catalog *walruscorev1.CatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Catalog, err error) { + if catalog == nil { + return nil, fmt.Errorf("catalog provided to Apply must not be nil") + } + data, err := json.Marshal(catalog) + if err != nil { + return nil, err + } + name := catalog.Name + if name == nil { + return nil, fmt.Errorf("catalog.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(catalogsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Catalog{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Catalog), err +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_connector.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_connector.go new file mode 100644 index 000000000..0f77196e6 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_connector.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeConnectors implements ConnectorInterface +type FakeConnectors struct { + Fake *FakeWalruscoreV1 + ns string +} + +var connectorsResource = v1.SchemeGroupVersion.WithResource("connectors") + +var connectorsKind = v1.SchemeGroupVersion.WithKind("Connector") + +// Get takes name of the connector, and returns the corresponding connector object, and an error if there is any. +func (c *FakeConnectors) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(connectorsResource, c.ns, name), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// List takes label and field selectors, and returns the list of Connectors that match those selectors. +func (c *FakeConnectors) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ConnectorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(connectorsResource, connectorsKind, c.ns, opts), &v1.ConnectorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ConnectorList{ListMeta: obj.(*v1.ConnectorList).ListMeta} + for _, item := range obj.(*v1.ConnectorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested connectors. +func (c *FakeConnectors) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(connectorsResource, c.ns, opts)) + +} + +// Create takes the representation of a connector and creates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *FakeConnectors) Create(ctx context.Context, connector *v1.Connector, opts metav1.CreateOptions) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(connectorsResource, c.ns, connector), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// Update takes the representation of a connector and updates it. Returns the server's representation of the connector, and an error, if there is any. +func (c *FakeConnectors) Update(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(connectorsResource, c.ns, connector), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeConnectors) UpdateStatus(ctx context.Context, connector *v1.Connector, opts metav1.UpdateOptions) (*v1.Connector, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(connectorsResource, "status", c.ns, connector), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// Delete takes name of the connector and deletes it. Returns an error if one occurs. +func (c *FakeConnectors) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(connectorsResource, c.ns, name, opts), &v1.Connector{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeConnectors) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(connectorsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ConnectorList{}) + return err +} + +// Patch applies the patch and returns the patched connector. +func (c *FakeConnectors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Connector, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(connectorsResource, c.ns, name, pt, data, subresources...), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied connector. +func (c *FakeConnectors) Apply(ctx context.Context, connector *walruscorev1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(connectorsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeConnectors) ApplyStatus(ctx context.Context, connector *walruscorev1.ConnectorApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Connector, err error) { + if connector == nil { + return nil, fmt.Errorf("connector provided to Apply must not be nil") + } + data, err := json.Marshal(connector) + if err != nil { + return nil, err + } + name := connector.Name + if name == nil { + return nil, fmt.Errorf("connector.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(connectorsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Connector{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Connector), err +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resource.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resource.go new file mode 100644 index 000000000..50a34c950 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resource.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResources implements ResourceInterface +type FakeResources struct { + Fake *FakeWalruscoreV1 + ns string +} + +var resourcesResource = v1.SchemeGroupVersion.WithResource("resources") + +var resourcesKind = v1.SchemeGroupVersion.WithKind("Resource") + +// Get takes name of the resource, and returns the corresponding resource object, and an error if there is any. +func (c *FakeResources) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcesResource, c.ns, name), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// List takes label and field selectors, and returns the list of Resources that match those selectors. +func (c *FakeResources) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcesResource, resourcesKind, c.ns, opts), &v1.ResourceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceList{ListMeta: obj.(*v1.ResourceList).ListMeta} + for _, item := range obj.(*v1.ResourceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resources. +func (c *FakeResources) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcesResource, c.ns, opts)) + +} + +// Create takes the representation of a resource and creates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *FakeResources) Create(ctx context.Context, resource *v1.Resource, opts metav1.CreateOptions) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcesResource, c.ns, resource), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// Update takes the representation of a resource and updates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *FakeResources) Update(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcesResource, c.ns, resource), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResources) UpdateStatus(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (*v1.Resource, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcesResource, "status", c.ns, resource), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// Delete takes name of the resource and deletes it. Returns an error if one occurs. +func (c *FakeResources) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcesResource, c.ns, name, opts), &v1.Resource{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResources) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceList{}) + return err +} + +// Patch applies the patch and returns the patched resource. +func (c *FakeResources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Resource, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcesResource, c.ns, name, pt, data, subresources...), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resource. +func (c *FakeResources) Apply(ctx context.Context, resource *walruscorev1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResources) ApplyStatus(ctx context.Context, resource *walruscorev1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Resource{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Resource), err +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resourcedefinition.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resourcedefinition.go new file mode 100644 index 000000000..c5b396fb6 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resourcedefinition.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResourceDefinitions implements ResourceDefinitionInterface +type FakeResourceDefinitions struct { + Fake *FakeWalruscoreV1 + ns string +} + +var resourcedefinitionsResource = v1.SchemeGroupVersion.WithResource("resourcedefinitions") + +var resourcedefinitionsKind = v1.SchemeGroupVersion.WithKind("ResourceDefinition") + +// Get takes name of the resourceDefinition, and returns the corresponding resourceDefinition object, and an error if there is any. +func (c *FakeResourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcedefinitionsResource, c.ns, name), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// List takes label and field selectors, and returns the list of ResourceDefinitions that match those selectors. +func (c *FakeResourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceDefinitionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcedefinitionsResource, resourcedefinitionsKind, c.ns, opts), &v1.ResourceDefinitionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceDefinitionList{ListMeta: obj.(*v1.ResourceDefinitionList).ListMeta} + for _, item := range obj.(*v1.ResourceDefinitionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resourceDefinitions. +func (c *FakeResourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcedefinitionsResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceDefinition and creates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *FakeResourceDefinitions) Create(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.CreateOptions) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcedefinitionsResource, c.ns, resourceDefinition), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// Update takes the representation of a resourceDefinition and updates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *FakeResourceDefinitions) Update(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcedefinitionsResource, c.ns, resourceDefinition), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResourceDefinitions) UpdateStatus(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (*v1.ResourceDefinition, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcedefinitionsResource, "status", c.ns, resourceDefinition), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// Delete takes name of the resourceDefinition and deletes it. Returns an error if one occurs. +func (c *FakeResourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcedefinitionsResource, c.ns, name, opts), &v1.ResourceDefinition{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcedefinitionsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceDefinitionList{}) + return err +} + +// Patch applies the patch and returns the patched resourceDefinition. +func (c *FakeResourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceDefinition, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcedefinitionsResource, c.ns, name, pt, data, subresources...), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceDefinition. +func (c *FakeResourceDefinitions) Apply(ctx context.Context, resourceDefinition *walruscorev1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcedefinitionsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceDefinitions) ApplyStatus(ctx context.Context, resourceDefinition *walruscorev1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcedefinitionsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ResourceDefinition{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceDefinition), err +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resourcerun.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resourcerun.go new file mode 100644 index 000000000..8fade1b33 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_resourcerun.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeResourceRuns implements ResourceRunInterface +type FakeResourceRuns struct { + Fake *FakeWalruscoreV1 + ns string +} + +var resourcerunsResource = v1.SchemeGroupVersion.WithResource("resourceruns") + +var resourcerunsKind = v1.SchemeGroupVersion.WithKind("ResourceRun") + +// Get takes name of the resourceRun, and returns the corresponding resourceRun object, and an error if there is any. +func (c *FakeResourceRuns) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(resourcerunsResource, c.ns, name), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// List takes label and field selectors, and returns the list of ResourceRuns that match those selectors. +func (c *FakeResourceRuns) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceRunList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(resourcerunsResource, resourcerunsKind, c.ns, opts), &v1.ResourceRunList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.ResourceRunList{ListMeta: obj.(*v1.ResourceRunList).ListMeta} + for _, item := range obj.(*v1.ResourceRunList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested resourceRuns. +func (c *FakeResourceRuns) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(resourcerunsResource, c.ns, opts)) + +} + +// Create takes the representation of a resourceRun and creates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *FakeResourceRuns) Create(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.CreateOptions) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(resourcerunsResource, c.ns, resourceRun), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// Update takes the representation of a resourceRun and updates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *FakeResourceRuns) Update(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(resourcerunsResource, c.ns, resourceRun), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeResourceRuns) UpdateStatus(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (*v1.ResourceRun, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(resourcerunsResource, "status", c.ns, resourceRun), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// Delete takes name of the resourceRun and deletes it. Returns an error if one occurs. +func (c *FakeResourceRuns) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(resourcerunsResource, c.ns, name, opts), &v1.ResourceRun{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeResourceRuns) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(resourcerunsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.ResourceRunList{}) + return err +} + +// Patch applies the patch and returns the patched resourceRun. +func (c *FakeResourceRuns) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceRun, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcerunsResource, c.ns, name, pt, data, subresources...), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceRun. +func (c *FakeResourceRuns) Apply(ctx context.Context, resourceRun *walruscorev1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcerunsResource, c.ns, *name, types.ApplyPatchType, data), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceRuns) ApplyStatus(ctx context.Context, resourceRun *walruscorev1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(resourcerunsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.ResourceRun{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceRun), err +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_template.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_template.go new file mode 100644 index 000000000..f1c4b3234 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_template.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTemplates implements TemplateInterface +type FakeTemplates struct { + Fake *FakeWalruscoreV1 + ns string +} + +var templatesResource = v1.SchemeGroupVersion.WithResource("templates") + +var templatesKind = v1.SchemeGroupVersion.WithKind("Template") + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *FakeTemplates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(templatesResource, c.ns, name), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *FakeTemplates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(templatesResource, templatesKind, c.ns, opts), &v1.TemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.TemplateList{ListMeta: obj.(*v1.TemplateList).ListMeta} + for _, item := range obj.(*v1.TemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *FakeTemplates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(templatesResource, c.ns, opts)) + +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *FakeTemplates) Create(ctx context.Context, template *v1.Template, opts metav1.CreateOptions) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(templatesResource, c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *FakeTemplates) Update(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(templatesResource, c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeTemplates) UpdateStatus(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (*v1.Template, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(templatesResource, "status", c.ns, template), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *FakeTemplates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(templatesResource, c.ns, name, opts), &v1.Template{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTemplates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(templatesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.TemplateList{}) + return err +} + +// Patch applies the patch and returns the patched template. +func (c *FakeTemplates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, name, pt, data, subresources...), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied template. +func (c *FakeTemplates) Apply(ctx context.Context, template *walruscorev1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeTemplates) ApplyStatus(ctx context.Context, template *walruscorev1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Template), err +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/fake/fake_walruscore_client.go b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_walruscore_client.go new file mode 100644 index 000000000..a95972625 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/fake/fake_walruscore_client.go @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package fake + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/clientset/typed/walruscore/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeWalruscoreV1 struct { + *testing.Fake +} + +func (c *FakeWalruscoreV1) Catalogs(namespace string) v1.CatalogInterface { + return &FakeCatalogs{c, namespace} +} + +func (c *FakeWalruscoreV1) Connectors(namespace string) v1.ConnectorInterface { + return &FakeConnectors{c, namespace} +} + +func (c *FakeWalruscoreV1) Resources(namespace string) v1.ResourceInterface { + return &FakeResources{c, namespace} +} + +func (c *FakeWalruscoreV1) ResourceDefinitions(namespace string) v1.ResourceDefinitionInterface { + return &FakeResourceDefinitions{c, namespace} +} + +func (c *FakeWalruscoreV1) ResourceRuns(namespace string) v1.ResourceRunInterface { + return &FakeResourceRuns{c, namespace} +} + +func (c *FakeWalruscoreV1) Templates(namespace string) v1.TemplateInterface { + return &FakeTemplates{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeWalruscoreV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/generated_expansion.go b/pkg/clients/clientset/typed/walruscore/v1/generated_expansion.go new file mode 100644 index 000000000..2877607de --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/generated_expansion.go @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +type CatalogExpansion interface{} + +type ConnectorExpansion interface{} + +type ResourceExpansion interface{} + +type ResourceDefinitionExpansion interface{} + +type ResourceRunExpansion interface{} + +type TemplateExpansion interface{} diff --git a/pkg/clients/clientset/typed/walruscore/v1/resource.go b/pkg/clients/clientset/typed/walruscore/v1/resource.go new file mode 100644 index 000000000..84a5c09fc --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/resource.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourcesGetter has a method to return a ResourceInterface. +// A group's client should implement this interface. +type ResourcesGetter interface { + Resources(namespace string) ResourceInterface +} + +// ResourceInterface has methods to work with Resource resources. +type ResourceInterface interface { + Create(ctx context.Context, resource *v1.Resource, opts metav1.CreateOptions) (*v1.Resource, error) + Update(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (*v1.Resource, error) + UpdateStatus(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (*v1.Resource, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Resource, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Resource, err error) + Apply(ctx context.Context, resource *walruscorev1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) + ApplyStatus(ctx context.Context, resource *walruscorev1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) + ResourceExpansion +} + +// resources implements ResourceInterface +type resources struct { + client rest.Interface + ns string +} + +// newResources returns a Resources +func newResources(c *WalruscoreV1Client, namespace string) *resources { + return &resources{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resource, and returns the corresponding resource object, and an error if there is any. +func (c *resources) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resources"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Resources that match those selectors. +func (c *resources) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resources. +func (c *resources) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resource and creates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *resources) Create(ctx context.Context, resource *v1.Resource, opts metav1.CreateOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resource). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resource and updates it. Returns the server's representation of the resource, and an error, if there is any. +func (c *resources) Update(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resources"). + Name(resource.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resource). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resources) UpdateStatus(ctx context.Context, resource *v1.Resource, opts metav1.UpdateOptions) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resources"). + Name(resource.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resource). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resource and deletes it. Returns an error if one occurs. +func (c *resources) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resources"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resources) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resources"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resource. +func (c *resources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Resource, err error) { + result = &v1.Resource{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resources"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resource. +func (c *resources) Apply(ctx context.Context, resource *walruscorev1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + result = &v1.Resource{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resources"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resources) ApplyStatus(ctx context.Context, resource *walruscorev1.ResourceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Resource, err error) { + if resource == nil { + return nil, fmt.Errorf("resource provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resource) + if err != nil { + return nil, err + } + + name := resource.Name + if name == nil { + return nil, fmt.Errorf("resource.Name must be provided to Apply") + } + + result = &v1.Resource{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resources"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/resourcedefinition.go b/pkg/clients/clientset/typed/walruscore/v1/resourcedefinition.go new file mode 100644 index 000000000..600d5b448 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/resourcedefinition.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourceDefinitionsGetter has a method to return a ResourceDefinitionInterface. +// A group's client should implement this interface. +type ResourceDefinitionsGetter interface { + ResourceDefinitions(namespace string) ResourceDefinitionInterface +} + +// ResourceDefinitionInterface has methods to work with ResourceDefinition resources. +type ResourceDefinitionInterface interface { + Create(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.CreateOptions) (*v1.ResourceDefinition, error) + Update(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (*v1.ResourceDefinition, error) + UpdateStatus(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (*v1.ResourceDefinition, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ResourceDefinition, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceDefinitionList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceDefinition, err error) + Apply(ctx context.Context, resourceDefinition *walruscorev1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) + ApplyStatus(ctx context.Context, resourceDefinition *walruscorev1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) + ResourceDefinitionExpansion +} + +// resourceDefinitions implements ResourceDefinitionInterface +type resourceDefinitions struct { + client rest.Interface + ns string +} + +// newResourceDefinitions returns a ResourceDefinitions +func newResourceDefinitions(c *WalruscoreV1Client, namespace string) *resourceDefinitions { + return &resourceDefinitions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceDefinition, and returns the corresponding resourceDefinition object, and an error if there is any. +func (c *resourceDefinitions) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceDefinitions that match those selectors. +func (c *resourceDefinitions) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceDefinitionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceDefinitionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceDefinitions. +func (c *resourceDefinitions) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceDefinition and creates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *resourceDefinitions) Create(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.CreateOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceDefinition). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceDefinition and updates it. Returns the server's representation of the resourceDefinition, and an error, if there is any. +func (c *resourceDefinitions) Update(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(resourceDefinition.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceDefinition). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resourceDefinitions) UpdateStatus(ctx context.Context, resourceDefinition *v1.ResourceDefinition, opts metav1.UpdateOptions) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(resourceDefinition.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceDefinition). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceDefinition and deletes it. Returns an error if one occurs. +func (c *resourceDefinitions) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceDefinitions) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resourcedefinitions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceDefinition. +func (c *resourceDefinitions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceDefinition, err error) { + result = &v1.ResourceDefinition{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceDefinition. +func (c *resourceDefinitions) Apply(ctx context.Context, resourceDefinition *walruscorev1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + result = &v1.ResourceDefinition{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resourceDefinitions) ApplyStatus(ctx context.Context, resourceDefinition *walruscorev1.ResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceDefinition, err error) { + if resourceDefinition == nil { + return nil, fmt.Errorf("resourceDefinition provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceDefinition) + if err != nil { + return nil, err + } + + name := resourceDefinition.Name + if name == nil { + return nil, fmt.Errorf("resourceDefinition.Name must be provided to Apply") + } + + result = &v1.ResourceDefinition{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourcedefinitions"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/resourcerun.go b/pkg/clients/clientset/typed/walruscore/v1/resourcerun.go new file mode 100644 index 000000000..c0c49cbe7 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/resourcerun.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ResourceRunsGetter has a method to return a ResourceRunInterface. +// A group's client should implement this interface. +type ResourceRunsGetter interface { + ResourceRuns(namespace string) ResourceRunInterface +} + +// ResourceRunInterface has methods to work with ResourceRun resources. +type ResourceRunInterface interface { + Create(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.CreateOptions) (*v1.ResourceRun, error) + Update(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (*v1.ResourceRun, error) + UpdateStatus(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (*v1.ResourceRun, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ResourceRun, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.ResourceRunList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceRun, err error) + Apply(ctx context.Context, resourceRun *walruscorev1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) + ApplyStatus(ctx context.Context, resourceRun *walruscorev1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) + ResourceRunExpansion +} + +// resourceRuns implements ResourceRunInterface +type resourceRuns struct { + client rest.Interface + ns string +} + +// newResourceRuns returns a ResourceRuns +func newResourceRuns(c *WalruscoreV1Client, namespace string) *resourceRuns { + return &resourceRuns{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the resourceRun, and returns the corresponding resourceRun object, and an error if there is any. +func (c *resourceRuns) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceruns"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ResourceRuns that match those selectors. +func (c *resourceRuns) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ResourceRunList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.ResourceRunList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested resourceRuns. +func (c *resourceRuns) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a resourceRun and creates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *resourceRuns) Create(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.CreateOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Post(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceRun). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a resourceRun and updates it. Returns the server's representation of the resourceRun, and an error, if there is any. +func (c *resourceRuns) Update(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceruns"). + Name(resourceRun.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceRun). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *resourceRuns) UpdateStatus(ctx context.Context, resourceRun *v1.ResourceRun, opts metav1.UpdateOptions) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Put(). + Namespace(c.ns). + Resource("resourceruns"). + Name(resourceRun.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(resourceRun). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the resourceRun and deletes it. Returns an error if one occurs. +func (c *resourceRuns) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceruns"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *resourceRuns) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("resourceruns"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched resourceRun. +func (c *resourceRuns) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ResourceRun, err error) { + result = &v1.ResourceRun{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("resourceruns"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceRun. +func (c *resourceRuns) Apply(ctx context.Context, resourceRun *walruscorev1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + result = &v1.ResourceRun{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourceruns"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *resourceRuns) ApplyStatus(ctx context.Context, resourceRun *walruscorev1.ResourceRunApplyConfiguration, opts metav1.ApplyOptions) (result *v1.ResourceRun, err error) { + if resourceRun == nil { + return nil, fmt.Errorf("resourceRun provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(resourceRun) + if err != nil { + return nil, err + } + + name := resourceRun.Name + if name == nil { + return nil, fmt.Errorf("resourceRun.Name must be provided to Apply") + } + + result = &v1.ResourceRun{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("resourceruns"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/template.go b/pkg/clients/clientset/typed/walruscore/v1/template.go new file mode 100644 index 000000000..cbe780145 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/template.go @@ -0,0 +1,243 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/clients/applyconfiguration/walruscore/v1" + scheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TemplatesGetter has a method to return a TemplateInterface. +// A group's client should implement this interface. +type TemplatesGetter interface { + Templates(namespace string) TemplateInterface +} + +// TemplateInterface has methods to work with Template resources. +type TemplateInterface interface { + Create(ctx context.Context, template *v1.Template, opts metav1.CreateOptions) (*v1.Template, error) + Update(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (*v1.Template, error) + UpdateStatus(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (*v1.Template, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Template, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.TemplateList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Template, err error) + Apply(ctx context.Context, template *walruscorev1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) + ApplyStatus(ctx context.Context, template *walruscorev1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) + TemplateExpansion +} + +// templates implements TemplateInterface +type templates struct { + client rest.Interface + ns string +} + +// newTemplates returns a Templates +func newTemplates(c *WalruscoreV1Client, namespace string) *templates { + return &templates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *templates) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *templates) List(ctx context.Context, opts metav1.ListOptions) (result *v1.TemplateList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.TemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *templates) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Create(ctx context.Context, template *v1.Template, opts metav1.CreateOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(template). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Update(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(template). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *templates) UpdateStatus(ctx context.Context, template *v1.Template, opts metav1.UpdateOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(template). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *templates) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templates) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched template. +func (c *templates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templates"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied template. +func (c *templates) Apply(ctx context.Context, template *walruscorev1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + result = &v1.Template{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("templates"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *templates) ApplyStatus(ctx context.Context, template *walruscorev1.TemplateApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Template, err error) { + if template == nil { + return nil, fmt.Errorf("template provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(template) + if err != nil { + return nil, err + } + + name := template.Name + if name == nil { + return nil, fmt.Errorf("template.Name must be provided to Apply") + } + + result = &v1.Template{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("templates"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/clientset/typed/walruscore/v1/walruscore_client.go b/pkg/clients/clientset/typed/walruscore/v1/walruscore_client.go new file mode 100644 index 000000000..c98ff3aa0 --- /dev/null +++ b/pkg/clients/clientset/typed/walruscore/v1/walruscore_client.go @@ -0,0 +1,119 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "net/http" + + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + rest "k8s.io/client-go/rest" +) + +type WalruscoreV1Interface interface { + RESTClient() rest.Interface + CatalogsGetter + ConnectorsGetter + ResourcesGetter + ResourceDefinitionsGetter + ResourceRunsGetter + TemplatesGetter +} + +// WalruscoreV1Client is used to interact with features provided by the walruscore.seal.io group. +type WalruscoreV1Client struct { + restClient rest.Interface +} + +func (c *WalruscoreV1Client) Catalogs(namespace string) CatalogInterface { + return newCatalogs(c, namespace) +} + +func (c *WalruscoreV1Client) Connectors(namespace string) ConnectorInterface { + return newConnectors(c, namespace) +} + +func (c *WalruscoreV1Client) Resources(namespace string) ResourceInterface { + return newResources(c, namespace) +} + +func (c *WalruscoreV1Client) ResourceDefinitions(namespace string) ResourceDefinitionInterface { + return newResourceDefinitions(c, namespace) +} + +func (c *WalruscoreV1Client) ResourceRuns(namespace string) ResourceRunInterface { + return newResourceRuns(c, namespace) +} + +func (c *WalruscoreV1Client) Templates(namespace string) TemplateInterface { + return newTemplates(c, namespace) +} + +// NewForConfig creates a new WalruscoreV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*WalruscoreV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new WalruscoreV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*WalruscoreV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &WalruscoreV1Client{client}, nil +} + +// NewForConfigOrDie creates a new WalruscoreV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *WalruscoreV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new WalruscoreV1Client for the given RESTClient. +func New(c rest.Interface) *WalruscoreV1Client { + return &WalruscoreV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *WalruscoreV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/informers/admissionregistration/interface.go b/pkg/clients/informers/admissionregistration/interface.go new file mode 100644 index 000000000..3ac40d39b --- /dev/null +++ b/pkg/clients/informers/admissionregistration/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package admissionregistration + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/admissionregistration/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/admissionregistration/v1/interface.go b/pkg/clients/informers/admissionregistration/v1/interface.go new file mode 100644 index 000000000..af7860c17 --- /dev/null +++ b/pkg/clients/informers/admissionregistration/v1/interface.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. + MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. + ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { + return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { + return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/admissionregistration/v1/mutatingwebhookconfiguration.go b/pkg/clients/informers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..207eb8c15 --- /dev/null +++ b/pkg/clients/informers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/admissionregistration/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.MutatingWebhookConfigurationLister +} + +type mutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *mutatingWebhookConfigurationInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *mutatingWebhookConfigurationInformer) Lister() v1.MutatingWebhookConfigurationLister { + return v1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/admissionregistration/v1/validatingwebhookconfiguration.go b/pkg/clients/informers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..d6de4217b --- /dev/null +++ b/pkg/clients/informers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/admissionregistration/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ValidatingWebhookConfigurationLister +} + +type validatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *validatingWebhookConfigurationInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *validatingWebhookConfigurationInformer) Lister() v1.ValidatingWebhookConfigurationLister { + return v1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apiextensions/interface.go b/pkg/clients/informers/apiextensions/interface.go new file mode 100644 index 000000000..312618d94 --- /dev/null +++ b/pkg/clients/informers/apiextensions/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package apiextensions + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/apiextensions/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/apiextensions/v1/customresourcedefinition.go b/pkg/clients/informers/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 000000000..af79beb5e --- /dev/null +++ b/pkg/clients/informers/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apiextensions/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CustomResourceDefinitionInformer provides access to a shared informer and lister for +// CustomResourceDefinitions. +type CustomResourceDefinitionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CustomResourceDefinitionLister +} + +type customResourceDefinitionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCustomResourceDefinitionInformer constructs a new informer for CustomResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCustomResourceDefinitionInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCustomResourceDefinitionInformer constructs a new informer for CustomResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCustomResourceDefinitionInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiextensionsV1().CustomResourceDefinitions().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiextensionsV1().CustomResourceDefinitions().Watch(context.TODO(), options) + }, + }, + &apiextensionsv1.CustomResourceDefinition{}, + resyncPeriod, + indexers, + ) +} + +func (f *customResourceDefinitionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCustomResourceDefinitionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *customResourceDefinitionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiextensionsv1.CustomResourceDefinition{}, f.defaultInformer) +} + +func (f *customResourceDefinitionInformer) Lister() v1.CustomResourceDefinitionLister { + return v1.NewCustomResourceDefinitionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apiextensions/v1/interface.go b/pkg/clients/informers/apiextensions/v1/interface.go new file mode 100644 index 000000000..5ac76047a --- /dev/null +++ b/pkg/clients/informers/apiextensions/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CustomResourceDefinitions returns a CustomResourceDefinitionInformer. + CustomResourceDefinitions() CustomResourceDefinitionInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CustomResourceDefinitions returns a CustomResourceDefinitionInformer. +func (v *version) CustomResourceDefinitions() CustomResourceDefinitionInformer { + return &customResourceDefinitionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/apiregistration/interface.go b/pkg/clients/informers/apiregistration/interface.go new file mode 100644 index 000000000..11b04cec7 --- /dev/null +++ b/pkg/clients/informers/apiregistration/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package apiregistration + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/apiregistration/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/apiregistration/v1/apiservice.go b/pkg/clients/informers/apiregistration/v1/apiservice.go new file mode 100644 index 000000000..073d3dfd2 --- /dev/null +++ b/pkg/clients/informers/apiregistration/v1/apiservice.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apiregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// APIServiceInformer provides access to a shared informer and lister for +// APIServices. +type APIServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.APIServiceLister +} + +type aPIServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewAPIServiceInformer constructs a new informer for APIService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAPIServiceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAPIServiceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredAPIServiceInformer constructs a new informer for APIService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAPIServiceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiregistrationV1().APIServices().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ApiregistrationV1().APIServices().Watch(context.TODO(), options) + }, + }, + &apiregistrationv1.APIService{}, + resyncPeriod, + indexers, + ) +} + +func (f *aPIServiceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAPIServiceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *aPIServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiregistrationv1.APIService{}, f.defaultInformer) +} + +func (f *aPIServiceInformer) Lister() v1.APIServiceLister { + return v1.NewAPIServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apiregistration/v1/interface.go b/pkg/clients/informers/apiregistration/v1/interface.go new file mode 100644 index 000000000..c066a5c87 --- /dev/null +++ b/pkg/clients/informers/apiregistration/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // APIServices returns a APIServiceInformer. + APIServices() APIServiceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// APIServices returns a APIServiceInformer. +func (v *version) APIServices() APIServiceInformer { + return &aPIServiceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/apps/interface.go b/pkg/clients/informers/apps/interface.go new file mode 100644 index 000000000..073ed77a1 --- /dev/null +++ b/pkg/clients/informers/apps/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package apps + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/apps/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/apps/v1/controllerrevision.go b/pkg/clients/informers/apps/v1/controllerrevision.go new file mode 100644 index 000000000..9055be70d --- /dev/null +++ b/pkg/clients/informers/apps/v1/controllerrevision.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apps/v1" + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1.ControllerRevisionLister { + return v1.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apps/v1/daemonset.go b/pkg/clients/informers/apps/v1/daemonset.go new file mode 100644 index 000000000..abcc644a0 --- /dev/null +++ b/pkg/clients/informers/apps/v1/daemonset.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apps/v1" + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1.DaemonSetLister { + return v1.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apps/v1/deployment.go b/pkg/clients/informers/apps/v1/deployment.go new file mode 100644 index 000000000..e747b9f0b --- /dev/null +++ b/pkg/clients/informers/apps/v1/deployment.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apps/v1" + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1.DeploymentLister { + return v1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apps/v1/interface.go b/pkg/clients/informers/apps/v1/interface.go new file mode 100644 index 000000000..2fb731277 --- /dev/null +++ b/pkg/clients/informers/apps/v1/interface.go @@ -0,0 +1,60 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/apps/v1/replicaset.go b/pkg/clients/informers/apps/v1/replicaset.go new file mode 100644 index 000000000..794bb9fe0 --- /dev/null +++ b/pkg/clients/informers/apps/v1/replicaset.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apps/v1" + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1.ReplicaSetLister { + return v1.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/apps/v1/statefulset.go b/pkg/clients/informers/apps/v1/statefulset.go new file mode 100644 index 000000000..5fa56e610 --- /dev/null +++ b/pkg/clients/informers/apps/v1/statefulset.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/apps/v1" + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1.StatefulSetLister { + return v1.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/autoscaling/interface.go b/pkg/clients/informers/autoscaling/interface.go new file mode 100644 index 000000000..1623a0bdf --- /dev/null +++ b/pkg/clients/informers/autoscaling/interface.go @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package autoscaling + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/autoscaling/v1" + v2 "github.com/seal-io/walrus/pkg/clients/informers/autoscaling/v2" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V2 provides access to shared informers for resources in V2. + V2() v2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2 returns a new v2.Interface. +func (g *group) V2() v2.Interface { + return v2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/autoscaling/v1/horizontalpodautoscaler.go b/pkg/clients/informers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..b18bb0101 --- /dev/null +++ b/pkg/clients/informers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/autoscaling/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v1.HorizontalPodAutoscalerLister { + return v1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/autoscaling/v1/interface.go b/pkg/clients/informers/autoscaling/v1/interface.go new file mode 100644 index 000000000..7bde211d0 --- /dev/null +++ b/pkg/clients/informers/autoscaling/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/autoscaling/v2/horizontalpodautoscaler.go b/pkg/clients/informers/autoscaling/v2/horizontalpodautoscaler.go new file mode 100644 index 000000000..05ee6bf9d --- /dev/null +++ b/pkg/clients/informers/autoscaling/v2/horizontalpodautoscaler.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v2 "github.com/seal-io/walrus/pkg/clients/listers/autoscaling/v2" + autoscalingv2 "k8s.io/api/autoscaling/v2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v2.HorizontalPodAutoscalerLister { + return v2.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/autoscaling/v2/interface.go b/pkg/clients/informers/autoscaling/v2/interface.go new file mode 100644 index 000000000..dba059c24 --- /dev/null +++ b/pkg/clients/informers/autoscaling/v2/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/batch/interface.go b/pkg/clients/informers/batch/interface.go new file mode 100644 index 000000000..7bd132442 --- /dev/null +++ b/pkg/clients/informers/batch/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package batch + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/batch/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/batch/v1/cronjob.go b/pkg/clients/informers/batch/v1/cronjob.go new file mode 100644 index 000000000..414fa0089 --- /dev/null +++ b/pkg/clients/informers/batch/v1/cronjob.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/batch/v1" + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CronJobLister +} + +type cronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *cronJobInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.CronJob{}, f.defaultInformer) +} + +func (f *cronJobInformer) Lister() v1.CronJobLister { + return v1.NewCronJobLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/batch/v1/interface.go b/pkg/clients/informers/batch/v1/interface.go new file mode 100644 index 000000000..118a99c51 --- /dev/null +++ b/pkg/clients/informers/batch/v1/interface.go @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CronJobs returns a CronJobInformer. + CronJobs() CronJobInformer + // Jobs returns a JobInformer. + Jobs() JobInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v *version) CronJobs() CronJobInformer { + return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Jobs returns a JobInformer. +func (v *version) Jobs() JobInformer { + return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/batch/v1/job.go b/pkg/clients/informers/batch/v1/job.go new file mode 100644 index 000000000..fde102dda --- /dev/null +++ b/pkg/clients/informers/batch/v1/job.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/batch/v1" + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// JobInformer provides access to a shared informer and lister for +// Jobs. +type JobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.JobLister +} + +type jobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewJobInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredJobInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.Job{}, + resyncPeriod, + indexers, + ) +} + +func (f *jobInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *jobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.Job{}, f.defaultInformer) +} + +func (f *jobInformer) Lister() v1.JobLister { + return v1.NewJobLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/certificates/interface.go b/pkg/clients/informers/certificates/interface.go new file mode 100644 index 000000000..9f1713fd1 --- /dev/null +++ b/pkg/clients/informers/certificates/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package certificates + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/certificates/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/certificates/v1/certificatesigningrequest.go b/pkg/clients/informers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..160562f42 --- /dev/null +++ b/pkg/clients/informers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/certificates/v1" + certificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CertificateSigningRequestLister +} + +type certificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateSigningRequestInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f *certificateSigningRequestInformer) Lister() v1.CertificateSigningRequestLister { + return v1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/certificates/v1/interface.go b/pkg/clients/informers/certificates/v1/interface.go new file mode 100644 index 000000000..7c37c5469 --- /dev/null +++ b/pkg/clients/informers/certificates/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CertificateSigningRequests returns a CertificateSigningRequestInformer. + CertificateSigningRequests() CertificateSigningRequestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { + return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/coordination/interface.go b/pkg/clients/informers/coordination/interface.go new file mode 100644 index 000000000..cbfd73f38 --- /dev/null +++ b/pkg/clients/informers/coordination/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package coordination + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/coordination/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/coordination/v1/interface.go b/pkg/clients/informers/coordination/v1/interface.go new file mode 100644 index 000000000..80519b95f --- /dev/null +++ b/pkg/clients/informers/coordination/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Leases returns a LeaseInformer. + Leases() LeaseInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v *version) Leases() LeaseInformer { + return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/coordination/v1/lease.go b/pkg/clients/informers/coordination/v1/lease.go new file mode 100644 index 000000000..5e16fb0f9 --- /dev/null +++ b/pkg/clients/informers/coordination/v1/lease.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/coordination/v1" + coordinationv1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.LeaseLister +} + +type leaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f *leaseInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *leaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1.Lease{}, f.defaultInformer) +} + +func (f *leaseInformer) Lister() v1.LeaseLister { + return v1.NewLeaseLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/interface.go b/pkg/clients/informers/core/interface.go new file mode 100644 index 000000000..d95da8fcb --- /dev/null +++ b/pkg/clients/informers/core/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package core + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/core/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/core/v1/componentstatus.go b/pkg/clients/informers/core/v1/componentstatus.go new file mode 100644 index 000000000..e2473d646 --- /dev/null +++ b/pkg/clients/informers/core/v1/componentstatus.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ComponentStatusInformer provides access to a shared informer and lister for +// ComponentStatuses. +type ComponentStatusInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ComponentStatusLister +} + +type componentStatusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewComponentStatusInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredComponentStatusInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().Watch(context.TODO(), options) + }, + }, + &corev1.ComponentStatus{}, + resyncPeriod, + indexers, + ) +} + +func (f *componentStatusInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *componentStatusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ComponentStatus{}, f.defaultInformer) +} + +func (f *componentStatusInformer) Lister() v1.ComponentStatusLister { + return v1.NewComponentStatusLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/configmap.go b/pkg/clients/informers/core/v1/configmap.go new file mode 100644 index 000000000..b838a9fd2 --- /dev/null +++ b/pkg/clients/informers/core/v1/configmap.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ConfigMapInformer provides access to a shared informer and lister for +// ConfigMaps. +type ConfigMapInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ConfigMapLister +} + +type configMapInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConfigMapInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConfigMapInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ConfigMap{}, + resyncPeriod, + indexers, + ) +} + +func (f *configMapInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *configMapInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ConfigMap{}, f.defaultInformer) +} + +func (f *configMapInformer) Lister() v1.ConfigMapLister { + return v1.NewConfigMapLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/endpoints.go b/pkg/clients/informers/core/v1/endpoints.go new file mode 100644 index 000000000..10b02d9ff --- /dev/null +++ b/pkg/clients/informers/core/v1/endpoints.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointsInformer provides access to a shared informer and lister for +// Endpoints. +type EndpointsInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EndpointsLister +} + +type endpointsInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointsInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointsInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Endpoints{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointsInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointsInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Endpoints{}, f.defaultInformer) +} + +func (f *endpointsInformer) Lister() v1.EndpointsLister { + return v1.NewEndpointsLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/event.go b/pkg/clients/informers/core/v1/event.go new file mode 100644 index 000000000..8a899365b --- /dev/null +++ b/pkg/clients/informers/core/v1/event.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1.EventLister { + return v1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/interface.go b/pkg/clients/informers/core/v1/interface.go new file mode 100644 index 000000000..d0505e4eb --- /dev/null +++ b/pkg/clients/informers/core/v1/interface.go @@ -0,0 +1,137 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ComponentStatuses returns a ComponentStatusInformer. + ComponentStatuses() ComponentStatusInformer + // ConfigMaps returns a ConfigMapInformer. + ConfigMaps() ConfigMapInformer + // Endpoints returns a EndpointsInformer. + Endpoints() EndpointsInformer + // Events returns a EventInformer. + Events() EventInformer + // LimitRanges returns a LimitRangeInformer. + LimitRanges() LimitRangeInformer + // Namespaces returns a NamespaceInformer. + Namespaces() NamespaceInformer + // Nodes returns a NodeInformer. + Nodes() NodeInformer + // PersistentVolumes returns a PersistentVolumeInformer. + PersistentVolumes() PersistentVolumeInformer + // PersistentVolumeClaims returns a PersistentVolumeClaimInformer. + PersistentVolumeClaims() PersistentVolumeClaimInformer + // Pods returns a PodInformer. + Pods() PodInformer + // PodTemplates returns a PodTemplateInformer. + PodTemplates() PodTemplateInformer + // ReplicationControllers returns a ReplicationControllerInformer. + ReplicationControllers() ReplicationControllerInformer + // ResourceQuotas returns a ResourceQuotaInformer. + ResourceQuotas() ResourceQuotaInformer + // Secrets returns a SecretInformer. + Secrets() SecretInformer + // Services returns a ServiceInformer. + Services() ServiceInformer + // ServiceAccounts returns a ServiceAccountInformer. + ServiceAccounts() ServiceAccountInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ComponentStatuses returns a ComponentStatusInformer. +func (v *version) ComponentStatuses() ComponentStatusInformer { + return &componentStatusInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ConfigMaps returns a ConfigMapInformer. +func (v *version) ConfigMaps() ConfigMapInformer { + return &configMapInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Endpoints returns a EndpointsInformer. +func (v *version) Endpoints() EndpointsInformer { + return &endpointsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// LimitRanges returns a LimitRangeInformer. +func (v *version) LimitRanges() LimitRangeInformer { + return &limitRangeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Namespaces returns a NamespaceInformer. +func (v *version) Namespaces() NamespaceInformer { + return &namespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Nodes returns a NodeInformer. +func (v *version) Nodes() NodeInformer { + return &nodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumes returns a PersistentVolumeInformer. +func (v *version) PersistentVolumes() PersistentVolumeInformer { + return &persistentVolumeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumeClaims returns a PersistentVolumeClaimInformer. +func (v *version) PersistentVolumeClaims() PersistentVolumeClaimInformer { + return &persistentVolumeClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Pods returns a PodInformer. +func (v *version) Pods() PodInformer { + return &podInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodTemplates returns a PodTemplateInformer. +func (v *version) PodTemplates() PodTemplateInformer { + return &podTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicationControllers returns a ReplicationControllerInformer. +func (v *version) ReplicationControllers() ReplicationControllerInformer { + return &replicationControllerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceQuotas returns a ResourceQuotaInformer. +func (v *version) ResourceQuotas() ResourceQuotaInformer { + return &resourceQuotaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Secrets returns a SecretInformer. +func (v *version) Secrets() SecretInformer { + return &secretInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Services returns a ServiceInformer. +func (v *version) Services() ServiceInformer { + return &serviceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ServiceAccounts returns a ServiceAccountInformer. +func (v *version) ServiceAccounts() ServiceAccountInformer { + return &serviceAccountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/core/v1/limitrange.go b/pkg/clients/informers/core/v1/limitrange.go new file mode 100644 index 000000000..1f59aff1e --- /dev/null +++ b/pkg/clients/informers/core/v1/limitrange.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// LimitRangeInformer provides access to a shared informer and lister for +// LimitRanges. +type LimitRangeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.LimitRangeLister +} + +type limitRangeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLimitRangeInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLimitRangeInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.LimitRange{}, + resyncPeriod, + indexers, + ) +} + +func (f *limitRangeInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *limitRangeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.LimitRange{}, f.defaultInformer) +} + +func (f *limitRangeInformer) Lister() v1.LimitRangeLister { + return v1.NewLimitRangeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/namespace.go b/pkg/clients/informers/core/v1/namespace.go new file mode 100644 index 000000000..bf21fbd53 --- /dev/null +++ b/pkg/clients/informers/core/v1/namespace.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// NamespaceInformer provides access to a shared informer and lister for +// Namespaces. +type NamespaceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NamespaceLister +} + +type namespaceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNamespaceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNamespaceInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().Watch(context.TODO(), options) + }, + }, + &corev1.Namespace{}, + resyncPeriod, + indexers, + ) +} + +func (f *namespaceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *namespaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Namespace{}, f.defaultInformer) +} + +func (f *namespaceInformer) Lister() v1.NamespaceLister { + return v1.NewNamespaceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/node.go b/pkg/clients/informers/core/v1/node.go new file mode 100644 index 000000000..b3aa760dd --- /dev/null +++ b/pkg/clients/informers/core/v1/node.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// NodeInformer provides access to a shared informer and lister for +// Nodes. +type NodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NodeLister +} + +type nodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNodeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNodeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().Watch(context.TODO(), options) + }, + }, + &corev1.Node{}, + resyncPeriod, + indexers, + ) +} + +func (f *nodeInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *nodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Node{}, f.defaultInformer) +} + +func (f *nodeInformer) Lister() v1.NodeLister { + return v1.NewNodeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/persistentvolume.go b/pkg/clients/informers/core/v1/persistentvolume.go new file mode 100644 index 000000000..befc7adb5 --- /dev/null +++ b/pkg/clients/informers/core/v1/persistentvolume.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeInformer provides access to a shared informer and lister for +// PersistentVolumes. +type PersistentVolumeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PersistentVolumeLister +} + +type persistentVolumeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolume{}, + resyncPeriod, + indexers, + ) +} + +func (f *persistentVolumeInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *persistentVolumeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolume{}, f.defaultInformer) +} + +func (f *persistentVolumeInformer) Lister() v1.PersistentVolumeLister { + return v1.NewPersistentVolumeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/persistentvolumeclaim.go b/pkg/clients/informers/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..979a0725c --- /dev/null +++ b/pkg/clients/informers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeClaimInformer provides access to a shared informer and lister for +// PersistentVolumeClaims. +type PersistentVolumeClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PersistentVolumeClaimLister +} + +type persistentVolumeClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeClaimInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeClaimInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolumeClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *persistentVolumeClaimInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *persistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolumeClaim{}, f.defaultInformer) +} + +func (f *persistentVolumeClaimInformer) Lister() v1.PersistentVolumeClaimLister { + return v1.NewPersistentVolumeClaimLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/pod.go b/pkg/clients/informers/core/v1/pod.go new file mode 100644 index 000000000..135f78d69 --- /dev/null +++ b/pkg/clients/informers/core/v1/pod.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PodInformer provides access to a shared informer and lister for +// Pods. +type PodInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodLister +} + +type podInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Pod{}, + resyncPeriod, + indexers, + ) +} + +func (f *podInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Pod{}, f.defaultInformer) +} + +func (f *podInformer) Lister() v1.PodLister { + return v1.NewPodLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/podtemplate.go b/pkg/clients/informers/core/v1/podtemplate.go new file mode 100644 index 000000000..cba87f8c2 --- /dev/null +++ b/pkg/clients/informers/core/v1/podtemplate.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PodTemplateInformer provides access to a shared informer and lister for +// PodTemplates. +type PodTemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodTemplateLister +} + +type podTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PodTemplate{}, + resyncPeriod, + indexers, + ) +} + +func (f *podTemplateInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PodTemplate{}, f.defaultInformer) +} + +func (f *podTemplateInformer) Lister() v1.PodTemplateLister { + return v1.NewPodTemplateLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/replicationcontroller.go b/pkg/clients/informers/core/v1/replicationcontroller.go new file mode 100644 index 000000000..039c0a298 --- /dev/null +++ b/pkg/clients/informers/core/v1/replicationcontroller.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicationControllerInformer provides access to a shared informer and lister for +// ReplicationControllers. +type ReplicationControllerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ReplicationControllerLister +} + +type replicationControllerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicationControllerInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicationControllerInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ReplicationController{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicationControllerInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicationControllerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ReplicationController{}, f.defaultInformer) +} + +func (f *replicationControllerInformer) Lister() v1.ReplicationControllerLister { + return v1.NewReplicationControllerLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/resourcequota.go b/pkg/clients/informers/core/v1/resourcequota.go new file mode 100644 index 000000000..57af93542 --- /dev/null +++ b/pkg/clients/informers/core/v1/resourcequota.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceQuotaInformer provides access to a shared informer and lister for +// ResourceQuotas. +type ResourceQuotaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceQuotaLister +} + +type resourceQuotaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceQuotaInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceQuotaInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ResourceQuota{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceQuotaInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceQuotaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ResourceQuota{}, f.defaultInformer) +} + +func (f *resourceQuotaInformer) Lister() v1.ResourceQuotaLister { + return v1.NewResourceQuotaLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/secret.go b/pkg/clients/informers/core/v1/secret.go new file mode 100644 index 000000000..61c51c3d6 --- /dev/null +++ b/pkg/clients/informers/core/v1/secret.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SecretInformer provides access to a shared informer and lister for +// Secrets. +type SecretInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SecretLister +} + +type secretInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecretInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSecretInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Secret{}, + resyncPeriod, + indexers, + ) +} + +func (f *secretInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *secretInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Secret{}, f.defaultInformer) +} + +func (f *secretInformer) Lister() v1.SecretLister { + return v1.NewSecretLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/service.go b/pkg/clients/informers/core/v1/service.go new file mode 100644 index 000000000..904b25c56 --- /dev/null +++ b/pkg/clients/informers/core/v1/service.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceInformer provides access to a shared informer and lister for +// Services. +type ServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceLister +} + +type serviceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Service{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Service{}, f.defaultInformer) +} + +func (f *serviceInformer) Lister() v1.ServiceLister { + return v1.NewServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/core/v1/serviceaccount.go b/pkg/clients/informers/core/v1/serviceaccount.go new file mode 100644 index 000000000..0e9258506 --- /dev/null +++ b/pkg/clients/informers/core/v1/serviceaccount.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/core/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceAccountInformer provides access to a shared informer and lister for +// ServiceAccounts. +type ServiceAccountInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceAccountLister +} + +type serviceAccountInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceAccountInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceAccountInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ServiceAccount{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceAccountInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ServiceAccount{}, f.defaultInformer) +} + +func (f *serviceAccountInformer) Lister() v1.ServiceAccountLister { + return v1.NewServiceAccountLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/discovery/interface.go b/pkg/clients/informers/discovery/interface.go new file mode 100644 index 000000000..ee74c565a --- /dev/null +++ b/pkg/clients/informers/discovery/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package discovery + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/discovery/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/discovery/v1/endpointslice.go b/pkg/clients/informers/discovery/v1/endpointslice.go new file mode 100644 index 000000000..717ca8f7f --- /dev/null +++ b/pkg/clients/informers/discovery/v1/endpointslice.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/discovery/v1" + discoveryv1 "k8s.io/api/discovery/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EndpointSliceLister +} + +type endpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSliceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1.EndpointSlice{}, f.defaultInformer) +} + +func (f *endpointSliceInformer) Lister() v1.EndpointSliceLister { + return v1.NewEndpointSliceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/discovery/v1/interface.go b/pkg/clients/informers/discovery/v1/interface.go new file mode 100644 index 000000000..e5f389589 --- /dev/null +++ b/pkg/clients/informers/discovery/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EndpointSlices returns a EndpointSliceInformer. + EndpointSlices() EndpointSliceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v *version) EndpointSlices() EndpointSliceInformer { + return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/events/interface.go b/pkg/clients/informers/events/interface.go new file mode 100644 index 000000000..7d8475e40 --- /dev/null +++ b/pkg/clients/informers/events/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package events + +import ( + v1 "github.com/seal-io/walrus/pkg/clients/informers/events/v1" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/events/v1/event.go b/pkg/clients/informers/events/v1/event.go new file mode 100644 index 000000000..06a746628 --- /dev/null +++ b/pkg/clients/informers/events/v1/event.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/events/v1" + eventsv1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1.EventLister { + return v1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/events/v1/interface.go b/pkg/clients/informers/events/v1/interface.go new file mode 100644 index 000000000..185a1791a --- /dev/null +++ b/pkg/clients/informers/events/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Events returns a EventInformer. + Events() EventInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/factory.go b/pkg/clients/informers/factory.go new file mode 100644 index 000000000..c65fe35aa --- /dev/null +++ b/pkg/clients/informers/factory.go @@ -0,0 +1,338 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package informers + +import ( + reflect "reflect" + sync "sync" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + admissionregistration "github.com/seal-io/walrus/pkg/clients/informers/admissionregistration" + apiextensions "github.com/seal-io/walrus/pkg/clients/informers/apiextensions" + apiregistration "github.com/seal-io/walrus/pkg/clients/informers/apiregistration" + apps "github.com/seal-io/walrus/pkg/clients/informers/apps" + autoscaling "github.com/seal-io/walrus/pkg/clients/informers/autoscaling" + batch "github.com/seal-io/walrus/pkg/clients/informers/batch" + certificates "github.com/seal-io/walrus/pkg/clients/informers/certificates" + coordination "github.com/seal-io/walrus/pkg/clients/informers/coordination" + core "github.com/seal-io/walrus/pkg/clients/informers/core" + discovery "github.com/seal-io/walrus/pkg/clients/informers/discovery" + events "github.com/seal-io/walrus/pkg/clients/informers/events" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + rbac "github.com/seal-io/walrus/pkg/clients/informers/rbac" + scheduling "github.com/seal-io/walrus/pkg/clients/informers/scheduling" + storage "github.com/seal-io/walrus/pkg/clients/informers/storage" + walrus "github.com/seal-io/walrus/pkg/clients/informers/walrus" + walruscore "github.com/seal-io/walrus/pkg/clients/informers/walruscore" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client clientset.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + transform cache.TransformFunc + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// WithTransform sets a transform on all informers. +func WithTransform(transform cache.TransformFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.transform = transform + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client clientset.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client clientset.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.shuttingDown { + return + } + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() + f.startedInformers[informerType] = true + } + } +} + +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + informer.SetTransform(f.transform) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + + Admissionregistration() admissionregistration.Interface + Apiextensions() apiextensions.Interface + Apiregistration() apiregistration.Interface + Apps() apps.Interface + Autoscaling() autoscaling.Interface + Batch() batch.Interface + Certificates() certificates.Interface + Coordination() coordination.Interface + Core() core.Interface + Discovery() discovery.Interface + Events() events.Interface + Rbac() rbac.Interface + Scheduling() scheduling.Interface + Storage() storage.Interface + Walrus() walrus.Interface + Walruscore() walruscore.Interface +} + +func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface { + return admissionregistration.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Apiextensions() apiextensions.Interface { + return apiextensions.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Apiregistration() apiregistration.Interface { + return apiregistration.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Apps() apps.Interface { + return apps.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { + return autoscaling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Batch() batch.Interface { + return batch.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Certificates() certificates.Interface { + return certificates.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Coordination() coordination.Interface { + return coordination.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Core() core.Interface { + return core.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Discovery() discovery.Interface { + return discovery.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Events() events.Interface { + return events.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Rbac() rbac.Interface { + return rbac.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Scheduling() scheduling.Interface { + return scheduling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Storage() storage.Interface { + return storage.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Walrus() walrus.Interface { + return walrus.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Walruscore() walruscore.Interface { + return walruscore.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/clients/informers/generic.go b/pkg/clients/informers/generic.go new file mode 100644 index 000000000..b662ce1fa --- /dev/null +++ b/pkg/clients/informers/generic.go @@ -0,0 +1,213 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package informers + +import ( + "fmt" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + v1 "k8s.io/api/admissionregistration/v1" + appsv1 "k8s.io/api/apps/v1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v2 "k8s.io/api/autoscaling/v2" + batchv1 "k8s.io/api/batch/v1" + certificatesv1 "k8s.io/api/certificates/v1" + coordinationv1 "k8s.io/api/coordination/v1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + eventsv1 "k8s.io/api/events/v1" + rbacv1 "k8s.io/api/rbac/v1" + schedulingv1 "k8s.io/api/scheduling/v1" + storagev1 "k8s.io/api/storage/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=admissionregistration.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=apiextensions.k8s.io, Version=v1 + case apiextensionsv1.SchemeGroupVersion.WithResource("customresourcedefinitions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apiextensions().V1().CustomResourceDefinitions().Informer()}, nil + + // Group=apiregistration.k8s.io, Version=v1 + case apiregistrationv1.SchemeGroupVersion.WithResource("apiservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apiregistration().V1().APIServices().Informer()}, nil + + // Group=apps, Version=v1 + case appsv1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ControllerRevisions().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().DaemonSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().Deployments().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ReplicaSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().StatefulSets().Informer()}, nil + + // Group=autoscaling, Version=v1 + case autoscalingv1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2 + case v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2().HorizontalPodAutoscalers().Informer()}, nil + + // Group=batch, Version=v1 + case batchv1.SchemeGroupVersion.WithResource("cronjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil + case batchv1.SchemeGroupVersion.WithResource("jobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1 + case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1 + case coordinationv1.SchemeGroupVersion.WithResource("leases"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1().Leases().Informer()}, nil + + // Group=core, Version=v1 + case corev1.SchemeGroupVersion.WithResource("componentstatuses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ComponentStatuses().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("configmaps"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ConfigMaps().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("endpointses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Endpointses().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Events().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("limitranges"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().LimitRanges().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("namespaces"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Namespaces().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("nodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Nodes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumeclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumeClaims().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("pods"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Pods().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("podtemplates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PodTemplates().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("replicationcontrollers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ReplicationControllers().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("resourcequotas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ResourceQuotas().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("secrets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Secrets().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("services"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Services().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("serviceaccounts"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ServiceAccounts().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1 + case discoveryv1.SchemeGroupVersion.WithResource("endpointslices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1().EndpointSlices().Informer()}, nil + + // Group=events.k8s.io, Version=v1 + case eventsv1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1().Events().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1 + case rbacv1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoleBindings().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().Roles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().RoleBindings().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1 + case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil + + // Group=storage.k8s.io, Version=v1 + case storagev1.SchemeGroupVersion.WithResource("csidrivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIDrivers().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("csinodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSINodes().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIStorageCapacities().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("storageclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().VolumeAttachments().Informer()}, nil + + // Group=walrus.seal.io, Version=v1 + case walrusv1.SchemeGroupVersion.WithResource("catalogs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Catalogs().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("connectors"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Connectors().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("environments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Environments().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("projects"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Projects().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("resources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Resources().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("resourcedefinitions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().ResourceDefinitions().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("resourceruns"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().ResourceRuns().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("settings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Settings().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("templates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Templates().Informer()}, nil + case walrusv1.SchemeGroupVersion.WithResource("variables"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walrus().V1().Variables().Informer()}, nil + + // Group=walruscore.seal.io, Version=v1 + case walruscorev1.SchemeGroupVersion.WithResource("catalogs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walruscore().V1().Catalogs().Informer()}, nil + case walruscorev1.SchemeGroupVersion.WithResource("connectors"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walruscore().V1().Connectors().Informer()}, nil + case walruscorev1.SchemeGroupVersion.WithResource("resources"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walruscore().V1().Resources().Informer()}, nil + case walruscorev1.SchemeGroupVersion.WithResource("resourcedefinitions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walruscore().V1().ResourceDefinitions().Informer()}, nil + case walruscorev1.SchemeGroupVersion.WithResource("resourceruns"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walruscore().V1().ResourceRuns().Informer()}, nil + case walruscorev1.SchemeGroupVersion.WithResource("templates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Walruscore().V1().Templates().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/clients/informers/internalinterfaces/factory_interfaces.go b/pkg/clients/informers/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..573576d39 --- /dev/null +++ b/pkg/clients/informers/internalinterfaces/factory_interfaces.go @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes clientset.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(clientset.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/clients/informers/rbac/interface.go b/pkg/clients/informers/rbac/interface.go new file mode 100644 index 000000000..8794a4ce6 --- /dev/null +++ b/pkg/clients/informers/rbac/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package rbac + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/informers/rbac/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/rbac/v1/clusterrole.go b/pkg/clients/informers/rbac/v1/clusterrole.go new file mode 100644 index 000000000..588daeea9 --- /dev/null +++ b/pkg/clients/informers/rbac/v1/clusterrole.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/rbac/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1.ClusterRoleLister { + return v1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/rbac/v1/clusterrolebinding.go b/pkg/clients/informers/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..ea5484c48 --- /dev/null +++ b/pkg/clients/informers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/rbac/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1.ClusterRoleBindingLister { + return v1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/rbac/v1/interface.go b/pkg/clients/informers/rbac/v1/interface.go new file mode 100644 index 000000000..86953e811 --- /dev/null +++ b/pkg/clients/informers/rbac/v1/interface.go @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/rbac/v1/role.go b/pkg/clients/informers/rbac/v1/role.go new file mode 100644 index 000000000..66f121eb2 --- /dev/null +++ b/pkg/clients/informers/rbac/v1/role.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/rbac/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1.RoleLister { + return v1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/rbac/v1/rolebinding.go b/pkg/clients/informers/rbac/v1/rolebinding.go new file mode 100644 index 000000000..3184a6d46 --- /dev/null +++ b/pkg/clients/informers/rbac/v1/rolebinding.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/rbac/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1.RoleBindingLister { + return v1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/scheduling/interface.go b/pkg/clients/informers/scheduling/interface.go new file mode 100644 index 000000000..1d5744e9d --- /dev/null +++ b/pkg/clients/informers/scheduling/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package scheduling + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/informers/scheduling/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/scheduling/v1/interface.go b/pkg/clients/informers/scheduling/v1/interface.go new file mode 100644 index 000000000..d770e156e --- /dev/null +++ b/pkg/clients/informers/scheduling/v1/interface.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/scheduling/v1/priorityclass.go b/pkg/clients/informers/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..1baa1f502 --- /dev/null +++ b/pkg/clients/informers/scheduling/v1/priorityclass.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/scheduling/v1" + schedulingv1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1.PriorityClassLister { + return v1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/storage/interface.go b/pkg/clients/informers/storage/interface.go new file mode 100644 index 000000000..9dcfe4abb --- /dev/null +++ b/pkg/clients/informers/storage/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package storage + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/informers/storage/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/storage/v1/csidriver.go b/pkg/clients/informers/storage/v1/csidriver.go new file mode 100644 index 000000000..98c286d0b --- /dev/null +++ b/pkg/clients/informers/storage/v1/csidriver.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/storage/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSIDriverLister +} + +type cSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIDriverInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSIDriver{}, f.defaultInformer) +} + +func (f *cSIDriverInformer) Lister() v1.CSIDriverLister { + return v1.NewCSIDriverLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/storage/v1/csinode.go b/pkg/clients/informers/storage/v1/csinode.go new file mode 100644 index 000000000..b47f8216f --- /dev/null +++ b/pkg/clients/informers/storage/v1/csinode.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/storage/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSINodeLister +} + +type cSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSINodeInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSINode{}, f.defaultInformer) +} + +func (f *cSINodeInformer) Lister() v1.CSINodeLister { + return v1.NewCSINodeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/storage/v1/csistoragecapacity.go b/pkg/clients/informers/storage/v1/csistoragecapacity.go new file mode 100644 index 000000000..286e04810 --- /dev/null +++ b/pkg/clients/informers/storage/v1/csistoragecapacity.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/storage/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSIStorageCapacityLister +} + +type cSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIStorageCapacityInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f *cSIStorageCapacityInformer) Lister() v1.CSIStorageCapacityLister { + return v1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/storage/v1/interface.go b/pkg/clients/informers/storage/v1/interface.go new file mode 100644 index 000000000..535a000a1 --- /dev/null +++ b/pkg/clients/informers/storage/v1/interface.go @@ -0,0 +1,60 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIDrivers returns a CSIDriverInformer. + CSIDrivers() CSIDriverInformer + // CSINodes returns a CSINodeInformer. + CSINodes() CSINodeInformer + // CSIStorageCapacities returns a CSIStorageCapacityInformer. + CSIStorageCapacities() CSIStorageCapacityInformer + // StorageClasses returns a StorageClassInformer. + StorageClasses() StorageClassInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v *version) CSIDrivers() CSIDriverInformer { + return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v *version) CSINodes() CSINodeInformer { + return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { + return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v *version) StorageClasses() StorageClassInformer { + return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/storage/v1/storageclass.go b/pkg/clients/informers/storage/v1/storageclass.go new file mode 100644 index 000000000..71a92ead4 --- /dev/null +++ b/pkg/clients/informers/storage/v1/storageclass.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/storage/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.StorageClassLister +} + +type storageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageClassInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.StorageClass{}, f.defaultInformer) +} + +func (f *storageClassInformer) Lister() v1.StorageClassLister { + return v1.NewStorageClassLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/storage/v1/volumeattachment.go b/pkg/clients/informers/storage/v1/volumeattachment.go new file mode 100644 index 000000000..534e7a978 --- /dev/null +++ b/pkg/clients/informers/storage/v1/volumeattachment.go @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/storage/v1" + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1.VolumeAttachmentLister { + return v1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/interface.go b/pkg/clients/informers/walrus/interface.go new file mode 100644 index 000000000..6942e69e8 --- /dev/null +++ b/pkg/clients/informers/walrus/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package walrus + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/informers/walrus/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/walrus/v1/catalog.go b/pkg/clients/informers/walrus/v1/catalog.go new file mode 100644 index 000000000..7b27c2255 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/catalog.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CatalogInformer provides access to a shared informer and lister for +// Catalogs. +type CatalogInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CatalogLister +} + +type catalogInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCatalogInformer constructs a new informer for Catalog type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCatalogInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCatalogInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCatalogInformer constructs a new informer for Catalog type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCatalogInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Catalogs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Catalogs(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Catalog{}, + resyncPeriod, + indexers, + ) +} + +func (f *catalogInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCatalogInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *catalogInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Catalog{}, f.defaultInformer) +} + +func (f *catalogInformer) Lister() v1.CatalogLister { + return v1.NewCatalogLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/connector.go b/pkg/clients/informers/walrus/v1/connector.go new file mode 100644 index 000000000..99f88f6a7 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/connector.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ConnectorInformer provides access to a shared informer and lister for +// Connectors. +type ConnectorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ConnectorLister +} + +type connectorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConnectorInformer constructs a new informer for Connector type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConnectorInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConnectorInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConnectorInformer constructs a new informer for Connector type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConnectorInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Connectors(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Connectors(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Connector{}, + resyncPeriod, + indexers, + ) +} + +func (f *connectorInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConnectorInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *connectorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Connector{}, f.defaultInformer) +} + +func (f *connectorInformer) Lister() v1.ConnectorLister { + return v1.NewConnectorLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/environment.go b/pkg/clients/informers/walrus/v1/environment.go new file mode 100644 index 000000000..24c94dd2d --- /dev/null +++ b/pkg/clients/informers/walrus/v1/environment.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// EnvironmentInformer provides access to a shared informer and lister for +// Environments. +type EnvironmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EnvironmentLister +} + +type environmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEnvironmentInformer constructs a new informer for Environment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEnvironmentInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEnvironmentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEnvironmentInformer constructs a new informer for Environment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEnvironmentInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Environments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Environments(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Environment{}, + resyncPeriod, + indexers, + ) +} + +func (f *environmentInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEnvironmentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *environmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Environment{}, f.defaultInformer) +} + +func (f *environmentInformer) Lister() v1.EnvironmentLister { + return v1.NewEnvironmentLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/interface.go b/pkg/clients/informers/walrus/v1/interface.go new file mode 100644 index 000000000..a93056c95 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/interface.go @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Catalogs returns a CatalogInformer. + Catalogs() CatalogInformer + // Connectors returns a ConnectorInformer. + Connectors() ConnectorInformer + // Environments returns a EnvironmentInformer. + Environments() EnvironmentInformer + // Projects returns a ProjectInformer. + Projects() ProjectInformer + // Resources returns a ResourceInformer. + Resources() ResourceInformer + // ResourceDefinitions returns a ResourceDefinitionInformer. + ResourceDefinitions() ResourceDefinitionInformer + // ResourceRuns returns a ResourceRunInformer. + ResourceRuns() ResourceRunInformer + // Settings returns a SettingInformer. + Settings() SettingInformer + // Templates returns a TemplateInformer. + Templates() TemplateInformer + // Variables returns a VariableInformer. + Variables() VariableInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Catalogs returns a CatalogInformer. +func (v *version) Catalogs() CatalogInformer { + return &catalogInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Connectors returns a ConnectorInformer. +func (v *version) Connectors() ConnectorInformer { + return &connectorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Environments returns a EnvironmentInformer. +func (v *version) Environments() EnvironmentInformer { + return &environmentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Projects returns a ProjectInformer. +func (v *version) Projects() ProjectInformer { + return &projectInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Resources returns a ResourceInformer. +func (v *version) Resources() ResourceInformer { + return &resourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceDefinitions returns a ResourceDefinitionInformer. +func (v *version) ResourceDefinitions() ResourceDefinitionInformer { + return &resourceDefinitionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceRuns returns a ResourceRunInformer. +func (v *version) ResourceRuns() ResourceRunInformer { + return &resourceRunInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Settings returns a SettingInformer. +func (v *version) Settings() SettingInformer { + return &settingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Templates returns a TemplateInformer. +func (v *version) Templates() TemplateInformer { + return &templateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Variables returns a VariableInformer. +func (v *version) Variables() VariableInformer { + return &variableInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/walrus/v1/project.go b/pkg/clients/informers/walrus/v1/project.go new file mode 100644 index 000000000..043d6acb4 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/project.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ProjectInformer provides access to a shared informer and lister for +// Projects. +type ProjectInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ProjectLister +} + +type projectInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewProjectInformer constructs a new informer for Project type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewProjectInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredProjectInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredProjectInformer constructs a new informer for Project type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredProjectInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Projects(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Projects(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Project{}, + resyncPeriod, + indexers, + ) +} + +func (f *projectInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredProjectInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *projectInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Project{}, f.defaultInformer) +} + +func (f *projectInformer) Lister() v1.ProjectLister { + return v1.NewProjectLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/resource.go b/pkg/clients/informers/walrus/v1/resource.go new file mode 100644 index 000000000..1567c4847 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/resource.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceInformer provides access to a shared informer and lister for +// Resources. +type ResourceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceLister +} + +type resourceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceInformer constructs a new informer for Resource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceInformer constructs a new informer for Resource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Resources(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Resources(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Resource{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Resource{}, f.defaultInformer) +} + +func (f *resourceInformer) Lister() v1.ResourceLister { + return v1.NewResourceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/resourcedefinition.go b/pkg/clients/informers/walrus/v1/resourcedefinition.go new file mode 100644 index 000000000..b0fd9c7cc --- /dev/null +++ b/pkg/clients/informers/walrus/v1/resourcedefinition.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceDefinitionInformer provides access to a shared informer and lister for +// ResourceDefinitions. +type ResourceDefinitionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceDefinitionLister +} + +type resourceDefinitionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceDefinitionInformer constructs a new informer for ResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceDefinitionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceDefinitionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceDefinitionInformer constructs a new informer for ResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceDefinitionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().ResourceDefinitions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().ResourceDefinitions(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.ResourceDefinition{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceDefinitionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceDefinitionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceDefinitionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.ResourceDefinition{}, f.defaultInformer) +} + +func (f *resourceDefinitionInformer) Lister() v1.ResourceDefinitionLister { + return v1.NewResourceDefinitionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/resourcerun.go b/pkg/clients/informers/walrus/v1/resourcerun.go new file mode 100644 index 000000000..319cd8fd5 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/resourcerun.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceRunInformer provides access to a shared informer and lister for +// ResourceRuns. +type ResourceRunInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceRunLister +} + +type resourceRunInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceRunInformer constructs a new informer for ResourceRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceRunInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceRunInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceRunInformer constructs a new informer for ResourceRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceRunInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().ResourceRuns(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().ResourceRuns(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.ResourceRun{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceRunInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceRunInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceRunInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.ResourceRun{}, f.defaultInformer) +} + +func (f *resourceRunInformer) Lister() v1.ResourceRunLister { + return v1.NewResourceRunLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/setting.go b/pkg/clients/informers/walrus/v1/setting.go new file mode 100644 index 000000000..ff263d3a5 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/setting.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SettingInformer provides access to a shared informer and lister for +// Settings. +type SettingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SettingLister +} + +type settingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSettingInformer constructs a new informer for Setting type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSettingInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSettingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSettingInformer constructs a new informer for Setting type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSettingInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Settings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Settings(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Setting{}, + resyncPeriod, + indexers, + ) +} + +func (f *settingInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSettingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *settingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Setting{}, f.defaultInformer) +} + +func (f *settingInformer) Lister() v1.SettingLister { + return v1.NewSettingLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/template.go b/pkg/clients/informers/walrus/v1/template.go new file mode 100644 index 000000000..299c4fdea --- /dev/null +++ b/pkg/clients/informers/walrus/v1/template.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TemplateInformer provides access to a shared informer and lister for +// Templates. +type TemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.TemplateLister +} + +type templateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTemplateInformer constructs a new informer for Template type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTemplateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTemplateInformer constructs a new informer for Template type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Templates(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Templates(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Template{}, + resyncPeriod, + indexers, + ) +} + +func (f *templateInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *templateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Template{}, f.defaultInformer) +} + +func (f *templateInformer) Lister() v1.TemplateLister { + return v1.NewTemplateLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walrus/v1/variable.go b/pkg/clients/informers/walrus/v1/variable.go new file mode 100644 index 000000000..94bd4b925 --- /dev/null +++ b/pkg/clients/informers/walrus/v1/variable.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walrusv1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walrus/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// VariableInformer provides access to a shared informer and lister for +// Variables. +type VariableInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VariableLister +} + +type variableInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVariableInformer constructs a new informer for Variable type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVariableInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVariableInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVariableInformer constructs a new informer for Variable type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVariableInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Variables(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalrusV1().Variables(namespace).Watch(context.TODO(), options) + }, + }, + &walrusv1.Variable{}, + resyncPeriod, + indexers, + ) +} + +func (f *variableInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVariableInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *variableInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walrusv1.Variable{}, f.defaultInformer) +} + +func (f *variableInformer) Lister() v1.VariableLister { + return v1.NewVariableLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walruscore/interface.go b/pkg/clients/informers/walruscore/interface.go new file mode 100644 index 000000000..fc4dc4891 --- /dev/null +++ b/pkg/clients/informers/walruscore/interface.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package walruscore + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/informers/walruscore/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/clients/informers/walruscore/v1/catalog.go b/pkg/clients/informers/walruscore/v1/catalog.go new file mode 100644 index 000000000..98367d988 --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/catalog.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CatalogInformer provides access to a shared informer and lister for +// Catalogs. +type CatalogInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CatalogLister +} + +type catalogInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCatalogInformer constructs a new informer for Catalog type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCatalogInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCatalogInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCatalogInformer constructs a new informer for Catalog type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCatalogInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Catalogs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Catalogs(namespace).Watch(context.TODO(), options) + }, + }, + &walruscorev1.Catalog{}, + resyncPeriod, + indexers, + ) +} + +func (f *catalogInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCatalogInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *catalogInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walruscorev1.Catalog{}, f.defaultInformer) +} + +func (f *catalogInformer) Lister() v1.CatalogLister { + return v1.NewCatalogLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walruscore/v1/connector.go b/pkg/clients/informers/walruscore/v1/connector.go new file mode 100644 index 000000000..6da06b7fc --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/connector.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ConnectorInformer provides access to a shared informer and lister for +// Connectors. +type ConnectorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ConnectorLister +} + +type connectorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConnectorInformer constructs a new informer for Connector type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConnectorInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConnectorInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConnectorInformer constructs a new informer for Connector type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConnectorInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Connectors(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Connectors(namespace).Watch(context.TODO(), options) + }, + }, + &walruscorev1.Connector{}, + resyncPeriod, + indexers, + ) +} + +func (f *connectorInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConnectorInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *connectorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walruscorev1.Connector{}, f.defaultInformer) +} + +func (f *connectorInformer) Lister() v1.ConnectorLister { + return v1.NewConnectorLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walruscore/v1/interface.go b/pkg/clients/informers/walruscore/v1/interface.go new file mode 100644 index 000000000..9d7c10250 --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/interface.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Catalogs returns a CatalogInformer. + Catalogs() CatalogInformer + // Connectors returns a ConnectorInformer. + Connectors() ConnectorInformer + // Resources returns a ResourceInformer. + Resources() ResourceInformer + // ResourceDefinitions returns a ResourceDefinitionInformer. + ResourceDefinitions() ResourceDefinitionInformer + // ResourceRuns returns a ResourceRunInformer. + ResourceRuns() ResourceRunInformer + // Templates returns a TemplateInformer. + Templates() TemplateInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Catalogs returns a CatalogInformer. +func (v *version) Catalogs() CatalogInformer { + return &catalogInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Connectors returns a ConnectorInformer. +func (v *version) Connectors() ConnectorInformer { + return &connectorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Resources returns a ResourceInformer. +func (v *version) Resources() ResourceInformer { + return &resourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceDefinitions returns a ResourceDefinitionInformer. +func (v *version) ResourceDefinitions() ResourceDefinitionInformer { + return &resourceDefinitionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceRuns returns a ResourceRunInformer. +func (v *version) ResourceRuns() ResourceRunInformer { + return &resourceRunInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Templates returns a TemplateInformer. +func (v *version) Templates() TemplateInformer { + return &templateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/clients/informers/walruscore/v1/resource.go b/pkg/clients/informers/walruscore/v1/resource.go new file mode 100644 index 000000000..cc5b84543 --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/resource.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceInformer provides access to a shared informer and lister for +// Resources. +type ResourceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceLister +} + +type resourceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceInformer constructs a new informer for Resource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceInformer constructs a new informer for Resource type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Resources(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Resources(namespace).Watch(context.TODO(), options) + }, + }, + &walruscorev1.Resource{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walruscorev1.Resource{}, f.defaultInformer) +} + +func (f *resourceInformer) Lister() v1.ResourceLister { + return v1.NewResourceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walruscore/v1/resourcedefinition.go b/pkg/clients/informers/walruscore/v1/resourcedefinition.go new file mode 100644 index 000000000..84c9c3e41 --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/resourcedefinition.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceDefinitionInformer provides access to a shared informer and lister for +// ResourceDefinitions. +type ResourceDefinitionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceDefinitionLister +} + +type resourceDefinitionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceDefinitionInformer constructs a new informer for ResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceDefinitionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceDefinitionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceDefinitionInformer constructs a new informer for ResourceDefinition type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceDefinitionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().ResourceDefinitions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().ResourceDefinitions(namespace).Watch(context.TODO(), options) + }, + }, + &walruscorev1.ResourceDefinition{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceDefinitionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceDefinitionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceDefinitionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walruscorev1.ResourceDefinition{}, f.defaultInformer) +} + +func (f *resourceDefinitionInformer) Lister() v1.ResourceDefinitionLister { + return v1.NewResourceDefinitionLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walruscore/v1/resourcerun.go b/pkg/clients/informers/walruscore/v1/resourcerun.go new file mode 100644 index 000000000..fa135ba89 --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/resourcerun.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceRunInformer provides access to a shared informer and lister for +// ResourceRuns. +type ResourceRunInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceRunLister +} + +type resourceRunInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceRunInformer constructs a new informer for ResourceRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceRunInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceRunInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceRunInformer constructs a new informer for ResourceRun type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceRunInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().ResourceRuns(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().ResourceRuns(namespace).Watch(context.TODO(), options) + }, + }, + &walruscorev1.ResourceRun{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceRunInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceRunInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceRunInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walruscorev1.ResourceRun{}, f.defaultInformer) +} + +func (f *resourceRunInformer) Lister() v1.ResourceRunLister { + return v1.NewResourceRunLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/informers/walruscore/v1/template.go b/pkg/clients/informers/walruscore/v1/template.go new file mode 100644 index 000000000..a258ab560 --- /dev/null +++ b/pkg/clients/informers/walruscore/v1/template.go @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + walruscorev1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + clientset "github.com/seal-io/walrus/pkg/clients/clientset" + internalinterfaces "github.com/seal-io/walrus/pkg/clients/informers/internalinterfaces" + v1 "github.com/seal-io/walrus/pkg/clients/listers/walruscore/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TemplateInformer provides access to a shared informer and lister for +// Templates. +type TemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.TemplateLister +} + +type templateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTemplateInformer constructs a new informer for Template type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTemplateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTemplateInformer constructs a new informer for Template type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTemplateInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Templates(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WalruscoreV1().Templates(namespace).Watch(context.TODO(), options) + }, + }, + &walruscorev1.Template{}, + resyncPeriod, + indexers, + ) +} + +func (f *templateInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *templateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&walruscorev1.Template{}, f.defaultInformer) +} + +func (f *templateInformer) Lister() v1.TemplateLister { + return v1.NewTemplateLister(f.Informer().GetIndexer()) +} diff --git a/pkg/clients/listers/admissionregistration/v1/expansion_generated.go b/pkg/clients/listers/admissionregistration/v1/expansion_generated.go new file mode 100644 index 000000000..a0002d693 --- /dev/null +++ b/pkg/clients/listers/admissionregistration/v1/expansion_generated.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// MutatingWebhookConfigurationListerExpansion allows custom methods to be added to +// MutatingWebhookConfigurationLister. +type MutatingWebhookConfigurationListerExpansion interface{} + +// ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to +// ValidatingWebhookConfigurationLister. +type ValidatingWebhookConfigurationListerExpansion interface{} diff --git a/pkg/clients/listers/admissionregistration/v1/mutatingwebhookconfiguration.go b/pkg/clients/listers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..0e2fdf40c --- /dev/null +++ b/pkg/clients/listers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type MutatingWebhookConfigurationLister interface { + // List lists all MutatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.MutatingWebhookConfiguration, err error) + // Get retrieves the MutatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.MutatingWebhookConfiguration, error) + MutatingWebhookConfigurationListerExpansion +} + +// mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. +type mutatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. +func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { + return &mutatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all MutatingWebhookConfigurations in the indexer. +func (s *mutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the MutatingWebhookConfiguration from the index for a given name. +func (s *mutatingWebhookConfigurationLister) Get(name string) (*v1.MutatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("mutatingwebhookconfiguration"), name) + } + return obj.(*v1.MutatingWebhookConfiguration), nil +} diff --git a/pkg/clients/listers/admissionregistration/v1/validatingwebhookconfiguration.go b/pkg/clients/listers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..b53761092 --- /dev/null +++ b/pkg/clients/listers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type ValidatingWebhookConfigurationLister interface { + // List lists all ValidatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ValidatingWebhookConfiguration, err error) + // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ValidatingWebhookConfiguration, error) + ValidatingWebhookConfigurationListerExpansion +} + +// validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. +type validatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. +func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { + return &validatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all ValidatingWebhookConfigurations in the indexer. +func (s *validatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the ValidatingWebhookConfiguration from the index for a given name. +func (s *validatingWebhookConfigurationLister) Get(name string) (*v1.ValidatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("validatingwebhookconfiguration"), name) + } + return obj.(*v1.ValidatingWebhookConfiguration), nil +} diff --git a/pkg/clients/listers/apiextensions/v1/customresourcedefinition.go b/pkg/clients/listers/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 000000000..6ab70eaf5 --- /dev/null +++ b/pkg/clients/listers/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CustomResourceDefinitionLister helps list CustomResourceDefinitions. +// All objects returned here must be treated as read-only. +type CustomResourceDefinitionLister interface { + // List lists all CustomResourceDefinitions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CustomResourceDefinition, err error) + // Get retrieves the CustomResourceDefinition from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CustomResourceDefinition, error) + CustomResourceDefinitionListerExpansion +} + +// customResourceDefinitionLister implements the CustomResourceDefinitionLister interface. +type customResourceDefinitionLister struct { + indexer cache.Indexer +} + +// NewCustomResourceDefinitionLister returns a new CustomResourceDefinitionLister. +func NewCustomResourceDefinitionLister(indexer cache.Indexer) CustomResourceDefinitionLister { + return &customResourceDefinitionLister{indexer: indexer} +} + +// List lists all CustomResourceDefinitions in the indexer. +func (s *customResourceDefinitionLister) List(selector labels.Selector) (ret []*v1.CustomResourceDefinition, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CustomResourceDefinition)) + }) + return ret, err +} + +// Get retrieves the CustomResourceDefinition from the index for a given name. +func (s *customResourceDefinitionLister) Get(name string) (*v1.CustomResourceDefinition, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("customresourcedefinition"), name) + } + return obj.(*v1.CustomResourceDefinition), nil +} diff --git a/pkg/clients/listers/apiextensions/v1/expansion_generated.go b/pkg/clients/listers/apiextensions/v1/expansion_generated.go new file mode 100644 index 000000000..946af2d4b --- /dev/null +++ b/pkg/clients/listers/apiextensions/v1/expansion_generated.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionListerExpansion allows custom methods to be added to +// CustomResourceDefinitionLister. +type CustomResourceDefinitionListerExpansion interface{} diff --git a/pkg/clients/listers/apiregistration/v1/apiservice.go b/pkg/clients/listers/apiregistration/v1/apiservice.go new file mode 100644 index 000000000..1f6e24737 --- /dev/null +++ b/pkg/clients/listers/apiregistration/v1/apiservice.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +// APIServiceLister helps list APIServices. +// All objects returned here must be treated as read-only. +type APIServiceLister interface { + // List lists all APIServices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.APIService, err error) + // Get retrieves the APIService from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.APIService, error) + APIServiceListerExpansion +} + +// aPIServiceLister implements the APIServiceLister interface. +type aPIServiceLister struct { + indexer cache.Indexer +} + +// NewAPIServiceLister returns a new APIServiceLister. +func NewAPIServiceLister(indexer cache.Indexer) APIServiceLister { + return &aPIServiceLister{indexer: indexer} +} + +// List lists all APIServices in the indexer. +func (s *aPIServiceLister) List(selector labels.Selector) (ret []*v1.APIService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.APIService)) + }) + return ret, err +} + +// Get retrieves the APIService from the index for a given name. +func (s *aPIServiceLister) Get(name string) (*v1.APIService, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("apiservice"), name) + } + return obj.(*v1.APIService), nil +} diff --git a/pkg/clients/listers/apiregistration/v1/expansion_generated.go b/pkg/clients/listers/apiregistration/v1/expansion_generated.go new file mode 100644 index 000000000..2a617aa0f --- /dev/null +++ b/pkg/clients/listers/apiregistration/v1/expansion_generated.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// APIServiceListerExpansion allows custom methods to be added to +// APIServiceLister. +type APIServiceListerExpansion interface{} diff --git a/pkg/clients/listers/apps/v1/controllerrevision.go b/pkg/clients/listers/apps/v1/controllerrevision.go new file mode 100644 index 000000000..0e3a35a2a --- /dev/null +++ b/pkg/clients/listers/apps/v1/controllerrevision.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("controllerrevision"), name) + } + return obj.(*v1.ControllerRevision), nil +} diff --git a/pkg/clients/listers/apps/v1/daemonset.go b/pkg/clients/listers/apps/v1/daemonset.go new file mode 100644 index 000000000..cb4780f92 --- /dev/null +++ b/pkg/clients/listers/apps/v1/daemonset.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("daemonset"), name) + } + return obj.(*v1.DaemonSet), nil +} diff --git a/pkg/clients/listers/apps/v1/deployment.go b/pkg/clients/listers/apps/v1/deployment.go new file mode 100644 index 000000000..dd34442c6 --- /dev/null +++ b/pkg/clients/listers/apps/v1/deployment.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("deployment"), name) + } + return obj.(*v1.Deployment), nil +} diff --git a/pkg/clients/listers/apps/v1/expansion_generated.go b/pkg/clients/listers/apps/v1/expansion_generated.go new file mode 100644 index 000000000..a0ee87850 --- /dev/null +++ b/pkg/clients/listers/apps/v1/expansion_generated.go @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface{} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface{} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface{} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/apps/v1/replicaset.go b/pkg/clients/listers/apps/v1/replicaset.go new file mode 100644 index 000000000..46e15c975 --- /dev/null +++ b/pkg/clients/listers/apps/v1/replicaset.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("replicaset"), name) + } + return obj.(*v1.ReplicaSet), nil +} diff --git a/pkg/clients/listers/apps/v1/statefulset.go b/pkg/clients/listers/apps/v1/statefulset.go new file mode 100644 index 000000000..8d7d0b107 --- /dev/null +++ b/pkg/clients/listers/apps/v1/statefulset.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("statefulset"), name) + } + return obj.(*v1.StatefulSet), nil +} diff --git a/pkg/clients/listers/autoscaling/v1/expansion_generated.go b/pkg/clients/listers/autoscaling/v1/expansion_generated.go new file mode 100644 index 000000000..7e6aaba21 --- /dev/null +++ b/pkg/clients/listers/autoscaling/v1/expansion_generated.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/autoscaling/v1/horizontalpodautoscaler.go b/pkg/clients/listers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..43ee067c3 --- /dev/null +++ b/pkg/clients/listers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/autoscaling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v1.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("horizontalpodautoscaler"), name) + } + return obj.(*v1.HorizontalPodAutoscaler), nil +} diff --git a/pkg/clients/listers/autoscaling/v2/expansion_generated.go b/pkg/clients/listers/autoscaling/v2/expansion_generated.go new file mode 100644 index 000000000..3a8a2b3f9 --- /dev/null +++ b/pkg/clients/listers/autoscaling/v2/expansion_generated.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/autoscaling/v2/horizontalpodautoscaler.go b/pkg/clients/listers/autoscaling/v2/horizontalpodautoscaler.go new file mode 100644 index 000000000..c42d0de98 --- /dev/null +++ b/pkg/clients/listers/autoscaling/v2/horizontalpodautoscaler.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v2 + +import ( + v2 "k8s.io/api/autoscaling/v2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v2.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2.SchemeResource("horizontalpodautoscaler"), name) + } + return obj.(*v2.HorizontalPodAutoscaler), nil +} diff --git a/pkg/clients/listers/batch/v1/cronjob.go b/pkg/clients/listers/batch/v1/cronjob.go new file mode 100644 index 000000000..f7aa9cc9a --- /dev/null +++ b/pkg/clients/listers/batch/v1/cronjob.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CronJobLister helps list CronJobs. +// All objects returned here must be treated as read-only. +type CronJobLister interface { + // List lists all CronJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CronJob, err error) + // CronJobs returns an object that can list and get CronJobs. + CronJobs(namespace string) CronJobNamespaceLister + CronJobListerExpansion +} + +// cronJobLister implements the CronJobLister interface. +type cronJobLister struct { + indexer cache.Indexer +} + +// NewCronJobLister returns a new CronJobLister. +func NewCronJobLister(indexer cache.Indexer) CronJobLister { + return &cronJobLister{indexer: indexer} +} + +// List lists all CronJobs in the indexer. +func (s *cronJobLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get CronJobs. +func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister { + return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CronJobNamespaceLister helps list and get CronJobs. +// All objects returned here must be treated as read-only. +type CronJobNamespaceLister interface { + // List lists all CronJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CronJob, err error) + // Get retrieves the CronJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CronJob, error) + CronJobNamespaceListerExpansion +} + +// cronJobNamespaceLister implements the CronJobNamespaceLister +// interface. +type cronJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CronJobs in the indexer for a given namespace. +func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CronJob)) + }) + return ret, err +} + +// Get retrieves the CronJob from the indexer for a given namespace and name. +func (s cronJobNamespaceLister) Get(name string) (*v1.CronJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("cronjob"), name) + } + return obj.(*v1.CronJob), nil +} diff --git a/pkg/clients/listers/batch/v1/expansion_generated.go b/pkg/clients/listers/batch/v1/expansion_generated.go new file mode 100644 index 000000000..00fe2f8be --- /dev/null +++ b/pkg/clients/listers/batch/v1/expansion_generated.go @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CronJobListerExpansion allows custom methods to be added to +// CronJobLister. +type CronJobListerExpansion interface{} + +// CronJobNamespaceListerExpansion allows custom methods to be added to +// CronJobNamespaceLister. +type CronJobNamespaceListerExpansion interface{} + +// JobListerExpansion allows custom methods to be added to +// JobLister. +type JobListerExpansion interface{} + +// JobNamespaceListerExpansion allows custom methods to be added to +// JobNamespaceLister. +type JobNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/batch/v1/job.go b/pkg/clients/listers/batch/v1/job.go new file mode 100644 index 000000000..088d1f5dd --- /dev/null +++ b/pkg/clients/listers/batch/v1/job.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// JobLister helps list Jobs. +// All objects returned here must be treated as read-only. +type JobLister interface { + // List lists all Jobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Jobs returns an object that can list and get Jobs. + Jobs(namespace string) JobNamespaceLister + JobListerExpansion +} + +// jobLister implements the JobLister interface. +type jobLister struct { + indexer cache.Indexer +} + +// NewJobLister returns a new JobLister. +func NewJobLister(indexer cache.Indexer) JobLister { + return &jobLister{indexer: indexer} +} + +// List lists all Jobs in the indexer. +func (s *jobLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Jobs returns an object that can list and get Jobs. +func (s *jobLister) Jobs(namespace string) JobNamespaceLister { + return jobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// JobNamespaceLister helps list and get Jobs. +// All objects returned here must be treated as read-only. +type JobNamespaceLister interface { + // List lists all Jobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Get retrieves the Job from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Job, error) + JobNamespaceListerExpansion +} + +// jobNamespaceLister implements the JobNamespaceLister +// interface. +type jobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Jobs in the indexer for a given namespace. +func (s jobNamespaceLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Get retrieves the Job from the indexer for a given namespace and name. +func (s jobNamespaceLister) Get(name string) (*v1.Job, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("job"), name) + } + return obj.(*v1.Job), nil +} diff --git a/pkg/clients/listers/certificates/v1/certificatesigningrequest.go b/pkg/clients/listers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..7a82c7013 --- /dev/null +++ b/pkg/clients/listers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/certificates/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestLister helps list CertificateSigningRequests. +// All objects returned here must be treated as read-only. +type CertificateSigningRequestLister interface { + // List lists all CertificateSigningRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CertificateSigningRequest, err error) + // Get retrieves the CertificateSigningRequest from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CertificateSigningRequest, error) + CertificateSigningRequestListerExpansion +} + +// certificateSigningRequestLister implements the CertificateSigningRequestLister interface. +type certificateSigningRequestLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestLister returns a new CertificateSigningRequestLister. +func NewCertificateSigningRequestLister(indexer cache.Indexer) CertificateSigningRequestLister { + return &certificateSigningRequestLister{indexer: indexer} +} + +// List lists all CertificateSigningRequests in the indexer. +func (s *certificateSigningRequestLister) List(selector labels.Selector) (ret []*v1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the CertificateSigningRequest from the index for a given name. +func (s *certificateSigningRequestLister) Get(name string) (*v1.CertificateSigningRequest, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("certificatesigningrequest"), name) + } + return obj.(*v1.CertificateSigningRequest), nil +} diff --git a/pkg/clients/listers/certificates/v1/expansion_generated.go b/pkg/clients/listers/certificates/v1/expansion_generated.go new file mode 100644 index 000000000..68dd05d69 --- /dev/null +++ b/pkg/clients/listers/certificates/v1/expansion_generated.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CertificateSigningRequestListerExpansion allows custom methods to be added to +// CertificateSigningRequestLister. +type CertificateSigningRequestListerExpansion interface{} diff --git a/pkg/clients/listers/coordination/v1/expansion_generated.go b/pkg/clients/listers/coordination/v1/expansion_generated.go new file mode 100644 index 000000000..33038522a --- /dev/null +++ b/pkg/clients/listers/coordination/v1/expansion_generated.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// LeaseListerExpansion allows custom methods to be added to +// LeaseLister. +type LeaseListerExpansion interface{} + +// LeaseNamespaceListerExpansion allows custom methods to be added to +// LeaseNamespaceLister. +type LeaseNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/coordination/v1/lease.go b/pkg/clients/listers/coordination/v1/lease.go new file mode 100644 index 000000000..8a5cb4b36 --- /dev/null +++ b/pkg/clients/listers/coordination/v1/lease.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/coordination/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LeaseLister helps list Leases. +// All objects returned here must be treated as read-only. +type LeaseLister interface { + // List lists all Leases in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Lease, err error) + // Leases returns an object that can list and get Leases. + Leases(namespace string) LeaseNamespaceLister + LeaseListerExpansion +} + +// leaseLister implements the LeaseLister interface. +type leaseLister struct { + indexer cache.Indexer +} + +// NewLeaseLister returns a new LeaseLister. +func NewLeaseLister(indexer cache.Indexer) LeaseLister { + return &leaseLister{indexer: indexer} +} + +// List lists all Leases in the indexer. +func (s *leaseLister) List(selector labels.Selector) (ret []*v1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get Leases. +func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { + return leaseNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LeaseNamespaceLister helps list and get Leases. +// All objects returned here must be treated as read-only. +type LeaseNamespaceLister interface { + // List lists all Leases in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Lease, err error) + // Get retrieves the Lease from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Lease, error) + LeaseNamespaceListerExpansion +} + +// leaseNamespaceLister implements the LeaseNamespaceLister +// interface. +type leaseNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Leases in the indexer for a given namespace. +func (s leaseNamespaceLister) List(selector labels.Selector) (ret []*v1.Lease, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Lease)) + }) + return ret, err +} + +// Get retrieves the Lease from the indexer for a given namespace and name. +func (s leaseNamespaceLister) Get(name string) (*v1.Lease, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("lease"), name) + } + return obj.(*v1.Lease), nil +} diff --git a/pkg/clients/listers/core/v1/componentstatus.go b/pkg/clients/listers/core/v1/componentstatus.go new file mode 100644 index 000000000..e2847944e --- /dev/null +++ b/pkg/clients/listers/core/v1/componentstatus.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ComponentStatusLister helps list ComponentStatuses. +// All objects returned here must be treated as read-only. +type ComponentStatusLister interface { + // List lists all ComponentStatuses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ComponentStatus, err error) + // Get retrieves the ComponentStatus from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ComponentStatus, error) + ComponentStatusListerExpansion +} + +// componentStatusLister implements the ComponentStatusLister interface. +type componentStatusLister struct { + indexer cache.Indexer +} + +// NewComponentStatusLister returns a new ComponentStatusLister. +func NewComponentStatusLister(indexer cache.Indexer) ComponentStatusLister { + return &componentStatusLister{indexer: indexer} +} + +// List lists all ComponentStatuses in the indexer. +func (s *componentStatusLister) List(selector labels.Selector) (ret []*v1.ComponentStatus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ComponentStatus)) + }) + return ret, err +} + +// Get retrieves the ComponentStatus from the index for a given name. +func (s *componentStatusLister) Get(name string) (*v1.ComponentStatus, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("componentstatus"), name) + } + return obj.(*v1.ComponentStatus), nil +} diff --git a/pkg/clients/listers/core/v1/configmap.go b/pkg/clients/listers/core/v1/configmap.go new file mode 100644 index 000000000..bee8c761c --- /dev/null +++ b/pkg/clients/listers/core/v1/configmap.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ConfigMapLister helps list ConfigMaps. +// All objects returned here must be treated as read-only. +type ConfigMapLister interface { + // List lists all ConfigMaps in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ConfigMap, err error) + // ConfigMaps returns an object that can list and get ConfigMaps. + ConfigMaps(namespace string) ConfigMapNamespaceLister + ConfigMapListerExpansion +} + +// configMapLister implements the ConfigMapLister interface. +type configMapLister struct { + indexer cache.Indexer +} + +// NewConfigMapLister returns a new ConfigMapLister. +func NewConfigMapLister(indexer cache.Indexer) ConfigMapLister { + return &configMapLister{indexer: indexer} +} + +// List lists all ConfigMaps in the indexer. +func (s *configMapLister) List(selector labels.Selector) (ret []*v1.ConfigMap, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ConfigMap)) + }) + return ret, err +} + +// ConfigMaps returns an object that can list and get ConfigMaps. +func (s *configMapLister) ConfigMaps(namespace string) ConfigMapNamespaceLister { + return configMapNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ConfigMapNamespaceLister helps list and get ConfigMaps. +// All objects returned here must be treated as read-only. +type ConfigMapNamespaceLister interface { + // List lists all ConfigMaps in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ConfigMap, err error) + // Get retrieves the ConfigMap from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ConfigMap, error) + ConfigMapNamespaceListerExpansion +} + +// configMapNamespaceLister implements the ConfigMapNamespaceLister +// interface. +type configMapNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ConfigMaps in the indexer for a given namespace. +func (s configMapNamespaceLister) List(selector labels.Selector) (ret []*v1.ConfigMap, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ConfigMap)) + }) + return ret, err +} + +// Get retrieves the ConfigMap from the indexer for a given namespace and name. +func (s configMapNamespaceLister) Get(name string) (*v1.ConfigMap, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("configmap"), name) + } + return obj.(*v1.ConfigMap), nil +} diff --git a/pkg/clients/listers/core/v1/endpoints.go b/pkg/clients/listers/core/v1/endpoints.go new file mode 100644 index 000000000..2271ce02c --- /dev/null +++ b/pkg/clients/listers/core/v1/endpoints.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointsLister helps list Endpoints. +// All objects returned here must be treated as read-only. +type EndpointsLister interface { + // List lists all Endpoints in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Endpoints, err error) + // Endpoints returns an object that can list and get Endpoints. + Endpoints(namespace string) EndpointsNamespaceLister + EndpointsListerExpansion +} + +// endpointsLister implements the EndpointsLister interface. +type endpointsLister struct { + indexer cache.Indexer +} + +// NewEndpointsLister returns a new EndpointsLister. +func NewEndpointsLister(indexer cache.Indexer) EndpointsLister { + return &endpointsLister{indexer: indexer} +} + +// List lists all Endpoints in the indexer. +func (s *endpointsLister) List(selector labels.Selector) (ret []*v1.Endpoints, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Endpoints)) + }) + return ret, err +} + +// Endpoints returns an object that can list and get Endpoints. +func (s *endpointsLister) Endpoints(namespace string) EndpointsNamespaceLister { + return endpointsNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointsNamespaceLister helps list and get Endpoints. +// All objects returned here must be treated as read-only. +type EndpointsNamespaceLister interface { + // List lists all Endpoints in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Endpoints, err error) + // Get retrieves the Endpoints from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Endpoints, error) + EndpointsNamespaceListerExpansion +} + +// endpointsNamespaceLister implements the EndpointsNamespaceLister +// interface. +type endpointsNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Endpoints in the indexer for a given namespace. +func (s endpointsNamespaceLister) List(selector labels.Selector) (ret []*v1.Endpoints, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Endpoints)) + }) + return ret, err +} + +// Get retrieves the Endpoints from the indexer for a given namespace and name. +func (s endpointsNamespaceLister) Get(name string) (*v1.Endpoints, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("endpoints"), name) + } + return obj.(*v1.Endpoints), nil +} diff --git a/pkg/clients/listers/core/v1/event.go b/pkg/clients/listers/core/v1/event.go new file mode 100644 index 000000000..8a078562c --- /dev/null +++ b/pkg/clients/listers/core/v1/event.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("event"), name) + } + return obj.(*v1.Event), nil +} diff --git a/pkg/clients/listers/core/v1/expansion_generated.go b/pkg/clients/listers/core/v1/expansion_generated.go new file mode 100644 index 000000000..61999b690 --- /dev/null +++ b/pkg/clients/listers/core/v1/expansion_generated.go @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ComponentStatusListerExpansion allows custom methods to be added to +// ComponentStatusLister. +type ComponentStatusListerExpansion interface{} + +// ConfigMapListerExpansion allows custom methods to be added to +// ConfigMapLister. +type ConfigMapListerExpansion interface{} + +// ConfigMapNamespaceListerExpansion allows custom methods to be added to +// ConfigMapNamespaceLister. +type ConfigMapNamespaceListerExpansion interface{} + +// EndpointsListerExpansion allows custom methods to be added to +// EndpointsLister. +type EndpointsListerExpansion interface{} + +// EndpointsNamespaceListerExpansion allows custom methods to be added to +// EndpointsNamespaceLister. +type EndpointsNamespaceListerExpansion interface{} + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} + +// LimitRangeListerExpansion allows custom methods to be added to +// LimitRangeLister. +type LimitRangeListerExpansion interface{} + +// LimitRangeNamespaceListerExpansion allows custom methods to be added to +// LimitRangeNamespaceLister. +type LimitRangeNamespaceListerExpansion interface{} + +// NamespaceListerExpansion allows custom methods to be added to +// NamespaceLister. +type NamespaceListerExpansion interface{} + +// NodeListerExpansion allows custom methods to be added to +// NodeLister. +type NodeListerExpansion interface{} + +// PersistentVolumeListerExpansion allows custom methods to be added to +// PersistentVolumeLister. +type PersistentVolumeListerExpansion interface{} + +// PersistentVolumeClaimListerExpansion allows custom methods to be added to +// PersistentVolumeClaimLister. +type PersistentVolumeClaimListerExpansion interface{} + +// PersistentVolumeClaimNamespaceListerExpansion allows custom methods to be added to +// PersistentVolumeClaimNamespaceLister. +type PersistentVolumeClaimNamespaceListerExpansion interface{} + +// PodListerExpansion allows custom methods to be added to +// PodLister. +type PodListerExpansion interface{} + +// PodNamespaceListerExpansion allows custom methods to be added to +// PodNamespaceLister. +type PodNamespaceListerExpansion interface{} + +// PodTemplateListerExpansion allows custom methods to be added to +// PodTemplateLister. +type PodTemplateListerExpansion interface{} + +// PodTemplateNamespaceListerExpansion allows custom methods to be added to +// PodTemplateNamespaceLister. +type PodTemplateNamespaceListerExpansion interface{} + +// ReplicationControllerListerExpansion allows custom methods to be added to +// ReplicationControllerLister. +type ReplicationControllerListerExpansion interface{} + +// ReplicationControllerNamespaceListerExpansion allows custom methods to be added to +// ReplicationControllerNamespaceLister. +type ReplicationControllerNamespaceListerExpansion interface{} + +// ResourceQuotaListerExpansion allows custom methods to be added to +// ResourceQuotaLister. +type ResourceQuotaListerExpansion interface{} + +// ResourceQuotaNamespaceListerExpansion allows custom methods to be added to +// ResourceQuotaNamespaceLister. +type ResourceQuotaNamespaceListerExpansion interface{} + +// SecretListerExpansion allows custom methods to be added to +// SecretLister. +type SecretListerExpansion interface{} + +// SecretNamespaceListerExpansion allows custom methods to be added to +// SecretNamespaceLister. +type SecretNamespaceListerExpansion interface{} + +// ServiceListerExpansion allows custom methods to be added to +// ServiceLister. +type ServiceListerExpansion interface{} + +// ServiceNamespaceListerExpansion allows custom methods to be added to +// ServiceNamespaceLister. +type ServiceNamespaceListerExpansion interface{} + +// ServiceAccountListerExpansion allows custom methods to be added to +// ServiceAccountLister. +type ServiceAccountListerExpansion interface{} + +// ServiceAccountNamespaceListerExpansion allows custom methods to be added to +// ServiceAccountNamespaceLister. +type ServiceAccountNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/core/v1/limitrange.go b/pkg/clients/listers/core/v1/limitrange.go new file mode 100644 index 000000000..2909f9748 --- /dev/null +++ b/pkg/clients/listers/core/v1/limitrange.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LimitRangeLister helps list LimitRanges. +// All objects returned here must be treated as read-only. +type LimitRangeLister interface { + // List lists all LimitRanges in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.LimitRange, err error) + // LimitRanges returns an object that can list and get LimitRanges. + LimitRanges(namespace string) LimitRangeNamespaceLister + LimitRangeListerExpansion +} + +// limitRangeLister implements the LimitRangeLister interface. +type limitRangeLister struct { + indexer cache.Indexer +} + +// NewLimitRangeLister returns a new LimitRangeLister. +func NewLimitRangeLister(indexer cache.Indexer) LimitRangeLister { + return &limitRangeLister{indexer: indexer} +} + +// List lists all LimitRanges in the indexer. +func (s *limitRangeLister) List(selector labels.Selector) (ret []*v1.LimitRange, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.LimitRange)) + }) + return ret, err +} + +// LimitRanges returns an object that can list and get LimitRanges. +func (s *limitRangeLister) LimitRanges(namespace string) LimitRangeNamespaceLister { + return limitRangeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LimitRangeNamespaceLister helps list and get LimitRanges. +// All objects returned here must be treated as read-only. +type LimitRangeNamespaceLister interface { + // List lists all LimitRanges in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.LimitRange, err error) + // Get retrieves the LimitRange from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.LimitRange, error) + LimitRangeNamespaceListerExpansion +} + +// limitRangeNamespaceLister implements the LimitRangeNamespaceLister +// interface. +type limitRangeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all LimitRanges in the indexer for a given namespace. +func (s limitRangeNamespaceLister) List(selector labels.Selector) (ret []*v1.LimitRange, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.LimitRange)) + }) + return ret, err +} + +// Get retrieves the LimitRange from the indexer for a given namespace and name. +func (s limitRangeNamespaceLister) Get(name string) (*v1.LimitRange, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("limitrange"), name) + } + return obj.(*v1.LimitRange), nil +} diff --git a/pkg/clients/listers/core/v1/namespace.go b/pkg/clients/listers/core/v1/namespace.go new file mode 100644 index 000000000..032e85578 --- /dev/null +++ b/pkg/clients/listers/core/v1/namespace.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NamespaceLister helps list Namespaces. +// All objects returned here must be treated as read-only. +type NamespaceLister interface { + // List lists all Namespaces in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Namespace, err error) + // Get retrieves the Namespace from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Namespace, error) + NamespaceListerExpansion +} + +// namespaceLister implements the NamespaceLister interface. +type namespaceLister struct { + indexer cache.Indexer +} + +// NewNamespaceLister returns a new NamespaceLister. +func NewNamespaceLister(indexer cache.Indexer) NamespaceLister { + return &namespaceLister{indexer: indexer} +} + +// List lists all Namespaces in the indexer. +func (s *namespaceLister) List(selector labels.Selector) (ret []*v1.Namespace, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Namespace)) + }) + return ret, err +} + +// Get retrieves the Namespace from the index for a given name. +func (s *namespaceLister) Get(name string) (*v1.Namespace, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("namespace"), name) + } + return obj.(*v1.Namespace), nil +} diff --git a/pkg/clients/listers/core/v1/node.go b/pkg/clients/listers/core/v1/node.go new file mode 100644 index 000000000..d4cd3e5c5 --- /dev/null +++ b/pkg/clients/listers/core/v1/node.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NodeLister helps list Nodes. +// All objects returned here must be treated as read-only. +type NodeLister interface { + // List lists all Nodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Node, err error) + // Get retrieves the Node from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Node, error) + NodeListerExpansion +} + +// nodeLister implements the NodeLister interface. +type nodeLister struct { + indexer cache.Indexer +} + +// NewNodeLister returns a new NodeLister. +func NewNodeLister(indexer cache.Indexer) NodeLister { + return &nodeLister{indexer: indexer} +} + +// List lists all Nodes in the indexer. +func (s *nodeLister) List(selector labels.Selector) (ret []*v1.Node, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Node)) + }) + return ret, err +} + +// Get retrieves the Node from the index for a given name. +func (s *nodeLister) Get(name string) (*v1.Node, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("node"), name) + } + return obj.(*v1.Node), nil +} diff --git a/pkg/clients/listers/core/v1/persistentvolume.go b/pkg/clients/listers/core/v1/persistentvolume.go new file mode 100644 index 000000000..385099885 --- /dev/null +++ b/pkg/clients/listers/core/v1/persistentvolume.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeLister helps list PersistentVolumes. +// All objects returned here must be treated as read-only. +type PersistentVolumeLister interface { + // List lists all PersistentVolumes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolume, err error) + // Get retrieves the PersistentVolume from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PersistentVolume, error) + PersistentVolumeListerExpansion +} + +// persistentVolumeLister implements the PersistentVolumeLister interface. +type persistentVolumeLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeLister returns a new PersistentVolumeLister. +func NewPersistentVolumeLister(indexer cache.Indexer) PersistentVolumeLister { + return &persistentVolumeLister{indexer: indexer} +} + +// List lists all PersistentVolumes in the indexer. +func (s *persistentVolumeLister) List(selector labels.Selector) (ret []*v1.PersistentVolume, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolume)) + }) + return ret, err +} + +// Get retrieves the PersistentVolume from the index for a given name. +func (s *persistentVolumeLister) Get(name string) (*v1.PersistentVolume, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("persistentvolume"), name) + } + return obj.(*v1.PersistentVolume), nil +} diff --git a/pkg/clients/listers/core/v1/persistentvolumeclaim.go b/pkg/clients/listers/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..4d683f2a0 --- /dev/null +++ b/pkg/clients/listers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeClaimLister helps list PersistentVolumeClaims. +// All objects returned here must be treated as read-only. +type PersistentVolumeClaimLister interface { + // List lists all PersistentVolumeClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) + // PersistentVolumeClaims returns an object that can list and get PersistentVolumeClaims. + PersistentVolumeClaims(namespace string) PersistentVolumeClaimNamespaceLister + PersistentVolumeClaimListerExpansion +} + +// persistentVolumeClaimLister implements the PersistentVolumeClaimLister interface. +type persistentVolumeClaimLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeClaimLister returns a new PersistentVolumeClaimLister. +func NewPersistentVolumeClaimLister(indexer cache.Indexer) PersistentVolumeClaimLister { + return &persistentVolumeClaimLister{indexer: indexer} +} + +// List lists all PersistentVolumeClaims in the indexer. +func (s *persistentVolumeClaimLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolumeClaim)) + }) + return ret, err +} + +// PersistentVolumeClaims returns an object that can list and get PersistentVolumeClaims. +func (s *persistentVolumeClaimLister) PersistentVolumeClaims(namespace string) PersistentVolumeClaimNamespaceLister { + return persistentVolumeClaimNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PersistentVolumeClaimNamespaceLister helps list and get PersistentVolumeClaims. +// All objects returned here must be treated as read-only. +type PersistentVolumeClaimNamespaceLister interface { + // List lists all PersistentVolumeClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) + // Get retrieves the PersistentVolumeClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PersistentVolumeClaim, error) + PersistentVolumeClaimNamespaceListerExpansion +} + +// persistentVolumeClaimNamespaceLister implements the PersistentVolumeClaimNamespaceLister +// interface. +type persistentVolumeClaimNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PersistentVolumeClaims in the indexer for a given namespace. +func (s persistentVolumeClaimNamespaceLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolumeClaim)) + }) + return ret, err +} + +// Get retrieves the PersistentVolumeClaim from the indexer for a given namespace and name. +func (s persistentVolumeClaimNamespaceLister) Get(name string) (*v1.PersistentVolumeClaim, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("persistentvolumeclaim"), name) + } + return obj.(*v1.PersistentVolumeClaim), nil +} diff --git a/pkg/clients/listers/core/v1/pod.go b/pkg/clients/listers/core/v1/pod.go new file mode 100644 index 000000000..962bb79e3 --- /dev/null +++ b/pkg/clients/listers/core/v1/pod.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodLister helps list Pods. +// All objects returned here must be treated as read-only. +type PodLister interface { + // List lists all Pods in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Pod, err error) + // Pods returns an object that can list and get Pods. + Pods(namespace string) PodNamespaceLister + PodListerExpansion +} + +// podLister implements the PodLister interface. +type podLister struct { + indexer cache.Indexer +} + +// NewPodLister returns a new PodLister. +func NewPodLister(indexer cache.Indexer) PodLister { + return &podLister{indexer: indexer} +} + +// List lists all Pods in the indexer. +func (s *podLister) List(selector labels.Selector) (ret []*v1.Pod, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Pod)) + }) + return ret, err +} + +// Pods returns an object that can list and get Pods. +func (s *podLister) Pods(namespace string) PodNamespaceLister { + return podNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodNamespaceLister helps list and get Pods. +// All objects returned here must be treated as read-only. +type PodNamespaceLister interface { + // List lists all Pods in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Pod, err error) + // Get retrieves the Pod from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Pod, error) + PodNamespaceListerExpansion +} + +// podNamespaceLister implements the PodNamespaceLister +// interface. +type podNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Pods in the indexer for a given namespace. +func (s podNamespaceLister) List(selector labels.Selector) (ret []*v1.Pod, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Pod)) + }) + return ret, err +} + +// Get retrieves the Pod from the indexer for a given namespace and name. +func (s podNamespaceLister) Get(name string) (*v1.Pod, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("pod"), name) + } + return obj.(*v1.Pod), nil +} diff --git a/pkg/clients/listers/core/v1/podtemplate.go b/pkg/clients/listers/core/v1/podtemplate.go new file mode 100644 index 000000000..b70145247 --- /dev/null +++ b/pkg/clients/listers/core/v1/podtemplate.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodTemplateLister helps list PodTemplates. +// All objects returned here must be treated as read-only. +type PodTemplateLister interface { + // List lists all PodTemplates in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodTemplate, err error) + // PodTemplates returns an object that can list and get PodTemplates. + PodTemplates(namespace string) PodTemplateNamespaceLister + PodTemplateListerExpansion +} + +// podTemplateLister implements the PodTemplateLister interface. +type podTemplateLister struct { + indexer cache.Indexer +} + +// NewPodTemplateLister returns a new PodTemplateLister. +func NewPodTemplateLister(indexer cache.Indexer) PodTemplateLister { + return &podTemplateLister{indexer: indexer} +} + +// List lists all PodTemplates in the indexer. +func (s *podTemplateLister) List(selector labels.Selector) (ret []*v1.PodTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodTemplate)) + }) + return ret, err +} + +// PodTemplates returns an object that can list and get PodTemplates. +func (s *podTemplateLister) PodTemplates(namespace string) PodTemplateNamespaceLister { + return podTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodTemplateNamespaceLister helps list and get PodTemplates. +// All objects returned here must be treated as read-only. +type PodTemplateNamespaceLister interface { + // List lists all PodTemplates in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodTemplate, err error) + // Get retrieves the PodTemplate from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PodTemplate, error) + PodTemplateNamespaceListerExpansion +} + +// podTemplateNamespaceLister implements the PodTemplateNamespaceLister +// interface. +type podTemplateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodTemplates in the indexer for a given namespace. +func (s podTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1.PodTemplate, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodTemplate)) + }) + return ret, err +} + +// Get retrieves the PodTemplate from the indexer for a given namespace and name. +func (s podTemplateNamespaceLister) Get(name string) (*v1.PodTemplate, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("podtemplate"), name) + } + return obj.(*v1.PodTemplate), nil +} diff --git a/pkg/clients/listers/core/v1/replicationcontroller.go b/pkg/clients/listers/core/v1/replicationcontroller.go new file mode 100644 index 000000000..61414258c --- /dev/null +++ b/pkg/clients/listers/core/v1/replicationcontroller.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicationControllerLister helps list ReplicationControllers. +// All objects returned here must be treated as read-only. +type ReplicationControllerLister interface { + // List lists all ReplicationControllers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicationController, err error) + // ReplicationControllers returns an object that can list and get ReplicationControllers. + ReplicationControllers(namespace string) ReplicationControllerNamespaceLister + ReplicationControllerListerExpansion +} + +// replicationControllerLister implements the ReplicationControllerLister interface. +type replicationControllerLister struct { + indexer cache.Indexer +} + +// NewReplicationControllerLister returns a new ReplicationControllerLister. +func NewReplicationControllerLister(indexer cache.Indexer) ReplicationControllerLister { + return &replicationControllerLister{indexer: indexer} +} + +// List lists all ReplicationControllers in the indexer. +func (s *replicationControllerLister) List(selector labels.Selector) (ret []*v1.ReplicationController, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicationController)) + }) + return ret, err +} + +// ReplicationControllers returns an object that can list and get ReplicationControllers. +func (s *replicationControllerLister) ReplicationControllers(namespace string) ReplicationControllerNamespaceLister { + return replicationControllerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicationControllerNamespaceLister helps list and get ReplicationControllers. +// All objects returned here must be treated as read-only. +type ReplicationControllerNamespaceLister interface { + // List lists all ReplicationControllers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicationController, err error) + // Get retrieves the ReplicationController from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ReplicationController, error) + ReplicationControllerNamespaceListerExpansion +} + +// replicationControllerNamespaceLister implements the ReplicationControllerNamespaceLister +// interface. +type replicationControllerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicationControllers in the indexer for a given namespace. +func (s replicationControllerNamespaceLister) List(selector labels.Selector) (ret []*v1.ReplicationController, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicationController)) + }) + return ret, err +} + +// Get retrieves the ReplicationController from the indexer for a given namespace and name. +func (s replicationControllerNamespaceLister) Get(name string) (*v1.ReplicationController, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("replicationcontroller"), name) + } + return obj.(*v1.ReplicationController), nil +} diff --git a/pkg/clients/listers/core/v1/resourcequota.go b/pkg/clients/listers/core/v1/resourcequota.go new file mode 100644 index 000000000..a50b83fad --- /dev/null +++ b/pkg/clients/listers/core/v1/resourcequota.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceQuotaLister helps list ResourceQuotas. +// All objects returned here must be treated as read-only. +type ResourceQuotaLister interface { + // List lists all ResourceQuotas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) + // ResourceQuotas returns an object that can list and get ResourceQuotas. + ResourceQuotas(namespace string) ResourceQuotaNamespaceLister + ResourceQuotaListerExpansion +} + +// resourceQuotaLister implements the ResourceQuotaLister interface. +type resourceQuotaLister struct { + indexer cache.Indexer +} + +// NewResourceQuotaLister returns a new ResourceQuotaLister. +func NewResourceQuotaLister(indexer cache.Indexer) ResourceQuotaLister { + return &resourceQuotaLister{indexer: indexer} +} + +// List lists all ResourceQuotas in the indexer. +func (s *resourceQuotaLister) List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceQuota)) + }) + return ret, err +} + +// ResourceQuotas returns an object that can list and get ResourceQuotas. +func (s *resourceQuotaLister) ResourceQuotas(namespace string) ResourceQuotaNamespaceLister { + return resourceQuotaNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceQuotaNamespaceLister helps list and get ResourceQuotas. +// All objects returned here must be treated as read-only. +type ResourceQuotaNamespaceLister interface { + // List lists all ResourceQuotas in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) + // Get retrieves the ResourceQuota from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceQuota, error) + ResourceQuotaNamespaceListerExpansion +} + +// resourceQuotaNamespaceLister implements the ResourceQuotaNamespaceLister +// interface. +type resourceQuotaNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceQuotas in the indexer for a given namespace. +func (s resourceQuotaNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceQuota)) + }) + return ret, err +} + +// Get retrieves the ResourceQuota from the indexer for a given namespace and name. +func (s resourceQuotaNamespaceLister) Get(name string) (*v1.ResourceQuota, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resourcequota"), name) + } + return obj.(*v1.ResourceQuota), nil +} diff --git a/pkg/clients/listers/core/v1/secret.go b/pkg/clients/listers/core/v1/secret.go new file mode 100644 index 000000000..c50216d29 --- /dev/null +++ b/pkg/clients/listers/core/v1/secret.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SecretLister helps list Secrets. +// All objects returned here must be treated as read-only. +type SecretLister interface { + // List lists all Secrets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Secret, err error) + // Secrets returns an object that can list and get Secrets. + Secrets(namespace string) SecretNamespaceLister + SecretListerExpansion +} + +// secretLister implements the SecretLister interface. +type secretLister struct { + indexer cache.Indexer +} + +// NewSecretLister returns a new SecretLister. +func NewSecretLister(indexer cache.Indexer) SecretLister { + return &secretLister{indexer: indexer} +} + +// List lists all Secrets in the indexer. +func (s *secretLister) List(selector labels.Selector) (ret []*v1.Secret, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Secret)) + }) + return ret, err +} + +// Secrets returns an object that can list and get Secrets. +func (s *secretLister) Secrets(namespace string) SecretNamespaceLister { + return secretNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SecretNamespaceLister helps list and get Secrets. +// All objects returned here must be treated as read-only. +type SecretNamespaceLister interface { + // List lists all Secrets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Secret, err error) + // Get retrieves the Secret from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Secret, error) + SecretNamespaceListerExpansion +} + +// secretNamespaceLister implements the SecretNamespaceLister +// interface. +type secretNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Secrets in the indexer for a given namespace. +func (s secretNamespaceLister) List(selector labels.Selector) (ret []*v1.Secret, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Secret)) + }) + return ret, err +} + +// Get retrieves the Secret from the indexer for a given namespace and name. +func (s secretNamespaceLister) Get(name string) (*v1.Secret, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("secret"), name) + } + return obj.(*v1.Secret), nil +} diff --git a/pkg/clients/listers/core/v1/service.go b/pkg/clients/listers/core/v1/service.go new file mode 100644 index 000000000..ce73a5727 --- /dev/null +++ b/pkg/clients/listers/core/v1/service.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceLister helps list Services. +// All objects returned here must be treated as read-only. +type ServiceLister interface { + // List lists all Services in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Service, err error) + // Services returns an object that can list and get Services. + Services(namespace string) ServiceNamespaceLister + ServiceListerExpansion +} + +// serviceLister implements the ServiceLister interface. +type serviceLister struct { + indexer cache.Indexer +} + +// NewServiceLister returns a new ServiceLister. +func NewServiceLister(indexer cache.Indexer) ServiceLister { + return &serviceLister{indexer: indexer} +} + +// List lists all Services in the indexer. +func (s *serviceLister) List(selector labels.Selector) (ret []*v1.Service, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Service)) + }) + return ret, err +} + +// Services returns an object that can list and get Services. +func (s *serviceLister) Services(namespace string) ServiceNamespaceLister { + return serviceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceNamespaceLister helps list and get Services. +// All objects returned here must be treated as read-only. +type ServiceNamespaceLister interface { + // List lists all Services in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Service, err error) + // Get retrieves the Service from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Service, error) + ServiceNamespaceListerExpansion +} + +// serviceNamespaceLister implements the ServiceNamespaceLister +// interface. +type serviceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Services in the indexer for a given namespace. +func (s serviceNamespaceLister) List(selector labels.Selector) (ret []*v1.Service, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Service)) + }) + return ret, err +} + +// Get retrieves the Service from the indexer for a given namespace and name. +func (s serviceNamespaceLister) Get(name string) (*v1.Service, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("service"), name) + } + return obj.(*v1.Service), nil +} diff --git a/pkg/clients/listers/core/v1/serviceaccount.go b/pkg/clients/listers/core/v1/serviceaccount.go new file mode 100644 index 000000000..a69be0f40 --- /dev/null +++ b/pkg/clients/listers/core/v1/serviceaccount.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceAccountLister helps list ServiceAccounts. +// All objects returned here must be treated as read-only. +type ServiceAccountLister interface { + // List lists all ServiceAccounts in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) + // ServiceAccounts returns an object that can list and get ServiceAccounts. + ServiceAccounts(namespace string) ServiceAccountNamespaceLister + ServiceAccountListerExpansion +} + +// serviceAccountLister implements the ServiceAccountLister interface. +type serviceAccountLister struct { + indexer cache.Indexer +} + +// NewServiceAccountLister returns a new ServiceAccountLister. +func NewServiceAccountLister(indexer cache.Indexer) ServiceAccountLister { + return &serviceAccountLister{indexer: indexer} +} + +// List lists all ServiceAccounts in the indexer. +func (s *serviceAccountLister) List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceAccount)) + }) + return ret, err +} + +// ServiceAccounts returns an object that can list and get ServiceAccounts. +func (s *serviceAccountLister) ServiceAccounts(namespace string) ServiceAccountNamespaceLister { + return serviceAccountNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceAccountNamespaceLister helps list and get ServiceAccounts. +// All objects returned here must be treated as read-only. +type ServiceAccountNamespaceLister interface { + // List lists all ServiceAccounts in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) + // Get retrieves the ServiceAccount from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ServiceAccount, error) + ServiceAccountNamespaceListerExpansion +} + +// serviceAccountNamespaceLister implements the ServiceAccountNamespaceLister +// interface. +type serviceAccountNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ServiceAccounts in the indexer for a given namespace. +func (s serviceAccountNamespaceLister) List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceAccount)) + }) + return ret, err +} + +// Get retrieves the ServiceAccount from the indexer for a given namespace and name. +func (s serviceAccountNamespaceLister) Get(name string) (*v1.ServiceAccount, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("serviceaccount"), name) + } + return obj.(*v1.ServiceAccount), nil +} diff --git a/pkg/clients/listers/discovery/v1/endpointslice.go b/pkg/clients/listers/discovery/v1/endpointslice.go new file mode 100644 index 000000000..88c24ce45 --- /dev/null +++ b/pkg/clients/listers/discovery/v1/endpointslice.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/discovery/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointSliceLister helps list EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceLister interface { + // List lists all EndpointSlices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) + // EndpointSlices returns an object that can list and get EndpointSlices. + EndpointSlices(namespace string) EndpointSliceNamespaceLister + EndpointSliceListerExpansion +} + +// endpointSliceLister implements the EndpointSliceLister interface. +type endpointSliceLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceLister returns a new EndpointSliceLister. +func NewEndpointSliceLister(indexer cache.Indexer) EndpointSliceLister { + return &endpointSliceLister{indexer: indexer} +} + +// List lists all EndpointSlices in the indexer. +func (s *endpointSliceLister) List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get EndpointSlices. +func (s *endpointSliceLister) EndpointSlices(namespace string) EndpointSliceNamespaceLister { + return endpointSliceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointSliceNamespaceLister helps list and get EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceNamespaceLister interface { + // List lists all EndpointSlices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) + // Get retrieves the EndpointSlice from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.EndpointSlice, error) + EndpointSliceNamespaceListerExpansion +} + +// endpointSliceNamespaceLister implements the EndpointSliceNamespaceLister +// interface. +type endpointSliceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EndpointSlices in the indexer for a given namespace. +func (s endpointSliceNamespaceLister) List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EndpointSlice)) + }) + return ret, err +} + +// Get retrieves the EndpointSlice from the indexer for a given namespace and name. +func (s endpointSliceNamespaceLister) Get(name string) (*v1.EndpointSlice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("endpointslice"), name) + } + return obj.(*v1.EndpointSlice), nil +} diff --git a/pkg/clients/listers/discovery/v1/expansion_generated.go b/pkg/clients/listers/discovery/v1/expansion_generated.go new file mode 100644 index 000000000..81a57d8ad --- /dev/null +++ b/pkg/clients/listers/discovery/v1/expansion_generated.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EndpointSliceListerExpansion allows custom methods to be added to +// EndpointSliceLister. +type EndpointSliceListerExpansion interface{} + +// EndpointSliceNamespaceListerExpansion allows custom methods to be added to +// EndpointSliceNamespaceLister. +type EndpointSliceNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/events/v1/event.go b/pkg/clients/listers/events/v1/event.go new file mode 100644 index 000000000..ba2ec1def --- /dev/null +++ b/pkg/clients/listers/events/v1/event.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/events/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("event"), name) + } + return obj.(*v1.Event), nil +} diff --git a/pkg/clients/listers/events/v1/expansion_generated.go b/pkg/clients/listers/events/v1/expansion_generated.go new file mode 100644 index 000000000..0c983d1e1 --- /dev/null +++ b/pkg/clients/listers/events/v1/expansion_generated.go @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/rbac/v1/clusterrole.go b/pkg/clients/listers/rbac/v1/clusterrole.go new file mode 100644 index 000000000..7f4b4c532 --- /dev/null +++ b/pkg/clients/listers/rbac/v1/clusterrole.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("clusterrole"), name) + } + return obj.(*v1.ClusterRole), nil +} diff --git a/pkg/clients/listers/rbac/v1/clusterrolebinding.go b/pkg/clients/listers/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..da77d55dd --- /dev/null +++ b/pkg/clients/listers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("clusterrolebinding"), name) + } + return obj.(*v1.ClusterRoleBinding), nil +} diff --git a/pkg/clients/listers/rbac/v1/expansion_generated.go b/pkg/clients/listers/rbac/v1/expansion_generated.go new file mode 100644 index 000000000..db97981fa --- /dev/null +++ b/pkg/clients/listers/rbac/v1/expansion_generated.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/rbac/v1/role.go b/pkg/clients/listers/rbac/v1/role.go new file mode 100644 index 000000000..e19322f33 --- /dev/null +++ b/pkg/clients/listers/rbac/v1/role.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("role"), name) + } + return obj.(*v1.Role), nil +} diff --git a/pkg/clients/listers/rbac/v1/rolebinding.go b/pkg/clients/listers/rbac/v1/rolebinding.go new file mode 100644 index 000000000..3a83eaabc --- /dev/null +++ b/pkg/clients/listers/rbac/v1/rolebinding.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("rolebinding"), name) + } + return obj.(*v1.RoleBinding), nil +} diff --git a/pkg/clients/listers/scheduling/v1/expansion_generated.go b/pkg/clients/listers/scheduling/v1/expansion_generated.go new file mode 100644 index 000000000..4e5cbbf13 --- /dev/null +++ b/pkg/clients/listers/scheduling/v1/expansion_generated.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/pkg/clients/listers/scheduling/v1/priorityclass.go b/pkg/clients/listers/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..73cc6b5cf --- /dev/null +++ b/pkg/clients/listers/scheduling/v1/priorityclass.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/scheduling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("priorityclass"), name) + } + return obj.(*v1.PriorityClass), nil +} diff --git a/pkg/clients/listers/storage/v1/csidriver.go b/pkg/clients/listers/storage/v1/csidriver.go new file mode 100644 index 000000000..a91695722 --- /dev/null +++ b/pkg/clients/listers/storage/v1/csidriver.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIDriverLister helps list CSIDrivers. +// All objects returned here must be treated as read-only. +type CSIDriverLister interface { + // List lists all CSIDrivers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSIDriver, err error) + // Get retrieves the CSIDriver from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSIDriver, error) + CSIDriverListerExpansion +} + +// cSIDriverLister implements the CSIDriverLister interface. +type cSIDriverLister struct { + indexer cache.Indexer +} + +// NewCSIDriverLister returns a new CSIDriverLister. +func NewCSIDriverLister(indexer cache.Indexer) CSIDriverLister { + return &cSIDriverLister{indexer: indexer} +} + +// List lists all CSIDrivers in the indexer. +func (s *cSIDriverLister) List(selector labels.Selector) (ret []*v1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the CSIDriver from the index for a given name. +func (s *cSIDriverLister) Get(name string) (*v1.CSIDriver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("csidriver"), name) + } + return obj.(*v1.CSIDriver), nil +} diff --git a/pkg/clients/listers/storage/v1/csinode.go b/pkg/clients/listers/storage/v1/csinode.go new file mode 100644 index 000000000..ede687e85 --- /dev/null +++ b/pkg/clients/listers/storage/v1/csinode.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSINodeLister helps list CSINodes. +// All objects returned here must be treated as read-only. +type CSINodeLister interface { + // List lists all CSINodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSINode, err error) + // Get retrieves the CSINode from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSINode, error) + CSINodeListerExpansion +} + +// cSINodeLister implements the CSINodeLister interface. +type cSINodeLister struct { + indexer cache.Indexer +} + +// NewCSINodeLister returns a new CSINodeLister. +func NewCSINodeLister(indexer cache.Indexer) CSINodeLister { + return &cSINodeLister{indexer: indexer} +} + +// List lists all CSINodes in the indexer. +func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSINode)) + }) + return ret, err +} + +// Get retrieves the CSINode from the index for a given name. +func (s *cSINodeLister) Get(name string) (*v1.CSINode, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("csinode"), name) + } + return obj.(*v1.CSINode), nil +} diff --git a/pkg/clients/listers/storage/v1/csistoragecapacity.go b/pkg/clients/listers/storage/v1/csistoragecapacity.go new file mode 100644 index 000000000..466dedfbb --- /dev/null +++ b/pkg/clients/listers/storage/v1/csistoragecapacity.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityLister helps list CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityLister interface { + // List lists all CSIStorageCapacities in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSIStorageCapacity, err error) + // CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. + CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister + CSIStorageCapacityListerExpansion +} + +// cSIStorageCapacityLister implements the CSIStorageCapacityLister interface. +type cSIStorageCapacityLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityLister returns a new CSIStorageCapacityLister. +func NewCSIStorageCapacityLister(indexer cache.Indexer) CSIStorageCapacityLister { + return &cSIStorageCapacityLister{indexer: indexer} +} + +// List lists all CSIStorageCapacities in the indexer. +func (s *cSIStorageCapacityLister) List(selector labels.Selector) (ret []*v1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. +func (s *cSIStorageCapacityLister) CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister { + return cSIStorageCapacityNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister helps list and get CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityNamespaceLister interface { + // List lists all CSIStorageCapacities in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSIStorageCapacity, err error) + // Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSIStorageCapacity, error) + CSIStorageCapacityNamespaceListerExpansion +} + +// cSIStorageCapacityNamespaceLister implements the CSIStorageCapacityNamespaceLister +// interface. +type cSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CSIStorageCapacities in the indexer for a given namespace. +func (s cSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*v1.CSIStorageCapacity, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSIStorageCapacity)) + }) + return ret, err +} + +// Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. +func (s cSIStorageCapacityNamespaceLister) Get(name string) (*v1.CSIStorageCapacity, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("csistoragecapacity"), name) + } + return obj.(*v1.CSIStorageCapacity), nil +} diff --git a/pkg/clients/listers/storage/v1/expansion_generated.go b/pkg/clients/listers/storage/v1/expansion_generated.go new file mode 100644 index 000000000..747ebbfea --- /dev/null +++ b/pkg/clients/listers/storage/v1/expansion_generated.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CSIDriverListerExpansion allows custom methods to be added to +// CSIDriverLister. +type CSIDriverListerExpansion interface{} + +// CSINodeListerExpansion allows custom methods to be added to +// CSINodeLister. +type CSINodeListerExpansion interface{} + +// CSIStorageCapacityListerExpansion allows custom methods to be added to +// CSIStorageCapacityLister. +type CSIStorageCapacityListerExpansion interface{} + +// CSIStorageCapacityNamespaceListerExpansion allows custom methods to be added to +// CSIStorageCapacityNamespaceLister. +type CSIStorageCapacityNamespaceListerExpansion interface{} + +// StorageClassListerExpansion allows custom methods to be added to +// StorageClassLister. +type StorageClassListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/pkg/clients/listers/storage/v1/storageclass.go b/pkg/clients/listers/storage/v1/storageclass.go new file mode 100644 index 000000000..5dc0f9fe9 --- /dev/null +++ b/pkg/clients/listers/storage/v1/storageclass.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageClassLister helps list StorageClasses. +// All objects returned here must be treated as read-only. +type StorageClassLister interface { + // List lists all StorageClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StorageClass, err error) + // Get retrieves the StorageClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.StorageClass, error) + StorageClassListerExpansion +} + +// storageClassLister implements the StorageClassLister interface. +type storageClassLister struct { + indexer cache.Indexer +} + +// NewStorageClassLister returns a new StorageClassLister. +func NewStorageClassLister(indexer cache.Indexer) StorageClassLister { + return &storageClassLister{indexer: indexer} +} + +// List lists all StorageClasses in the indexer. +func (s *storageClassLister) List(selector labels.Selector) (ret []*v1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the StorageClass from the index for a given name. +func (s *storageClassLister) Get(name string) (*v1.StorageClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("storageclass"), name) + } + return obj.(*v1.StorageClass), nil +} diff --git a/pkg/clients/listers/storage/v1/volumeattachment.go b/pkg/clients/listers/storage/v1/volumeattachment.go new file mode 100644 index 000000000..3ee2a813a --- /dev/null +++ b/pkg/clients/listers/storage/v1/volumeattachment.go @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("volumeattachment"), name) + } + return obj.(*v1.VolumeAttachment), nil +} diff --git a/pkg/clients/listers/walrus/v1/catalog.go b/pkg/clients/listers/walrus/v1/catalog.go new file mode 100644 index 000000000..d533e2def --- /dev/null +++ b/pkg/clients/listers/walrus/v1/catalog.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CatalogLister helps list Catalogs. +// All objects returned here must be treated as read-only. +type CatalogLister interface { + // List lists all Catalogs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Catalog, err error) + // Catalogs returns an object that can list and get Catalogs. + Catalogs(namespace string) CatalogNamespaceLister + CatalogListerExpansion +} + +// catalogLister implements the CatalogLister interface. +type catalogLister struct { + indexer cache.Indexer +} + +// NewCatalogLister returns a new CatalogLister. +func NewCatalogLister(indexer cache.Indexer) CatalogLister { + return &catalogLister{indexer: indexer} +} + +// List lists all Catalogs in the indexer. +func (s *catalogLister) List(selector labels.Selector) (ret []*v1.Catalog, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Catalog)) + }) + return ret, err +} + +// Catalogs returns an object that can list and get Catalogs. +func (s *catalogLister) Catalogs(namespace string) CatalogNamespaceLister { + return catalogNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CatalogNamespaceLister helps list and get Catalogs. +// All objects returned here must be treated as read-only. +type CatalogNamespaceLister interface { + // List lists all Catalogs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Catalog, err error) + // Get retrieves the Catalog from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Catalog, error) + CatalogNamespaceListerExpansion +} + +// catalogNamespaceLister implements the CatalogNamespaceLister +// interface. +type catalogNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Catalogs in the indexer for a given namespace. +func (s catalogNamespaceLister) List(selector labels.Selector) (ret []*v1.Catalog, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Catalog)) + }) + return ret, err +} + +// Get retrieves the Catalog from the indexer for a given namespace and name. +func (s catalogNamespaceLister) Get(name string) (*v1.Catalog, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("catalog"), name) + } + return obj.(*v1.Catalog), nil +} diff --git a/pkg/clients/listers/walrus/v1/connector.go b/pkg/clients/listers/walrus/v1/connector.go new file mode 100644 index 000000000..0ab9598f6 --- /dev/null +++ b/pkg/clients/listers/walrus/v1/connector.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ConnectorLister helps list Connectors. +// All objects returned here must be treated as read-only. +type ConnectorLister interface { + // List lists all Connectors in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Connector, err error) + // Connectors returns an object that can list and get Connectors. + Connectors(namespace string) ConnectorNamespaceLister + ConnectorListerExpansion +} + +// connectorLister implements the ConnectorLister interface. +type connectorLister struct { + indexer cache.Indexer +} + +// NewConnectorLister returns a new ConnectorLister. +func NewConnectorLister(indexer cache.Indexer) ConnectorLister { + return &connectorLister{indexer: indexer} +} + +// List lists all Connectors in the indexer. +func (s *connectorLister) List(selector labels.Selector) (ret []*v1.Connector, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Connector)) + }) + return ret, err +} + +// Connectors returns an object that can list and get Connectors. +func (s *connectorLister) Connectors(namespace string) ConnectorNamespaceLister { + return connectorNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ConnectorNamespaceLister helps list and get Connectors. +// All objects returned here must be treated as read-only. +type ConnectorNamespaceLister interface { + // List lists all Connectors in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Connector, err error) + // Get retrieves the Connector from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Connector, error) + ConnectorNamespaceListerExpansion +} + +// connectorNamespaceLister implements the ConnectorNamespaceLister +// interface. +type connectorNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Connectors in the indexer for a given namespace. +func (s connectorNamespaceLister) List(selector labels.Selector) (ret []*v1.Connector, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Connector)) + }) + return ret, err +} + +// Get retrieves the Connector from the indexer for a given namespace and name. +func (s connectorNamespaceLister) Get(name string) (*v1.Connector, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("connector"), name) + } + return obj.(*v1.Connector), nil +} diff --git a/pkg/clients/listers/walrus/v1/environment.go b/pkg/clients/listers/walrus/v1/environment.go new file mode 100644 index 000000000..8a256f12a --- /dev/null +++ b/pkg/clients/listers/walrus/v1/environment.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EnvironmentLister helps list Environments. +// All objects returned here must be treated as read-only. +type EnvironmentLister interface { + // List lists all Environments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Environment, err error) + // Environments returns an object that can list and get Environments. + Environments(namespace string) EnvironmentNamespaceLister + EnvironmentListerExpansion +} + +// environmentLister implements the EnvironmentLister interface. +type environmentLister struct { + indexer cache.Indexer +} + +// NewEnvironmentLister returns a new EnvironmentLister. +func NewEnvironmentLister(indexer cache.Indexer) EnvironmentLister { + return &environmentLister{indexer: indexer} +} + +// List lists all Environments in the indexer. +func (s *environmentLister) List(selector labels.Selector) (ret []*v1.Environment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Environment)) + }) + return ret, err +} + +// Environments returns an object that can list and get Environments. +func (s *environmentLister) Environments(namespace string) EnvironmentNamespaceLister { + return environmentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EnvironmentNamespaceLister helps list and get Environments. +// All objects returned here must be treated as read-only. +type EnvironmentNamespaceLister interface { + // List lists all Environments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Environment, err error) + // Get retrieves the Environment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Environment, error) + EnvironmentNamespaceListerExpansion +} + +// environmentNamespaceLister implements the EnvironmentNamespaceLister +// interface. +type environmentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Environments in the indexer for a given namespace. +func (s environmentNamespaceLister) List(selector labels.Selector) (ret []*v1.Environment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Environment)) + }) + return ret, err +} + +// Get retrieves the Environment from the indexer for a given namespace and name. +func (s environmentNamespaceLister) Get(name string) (*v1.Environment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("environment"), name) + } + return obj.(*v1.Environment), nil +} diff --git a/pkg/clients/listers/walrus/v1/expansion_generated.go b/pkg/clients/listers/walrus/v1/expansion_generated.go new file mode 100644 index 000000000..67a6e2139 --- /dev/null +++ b/pkg/clients/listers/walrus/v1/expansion_generated.go @@ -0,0 +1,94 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CatalogListerExpansion allows custom methods to be added to +// CatalogLister. +type CatalogListerExpansion interface{} + +// CatalogNamespaceListerExpansion allows custom methods to be added to +// CatalogNamespaceLister. +type CatalogNamespaceListerExpansion interface{} + +// ConnectorListerExpansion allows custom methods to be added to +// ConnectorLister. +type ConnectorListerExpansion interface{} + +// ConnectorNamespaceListerExpansion allows custom methods to be added to +// ConnectorNamespaceLister. +type ConnectorNamespaceListerExpansion interface{} + +// EnvironmentListerExpansion allows custom methods to be added to +// EnvironmentLister. +type EnvironmentListerExpansion interface{} + +// EnvironmentNamespaceListerExpansion allows custom methods to be added to +// EnvironmentNamespaceLister. +type EnvironmentNamespaceListerExpansion interface{} + +// FileExampleListerExpansion allows custom methods to be added to +// FileExampleLister. +type FileExampleListerExpansion interface{} + +// FileExampleNamespaceListerExpansion allows custom methods to be added to +// FileExampleNamespaceLister. +type FileExampleNamespaceListerExpansion interface{} + +// ProjectListerExpansion allows custom methods to be added to +// ProjectLister. +type ProjectListerExpansion interface{} + +// ProjectNamespaceListerExpansion allows custom methods to be added to +// ProjectNamespaceLister. +type ProjectNamespaceListerExpansion interface{} + +// ResourceListerExpansion allows custom methods to be added to +// ResourceLister. +type ResourceListerExpansion interface{} + +// ResourceNamespaceListerExpansion allows custom methods to be added to +// ResourceNamespaceLister. +type ResourceNamespaceListerExpansion interface{} + +// ResourceDefinitionListerExpansion allows custom methods to be added to +// ResourceDefinitionLister. +type ResourceDefinitionListerExpansion interface{} + +// ResourceDefinitionNamespaceListerExpansion allows custom methods to be added to +// ResourceDefinitionNamespaceLister. +type ResourceDefinitionNamespaceListerExpansion interface{} + +// ResourceRunListerExpansion allows custom methods to be added to +// ResourceRunLister. +type ResourceRunListerExpansion interface{} + +// ResourceRunNamespaceListerExpansion allows custom methods to be added to +// ResourceRunNamespaceLister. +type ResourceRunNamespaceListerExpansion interface{} + +// SettingListerExpansion allows custom methods to be added to +// SettingLister. +type SettingListerExpansion interface{} + +// SettingNamespaceListerExpansion allows custom methods to be added to +// SettingNamespaceLister. +type SettingNamespaceListerExpansion interface{} + +// TemplateListerExpansion allows custom methods to be added to +// TemplateLister. +type TemplateListerExpansion interface{} + +// TemplateNamespaceListerExpansion allows custom methods to be added to +// TemplateNamespaceLister. +type TemplateNamespaceListerExpansion interface{} + +// VariableListerExpansion allows custom methods to be added to +// VariableLister. +type VariableListerExpansion interface{} + +// VariableNamespaceListerExpansion allows custom methods to be added to +// VariableNamespaceLister. +type VariableNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/walrus/v1/fileexample.go b/pkg/clients/listers/walrus/v1/fileexample.go new file mode 100644 index 000000000..7485490bf --- /dev/null +++ b/pkg/clients/listers/walrus/v1/fileexample.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FileExampleLister helps list FileExamples. +// All objects returned here must be treated as read-only. +type FileExampleLister interface { + // List lists all FileExamples in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.FileExample, err error) + // FileExamples returns an object that can list and get FileExamples. + FileExamples(namespace string) FileExampleNamespaceLister + FileExampleListerExpansion +} + +// fileExampleLister implements the FileExampleLister interface. +type fileExampleLister struct { + indexer cache.Indexer +} + +// NewFileExampleLister returns a new FileExampleLister. +func NewFileExampleLister(indexer cache.Indexer) FileExampleLister { + return &fileExampleLister{indexer: indexer} +} + +// List lists all FileExamples in the indexer. +func (s *fileExampleLister) List(selector labels.Selector) (ret []*v1.FileExample, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.FileExample)) + }) + return ret, err +} + +// FileExamples returns an object that can list and get FileExamples. +func (s *fileExampleLister) FileExamples(namespace string) FileExampleNamespaceLister { + return fileExampleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// FileExampleNamespaceLister helps list and get FileExamples. +// All objects returned here must be treated as read-only. +type FileExampleNamespaceLister interface { + // List lists all FileExamples in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.FileExample, err error) + // Get retrieves the FileExample from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.FileExample, error) + FileExampleNamespaceListerExpansion +} + +// fileExampleNamespaceLister implements the FileExampleNamespaceLister +// interface. +type fileExampleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all FileExamples in the indexer for a given namespace. +func (s fileExampleNamespaceLister) List(selector labels.Selector) (ret []*v1.FileExample, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.FileExample)) + }) + return ret, err +} + +// Get retrieves the FileExample from the indexer for a given namespace and name. +func (s fileExampleNamespaceLister) Get(name string) (*v1.FileExample, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("fileexample"), name) + } + return obj.(*v1.FileExample), nil +} diff --git a/pkg/clients/listers/walrus/v1/project.go b/pkg/clients/listers/walrus/v1/project.go new file mode 100644 index 000000000..02021fe74 --- /dev/null +++ b/pkg/clients/listers/walrus/v1/project.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ProjectLister helps list Projects. +// All objects returned here must be treated as read-only. +type ProjectLister interface { + // List lists all Projects in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Project, err error) + // Projects returns an object that can list and get Projects. + Projects(namespace string) ProjectNamespaceLister + ProjectListerExpansion +} + +// projectLister implements the ProjectLister interface. +type projectLister struct { + indexer cache.Indexer +} + +// NewProjectLister returns a new ProjectLister. +func NewProjectLister(indexer cache.Indexer) ProjectLister { + return &projectLister{indexer: indexer} +} + +// List lists all Projects in the indexer. +func (s *projectLister) List(selector labels.Selector) (ret []*v1.Project, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Project)) + }) + return ret, err +} + +// Projects returns an object that can list and get Projects. +func (s *projectLister) Projects(namespace string) ProjectNamespaceLister { + return projectNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ProjectNamespaceLister helps list and get Projects. +// All objects returned here must be treated as read-only. +type ProjectNamespaceLister interface { + // List lists all Projects in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Project, err error) + // Get retrieves the Project from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Project, error) + ProjectNamespaceListerExpansion +} + +// projectNamespaceLister implements the ProjectNamespaceLister +// interface. +type projectNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Projects in the indexer for a given namespace. +func (s projectNamespaceLister) List(selector labels.Selector) (ret []*v1.Project, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Project)) + }) + return ret, err +} + +// Get retrieves the Project from the indexer for a given namespace and name. +func (s projectNamespaceLister) Get(name string) (*v1.Project, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("project"), name) + } + return obj.(*v1.Project), nil +} diff --git a/pkg/clients/listers/walrus/v1/resource.go b/pkg/clients/listers/walrus/v1/resource.go new file mode 100644 index 000000000..8b19f9a45 --- /dev/null +++ b/pkg/clients/listers/walrus/v1/resource.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceLister helps list Resources. +// All objects returned here must be treated as read-only. +type ResourceLister interface { + // List lists all Resources in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Resource, err error) + // Resources returns an object that can list and get Resources. + Resources(namespace string) ResourceNamespaceLister + ResourceListerExpansion +} + +// resourceLister implements the ResourceLister interface. +type resourceLister struct { + indexer cache.Indexer +} + +// NewResourceLister returns a new ResourceLister. +func NewResourceLister(indexer cache.Indexer) ResourceLister { + return &resourceLister{indexer: indexer} +} + +// List lists all Resources in the indexer. +func (s *resourceLister) List(selector labels.Selector) (ret []*v1.Resource, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Resource)) + }) + return ret, err +} + +// Resources returns an object that can list and get Resources. +func (s *resourceLister) Resources(namespace string) ResourceNamespaceLister { + return resourceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceNamespaceLister helps list and get Resources. +// All objects returned here must be treated as read-only. +type ResourceNamespaceLister interface { + // List lists all Resources in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Resource, err error) + // Get retrieves the Resource from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Resource, error) + ResourceNamespaceListerExpansion +} + +// resourceNamespaceLister implements the ResourceNamespaceLister +// interface. +type resourceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Resources in the indexer for a given namespace. +func (s resourceNamespaceLister) List(selector labels.Selector) (ret []*v1.Resource, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Resource)) + }) + return ret, err +} + +// Get retrieves the Resource from the indexer for a given namespace and name. +func (s resourceNamespaceLister) Get(name string) (*v1.Resource, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resource"), name) + } + return obj.(*v1.Resource), nil +} diff --git a/pkg/clients/listers/walrus/v1/resourcedefinition.go b/pkg/clients/listers/walrus/v1/resourcedefinition.go new file mode 100644 index 000000000..1b70380cf --- /dev/null +++ b/pkg/clients/listers/walrus/v1/resourcedefinition.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceDefinitionLister helps list ResourceDefinitions. +// All objects returned here must be treated as read-only. +type ResourceDefinitionLister interface { + // List lists all ResourceDefinitions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) + // ResourceDefinitions returns an object that can list and get ResourceDefinitions. + ResourceDefinitions(namespace string) ResourceDefinitionNamespaceLister + ResourceDefinitionListerExpansion +} + +// resourceDefinitionLister implements the ResourceDefinitionLister interface. +type resourceDefinitionLister struct { + indexer cache.Indexer +} + +// NewResourceDefinitionLister returns a new ResourceDefinitionLister. +func NewResourceDefinitionLister(indexer cache.Indexer) ResourceDefinitionLister { + return &resourceDefinitionLister{indexer: indexer} +} + +// List lists all ResourceDefinitions in the indexer. +func (s *resourceDefinitionLister) List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceDefinition)) + }) + return ret, err +} + +// ResourceDefinitions returns an object that can list and get ResourceDefinitions. +func (s *resourceDefinitionLister) ResourceDefinitions(namespace string) ResourceDefinitionNamespaceLister { + return resourceDefinitionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceDefinitionNamespaceLister helps list and get ResourceDefinitions. +// All objects returned here must be treated as read-only. +type ResourceDefinitionNamespaceLister interface { + // List lists all ResourceDefinitions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) + // Get retrieves the ResourceDefinition from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceDefinition, error) + ResourceDefinitionNamespaceListerExpansion +} + +// resourceDefinitionNamespaceLister implements the ResourceDefinitionNamespaceLister +// interface. +type resourceDefinitionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceDefinitions in the indexer for a given namespace. +func (s resourceDefinitionNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceDefinition)) + }) + return ret, err +} + +// Get retrieves the ResourceDefinition from the indexer for a given namespace and name. +func (s resourceDefinitionNamespaceLister) Get(name string) (*v1.ResourceDefinition, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resourcedefinition"), name) + } + return obj.(*v1.ResourceDefinition), nil +} diff --git a/pkg/clients/listers/walrus/v1/resourcerun.go b/pkg/clients/listers/walrus/v1/resourcerun.go new file mode 100644 index 000000000..0742f5e13 --- /dev/null +++ b/pkg/clients/listers/walrus/v1/resourcerun.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceRunLister helps list ResourceRuns. +// All objects returned here must be treated as read-only. +type ResourceRunLister interface { + // List lists all ResourceRuns in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceRun, err error) + // ResourceRuns returns an object that can list and get ResourceRuns. + ResourceRuns(namespace string) ResourceRunNamespaceLister + ResourceRunListerExpansion +} + +// resourceRunLister implements the ResourceRunLister interface. +type resourceRunLister struct { + indexer cache.Indexer +} + +// NewResourceRunLister returns a new ResourceRunLister. +func NewResourceRunLister(indexer cache.Indexer) ResourceRunLister { + return &resourceRunLister{indexer: indexer} +} + +// List lists all ResourceRuns in the indexer. +func (s *resourceRunLister) List(selector labels.Selector) (ret []*v1.ResourceRun, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceRun)) + }) + return ret, err +} + +// ResourceRuns returns an object that can list and get ResourceRuns. +func (s *resourceRunLister) ResourceRuns(namespace string) ResourceRunNamespaceLister { + return resourceRunNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceRunNamespaceLister helps list and get ResourceRuns. +// All objects returned here must be treated as read-only. +type ResourceRunNamespaceLister interface { + // List lists all ResourceRuns in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceRun, err error) + // Get retrieves the ResourceRun from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceRun, error) + ResourceRunNamespaceListerExpansion +} + +// resourceRunNamespaceLister implements the ResourceRunNamespaceLister +// interface. +type resourceRunNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceRuns in the indexer for a given namespace. +func (s resourceRunNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceRun, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceRun)) + }) + return ret, err +} + +// Get retrieves the ResourceRun from the indexer for a given namespace and name. +func (s resourceRunNamespaceLister) Get(name string) (*v1.ResourceRun, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resourcerun"), name) + } + return obj.(*v1.ResourceRun), nil +} diff --git a/pkg/clients/listers/walrus/v1/setting.go b/pkg/clients/listers/walrus/v1/setting.go new file mode 100644 index 000000000..545ca1005 --- /dev/null +++ b/pkg/clients/listers/walrus/v1/setting.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SettingLister helps list Settings. +// All objects returned here must be treated as read-only. +type SettingLister interface { + // List lists all Settings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Setting, err error) + // Settings returns an object that can list and get Settings. + Settings(namespace string) SettingNamespaceLister + SettingListerExpansion +} + +// settingLister implements the SettingLister interface. +type settingLister struct { + indexer cache.Indexer +} + +// NewSettingLister returns a new SettingLister. +func NewSettingLister(indexer cache.Indexer) SettingLister { + return &settingLister{indexer: indexer} +} + +// List lists all Settings in the indexer. +func (s *settingLister) List(selector labels.Selector) (ret []*v1.Setting, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Setting)) + }) + return ret, err +} + +// Settings returns an object that can list and get Settings. +func (s *settingLister) Settings(namespace string) SettingNamespaceLister { + return settingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SettingNamespaceLister helps list and get Settings. +// All objects returned here must be treated as read-only. +type SettingNamespaceLister interface { + // List lists all Settings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Setting, err error) + // Get retrieves the Setting from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Setting, error) + SettingNamespaceListerExpansion +} + +// settingNamespaceLister implements the SettingNamespaceLister +// interface. +type settingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Settings in the indexer for a given namespace. +func (s settingNamespaceLister) List(selector labels.Selector) (ret []*v1.Setting, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Setting)) + }) + return ret, err +} + +// Get retrieves the Setting from the indexer for a given namespace and name. +func (s settingNamespaceLister) Get(name string) (*v1.Setting, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("setting"), name) + } + return obj.(*v1.Setting), nil +} diff --git a/pkg/clients/listers/walrus/v1/template.go b/pkg/clients/listers/walrus/v1/template.go new file mode 100644 index 000000000..dbf799fac --- /dev/null +++ b/pkg/clients/listers/walrus/v1/template.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TemplateLister helps list Templates. +// All objects returned here must be treated as read-only. +type TemplateLister interface { + // List lists all Templates in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Template, err error) + // Templates returns an object that can list and get Templates. + Templates(namespace string) TemplateNamespaceLister + TemplateListerExpansion +} + +// templateLister implements the TemplateLister interface. +type templateLister struct { + indexer cache.Indexer +} + +// NewTemplateLister returns a new TemplateLister. +func NewTemplateLister(indexer cache.Indexer) TemplateLister { + return &templateLister{indexer: indexer} +} + +// List lists all Templates in the indexer. +func (s *templateLister) List(selector labels.Selector) (ret []*v1.Template, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Template)) + }) + return ret, err +} + +// Templates returns an object that can list and get Templates. +func (s *templateLister) Templates(namespace string) TemplateNamespaceLister { + return templateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TemplateNamespaceLister helps list and get Templates. +// All objects returned here must be treated as read-only. +type TemplateNamespaceLister interface { + // List lists all Templates in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Template, err error) + // Get retrieves the Template from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Template, error) + TemplateNamespaceListerExpansion +} + +// templateNamespaceLister implements the TemplateNamespaceLister +// interface. +type templateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Templates in the indexer for a given namespace. +func (s templateNamespaceLister) List(selector labels.Selector) (ret []*v1.Template, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Template)) + }) + return ret, err +} + +// Get retrieves the Template from the indexer for a given namespace and name. +func (s templateNamespaceLister) Get(name string) (*v1.Template, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("template"), name) + } + return obj.(*v1.Template), nil +} diff --git a/pkg/clients/listers/walrus/v1/variable.go b/pkg/clients/listers/walrus/v1/variable.go new file mode 100644 index 000000000..3ed0398fd --- /dev/null +++ b/pkg/clients/listers/walrus/v1/variable.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VariableLister helps list Variables. +// All objects returned here must be treated as read-only. +type VariableLister interface { + // List lists all Variables in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Variable, err error) + // Variables returns an object that can list and get Variables. + Variables(namespace string) VariableNamespaceLister + VariableListerExpansion +} + +// variableLister implements the VariableLister interface. +type variableLister struct { + indexer cache.Indexer +} + +// NewVariableLister returns a new VariableLister. +func NewVariableLister(indexer cache.Indexer) VariableLister { + return &variableLister{indexer: indexer} +} + +// List lists all Variables in the indexer. +func (s *variableLister) List(selector labels.Selector) (ret []*v1.Variable, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Variable)) + }) + return ret, err +} + +// Variables returns an object that can list and get Variables. +func (s *variableLister) Variables(namespace string) VariableNamespaceLister { + return variableNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VariableNamespaceLister helps list and get Variables. +// All objects returned here must be treated as read-only. +type VariableNamespaceLister interface { + // List lists all Variables in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Variable, err error) + // Get retrieves the Variable from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Variable, error) + VariableNamespaceListerExpansion +} + +// variableNamespaceLister implements the VariableNamespaceLister +// interface. +type variableNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Variables in the indexer for a given namespace. +func (s variableNamespaceLister) List(selector labels.Selector) (ret []*v1.Variable, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Variable)) + }) + return ret, err +} + +// Get retrieves the Variable from the indexer for a given namespace and name. +func (s variableNamespaceLister) Get(name string) (*v1.Variable, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("variable"), name) + } + return obj.(*v1.Variable), nil +} diff --git a/pkg/clients/listers/walruscore/v1/catalog.go b/pkg/clients/listers/walruscore/v1/catalog.go new file mode 100644 index 000000000..5a9deeea6 --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/catalog.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CatalogLister helps list Catalogs. +// All objects returned here must be treated as read-only. +type CatalogLister interface { + // List lists all Catalogs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Catalog, err error) + // Catalogs returns an object that can list and get Catalogs. + Catalogs(namespace string) CatalogNamespaceLister + CatalogListerExpansion +} + +// catalogLister implements the CatalogLister interface. +type catalogLister struct { + indexer cache.Indexer +} + +// NewCatalogLister returns a new CatalogLister. +func NewCatalogLister(indexer cache.Indexer) CatalogLister { + return &catalogLister{indexer: indexer} +} + +// List lists all Catalogs in the indexer. +func (s *catalogLister) List(selector labels.Selector) (ret []*v1.Catalog, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Catalog)) + }) + return ret, err +} + +// Catalogs returns an object that can list and get Catalogs. +func (s *catalogLister) Catalogs(namespace string) CatalogNamespaceLister { + return catalogNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CatalogNamespaceLister helps list and get Catalogs. +// All objects returned here must be treated as read-only. +type CatalogNamespaceLister interface { + // List lists all Catalogs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Catalog, err error) + // Get retrieves the Catalog from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Catalog, error) + CatalogNamespaceListerExpansion +} + +// catalogNamespaceLister implements the CatalogNamespaceLister +// interface. +type catalogNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Catalogs in the indexer for a given namespace. +func (s catalogNamespaceLister) List(selector labels.Selector) (ret []*v1.Catalog, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Catalog)) + }) + return ret, err +} + +// Get retrieves the Catalog from the indexer for a given namespace and name. +func (s catalogNamespaceLister) Get(name string) (*v1.Catalog, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("catalog"), name) + } + return obj.(*v1.Catalog), nil +} diff --git a/pkg/clients/listers/walruscore/v1/connector.go b/pkg/clients/listers/walruscore/v1/connector.go new file mode 100644 index 000000000..53367b7cd --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/connector.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ConnectorLister helps list Connectors. +// All objects returned here must be treated as read-only. +type ConnectorLister interface { + // List lists all Connectors in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Connector, err error) + // Connectors returns an object that can list and get Connectors. + Connectors(namespace string) ConnectorNamespaceLister + ConnectorListerExpansion +} + +// connectorLister implements the ConnectorLister interface. +type connectorLister struct { + indexer cache.Indexer +} + +// NewConnectorLister returns a new ConnectorLister. +func NewConnectorLister(indexer cache.Indexer) ConnectorLister { + return &connectorLister{indexer: indexer} +} + +// List lists all Connectors in the indexer. +func (s *connectorLister) List(selector labels.Selector) (ret []*v1.Connector, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Connector)) + }) + return ret, err +} + +// Connectors returns an object that can list and get Connectors. +func (s *connectorLister) Connectors(namespace string) ConnectorNamespaceLister { + return connectorNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ConnectorNamespaceLister helps list and get Connectors. +// All objects returned here must be treated as read-only. +type ConnectorNamespaceLister interface { + // List lists all Connectors in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Connector, err error) + // Get retrieves the Connector from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Connector, error) + ConnectorNamespaceListerExpansion +} + +// connectorNamespaceLister implements the ConnectorNamespaceLister +// interface. +type connectorNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Connectors in the indexer for a given namespace. +func (s connectorNamespaceLister) List(selector labels.Selector) (ret []*v1.Connector, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Connector)) + }) + return ret, err +} + +// Get retrieves the Connector from the indexer for a given namespace and name. +func (s connectorNamespaceLister) Get(name string) (*v1.Connector, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("connector"), name) + } + return obj.(*v1.Connector), nil +} diff --git a/pkg/clients/listers/walruscore/v1/expansion_generated.go b/pkg/clients/listers/walruscore/v1/expansion_generated.go new file mode 100644 index 000000000..050bf9bd7 --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/expansion_generated.go @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +// CatalogListerExpansion allows custom methods to be added to +// CatalogLister. +type CatalogListerExpansion interface{} + +// CatalogNamespaceListerExpansion allows custom methods to be added to +// CatalogNamespaceLister. +type CatalogNamespaceListerExpansion interface{} + +// ConnectorListerExpansion allows custom methods to be added to +// ConnectorLister. +type ConnectorListerExpansion interface{} + +// ConnectorNamespaceListerExpansion allows custom methods to be added to +// ConnectorNamespaceLister. +type ConnectorNamespaceListerExpansion interface{} + +// ResourceListerExpansion allows custom methods to be added to +// ResourceLister. +type ResourceListerExpansion interface{} + +// ResourceNamespaceListerExpansion allows custom methods to be added to +// ResourceNamespaceLister. +type ResourceNamespaceListerExpansion interface{} + +// ResourceDefinitionListerExpansion allows custom methods to be added to +// ResourceDefinitionLister. +type ResourceDefinitionListerExpansion interface{} + +// ResourceDefinitionNamespaceListerExpansion allows custom methods to be added to +// ResourceDefinitionNamespaceLister. +type ResourceDefinitionNamespaceListerExpansion interface{} + +// ResourceRunListerExpansion allows custom methods to be added to +// ResourceRunLister. +type ResourceRunListerExpansion interface{} + +// ResourceRunNamespaceListerExpansion allows custom methods to be added to +// ResourceRunNamespaceLister. +type ResourceRunNamespaceListerExpansion interface{} + +// TemplateListerExpansion allows custom methods to be added to +// TemplateLister. +type TemplateListerExpansion interface{} + +// TemplateNamespaceListerExpansion allows custom methods to be added to +// TemplateNamespaceLister. +type TemplateNamespaceListerExpansion interface{} diff --git a/pkg/clients/listers/walruscore/v1/resource.go b/pkg/clients/listers/walruscore/v1/resource.go new file mode 100644 index 000000000..f6d0e7fba --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/resource.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceLister helps list Resources. +// All objects returned here must be treated as read-only. +type ResourceLister interface { + // List lists all Resources in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Resource, err error) + // Resources returns an object that can list and get Resources. + Resources(namespace string) ResourceNamespaceLister + ResourceListerExpansion +} + +// resourceLister implements the ResourceLister interface. +type resourceLister struct { + indexer cache.Indexer +} + +// NewResourceLister returns a new ResourceLister. +func NewResourceLister(indexer cache.Indexer) ResourceLister { + return &resourceLister{indexer: indexer} +} + +// List lists all Resources in the indexer. +func (s *resourceLister) List(selector labels.Selector) (ret []*v1.Resource, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Resource)) + }) + return ret, err +} + +// Resources returns an object that can list and get Resources. +func (s *resourceLister) Resources(namespace string) ResourceNamespaceLister { + return resourceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceNamespaceLister helps list and get Resources. +// All objects returned here must be treated as read-only. +type ResourceNamespaceLister interface { + // List lists all Resources in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Resource, err error) + // Get retrieves the Resource from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Resource, error) + ResourceNamespaceListerExpansion +} + +// resourceNamespaceLister implements the ResourceNamespaceLister +// interface. +type resourceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Resources in the indexer for a given namespace. +func (s resourceNamespaceLister) List(selector labels.Selector) (ret []*v1.Resource, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Resource)) + }) + return ret, err +} + +// Get retrieves the Resource from the indexer for a given namespace and name. +func (s resourceNamespaceLister) Get(name string) (*v1.Resource, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resource"), name) + } + return obj.(*v1.Resource), nil +} diff --git a/pkg/clients/listers/walruscore/v1/resourcedefinition.go b/pkg/clients/listers/walruscore/v1/resourcedefinition.go new file mode 100644 index 000000000..0af692c94 --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/resourcedefinition.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceDefinitionLister helps list ResourceDefinitions. +// All objects returned here must be treated as read-only. +type ResourceDefinitionLister interface { + // List lists all ResourceDefinitions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) + // ResourceDefinitions returns an object that can list and get ResourceDefinitions. + ResourceDefinitions(namespace string) ResourceDefinitionNamespaceLister + ResourceDefinitionListerExpansion +} + +// resourceDefinitionLister implements the ResourceDefinitionLister interface. +type resourceDefinitionLister struct { + indexer cache.Indexer +} + +// NewResourceDefinitionLister returns a new ResourceDefinitionLister. +func NewResourceDefinitionLister(indexer cache.Indexer) ResourceDefinitionLister { + return &resourceDefinitionLister{indexer: indexer} +} + +// List lists all ResourceDefinitions in the indexer. +func (s *resourceDefinitionLister) List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceDefinition)) + }) + return ret, err +} + +// ResourceDefinitions returns an object that can list and get ResourceDefinitions. +func (s *resourceDefinitionLister) ResourceDefinitions(namespace string) ResourceDefinitionNamespaceLister { + return resourceDefinitionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceDefinitionNamespaceLister helps list and get ResourceDefinitions. +// All objects returned here must be treated as read-only. +type ResourceDefinitionNamespaceLister interface { + // List lists all ResourceDefinitions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) + // Get retrieves the ResourceDefinition from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceDefinition, error) + ResourceDefinitionNamespaceListerExpansion +} + +// resourceDefinitionNamespaceLister implements the ResourceDefinitionNamespaceLister +// interface. +type resourceDefinitionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceDefinitions in the indexer for a given namespace. +func (s resourceDefinitionNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceDefinition, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceDefinition)) + }) + return ret, err +} + +// Get retrieves the ResourceDefinition from the indexer for a given namespace and name. +func (s resourceDefinitionNamespaceLister) Get(name string) (*v1.ResourceDefinition, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resourcedefinition"), name) + } + return obj.(*v1.ResourceDefinition), nil +} diff --git a/pkg/clients/listers/walruscore/v1/resourcerun.go b/pkg/clients/listers/walruscore/v1/resourcerun.go new file mode 100644 index 000000000..705e25b64 --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/resourcerun.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceRunLister helps list ResourceRuns. +// All objects returned here must be treated as read-only. +type ResourceRunLister interface { + // List lists all ResourceRuns in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceRun, err error) + // ResourceRuns returns an object that can list and get ResourceRuns. + ResourceRuns(namespace string) ResourceRunNamespaceLister + ResourceRunListerExpansion +} + +// resourceRunLister implements the ResourceRunLister interface. +type resourceRunLister struct { + indexer cache.Indexer +} + +// NewResourceRunLister returns a new ResourceRunLister. +func NewResourceRunLister(indexer cache.Indexer) ResourceRunLister { + return &resourceRunLister{indexer: indexer} +} + +// List lists all ResourceRuns in the indexer. +func (s *resourceRunLister) List(selector labels.Selector) (ret []*v1.ResourceRun, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceRun)) + }) + return ret, err +} + +// ResourceRuns returns an object that can list and get ResourceRuns. +func (s *resourceRunLister) ResourceRuns(namespace string) ResourceRunNamespaceLister { + return resourceRunNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceRunNamespaceLister helps list and get ResourceRuns. +// All objects returned here must be treated as read-only. +type ResourceRunNamespaceLister interface { + // List lists all ResourceRuns in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceRun, err error) + // Get retrieves the ResourceRun from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceRun, error) + ResourceRunNamespaceListerExpansion +} + +// resourceRunNamespaceLister implements the ResourceRunNamespaceLister +// interface. +type resourceRunNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceRuns in the indexer for a given namespace. +func (s resourceRunNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceRun, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceRun)) + }) + return ret, err +} + +// Get retrieves the ResourceRun from the indexer for a given namespace and name. +func (s resourceRunNamespaceLister) Get(name string) (*v1.ResourceRun, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("resourcerun"), name) + } + return obj.(*v1.ResourceRun), nil +} diff --git a/pkg/clients/listers/walruscore/v1/template.go b/pkg/clients/listers/walruscore/v1/template.go new file mode 100644 index 000000000..981960fa9 --- /dev/null +++ b/pkg/clients/listers/walruscore/v1/template.go @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TemplateLister helps list Templates. +// All objects returned here must be treated as read-only. +type TemplateLister interface { + // List lists all Templates in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Template, err error) + // Templates returns an object that can list and get Templates. + Templates(namespace string) TemplateNamespaceLister + TemplateListerExpansion +} + +// templateLister implements the TemplateLister interface. +type templateLister struct { + indexer cache.Indexer +} + +// NewTemplateLister returns a new TemplateLister. +func NewTemplateLister(indexer cache.Indexer) TemplateLister { + return &templateLister{indexer: indexer} +} + +// List lists all Templates in the indexer. +func (s *templateLister) List(selector labels.Selector) (ret []*v1.Template, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Template)) + }) + return ret, err +} + +// Templates returns an object that can list and get Templates. +func (s *templateLister) Templates(namespace string) TemplateNamespaceLister { + return templateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TemplateNamespaceLister helps list and get Templates. +// All objects returned here must be treated as read-only. +type TemplateNamespaceLister interface { + // List lists all Templates in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Template, err error) + // Get retrieves the Template from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Template, error) + TemplateNamespaceListerExpansion +} + +// templateNamespaceLister implements the TemplateNamespaceLister +// interface. +type templateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Templates in the indexer for a given namespace. +func (s templateNamespaceLister) List(selector labels.Selector) (ret []*v1.Template, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Template)) + }) + return ret, err +} + +// Get retrieves the Template from the indexer for a given namespace and name. +func (s templateNamespaceLister) Get(name string) (*v1.Template, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.SchemeResource("template"), name) + } + return obj.(*v1.Template), nil +} diff --git a/pkg/controller/types.go b/pkg/controller/types.go new file mode 100644 index 000000000..c06e8bab1 --- /dev/null +++ b/pkg/controller/types.go @@ -0,0 +1,27 @@ +package controller + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +type ( + // SetupOptions is the options for setting up a controller. + SetupOptions struct { + // Manager is the controller-runtime manager. + Manager ctrl.Manager + } + + // Setup is the interface for the controller setup. + Setup interface { + ctrlreconcile.Reconciler + // SetupController sets up the controller. + // + // SetupController is called before the Cache is started, + // you should not do anything that requires the Cache to be started. + // Instead, you can configure the Cache, like IndexField or something else. + SetupController(ctx context.Context, opts SetupOptions) error + } +) diff --git a/pkg/controllers/setup.go b/pkg/controllers/setup.go new file mode 100644 index 000000000..1b846a2f3 --- /dev/null +++ b/pkg/controllers/setup.go @@ -0,0 +1,32 @@ +package controllers + +import ( + "context" + "fmt" + + "github.com/davecgh/go-spew/spew" + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/seal-io/walrus/pkg/controller" + "github.com/seal-io/walrus/pkg/controllers/walruscore" +) + +// NB(thxCode): Register controllers below. +var setupers = []controller.Setup{ + new(walruscore.CatalogReconciler), + new(walruscore.ConnectorReconciler), + new(walruscore.ResourceReconciler), + new(walruscore.ResourceDefinitionReconciler), + new(walruscore.TemplateReconciler), +} + +func Setup(ctx context.Context, mgr ctrl.Manager) error { + for i := range setupers { + opts := controller.SetupOptions{Manager: mgr} + err := setupers[i].SetupController(ctx, opts) + if err != nil { + return fmt.Errorf("controller setup: %s: %w", spew.Sdump(setupers[i]), err) + } + } + return nil +} diff --git a/pkg/controllers/walruscore/catalog.go b/pkg/controllers/walruscore/catalog.go new file mode 100644 index 000000000..74b34741b --- /dev/null +++ b/pkg/controllers/walruscore/catalog.go @@ -0,0 +1,31 @@ +package walruscore + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrllog "sigs.k8s.io/controller-runtime/pkg/log" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/controller" +) + +// CatalogReconciler reconciles a v1.Catalog object. +type CatalogReconciler struct{} + +var _ ctrlreconcile.Reconciler = (*CatalogReconciler)(nil) + +func (r *CatalogReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = ctrllog.FromContext(ctx) + + // TODO: your logic here + + return ctrl.Result{}, nil +} + +func (r *CatalogReconciler) SetupController(_ context.Context, opts controller.SetupOptions) error { + return ctrl.NewControllerManagedBy(opts.Manager). + For(&walruscore.Catalog{}). + Complete(r) +} diff --git a/pkg/controllers/walruscore/connector.go b/pkg/controllers/walruscore/connector.go new file mode 100644 index 000000000..3f163d743 --- /dev/null +++ b/pkg/controllers/walruscore/connector.go @@ -0,0 +1,31 @@ +package walruscore + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrllog "sigs.k8s.io/controller-runtime/pkg/log" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/controller" +) + +// ConnectorReconciler reconciles a v1.Connector object. +type ConnectorReconciler struct{} + +var _ ctrlreconcile.Reconciler = (*ConnectorReconciler)(nil) + +func (r *ConnectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = ctrllog.FromContext(ctx) + + // TODO: your logic here + + return ctrl.Result{}, nil +} + +func (r *ConnectorReconciler) SetupController(_ context.Context, opts controller.SetupOptions) error { + return ctrl.NewControllerManagedBy(opts.Manager). + For(&walruscore.Connector{}). + Complete(r) +} diff --git a/pkg/controllers/walruscore/resource.go b/pkg/controllers/walruscore/resource.go new file mode 100644 index 000000000..898d5b7bd --- /dev/null +++ b/pkg/controllers/walruscore/resource.go @@ -0,0 +1,31 @@ +package walruscore + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrllog "sigs.k8s.io/controller-runtime/pkg/log" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/controller" +) + +// ResourceReconciler reconciles a v1.Resource object. +type ResourceReconciler struct{} + +var _ ctrlreconcile.Reconciler = (*ResourceReconciler)(nil) + +func (r *ResourceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = ctrllog.FromContext(ctx) + + // TODO: your logic here + + return ctrl.Result{}, nil +} + +func (r *ResourceReconciler) SetupController(_ context.Context, opts controller.SetupOptions) error { + return ctrl.NewControllerManagedBy(opts.Manager). + For(&walruscore.Resource{}). + Complete(r) +} diff --git a/pkg/controllers/walruscore/resource_definition.go b/pkg/controllers/walruscore/resource_definition.go new file mode 100644 index 000000000..e3c091d04 --- /dev/null +++ b/pkg/controllers/walruscore/resource_definition.go @@ -0,0 +1,31 @@ +package walruscore + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrllog "sigs.k8s.io/controller-runtime/pkg/log" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/controller" +) + +// ResourceDefinitionReconciler reconciles a v1.ResourceDefinition object. +type ResourceDefinitionReconciler struct{} + +var _ ctrlreconcile.Reconciler = (*ResourceDefinitionReconciler)(nil) + +func (r *ResourceDefinitionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = ctrllog.FromContext(ctx) + + // TODO: your logic here + + return ctrl.Result{}, nil +} + +func (r *ResourceDefinitionReconciler) SetupController(_ context.Context, opts controller.SetupOptions) error { + return ctrl.NewControllerManagedBy(opts.Manager). + For(&walruscore.ResourceDefinition{}). + Complete(r) +} diff --git a/pkg/controllers/walruscore/resource_run.go b/pkg/controllers/walruscore/resource_run.go new file mode 100644 index 000000000..ebac48802 --- /dev/null +++ b/pkg/controllers/walruscore/resource_run.go @@ -0,0 +1,31 @@ +package walruscore + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrllog "sigs.k8s.io/controller-runtime/pkg/log" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/controller" +) + +// ResourceRunReconciler reconciles a v1.ResourceRun object. +type ResourceRunReconciler struct{} + +var _ ctrlreconcile.Reconciler = (*ResourceRunReconciler)(nil) + +func (r *ResourceRunReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = ctrllog.FromContext(ctx) + + // TODO: your logic here + + return ctrl.Result{}, nil +} + +func (r *ResourceRunReconciler) SetupController(_ context.Context, opts controller.SetupOptions) error { + return ctrl.NewControllerManagedBy(opts.Manager). + For(&walruscore.ResourceRun{}). + Complete(r) +} diff --git a/pkg/controllers/walruscore/template.go b/pkg/controllers/walruscore/template.go new file mode 100644 index 000000000..a0d46c2d3 --- /dev/null +++ b/pkg/controllers/walruscore/template.go @@ -0,0 +1,31 @@ +package walruscore + +import ( + "context" + + ctrl "sigs.k8s.io/controller-runtime" + ctrllog "sigs.k8s.io/controller-runtime/pkg/log" + ctrlreconcile "sigs.k8s.io/controller-runtime/pkg/reconcile" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/controller" +) + +// TemplateReconciler reconciles a v1.Template object. +type TemplateReconciler struct{} + +var _ ctrlreconcile.Reconciler = (*TemplateReconciler)(nil) + +func (r *TemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = ctrllog.FromContext(ctx) + + // TODO: your logic here + + return ctrl.Result{}, nil +} + +func (r *TemplateReconciler) SetupController(_ context.Context, opts controller.SetupOptions) error { + return ctrl.NewControllerManagedBy(opts.Manager). + For(&walruscore.Template{}). + Complete(r) +} diff --git a/pkg/extensionapi/storage.go b/pkg/extensionapi/storage.go new file mode 100644 index 000000000..ed45b50d4 --- /dev/null +++ b/pkg/extensionapi/storage.go @@ -0,0 +1,1086 @@ +package extensionapi + +import ( + "context" + "errors" + "fmt" + "net/http" + + "github.com/seal-io/utils/pools/gopool" + kerrors "k8s.io/apimachinery/pkg/api/errors" + kmeta "k8s.io/apimachinery/pkg/api/meta" + metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" + "k8s.io/apiserver/pkg/storage/names" + "k8s.io/apiserver/pkg/util/dryrun" + "k8s.io/utils/ptr" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ( + // CreateHandler is an interface for a creation handler. + CreateHandler interface { + // New returns a new object. + New() runtime.Object + // OnCreate creates the object with the given options, + // and returns the created object. + OnCreate(ctx context.Context, object runtime.Object, opts ctrlcli.CreateOptions) (created runtime.Object, err error) + } + + // CreateOperation implements the rest.Creater interface. + CreateOperation struct { + Handler CreateHandler + } +) + +var _ rest.Creater = (*CreateOperation)(nil) + +// WithCreate returns a CreateOperation for the given CreateHandler. +func WithCreate(h CreateHandler) CreateOperation { + return CreateOperation{Handler: h} +} + +func (s CreateOperation) New() runtime.Object { + return s.Handler.New() +} + +func (s CreateOperation) Create( + ctx context.Context, + obj runtime.Object, + createValidation rest.ValidateObjectFunc, + options *meta.CreateOptions, +) (runtime.Object, error) { + if options == nil { + options = &meta.CreateOptions{} + } + + om, err := kmeta.Accessor(obj) + if err != nil { + return nil, kerrors.NewInternalError(err) + } + rest.FillObjectMetaSystemFields(om) + if gn := om.GetGenerateName(); len(gn) > 0 && len(om.GetName()) == 0 { + om.SetName(names.SimpleNameGenerator.GenerateName(gn)) + } + + if createValidation != nil { + err = createValidation(ctx, obj.DeepCopyObject()) + if err != nil { + return nil, err + } + } + + if dryrun.IsDryRun(options.DryRun) { + getter, ok := s.Handler.(rest.Getter) + if !ok { + // If the handler does not support get, we cannot check for existence. + return obj, nil + } + + _, err = getter.Get(ctx, om.GetName(), &meta.GetOptions{ResourceVersion: "0"}) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, wrapError(ctx, om.GetName(), err) + } + return obj, nil + } + + return nil, kerrors.NewAlreadyExists(qualifiedResourceFromContext(ctx), om.GetName()) + } + + obj, err = s.Handler.OnCreate(ctx, obj, convertCtrlCreateOptionsFromMeta(options)) + if err != nil { + return nil, wrapError(ctx, om.GetName(), err) + } + return obj, nil +} + +type ( + // ListHandler is an interface for a listing handler. + ListHandler interface { + // NewList returns an empty object that can be used with the List call. + NewList() runtime.Object + // OnList returns an object list collection for the given options. + OnList(ctx context.Context, opts ctrlcli.ListOptions) (list runtime.Object, err error) + } + + // ListOperation implements the rest.Lister interface. + ListOperation struct { + WatchBookmark WatchBookmark + Handler ListHandler + TableConvertor rest.TableConvertor + } +) + +var _ rest.Lister = (*ListOperation)(nil) + +// WithList returns a ListOperation for the given rest.TableConvertor and ListHandler. +func WithList(tc rest.TableConvertor, h ListHandler) ListOperation { + if tc == nil { + tc = NewDefaultTableConvertor() + } + return ListOperation{ + WatchBookmark: NewWatchBookmark(), + Handler: h, + TableConvertor: tc, + } +} + +func (s ListOperation) ConvertToTable(ctx context.Context, object, tableOptions runtime.Object) (*meta.Table, error) { + return s.TableConvertor.ConvertToTable(ctx, object, tableOptions) +} + +func (s ListOperation) NewList() runtime.Object { + return s.Handler.NewList() +} + +func (s ListOperation) List( + ctx context.Context, + options *metainternal.ListOptions, +) (runtime.Object, error) { + if options == nil { + options = &metainternal.ListOptions{ResourceVersion: "0"} + } + + listObj, err := s.Handler.OnList(ctx, convertCtrlListOptionsFromMeta(ctx, options)) + if err != nil { + return nil, wrapError(ctx, "", err) + } + + if listObj == nil { + listObj = s.Handler.NewList() + } else { + // Get the highest revision from the list items. + items, _ := kmeta.ExtractList(listObj) + if len(items) != 0 { + om, err := kmeta.Accessor(items[len(items)-1]) + if err == nil { + s.WatchBookmark.SwapResourceVersion(om.GetResourceVersion()) + } + } + } + + return listObj, nil +} + +type ( + // WatchHandler is an interface for a watching handler. + WatchHandler interface { + // OnWatch returns a watch.Interface that watches the list of objects. + OnWatch(ctx context.Context, opts ctrlcli.ListOptions) (watch.Interface, error) + } + + // ListWatchHandler is an interface for a listing handler. + ListWatchHandler interface { + ListHandler + WatchHandler + } + + // ListWatchOperation implements the rest.Lister and rest.Watcher interfaces. + ListWatchOperation struct { + ListOperation + Handler WatchHandler + } +) + +var ( + _ rest.Lister = (*ListWatchOperation)(nil) + _ rest.Watcher = (*ListWatchOperation)(nil) +) + +// WithListWatch returns a ListWatchOperation for the given rest.TableConvertor and ListWatchHandler. +func WithListWatch(tc rest.TableConvertor, h ListWatchHandler) ListWatchOperation { + return ListWatchOperation{ + ListOperation: WithList(tc, h), + Handler: h, + } +} + +func (s ListWatchOperation) Watch( + ctx context.Context, + options *metainternal.ListOptions, +) (watch.Interface, error) { + if options == nil { + options = &metainternal.ListOptions{ResourceVersion: "0", Watch: true} + } + + uw, err := s.Handler.OnWatch(ctx, convertCtrlListOptionsFromMeta(ctx, options)) + if err != nil { + return nil, wrapError(ctx, "", err) + } + + wm := s.WatchBookmark.DeepCopy() + c := make(chan watch.Event) + dw := watch.NewProxyWatcher(c) + gopool.Go(func() { + defer close(c) + defer uw.Stop() + + for { + select { + case <-ctx.Done(): + // Cancel by context. + return + case <-dw.StopChan(): + // Cancel by downstream. + return + case e, ok := <-uw.ResultChan(): + if !ok { + // Close by upstream. + return + } + + // Nothing to do. + if e.Object == nil { + c <- e + continue + } + + // Process bookmark. + if e.Type == watch.Bookmark { + c <- e + continue + } + + // Record the highest revision. + om, err := kmeta.Accessor(e.Object) + if err == nil { + swapped := wm.SwapResourceVersion(om.GetResourceVersion()) + if !swapped { + // If the revision is not updated, ignore the event. + continue + } + } + + c <- e + } + } + }) + + return dw, nil +} + +type ( + // GetHandler is an interface for a getting handler. + GetHandler interface { + rest.Scoper + // OnGet returns the object with the given key and options. + OnGet(ctx context.Context, key types.NamespacedName, opts ctrlcli.GetOptions) (object runtime.Object, err error) + } + + // GetOperation implements the rest.Getter interface. + GetOperation struct { + Handler GetHandler + } +) + +var _ rest.Getter = (*GetOperation)(nil) + +// WithGet returns a GetOperation for the given GetHandler. +func WithGet(h GetHandler) GetOperation { + return GetOperation{Handler: h} +} + +func (s GetOperation) Get( + ctx context.Context, + name string, + options *meta.GetOptions, +) (runtime.Object, error) { + if options == nil { + options = &meta.GetOptions{ResourceVersion: "0"} + } + + keyFunc := keyFuncForClusterScope + if s.Handler.NamespaceScoped() { + keyFunc = keyFuncForNamespacedScope + } + key, err := keyFunc(ctx, name) + if err != nil { + return nil, err + } + + obj, err := s.Handler.OnGet(ctx, key, convertCtrlGetOptionsFromMeta(options)) + if err != nil { + return nil, wrapError(ctx, name, err) + } + return obj, nil +} + +type ( + // UpdateHandler is an interface for an updating handler. + UpdateHandler interface { + GetHandler + // New returns a new object. + New() runtime.Object + // OnUpdate updates the object with the given options, + // and returns the updated object. + OnUpdate(ctx context.Context, object, oldObject runtime.Object, opts ctrlcli.UpdateOptions) (updated runtime.Object, err error) + } + + // BeforeUpdateFunc is a function that is called before update. + BeforeUpdateFunc = func(ctx context.Context, object, existing runtime.Object) (runtime.Object, error) + + // UpdateOperation implements the rest.Updater interface. + UpdateOperation struct { + Handler UpdateHandler + BeforeUpdate BeforeUpdateFunc + } +) + +var _ rest.Updater = (*UpdateOperation)(nil) + +// WithUpdate returns a UpdateOperation for the given UpdateHandler. +func WithUpdate(h UpdateHandler) UpdateOperation { + var bf BeforeUpdateFunc + if _, ok := h.New().(ObjectWithStatusSubResource); ok { + bf = beforeUpdateFuncForPreventStatusModify + } + return UpdateOperation{ + Handler: h, + BeforeUpdate: bf, + } +} + +func (s UpdateOperation) New() runtime.Object { + return s.Handler.New() +} + +func (s UpdateOperation) Update( + ctx context.Context, + name string, + objInfo rest.UpdatedObjectInfo, + createValidation rest.ValidateObjectFunc, + updateValidation rest.ValidateObjectUpdateFunc, + forceAllowCreate bool, + options *meta.UpdateOptions, +) (runtime.Object, bool, error) { + if options == nil { + options = &meta.UpdateOptions{} + } + + keyFunc := keyFuncForClusterScope + if s.Handler.NamespaceScoped() { + keyFunc = keyFuncForNamespacedScope + } + key, err := keyFunc(ctx, name) + if err != nil { + return nil, false, err + } + + var creating bool + existing, err := s.Handler.OnGet(ctx, key, ctrlcli.GetOptions{}) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, false, wrapError(ctx, name, err) + } + if !forceAllowCreate { + return nil, false, kerrors.NewNotFound(qualifiedResourceFromContext(ctx), name) + } + existing = s.Handler.New() + creating = true + } + + obj, err := objInfo.UpdatedObject(ctx, existing) + if err != nil { + return nil, false, err + } + + if creating { + createHandler, ok := s.Handler.(CreateHandler) + if !ok { + // If the handler does not support get, just return an error. + return nil, false, kerrors.NewNotFound(qualifiedResourceFromContext(ctx), name) + } + + creator := WithCreate(createHandler) + obj, err = creator.Create(ctx, obj, createValidation, newCreateOptionsFromUpdateOptions(options)) + if err != nil { + return nil, false, err + } + return obj, true, nil + } + + om, err := kmeta.Accessor(obj) + if err != nil { + return nil, false, kerrors.NewInternalError(err) + } + + if om.GetResourceVersion() == "" { + gk := qualifiedKindFromContext(ctx) + dt := field.Invalid( + field.NewPath("metadata.resourceVersion"), + 0, + "must be specified for an update", + ) + return nil, false, kerrors.NewInvalid(gk, name, field.ErrorList{dt}) + } + + if s.BeforeUpdate != nil { + obj, err = s.BeforeUpdate(ctx, obj, existing) + if err != nil { + return nil, false, kerrors.NewInternalError(err) + } + } + + obj, err = fieldmanager.IgnoreManagedFieldsTimestampsTransformer(ctx, obj, existing) + if err != nil { + return nil, false, err + } + + if updateValidation != nil { + err = updateValidation(ctx, obj.DeepCopyObject(), existing.DeepCopyObject()) + if err != nil { + return nil, false, err + } + } + + if dryrun.IsDryRun(options.DryRun) { + return obj, false, nil + } + + obj, err = s.Handler.OnUpdate(ctx, obj, existing, convertCtrlUpdateOptionsFromMeta(options)) + if err != nil { + return nil, false, wrapError(ctx, name, err) + } + return obj, false, err +} + +func (s UpdateOperation) GetStatusSubResourceUpdater() UpdateOperation { + s.BeforeUpdate = beforeUpdateFuncForStatusModifyOnly + return s +} + +type ( + // CreateUpdateHandler is an interface for creating and updating handler. + CreateUpdateHandler interface { + GetHandler + // New returns a new object. + New() runtime.Object + // OnCreate creates the object with the given options, + // and returns the created object. + OnCreate(ctx context.Context, object runtime.Object, opts ctrlcli.CreateOptions) (created runtime.Object, err error) + // OnUpdate updates the object with the given options, + // and returns the updated object. + OnUpdate(ctx context.Context, object, oldObject runtime.Object, opts ctrlcli.UpdateOptions) (updated runtime.Object, err error) + } + + // CreateUpdateOperation implements the rest.Creater and rest.Updater interface. + CreateUpdateOperation struct { + UpdateOperation + CreateOperation CreateOperation + } +) + +var ( + _ rest.Creater = (*CreateUpdateOperation)(nil) + _ rest.Updater = (*CreateUpdateOperation)(nil) +) + +// WithCreateUpdate returns a CreateUpdateOperation for the given CreateUpdateHandler. +func WithCreateUpdate(h CreateUpdateHandler) CreateUpdateOperation { + return CreateUpdateOperation{ + UpdateOperation: WithUpdate(h), + CreateOperation: WithCreate(h), + } +} + +func (s CreateUpdateOperation) Create( + ctx context.Context, + obj runtime.Object, + createValidation rest.ValidateObjectFunc, + options *meta.CreateOptions, +) (runtime.Object, error) { + return s.CreateOperation.Create(ctx, obj, createValidation, options) +} + +func (s CreateUpdateOperation) Update( + ctx context.Context, + name string, + objInfo rest.UpdatedObjectInfo, + createValidation rest.ValidateObjectFunc, + updateValidation rest.ValidateObjectUpdateFunc, + forceAllowCreate bool, + options *meta.UpdateOptions, +) (runtime.Object, bool, error) { + return s.UpdateOperation.Update(ctx, name, objInfo, createValidation, updateValidation, forceAllowCreate, options) +} + +type ( + // DeleteHandler is an interface for a deletion handler. + DeleteHandler = interface { + GetHandler + // OnDelete deletes the object with the given options. + OnDelete(ctx context.Context, object runtime.Object, opts ctrlcli.DeleteOptions) error + } + + // DeleteOperation implements the rest.Deleter interface. + DeleteOperation struct { + Handler DeleteHandler + } +) + +var _ rest.GracefulDeleter = (*DeleteOperation)(nil) + +// WithDelete returns a DeleteOperation for the given DeleteHandler. +func WithDelete(h DeleteHandler) DeleteOperation { + return DeleteOperation{ + Handler: h, + } +} + +func (s DeleteOperation) Delete( + ctx context.Context, + name string, + deleteValidation rest.ValidateObjectFunc, + options *meta.DeleteOptions, +) (runtime.Object, bool, error) { + if options == nil { + options = &meta.DeleteOptions{GracePeriodSeconds: ptr.To[int64](0)} + } + + keyFunc := keyFuncForClusterScope + if s.Handler.NamespaceScoped() { + keyFunc = keyFuncForNamespacedScope + } + key, err := keyFunc(ctx, name) + if err != nil { + return nil, false, err + } + + existing, err := s.Handler.OnGet(ctx, key, ctrlcli.GetOptions{}) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, false, wrapError(ctx, name, err) + } + return nil, false, kerrors.NewNotFound(qualifiedResourceFromContext(ctx), name) + } + + om, err := kmeta.Accessor(existing) + if err != nil { + return nil, false, kerrors.NewInternalError(err) + } + + if deleteValidation != nil { + err = deleteValidation(ctx, existing.DeepCopyObject()) + if err != nil { + return nil, false, err + } + } + + gk := qualifiedKindFromContext(ctx) + st := &meta.Status{ + Status: meta.StatusSuccess, + Details: &meta.StatusDetails{ + Group: gk.Group, + Kind: gk.Kind, + Name: name, + UID: om.GetUID(), + }, + } + async := ptr.Deref(options.PropagationPolicy, meta.DeletePropagationBackground) == meta.DeletePropagationBackground + if dryrun.IsDryRun(options.DryRun) { + // TODO(thxCode): support delete dry run? + return st, async, nil + } + + err = s.Handler.OnDelete(ctx, existing, convertCtrlDeleteOptionsFromMeta(options)) + if err != nil { + return nil, false, wrapError(ctx, name, err) + } + return st, async, err +} + +// CollectionDeleteOperation implements the rest.Lister, rest.GracefulDeleter and rest.CollectionDeleter interfaces. +type CollectionDeleteOperation struct { + ListWatchOperation + DeleteOperation +} + +var ( + _ rest.Lister = (*CollectionDeleteOperation)(nil) + _ rest.GracefulDeleter = (*CollectionDeleteOperation)(nil) + _ rest.CollectionDeleter = (*CollectionDeleteOperation)(nil) +) + +// WithCollectionDelete returns a CollectionDeleteOperation for the given ListWatchHandler and DeleteHandler. +func WithCollectionDelete(l ListWatchOperation, d DeleteOperation) CollectionDeleteOperation { + return CollectionDeleteOperation{ + ListWatchOperation: l, + DeleteOperation: d, + } +} + +func (s CollectionDeleteOperation) DeleteCollection( + ctx context.Context, + deleteValidation rest.ValidateObjectFunc, + options *meta.DeleteOptions, + listOptions *metainternal.ListOptions, +) (runtime.Object, error) { + if options == nil { + options = meta.NewDeleteOptions(0) + } + if listOptions == nil { + listOptions = &metainternal.ListOptions{ResourceVersion: "0"} + } else { + listOptions = listOptions.DeepCopy() + } + + hasLimit := listOptions.Limit > 0 + if listOptions.Limit == 0 { + listOptions.Limit = 1000 + } + + var ( + items []runtime.Object + itemsCh = make(chan runtime.Object, 256) + ) + gp := gopool.GroupWithContextIn(ctx) + gp.Go(func(ctx context.Context) error { + for { + select { + case <-ctx.Done(): + return ctx.Err() + default: + } + + listObj, err := s.List(ctx, listOptions) + if err != nil { + return err + } + if listObj == nil { + return nil + } + + newItems, err := kmeta.ExtractList(listObj) + if err != nil { + return kerrors.NewInternalError(err) + } + items = append(items, newItems...) + + for i := 0; i < len(newItems); i++ { + select { + case itemsCh <- newItems[i]: + case <-ctx.Done(): + return ctx.Err() + } + } + + // Done as reached limit. + if hasLimit { + close(itemsCh) + return nil + } + + // Or done as no more items. + om, err := kmeta.ListAccessor(listObj) + if err != nil { + return kerrors.NewInternalError(err) + } + if om.GetContinue() == "" { + close(itemsCh) + return nil + } + + // Otherwise, continue. + listOptions.Continue = om.GetContinue() + listOptions.ResourceVersion = "" + listOptions.ResourceVersionMatch = "" + } + }) + gp.Go(func(ctx context.Context) error { + for { + var ( + item runtime.Object + ok bool + ) + select { + case <-ctx.Done(): + return ctx.Err() + case item, ok = <-itemsCh: + if !ok { + return nil + } + } + + om, err := kmeta.Accessor(item) + if err != nil { + return kerrors.NewInternalError(err) + } + + _, _, err = s.Delete(ctx, om.GetName(), deleteValidation, options.DeepCopy()) + if err != nil && !kerrors.IsNotFound(err) { + return err + } + } + }) + err := gp.Wait() + if err != nil { + return nil, kerrors.NewInternalError(err) + } + + listObj := s.NewList() + _ = kmeta.SetList(listObj, items) + return listObj, nil +} + +type ( + // CurdOperationsHandler is an interface for CURD handler. + CurdOperationsHandler interface { + CreateUpdateHandler + ListWatchHandler + GetHandler + DeleteHandler + } + + // CurdOperations implements the rest.Creater, rest.Lister, rest.Watcher, rest.Getter, + // rest.Updater, rest.GracefulDeleter and rest.CollectionDeleter interfaces. + CurdOperations struct { + CreateUpdateOperation + ListWatchOperation + GetOperation + DeleteOperation + CollectionDeleteOperation + } +) + +var ( + _ rest.Creater = (*CurdOperations)(nil) + _ rest.Lister = (*CurdOperations)(nil) + _ rest.Watcher = (*CurdOperations)(nil) + _ rest.Getter = (*CurdOperations)(nil) + _ rest.Updater = (*CurdOperations)(nil) + _ rest.Patcher = (*CurdOperations)(nil) + _ rest.GracefulDeleter = (*CurdOperations)(nil) + _ rest.CollectionDeleter = (*CurdOperations)(nil) +) + +// WithCurd returns a CurdOperations for the given rest.TableConvertor and CurdOperationsHandler, +// which implements the rest.Creater, rest.Lister, rest.Watcher, rest.Getter, rest.Updater, rest.GracefulDeleter +// and rest.CollectionDeleter interfaces. +func WithCurd(tc rest.TableConvertor, h CurdOperationsHandler) CurdOperations { + cu := WithCreateUpdate(h) + l := WithListWatch(tc, h) + g := WithGet(h) + d := WithDelete(h) + return CurdOperations{ + CreateUpdateOperation: cu, + ListWatchOperation: l, + GetOperation: g, + DeleteOperation: d, + CollectionDeleteOperation: WithCollectionDelete(l, d), + } +} + +type ( + // CurdProxyHandler is an handler for proxy CURD handler. + CurdProxyHandler[DO MetaObject, DOL MetaObjectList, UO MetaObject, UOL MetaObjectList] interface { + rest.Scoper + rest.Storage + // NewList returns an empty object that can be used with the List call. + NewList() runtime.Object + // CastObjectTo casts the object from downstream to upstream. + CastObjectTo(DO) UO + // CastObjectFrom casts the object from upstream to downstream. + CastObjectFrom(UO) DO + // CastObjectListTo casts the object list from downstream to upstream. + CastObjectListTo(DOL) UOL + // CastObjectListFrom casts the object list from upstream to downstream. + CastObjectListFrom(UOL) DOL + } + + // CurdProxyOnCreateAdvice is an interface for intercepting OnCreate. + CurdProxyOnCreateAdvice[DO MetaObject] interface { + // BeforeOnCreate is called before create. + BeforeOnCreate(ctx context.Context, obj DO, opts *ctrlcli.CreateOptions) error + } + + // CurdProxyOnListWatchAdvice is an interface for interception OnList/OnWatch. + CurdProxyOnListWatchAdvice interface { + // BeforeOnListWatch is called before list/watch. + BeforeOnListWatch(ctx context.Context, options *ctrlcli.ListOptions) error + } + + // CurdProxyOnGetAdvice is an interface for intercepting OnGet. + CurdProxyOnGetAdvice[DO MetaObject] interface { + // BeforeOnGet is called before get. + BeforeOnGet(ctx context.Context, key types.NamespacedName, opts *ctrlcli.GetOptions) error + } + + // CurdProxyOnUpdateAdvice is an interface for intercepting OnUpdate. + CurdProxyOnUpdateAdvice[DO MetaObject] interface { + // BeforeOnUpdate is called before update. + BeforeOnUpdate(ctx context.Context, obj, oldObj DO, opts *ctrlcli.UpdateOptions) error + } + + // CurdProxyOnDeleteAdvice is an interface for intercepting OnDelete. + CurdProxyOnDeleteAdvice[DO MetaObject] interface { + // BeforeOnDelete is called before delete. + BeforeOnDelete(ctx context.Context, obj DO, opts *ctrlcli.DeleteOptions) error + } + + // _CurdProxyHandler is a private struct that implements CurdProxyHandler. + _CurdProxyHandler[DO MetaObject, DOL MetaObjectList, UO MetaObject, UOL MetaObjectList] struct { + CurdProxyHandler[DO, DOL, UO, UOL] + CtrlCli ctrlcli.WithWatch + } +) + +// WithCurdProxy returns a CurdOperations with the given CurdProxyHandler. +func WithCurdProxy[DO MetaObject, DOL MetaObjectList, UO MetaObject, UOL MetaObjectList]( + tc rest.TableConvertor, + h CurdProxyHandler[DO, DOL, UO, UOL], + ctrlCli ctrlcli.WithWatch, +) CurdOperations { + ph := _CurdProxyHandler[DO, DOL, UO, UOL]{ + CurdProxyHandler: h, + CtrlCli: ctrlCli, + } + return WithCurd(tc, ph) +} + +// _CreateHandlerWithoutNew is an interface for a creation handler without New function. +type _CreateHandlerWithoutNew interface { + // OnCreate creates the object with the given options, + // and returns the created object. + OnCreate(ctx context.Context, object runtime.Object, opts ctrlcli.CreateOptions) (created runtime.Object, err error) +} + +func (h _CurdProxyHandler[DO, DOL, UO, UOL]) OnCreate( + ctx context.Context, + obj runtime.Object, + opts ctrlcli.CreateOptions, +) (runtime.Object, error) { + if gh, ok := h.CurdProxyHandler.(_CreateHandlerWithoutNew); ok { + return gh.OnCreate(ctx, obj, opts) + } + + if bf, ok := h.CurdProxyHandler.(CurdProxyOnCreateAdvice[DO]); ok { + err := bf.BeforeOnCreate(ctx, obj.(DO), &opts) + if err != nil { + return nil, err + } + } + + uo := h.CastObjectTo(obj.(DO)) + err := h.CtrlCli.Create(ctx, uo, &opts) + return h.CastObjectFrom(uo), err +} + +func (h _CurdProxyHandler[DO, DOL, UO, UOL]) OnList( + ctx context.Context, + opts ctrlcli.ListOptions, +) (runtime.Object, error) { + if gh, ok := h.CurdProxyHandler.(ListHandler); ok { + return gh.OnList(ctx, opts) + } + + if bf, ok := h.CurdProxyHandler.(CurdProxyOnListWatchAdvice); ok { + err := bf.BeforeOnListWatch(ctx, &opts) + if err != nil { + return nil, err + } + } + + uol := h.CastObjectListTo(h.NewList().(DOL)) + err := h.CtrlCli.List(ctx, uol, &opts) + return h.CastObjectListFrom(uol), err +} + +func (h _CurdProxyHandler[DO, DOL, UO, UOL]) OnWatch( + ctx context.Context, + opts ctrlcli.ListOptions, +) (watch.Interface, error) { + if gh, ok := h.CurdProxyHandler.(WatchHandler); ok { + return gh.OnWatch(ctx, opts) + } + + if bf, ok := h.CurdProxyHandler.(CurdProxyOnListWatchAdvice); ok { + err := bf.BeforeOnListWatch(ctx, &opts) + if err != nil { + return nil, err + } + } + + uol := h.CastObjectListTo(h.NewList().(DOL)) + uw, err := h.CtrlCli.Watch(ctx, uol, &opts) + if err != nil { + return nil, err + } + + c := make(chan watch.Event) + dw := watch.NewProxyWatcher(c) + gopool.Go(func() { + defer close(c) + defer uw.Stop() + + for { + select { + case <-ctx.Done(): + // Cancel by context. + return + case <-dw.StopChan(): + // Cancel by downstream. + return + case e, ok := <-uw.ResultChan(): + if !ok { + // Close by upstream. + return + } + + if e.Object == nil { + // Nothing to do. + c <- e + continue + } + + // Type assert. + uo, ok := e.Object.(UO) + if !ok { + continue + } + + // Cast. + e.Object = h.CastObjectFrom(uo) + c <- e + } + } + }) + + return dw, nil +} + +func (h _CurdProxyHandler[DO, DOL, UO, UOL]) OnGet( + ctx context.Context, + key types.NamespacedName, + opts ctrlcli.GetOptions, +) (runtime.Object, error) { + if gh, ok := h.CurdProxyHandler.(GetHandler); ok { + return gh.OnGet(ctx, key, opts) + } + + if bf, ok := h.CurdProxyHandler.(CurdProxyOnGetAdvice[DO]); ok { + err := bf.BeforeOnGet(ctx, key, &opts) + if err != nil { + return nil, err + } + } + uo := h.CastObjectTo(h.New().(DO)) + err := h.CtrlCli.Get(ctx, key, uo, &opts) + return h.CastObjectFrom(uo), err +} + +// _UpdateHandlerWithoutNew is an interface for an updating handler without New function. +type _UpdateHandlerWithoutNew interface { + // OnUpdate updates the object with the given options, + // and returns the updated object. + OnUpdate(ctx context.Context, object, oldObject runtime.Object, opts ctrlcli.UpdateOptions) (updated runtime.Object, err error) +} + +func (h _CurdProxyHandler[DO, DOL, UO, UOL]) OnUpdate( + ctx context.Context, + obj, oldObj runtime.Object, + opts ctrlcli.UpdateOptions, +) (runtime.Object, error) { + if gh, ok := h.CurdProxyHandler.(_UpdateHandlerWithoutNew); ok { + return gh.OnUpdate(ctx, obj, oldObj, opts) + } + + if bf, ok := h.CurdProxyHandler.(CurdProxyOnUpdateAdvice[DO]); ok { + err := bf.BeforeOnUpdate(ctx, obj.(DO), oldObj.(DO), &opts) + if err != nil { + return nil, err + } + } + uo := h.CastObjectTo(obj.(DO)) + err := h.CtrlCli.Update(ctx, uo, &opts) + return h.CastObjectFrom(uo), err +} + +func (h _CurdProxyHandler[DO, DOL, UO, UOL]) OnDelete( + ctx context.Context, + obj runtime.Object, + opts ctrlcli.DeleteOptions, +) error { + if gh, ok := h.CurdProxyHandler.(DeleteHandler); ok { + return gh.OnDelete(ctx, obj, opts) + } + + if bf, ok := h.CurdProxyHandler.(CurdProxyOnDeleteAdvice[DO]); ok { + err := bf.BeforeOnDelete(ctx, obj.(DO), &opts) + if err != nil { + return err + } + } + uo := h.CastObjectTo(obj.(DO)) + return h.CtrlCli.Delete(ctx, uo, &opts) +} + +func qualifiedResourceFromContext(ctx context.Context) schema.GroupResource { + ri, _ := genericapirequest.RequestInfoFrom(ctx) + return schema.GroupResource{ + Group: ri.APIGroup, + Resource: ri.Resource, + } +} + +func qualifiedKindFromContext(ctx context.Context) schema.GroupKind { + ri, _ := genericapirequest.RequestInfoFrom(ctx) + return schema.GroupKind{ + Group: ri.APIGroup, + Kind: ri.Resource, // We use the resource name as the kind name. + } +} + +func wrapError(ctx context.Context, name string, err error) error { + if err == nil { + return nil + } + + gk := qualifiedKindFromContext(ctx) + + var es meta.Status + if st, ok := err.(kerrors.APIStatus); ok || errors.As(err, &st) { + ss := st.Status() + ssd := ss.Details + if ssd == nil { + ssd = &meta.StatusDetails{} + } + es = meta.Status{ + Status: ss.Status, + Code: ss.Code, + Reason: ss.Reason, + Details: &meta.StatusDetails{ + Name: name, + Group: gk.Group, + Kind: gk.Kind, + UID: ssd.UID, + Causes: ssd.Causes, + RetryAfterSeconds: ssd.RetryAfterSeconds, + }, + Message: ss.Message, + } + } else { + es = meta.Status{ + Status: meta.StatusFailure, + Code: http.StatusInternalServerError, + Reason: meta.StatusReasonInternalError, + Details: &meta.StatusDetails{ + Name: name, + Group: gk.Group, + Kind: gk.Kind, + Causes: []meta.StatusCause{{Message: err.Error()}}, + }, + Message: fmt.Sprintf("Internal error occurred: %v", err), + } + } + + return &kerrors.StatusError{ErrStatus: es} +} diff --git a/pkg/extensionapi/storage_helper.go b/pkg/extensionapi/storage_helper.go new file mode 100644 index 000000000..7f23fd376 --- /dev/null +++ b/pkg/extensionapi/storage_helper.go @@ -0,0 +1,176 @@ +package extensionapi + +import ( + "context" + "fmt" + "strings" + + autoscaling "k8s.io/api/autoscaling/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/validation/path" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" + "k8s.io/utils/ptr" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +func newCreateOptionsFromUpdateOptions(in *v1.UpdateOptions) *v1.CreateOptions { + co := &v1.CreateOptions{ + DryRun: in.DryRun, + FieldManager: in.FieldManager, + FieldValidation: in.FieldValidation, + } + co.TypeMeta.SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("CreateOptions")) + return co +} + +func convertCtrlCreateOptionsFromMeta(in *v1.CreateOptions) ctrlcli.CreateOptions { + return ctrlcli.CreateOptions{ + DryRun: in.DryRun, + FieldManager: in.FieldManager, + Raw: in, + } +} + +func convertCtrlUpdateOptionsFromMeta(in *v1.UpdateOptions) ctrlcli.UpdateOptions { + return ctrlcli.UpdateOptions{ + DryRun: in.DryRun, + FieldManager: in.FieldManager, + Raw: in, + } +} + +func convertCtrlDeleteOptionsFromMeta(in *v1.DeleteOptions) ctrlcli.DeleteOptions { + return ctrlcli.DeleteOptions{ + GracePeriodSeconds: in.GracePeriodSeconds, + Preconditions: in.Preconditions, + PropagationPolicy: in.PropagationPolicy, + Raw: in, + DryRun: in.DryRun, + } +} + +func convertCtrlGetOptionsFromMeta(in *v1.GetOptions) ctrlcli.GetOptions { + return ctrlcli.GetOptions{ + Raw: in, + } +} + +func convertInternalListOptions(in *internalversion.ListOptions) v1.ListOptions { + var out v1.ListOptions + _ = internalversion.Convert_internalversion_ListOptions_To_v1_ListOptions(in, &out, nil) + out.TypeMeta.SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("ListOptions")) + return out +} + +func convertCtrlListOptionsFromMeta(ctx context.Context, in *internalversion.ListOptions) ctrlcli.ListOptions { + ns, _ := request.NamespaceFrom(ctx) + + opts := ctrlcli.ListOptions{ + Namespace: ns, + Limit: in.Limit, + Continue: in.Continue, + Raw: ptr.To(convertInternalListOptions(in)), + } + if in.FieldSelector != nil && !in.FieldSelector.Empty() { + opts.FieldSelector = in.FieldSelector + } + if in.LabelSelector != nil && !in.LabelSelector.Empty() { + opts.LabelSelector = in.LabelSelector + } + return opts +} + +func keyFuncForNamespacedScope(ctx context.Context, name string) (types.NamespacedName, error) { + ns, ok := request.NamespaceFrom(ctx) + if !ok || len(ns) == 0 { + return types.NamespacedName{}, + kerrors.NewBadRequest("Namespace parameter required.") + } + if len(name) == 0 { + return types.NamespacedName{}, + kerrors.NewBadRequest("Name parameter required.") + } + if msgs := path.IsValidPathSegmentName(name); len(msgs) != 0 { + return types.NamespacedName{}, + kerrors.NewBadRequest(fmt.Sprintf("Name parameter invalid: %q: %s", name, strings.Join(msgs, ";"))) + } + return types.NamespacedName{Name: name, Namespace: ns}, nil +} + +func keyFuncForClusterScope(ctx context.Context, name string) (types.NamespacedName, error) { + if len(name) == 0 { + return types.NamespacedName{}, + kerrors.NewBadRequest("Name parameter required.") + } + if msgs := path.IsValidPathSegmentName(name); len(msgs) != 0 { + return types.NamespacedName{}, + kerrors.NewBadRequest(fmt.Sprintf("Name parameter invalid: %q: %s", name, strings.Join(msgs, ";"))) + } + return types.NamespacedName{Name: name}, nil +} + +func beforeUpdateFuncForPreventStatusModify(ctx context.Context, newObj, oldObj runtime.Object) (runtime.Object, error) { + if oldWithStatus, ok := oldObj.(ObjectWithStatusSubResource); ok { + oldWithStatus.CopyStatusTo(newObj) + return newObj, nil + } + return nil, kerrors.NewBadRequest("do not support status subresource") +} + +func beforeUpdateFuncForStatusModifyOnly(ctx context.Context, newObj, oldObj runtime.Object) (runtime.Object, error) { + if newWithStatus, ok := newObj.(ObjectWithStatusSubResource); ok { + newWithStatus.CopyStatusTo(oldObj) + return oldObj, nil + } + return nil, kerrors.NewBadRequest("do not support status subresource") +} + +type _ScaleUpdatedObjectInfo struct { + rest.UpdatedObjectInfo +} + +func toScaleUpdatedObjectInfo(info rest.UpdatedObjectInfo) rest.UpdatedObjectInfo { + return _ScaleUpdatedObjectInfo{info} +} + +func (s _ScaleUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runtime.Object) (runtime.Object, error) { + withScale, ok := oldObj.(ObjectWithScaleSubResource) + if !ok { + return nil, kerrors.NewBadRequest("do not support scale subresource") + } + + oldScale := withScale.GetScale() + obj, err := s.UpdatedObjectInfo.UpdatedObject(ctx, oldScale) + if err != nil { + return nil, err + } + if obj == nil { + return nil, kerrors.NewBadRequest("returned nil updated object") + } + + newScale, ok := obj.(*autoscaling.Scale) + if !ok { + return nil, kerrors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj)) + } + withScale.SetScale(newScale) + if len(newScale.ResourceVersion) != 0 { + withScale.GetObjectMeta().SetResourceVersion(newScale.ResourceVersion) + } + + return withScale, nil +} + +func toScaleCreateValidation(fn rest.ValidateObjectFunc) rest.ValidateObjectFunc { + return func(ctx context.Context, obj runtime.Object) error { + withScale, ok := obj.(ObjectWithScaleSubResource) + if !ok { + return kerrors.NewBadRequest("do not support scale subresource") + } + return fn(ctx, withScale.GetScale()) + } +} diff --git a/pkg/extensionapi/storage_subresource.go b/pkg/extensionapi/storage_subresource.go new file mode 100644 index 000000000..ffa4919e3 --- /dev/null +++ b/pkg/extensionapi/storage_subresource.go @@ -0,0 +1,123 @@ +package extensionapi + +import ( + "context" + + autoscaling "k8s.io/api/autoscaling/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/rest" +) + +type ( + StatusSubResourceParentStore interface { + rest.Storage + rest.Getter + rest.Updater + // GetStatusSubResourceUpdater returns an Updater for the status subresource. + GetStatusSubResourceUpdater() UpdateOperation + } + + StatusSubResourceStorage struct { + StatusSubResourceParentStore + } +) + +var ( + _ rest.Storage = (*StatusSubResourceStorage)(nil) + _ rest.Getter = (*StatusSubResourceStorage)(nil) + _ rest.Updater = (*StatusSubResourceStorage)(nil) +) + +// AsStatusSubResourceStorage returns a default status SubResourceStorage for the given SubResourceObject. +func AsStatusSubResourceStorage(s StatusSubResourceParentStore) StatusSubResourceStorage { + return StatusSubResourceStorage{StatusSubResourceParentStore: s} +} + +func (s StatusSubResourceStorage) Update( + ctx context.Context, + name string, + objInfo rest.UpdatedObjectInfo, + createValidation rest.ValidateObjectFunc, + updateValidation rest.ValidateObjectUpdateFunc, + forceAllowCreate bool, + options *meta.UpdateOptions, +) (runtime.Object, bool, error) { + return s.GetStatusSubResourceUpdater().Update(ctx, name, objInfo, createValidation, updateValidation, forceAllowCreate, options) +} + +type ( + ScaleSubResourceParentStore interface { + rest.Getter + rest.Updater + } + + ScaleSubResourceStorage struct { + ScaleSubResourceParentStore + } +) + +var ( + _ rest.Storage = (*ScaleSubResourceStorage)(nil) + _ rest.Getter = (*ScaleSubResourceStorage)(nil) + _ rest.Updater = (*ScaleSubResourceStorage)(nil) +) + +// AsScaleSubResourceStorage returns a default scale SubResourceStorage for the given SubResourceObject. +func AsScaleSubResourceStorage(s ScaleSubResourceParentStore) ScaleSubResourceStorage { + return ScaleSubResourceStorage{ScaleSubResourceParentStore: s} +} + +func (s ScaleSubResourceStorage) New() runtime.Object { + return &autoscaling.Scale{} +} + +func (s ScaleSubResourceStorage) Destroy() { +} + +func (s ScaleSubResourceStorage) Get( + ctx context.Context, + name string, + options *meta.GetOptions, +) (runtime.Object, error) { + obj, err := s.ScaleSubResourceParentStore.Get(ctx, name, options) + if err != nil { + return nil, err + } + + withScale, ok := obj.(ObjectWithScaleSubResource) + if !ok { + return nil, kerrors.NewBadRequest("do not support scale subresource") + } + return withScale.GetScale(), nil +} + +func (s ScaleSubResourceStorage) Update( + ctx context.Context, + name string, + objInfo rest.UpdatedObjectInfo, + createValidation rest.ValidateObjectFunc, + updateValidation rest.ValidateObjectUpdateFunc, + forceAllowCreate bool, + options *meta.UpdateOptions, +) (runtime.Object, bool, error) { + obj, updated, err := s.ScaleSubResourceParentStore.Update( + ctx, + name, + toScaleUpdatedObjectInfo(objInfo), + toScaleCreateValidation(createValidation), + updateValidation, + forceAllowCreate, + options, + ) + if err != nil { + return nil, false, err + } + + withScale, ok := obj.(ObjectWithScaleSubResource) + if !ok { + return nil, false, kerrors.NewBadRequest("do not support scale subresource") + } + return withScale.GetScale(), updated, nil +} diff --git a/pkg/extensionapi/tableconvertor.go b/pkg/extensionapi/tableconvertor.go new file mode 100644 index 000000000..4bf7988b8 --- /dev/null +++ b/pkg/extensionapi/tableconvertor.go @@ -0,0 +1,159 @@ +package extensionapi + +import ( + "context" + "fmt" + "net/http" + "slices" + + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiexttableconvertor "k8s.io/apiextensions-apiserver/pkg/registry/customresource/tableconvertor" + kerrors "k8s.io/apimachinery/pkg/api/errors" + kmeta "k8s.io/apimachinery/pkg/api/meta" + metatable "k8s.io/apimachinery/pkg/api/meta/table" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/rest" +) + +var swaggerMetadataDescriptions = meta.ObjectMeta{}.SwaggerDoc() + +type ( + // JSONPathTableColumnDefinition is a definition of a column in a table that is populated. + // + // Must provide a JSONPath to extract the value from the custom resource. + JSONPathTableColumnDefinition struct { + meta.TableColumnDefinition + + // JSONPath is a simple JSON path (i.e. with array notation) which is evaluated against + // each custom resource to produce the value for this column. + JSONPath string + } + _JSONPathTableColumnInternalDefinition = apiext.CustomResourceColumnDefinition +) + +// NewJSONPathTableConvertor creates a new table convertor that uses JSONPath to extract values from custom resources. +// +// It relies on apiexttableconvertor.New to create the table convertor. +func NewJSONPathTableConvertor(definitions ...JSONPathTableColumnDefinition) (rest.TableConvertor, error) { + defs := make([]_JSONPathTableColumnInternalDefinition, 0, len(definitions)+1) + + agePriority := int32(0) + for i := range definitions { + switch { + case definitions[i].Name == "": + return nil, fmt.Errorf("column definition must have a non-empty name") + case definitions[i].JSONPath == "": + return nil, fmt.Errorf("column definition %q must have a non-empty JSONPath", definitions[i].Name) + case definitions[i].Priority < 0: + return nil, fmt.Errorf("column definition %q must have a non-negative priority", definitions[i].Name) + } + + desc := definitions[i].Description + if desc == "" { + // NB(thxCode): Avoid the default description generated by apiexttableconvertor.New. + desc = "Description to " + definitions[i].Name + } + + defs = append(defs, _JSONPathTableColumnInternalDefinition{ + Name: definitions[i].Name, + Description: desc, + Type: definitions[i].Type, + Format: definitions[i].Format, + JSONPath: definitions[i].JSONPath, + Priority: definitions[i].Priority, + }) + if definitions[i].Priority > agePriority { + agePriority = definitions[i].Priority + } + } + + defs = append(defs, _JSONPathTableColumnInternalDefinition{ + Name: "Age", + Description: swaggerMetadataDescriptions["creationTimestamp"], + Type: "date", + JSONPath: ".metadata.creationTimestamp", + Priority: agePriority + 1, + }) + + defs = slices.CompactFunc(defs, func(a, b _JSONPathTableColumnInternalDefinition) bool { + return a.Name == b.Name + }) + + return apiexttableconvertor.New(defs) +} + +type _DefaultTableColumnDefinition struct{} + +// NewDefaultTableConvertor creates a default convertor. +// +// It borrows from k8s.io/apiserver/pkg/registry/rest.NewDefaultTableConvertor, +// but modify the latest column name. +func NewDefaultTableConvertor() rest.TableConvertor { + return _DefaultTableColumnDefinition{} +} + +func (c _DefaultTableColumnDefinition) ConvertToTable(ctx context.Context, object, tableOptions runtime.Object) (*meta.Table, error) { + var table meta.Table + fn := func(obj runtime.Object) error { + m, err := kmeta.Accessor(obj) + if err != nil { + return &kerrors.StatusError{ + ErrStatus: meta.Status{ + Status: meta.StatusFailure, + Code: http.StatusNotAcceptable, + Reason: meta.StatusReasonNotAcceptable, + Message: fmt.Sprintf("do not support being converted to a Table: %v", err), + }, + } + } + table.Rows = append(table.Rows, meta.TableRow{ + Cells: []any{ + m.GetName(), + metatable.ConvertToHumanReadableDateType(m.GetCreationTimestamp()), + }, + Object: runtime.RawExtension{ + Object: obj, + }, + }) + return nil + } + + switch { + case kmeta.IsListType(object): + if err := kmeta.EachListItem(object, fn); err != nil { + return nil, err + } + default: + if err := fn(object); err != nil { + return nil, err + } + } + + if m, err := kmeta.ListAccessor(object); err == nil { + table.ResourceVersion = m.GetResourceVersion() + table.Continue = m.GetContinue() + table.RemainingItemCount = m.GetRemainingItemCount() + } else { + if m, err := kmeta.CommonAccessor(object); err == nil { + table.ResourceVersion = m.GetResourceVersion() + } + } + if opt, ok := tableOptions.(*meta.TableOptions); !ok || !opt.NoHeaders { + table.ColumnDefinitions = []meta.TableColumnDefinition{ + { + Name: "Name", + Description: swaggerMetadataDescriptions["name"], + Type: "string", + Format: "name", + }, + { + Name: "Age", + Description: swaggerMetadataDescriptions["creationTimestamp"], + Type: "date", + }, + } + } + + return &table, nil +} diff --git a/pkg/extensionapi/types.go b/pkg/extensionapi/types.go new file mode 100644 index 000000000..b9d11f52b --- /dev/null +++ b/pkg/extensionapi/types.go @@ -0,0 +1,67 @@ +package extensionapi + +import ( + "context" + + autoscaling "k8s.io/api/autoscaling/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/rest" + ctrl "sigs.k8s.io/controller-runtime" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ( + // SetupOptions is the options for setting up a handler. + SetupOptions struct { + // Manager is the controller-runtime manager. + Manager ctrl.Manager + } + + // Setup is an interface for setting up a handler. + Setup interface { + rest.Storage + // SetupHandler sets up the handler. + // + // SetupHandler is called before the Cache is started, + // you should not do anything that requires the Cache to be started. + // Instead, you can configure the Cache, like IndexField or something else. + SetupHandler(ctx context.Context, opts SetupOptions) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) // nolint: lll + } +) + +type ( + // ObjectInfo is an interface for informing extension API objects. + ObjectInfo interface { + rest.Scoper + rest.KindProvider + rest.SingularNameProvider + rest.CategoriesProvider + rest.ShortNamesProvider + } + + // ObjectWithStatusSubResource is an interface for extension API objects with status subresources, + // which indicates the resource has a status subresource. + ObjectWithStatusSubResource interface { + meta.ObjectMetaAccessor + runtime.Object + CopyStatusTo(runtime.Object) + } + + // ObjectWithScaleSubResource is an interface for extension API objects with scale subresources, + // which indicates the resource has a scale subresource. + ObjectWithScaleSubResource interface { + meta.ObjectMetaAccessor + runtime.Object + GetScale() *autoscaling.Scale + SetScale(*autoscaling.Scale) + } +) + +type ( + // MetaObject is the interface for the object with metadata. + MetaObject = ctrlcli.Object + // MetaObjectList is the interface for the list of objects with metadata. + MetaObjectList = ctrlcli.ObjectList +) diff --git a/pkg/extensionapi/watcher.go b/pkg/extensionapi/watcher.go new file mode 100644 index 000000000..5cb1d16ef --- /dev/null +++ b/pkg/extensionapi/watcher.go @@ -0,0 +1,48 @@ +package extensionapi + +import ( + "runtime" + + "go.uber.org/atomic" +) + +type WatchBookmark struct { + rv *atomic.String +} + +// NewWatchBookmark creates a new WatchBookmark. +func NewWatchBookmark() WatchBookmark { + return WatchBookmark{ + rv: atomic.NewString("0"), + } +} + +// SwapResourceVersion swaps the current resource version with the new one if the new one is greater. +// +// SwapResourceVersion returns false if the new resource version is not swapped. +func (c WatchBookmark) SwapResourceVersion(newRv string) bool { + for { + oldRv := c.rv.Load() + if oldRv == newRv || + len(oldRv) > len(newRv) || + (len(oldRv) == len(newRv) && oldRv > newRv) { + return false + } + if c.rv.CompareAndSwap(oldRv, newRv) { + return true + } + runtime.Gosched() // Yield to other goroutines. + } +} + +// GetResourceVersion returns the latest resource version. +func (c WatchBookmark) GetResourceVersion() string { + return c.rv.Load() +} + +// DeepCopy returns a deep copy of the WatchBookmark. +func (c WatchBookmark) DeepCopy() WatchBookmark { + return WatchBookmark{ + rv: atomic.NewString(c.rv.Load()), + } +} diff --git a/pkg/extensionapis/setup.go b/pkg/extensionapis/setup.go new file mode 100644 index 000000000..f99c1145a --- /dev/null +++ b/pkg/extensionapis/setup.go @@ -0,0 +1,141 @@ +package extensionapis + +import ( + "context" + "fmt" + + "github.com/davecgh/go-spew/spew" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apiserver/pkg/registry/rest" + genericapiserver "k8s.io/apiserver/pkg/server" + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/extensionapis/walrus" +) + +// NB(thxCode): Register handlers below. +var setupers = []extensionapi.Setup{ + new(walrus.CatalogHandler), + new(walrus.ConnectorHandler), + new(walrus.EnvironmentHandler), + new(walrus.FileExampleHandler), + new(walrus.ProjectHandler), + new(walrus.ResourceHandler), + new(walrus.ResourceDefinitionHandler), + new(walrus.ResourceRunHandler), + new(walrus.SettingHandler), + new(walrus.TemplateHandler), + new(walrus.VariableHandler), +} + +type _APIOptions struct { + ResourceStorage rest.Storage + SubResourceStorages map[string]rest.Storage +} + +func Setup( + ctx context.Context, + srv *genericapiserver.GenericAPIServer, + srvScheme *runtime.Scheme, + srvParameterCodec runtime.ParameterCodec, + srvCodec serializer.CodecFactory, + mgr ctrl.Manager, +) error { + // Setup all handlers. + apiOpts := make(map[string]map[string]map[string]_APIOptions) + for i := range setupers { + opts := extensionapi.SetupOptions{Manager: mgr} + gvr, srs, err := setupers[i].SetupHandler(ctx, opts) + if err != nil { + return fmt.Errorf("extension api setup: %s: %w", spew.Sdump(setupers[i]), err) + } + + if apiOpts[gvr.Group] == nil { + apiOpts[gvr.Group] = make(map[string]map[string]_APIOptions) + } + if apiOpts[gvr.Group][gvr.Version] == nil { + apiOpts[gvr.Group][gvr.Version] = make(map[string]_APIOptions) + } + apiOpts[gvr.Group][gvr.Version][gvr.Resource] = _APIOptions{ + ResourceStorage: setupers[i], + SubResourceStorages: srs, + } + } + + agis := make([]*genericapiserver.APIGroupInfo, 0, len(apiOpts)) + for _, gn := range sets.List(sets.KeySet(apiOpts)) { + agi := genericapiserver.NewDefaultAPIGroupInfo(gn, srvScheme, srvParameterCodec, srvCodec) + for _, vn := range sets.List(sets.KeySet(apiOpts[gn])) { + if len(apiOpts[gn][vn]) == 0 { + continue + } + agi.VersionedResourcesStorageMap[vn] = make(map[string]rest.Storage) + for _, rn := range sets.List(sets.KeySet(apiOpts[gn][vn])) { + igv := schema.GroupVersion{Group: gn, Version: runtime.APIVersionInternal} + egv := schema.GroupVersion{Group: gn, Version: vn} + stg := apiOpts[gn][vn][rn].ResourceStorage + // TODO(thxCode): Remove this hack after we adopt conversion-gen. + // Register internal version. + srvScheme.AddKnownTypes(igv, stg.New()) + if v, ok := stg.(rest.Lister); ok { + srvScheme.AddKnownTypes(igv, v.NewList()) + } + // Register primary storage. + agi.VersionedResourcesStorageMap[vn][rn] = stg + // Register status subresource if existed. + if _, ok := stg.New().(extensionapi.ObjectWithStatusSubResource); ok { + pstg := stg.(extensionapi.StatusSubResourceParentStore) + stg := extensionapi.AsStatusSubResourceStorage(pstg) + agi.VersionedResourcesStorageMap[vn][rn+"/status"] = stg + } + // Register scale subresource if existed. + if _, ok := stg.New().(extensionapi.ObjectWithScaleSubResource); ok { + pstg := stg.(extensionapi.ScaleSubResourceParentStore) + stg := extensionapi.AsScaleSubResourceStorage(pstg) + agi.VersionedResourcesStorageMap[vn][rn+"/scale"] = stg + } + // Register arbitrary subresources if existed. + { + srs := apiOpts[gn][vn][rn].SubResourceStorages + for srn := range srs { + sstg := srs[srn] + // Register internal version. + srvScheme.AddKnownTypes(igv, sstg.New()) + // Register external version. + srvScheme.AddKnownTypes(egv, sstg.New()) + // Register storage. + agi.VersionedResourcesStorageMap[vn][rn+"/"+srn] = sstg + // Register optional getter options. + if v, ok := sstg.(rest.GetterWithOptions); ok { + optionsObj, _, _ := v.NewGetOptions() + if optionsObj != nil { + // Register internal version. + srvScheme.AddKnownTypes(igv, optionsObj) + // Register external version. + srvScheme.AddKnownTypes(egv, optionsObj) + } + } + // Register optional connector options. + if v, ok := sstg.(rest.Connecter); ok { + optionsObj, _, _ := v.NewConnectOptions() + if optionsObj != nil { + // Register internal version. + srvScheme.AddKnownTypes(igv, optionsObj) + // Register external version. + srvScheme.AddKnownTypes(egv, optionsObj) + } + } + } + } + } + } + agis = append(agis, &agi) + } + + // Install. + return srv.InstallAPIGroups(agis...) +} diff --git a/pkg/extensionapis/walrus/catalog.go b/pkg/extensionapis/walrus/catalog.go new file mode 100644 index 000000000..a64de9bc9 --- /dev/null +++ b/pkg/extensionapis/walrus/catalog.go @@ -0,0 +1,77 @@ +package walrus + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/extensionapi" +) + +// CatalogHandler handles v1.Catalog objects. +// +// CatalogHandler proxies the v1.Catalog objects to the walrus core. +type CatalogHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations +} + +func (h *CatalogHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("catalogs") + + // As storage. + h.ObjectInfo = &walrus.Catalog{} + h.CurdOperations = extensionapi.WithCurdProxy[ + *walrus.Catalog, *walrus.CatalogList, *walruscore.Catalog, *walruscore.CatalogList, + ](nil, h, opts.Manager.GetClient().(ctrlcli.WithWatch)) + + return +} + +var ( + _ rest.Storage = (*CatalogHandler)(nil) + _ rest.Creater = (*CatalogHandler)(nil) + _ rest.Lister = (*CatalogHandler)(nil) + _ rest.Watcher = (*CatalogHandler)(nil) + _ rest.Getter = (*CatalogHandler)(nil) + _ rest.Updater = (*CatalogHandler)(nil) + _ rest.Patcher = (*CatalogHandler)(nil) + _ rest.GracefulDeleter = (*CatalogHandler)(nil) + _ rest.CollectionDeleter = (*CatalogHandler)(nil) +) + +func (h *CatalogHandler) Destroy() { +} + +func (h *CatalogHandler) New() runtime.Object { + return &walrus.Catalog{} +} + +func (h *CatalogHandler) NewList() runtime.Object { + return &walrus.CatalogList{} +} + +func (h *CatalogHandler) CastObjectTo(do *walrus.Catalog) (uo *walruscore.Catalog) { + return (*walruscore.Catalog)(do) +} + +func (h *CatalogHandler) CastObjectFrom(uo *walruscore.Catalog) (do *walrus.Catalog) { + return (*walrus.Catalog)(uo) +} + +func (h *CatalogHandler) CastObjectListTo(dol *walrus.CatalogList) (uol *walruscore.CatalogList) { + return (*walruscore.CatalogList)(dol) +} + +func (h *CatalogHandler) CastObjectListFrom(uol *walruscore.CatalogList) (dol *walrus.CatalogList) { + return (*walrus.CatalogList)(uol) +} diff --git a/pkg/extensionapis/walrus/connector.go b/pkg/extensionapis/walrus/connector.go new file mode 100644 index 000000000..7401a73a9 --- /dev/null +++ b/pkg/extensionapis/walrus/connector.go @@ -0,0 +1,77 @@ +package walrus + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/extensionapi" +) + +// ConnectorHandler handles v1.Connector objects. +// +// ConnectorHandler proxies the v1.Connector objects to the walrus core. +type ConnectorHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations +} + +func (h *ConnectorHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("connectors") + + // As storage. + h.ObjectInfo = &walrus.Connector{} + h.CurdOperations = extensionapi.WithCurdProxy[ + *walrus.Connector, *walrus.ConnectorList, *walruscore.Connector, *walruscore.ConnectorList, + ](nil, h, opts.Manager.GetClient().(ctrlcli.WithWatch)) + + return +} + +var ( + _ rest.Storage = (*ConnectorHandler)(nil) + _ rest.Creater = (*ConnectorHandler)(nil) + _ rest.Lister = (*ConnectorHandler)(nil) + _ rest.Watcher = (*ConnectorHandler)(nil) + _ rest.Getter = (*ConnectorHandler)(nil) + _ rest.Updater = (*ConnectorHandler)(nil) + _ rest.Patcher = (*ConnectorHandler)(nil) + _ rest.GracefulDeleter = (*ConnectorHandler)(nil) + _ rest.CollectionDeleter = (*ConnectorHandler)(nil) +) + +func (h *ConnectorHandler) Destroy() { +} + +func (h *ConnectorHandler) New() runtime.Object { + return &walrus.Connector{} +} + +func (h *ConnectorHandler) NewList() runtime.Object { + return &walrus.ConnectorList{} +} + +func (h *ConnectorHandler) CastObjectTo(do *walrus.Connector) (uo *walruscore.Connector) { + return (*walruscore.Connector)(do) +} + +func (h *ConnectorHandler) CastObjectFrom(uo *walruscore.Connector) (do *walrus.Connector) { + return (*walrus.Connector)(uo) +} + +func (h *ConnectorHandler) CastObjectListTo(dol *walrus.ConnectorList) (uol *walruscore.ConnectorList) { + return (*walruscore.ConnectorList)(dol) +} + +func (h *ConnectorHandler) CastObjectListFrom(uol *walruscore.ConnectorList) (dol *walrus.ConnectorList) { + return (*walrus.ConnectorList)(uol) +} diff --git a/pkg/extensionapis/walrus/environment.go b/pkg/extensionapis/walrus/environment.go new file mode 100644 index 000000000..9ac6ae7e6 --- /dev/null +++ b/pkg/extensionapis/walrus/environment.go @@ -0,0 +1,494 @@ +package walrus + +import ( + "context" + "errors" + "fmt" + "slices" + "sort" + "strings" + + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" + core "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/kubemeta" + "github.com/seal-io/walrus/pkg/systemauthz" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemmeta" +) + +// EnvironmentHandler handles v1.Environment objects. +// +// EnvironmentHandler maps the v1.Environment object to a Kubernetes Namespace resource, +// which is name as the environment's name. +// +// Each v1.Environment object will be controlled by a v1.Project object, +// which records in the OwnerReferences of the Namespace resource. +type EnvironmentHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations + + Client ctrlcli.Client +} + +func (h *EnvironmentHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Configure field indexer. + fi := opts.Manager.GetFieldIndexer() + err = fi.IndexField(ctx, &core.Namespace{}, "metadata.name", + func(obj ctrlcli.Object) []string { + if obj == nil { + return nil + } + return []string{obj.GetName()} + }) + if err != nil { + return + } + + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("environments") + + // Create table convertor to pretty the kubectl's output. + var tc rest.TableConvertor + { + tc, err = extensionapi.NewJSONPathTableConvertor( + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Type", + Type: "string", + }, + JSONPath: ".spec.type", + }, + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Phase", + Type: "string", + }, + JSONPath: ".status.phase", + }, + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Project", + Type: "string", + }, + JSONPath: ".status.project", + }) + if err != nil { + return + } + } + + // As storage. + h.ObjectInfo = &walrus.Environment{} + h.CurdOperations = extensionapi.WithCurd(tc, h) + + // Set client. + h.Client = opts.Manager.GetClient() + + return +} + +var ( + _ rest.Storage = (*EnvironmentHandler)(nil) + _ rest.Creater = (*EnvironmentHandler)(nil) + _ rest.Lister = (*EnvironmentHandler)(nil) + _ rest.Watcher = (*EnvironmentHandler)(nil) + _ rest.Getter = (*EnvironmentHandler)(nil) + _ rest.Updater = (*EnvironmentHandler)(nil) + _ rest.Patcher = (*EnvironmentHandler)(nil) + _ rest.GracefulDeleter = (*EnvironmentHandler)(nil) + _ rest.CollectionDeleter = (*EnvironmentHandler)(nil) +) + +func (h *EnvironmentHandler) New() runtime.Object { + return &walrus.Environment{} +} + +func (h *EnvironmentHandler) Destroy() {} + +func (h *EnvironmentHandler) OnCreate(ctx context.Context, obj runtime.Object, opts ctrlcli.CreateOptions) (runtime.Object, error) { + // Validate. + env := obj.(*walrus.Environment) + { + var errs field.ErrorList + if !strings.HasPrefix(env.Name, env.Namespace+"-") { + errs = append(errs, field.Invalid( + field.NewPath("name"), env.Name, "name must start with the namespace")) + } + if stringx.StringWidth(env.Name) > 30 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("name"), stringx.StringWidth(env.Name), 30)) + } + if err := env.Spec.Type.Validate(); err != nil { + errs = append(errs, field.Invalid( + field.NewPath("spec.type"), env.Spec.Type, err.Error())) + } + if stringx.StringWidth(env.Spec.DisplayName) > 30 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.displayName"), stringx.StringWidth(env.Spec.DisplayName), 30)) + } + if stringx.StringWidth(env.Spec.Description) > 50 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.description"), stringx.StringWidth(env.Spec.Description), 50)) + } + if len(errs) > 0 { + return nil, kerrors.NewInvalid(walrus.SchemeKind("environments"), env.Name, errs) + } + } + + // Get project. + proj := &walrus.Project{ + ObjectMeta: meta.ObjectMeta{ + Namespace: systemkuberes.SystemNamespaceName, + Name: env.Namespace, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(proj), proj) + if err != nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("projects"), proj.Name) + } + + // Create. + { + ns := convertNamespaceFromEnvironment(env) + kubemeta.ControlOn(ns, proj, walrus.SchemeGroupVersion.WithKind("Project")) + err = h.Client.Create(ctx, ns, &opts) + if err != nil { + return nil, err + } + env = convertEnvironmentFromNamespace(ns) + } + + // Create RBAC. + err = systemauthz.CreateEnvironmentSpace(ctx, h.Client, env) + if err != nil { + return nil, kerrors.NewInternalError(fmt.Errorf("create environment space: %w", err)) + } + + return env, nil +} + +func (h *EnvironmentHandler) NewList() runtime.Object { + return &walrus.EnvironmentList{} +} + +func (h *EnvironmentHandler) OnList(ctx context.Context, opts ctrlcli.ListOptions) (runtime.Object, error) { + // List. + nsList := new(core.NamespaceList) + err := h.Client.List(ctx, nsList, + convertNamespaceListOptsFromEnvironmentListOpts(opts)) + if err != nil { + return nil, err + } + + // Convert. + eList := convertEnvironmentListFromNamespaceList(nsList, opts) + return eList, nil +} + +func (h *EnvironmentHandler) OnWatch(ctx context.Context, opts ctrlcli.ListOptions) (watch.Interface, error) { + // Watch. + uw, err := h.Client.(ctrlcli.WithWatch).Watch(ctx, new(core.NamespaceList), + convertNamespaceListOptsFromEnvironmentListOpts(opts)) + if err != nil { + return nil, err + } + + c := make(chan watch.Event) + dw := watch.NewProxyWatcher(c) + gopool.Go(func() { + defer close(c) + defer uw.Stop() + + for { + select { + case <-ctx.Done(): + // Cancel by context. + return + case <-dw.StopChan(): + // Stop by downstream. + return + case e, ok := <-uw.ResultChan(): + if !ok { + // Close by upstream. + return + } + + // Nothing to do. + if e.Object == nil { + c <- e + continue + } + + // Type assert. + ns, ok := e.Object.(*core.Namespace) + if !ok { + c <- e + continue + } + + // Process bookmark. + if e.Type == watch.Bookmark { + e.Object = &walrus.Environment{ObjectMeta: ns.ObjectMeta} + c <- e + continue + } + + // Convert. + env := safeConvertEnvironmentFromNamespace(ns, opts.Namespace) + if env == nil { + continue + } + + // Ignore if not be selected by `kubectl get --field-selector=metadata.namespace=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.namespace": env.Namespace}) { + continue + } + + // Dispatch. + e.Object = env + c <- e + } + } + }) + + return dw, nil +} + +func (h *EnvironmentHandler) OnGet(ctx context.Context, key types.NamespacedName, opts ctrlcli.GetOptions) (runtime.Object, error) { + // Get. + ns := &core.Namespace{ + ObjectMeta: meta.ObjectMeta{ + Name: key.Name, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(ns), ns, &opts) + if err != nil { + return nil, err + } + + // Convert. + env := safeConvertEnvironmentFromNamespace(ns, key.Namespace) + if env == nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("environments"), key.Name) + } + + return env, nil +} + +func (h *EnvironmentHandler) OnUpdate(ctx context.Context, obj, oldObj runtime.Object, opts ctrlcli.UpdateOptions) (runtime.Object, error) { + // Validate. + env := obj.(*walrus.Environment) + { + oldEnv := oldObj.(*walrus.Environment) + var errs field.ErrorList + if env.Spec.Type != oldEnv.Spec.Type { + errs = append(errs, field.Invalid( + field.NewPath("spec.type"), env.Spec.Type, "type is immutable")) + } + if stringx.StringWidth(env.Spec.DisplayName) > 30 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.displayName"), stringx.StringWidth(env.Spec.DisplayName), 30)) + } + if stringx.StringWidth(env.Spec.Description) > 50 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.description"), stringx.StringWidth(env.Spec.Description), 50)) + } + if len(errs) > 0 { + return nil, kerrors.NewInvalid(walrus.SchemeKind("environments"), env.Name, errs) + } + } + + // Update. + { + ns := convertNamespaceFromEnvironment(env) + err := h.Client.Update(ctx, ns, &opts) + if err != nil { + return nil, err + } + env = convertEnvironmentFromNamespace(ns) + } + + return env, nil +} + +func (h *EnvironmentHandler) OnDelete(ctx context.Context, obj runtime.Object, opts ctrlcli.DeleteOptions) error { + env := obj.(*walrus.Environment) + + // Validate. + { + // Prevent deleting if it has resources. + resList := new(walrus.ResourceList) + err := h.Client.List(ctx, resList, &ctrlcli.ListOptions{ + Namespace: env.Name, + }) + if err != nil { + return kerrors.NewInternalError(fmt.Errorf("list resources below the environment: %w", err)) + } + if len(resList.Items) != 0 { + return kerrors.NewForbidden(walrus.SchemeResource("environments"), env.Name, + errors.New("environment has resources")) + } + } + + // Unlock if needed. + ns := convertNamespaceFromEnvironment(env) + unlocked := systemmeta.Unlock(ns) + if !unlocked { + err := h.Client.Update(ctx, ns) + if err != nil { + return fmt.Errorf("unset finalizer: %w", err) + } + } + + // Delete. + err := h.Client.Delete(ctx, ns, &opts) + if err != nil && kerrors.IsNotFound(err) && !unlocked { + // NB(thxCode): If deleting resource has been locked, + // we ignore the not found error after we unlock it. + return nil + } + + // Delete RBAC. + err = systemauthz.DeleteEnvironmentSpace(ctx, h.Client, env) + if err != nil { + return kerrors.NewInternalError(fmt.Errorf("delete environment space: %w", err)) + } + + return nil +} + +func convertNamespaceListOptsFromEnvironmentListOpts(in ctrlcli.ListOptions) (out *ctrlcli.ListOptions) { + // Ignore namespace selector. + in.Namespace = "" + if in.FieldSelector != nil { + reqs := slices.DeleteFunc(in.FieldSelector.Requirements(), func(req fields.Requirement) bool { + return req.Field == "metadata.namespace" && + ((req.Operator == selection.Equals && req.Value == systemkuberes.SystemNamespaceName) || + (req.Operator == selection.NotEquals && req.Value != systemkuberes.SystemNamespaceName)) + }) + if len(reqs) == 0 { + in.FieldSelector = nil + } else { + in.FieldSelector = kubemeta.FieldSelectorFromRequirements(reqs) + } + } + + // Add necessary label selector. + if lbs := systemmeta.GetResourcesLabelSelectorOfType("environments"); in.LabelSelector == nil { + in.LabelSelector = lbs + } else { + reqs, _ := lbs.Requirements() + in.LabelSelector = in.LabelSelector.DeepCopySelector().Add(reqs...) + } + + return &in +} + +func convertNamespaceFromEnvironment(env *walrus.Environment) *core.Namespace { + ns := &core.Namespace{ + ObjectMeta: env.ObjectMeta, + } + systemmeta.NoteResource(ns, "environments", map[string]string{ + "type": env.Spec.Type.String(), + "displayName": env.Spec.DisplayName, + "description": env.Spec.Description, + }) + ns.Namespace = "" + if ns.DeletionTimestamp == nil { + systemmeta.Lock(ns) + } + return ns +} + +func convertEnvironmentFromNamespace(ns *core.Namespace) *walrus.Environment { + if ns == nil { + return nil + } + + resType, notes := systemmeta.UnnoteResource(ns) + if resType != "environments" { + return nil + } + + ref := meta.GetControllerOf(ns) + if ref == nil || + ref.APIVersion != walrus.SchemeGroupVersion.String() || + ref.Kind != "Project" { + return nil + } + + env := &walrus.Environment{ + ObjectMeta: ns.ObjectMeta, + Spec: walrus.EnvironmentSpec{ + Type: walrus.EnvironmentType(notes["type"]), + DisplayName: notes["displayName"], + Description: notes["description"], + }, + Status: walrus.EnvironmentStatus{ + Project: ref.Name, + Phase: ns.Status.Phase, + }, + } + env.Namespace = ref.Name + return env +} + +func safeConvertEnvironmentFromNamespace(ns *core.Namespace, reqNamespace string) *walrus.Environment { + env := convertEnvironmentFromNamespace(ns) + if env != nil && reqNamespace != "" && reqNamespace != env.Namespace { + // NB(thxCode): sanitize if the environment's namespace doesn't match requested namespace. + env = nil + } + return env +} + +func convertEnvironmentListFromNamespaceList(nsList *core.NamespaceList, opts ctrlcli.ListOptions) *walrus.EnvironmentList { + if nsList == nil { + return &walrus.EnvironmentList{} + } + + // Sort by resource version. + sort.SliceStable(nsList.Items, func(i, j int) bool { + l, r := nsList.Items[i].ResourceVersion, nsList.Items[j].ResourceVersion + return len(l) < len(r) || + (len(l) == len(r) && l < r) + }) + + eList := &walrus.EnvironmentList{ + Items: make([]walrus.Environment, 0, len(nsList.Items)), + } + + for i := range nsList.Items { + env := safeConvertEnvironmentFromNamespace(&nsList.Items[i], opts.Namespace) + if env == nil { + continue + } + // Ignore if not be selected by `kubectl get --field-selector=metadata.namespace=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.namespace": env.Namespace}) { + continue + } + eList.Items = append(eList.Items, *env) + } + + return eList +} diff --git a/pkg/extensionapis/walrus/file_example.go b/pkg/extensionapis/walrus/file_example.go new file mode 100644 index 000000000..392326cd1 --- /dev/null +++ b/pkg/extensionapis/walrus/file_example.go @@ -0,0 +1,215 @@ +package walrus + +import ( + "context" + "encoding/base64" + "fmt" + "io/fs" + "net/url" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/google/uuid" + "github.com/seal-io/utils/stringx" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemsetting" + "github.com/seal-io/walrus/pkg/vcs" +) + +// FileExampleHandler handles v1.FileExample objects. +// +// FileExampleHandler maintains an in-memory v1.FileExampleList object to serve the get/list operation. +// +// During setup, if the serve-walrus-files-url v1.Setting is a remote URL, +// FileExampleHandler will clone the repository to the local file system at first. +// Then, it will load the file examples from the local file system. +// +// The icon of each v1.FileExample object has been encoded as Base64. +type FileExampleHandler struct { + extensionapi.ObjectInfo + extensionapi.GetOperation + extensionapi.ListOperation + + InMemoryListObject walrus.FileExampleList +} + +func (h *FileExampleHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("fileexamples") + + // As storage. + h.ObjectInfo = &walrus.FileExample{} + h.GetOperation = extensionapi.WithGet(h) + h.ListOperation = extensionapi.WithList(nil, h) + + // Get file examples local filesystem. + var wfFs fs.FS + { + var wfUri *url.URL + wfUri, err = systemsetting.ServeWalrusFilesUrl.ValueURL(ctx) + if err != nil { + return + } + if wfUri.Scheme != "file" { + // Git clone from remote. + // TODO(thxCode): support other remote source? + dir := system.SubDataDir("files") + wfFs, err = vcs.GitClone(ctx, dir, vcs.GitCloneOptions{URL: wfUri.String()}) + if err != nil { + return + } + } else { + // Load from local. + wfFs = os.DirFS(wfUri.Path) + } + } + + // Load file examples in memory. + h.InMemoryListObject.Items, err = loadFileExamples(wfFs, systemkuberes.SystemNamespaceName) + if err != nil { + return + } + + return +} + +var ( + _ rest.Storage = (*FileExampleHandler)(nil) + _ rest.Lister = (*FileExampleHandler)(nil) + _ rest.Getter = (*FileExampleHandler)(nil) +) + +func (h *FileExampleHandler) New() runtime.Object { + return &walrus.FileExample{} +} + +func (h *FileExampleHandler) Destroy() {} + +func (h *FileExampleHandler) NewList() runtime.Object { + return &walrus.FileExampleList{} +} + +func (h *FileExampleHandler) OnList(ctx context.Context, opts ctrlcli.ListOptions) (runtime.Object, error) { + // Support watch with `kubectl get -A`. + if opts.Namespace == "" { + opts.Namespace = systemkuberes.SystemNamespaceName + } + + // Only support list in system namespace. + if opts.Namespace == systemkuberes.SystemNamespaceName { + return h.InMemoryListObject.DeepCopy(), nil + } + + return &walrus.FileExampleList{}, nil +} + +func (h *FileExampleHandler) OnGet(ctx context.Context, key types.NamespacedName, opts ctrlcli.GetOptions) (runtime.Object, error) { + // Only support get in system namespace. + if key.Namespace == systemkuberes.SystemNamespaceName { + for _, item := range h.InMemoryListObject.Items { + if item.Name == key.Name { + return item.DeepCopy(), nil + } + } + } + + return nil, kerrors.NewNotFound(walrus.SchemeResource("fileexamples"), key.Name) +} + +func loadFileExamples(dir fs.FS, namespace string) ([]walrus.FileExample, error) { + var ( + knownIconFiles = sets.New( + "icon.png", + "icon.jpg", + "icon.jpeg", + "icon.svg") + knownReadmeFiles = sets.New( + "README.md", + "readme.md") + knownYamlSuffixes = sets.New( + ".yaml", + ".yml") + ) + + entries, err := fs.ReadDir(dir, ".") + if err != nil { + return nil, fmt.Errorf("read dir: %w", err) + } + + // Sort by name. + sort.SliceStable(entries, func(i, j int) bool { + return entries[i].Name() < entries[j].Name() + }) + + exps := make([]walrus.FileExample, 0, len(entries)) + for i, en := range entries { + if !en.IsDir() || strings.HasPrefix(en.Name(), ".") { + continue + } + + sdir, err := fs.Sub(dir, en.Name()) + if err != nil { + return nil, fmt.Errorf("sub dir: %w", err) + } + sentries, err := fs.ReadDir(sdir, ".") + if err != nil { + return nil, fmt.Errorf("read sub dir: %w", err) + } + + exp := walrus.FileExample{ + ObjectMeta: meta.ObjectMeta{ + Namespace: namespace, + Name: en.Name(), + UID: types.UID(uuid.NewMD5(uuid.Nil, []byte(en.Name())).String()), // Create a deterministic UID. + CreationTimestamp: meta.Now(), + ResourceVersion: stringx.FromInt(i + 1), + }, + } + + for _, sen := range sentries { + fn := sen.Name() + + switch { + case knownIconFiles.Has(fn): + data, err := fs.ReadFile(sdir, fn) + if err != nil { + return nil, fmt.Errorf("read icon: %w", err) + } + exp.Status.Icon = base64.StdEncoding.EncodeToString(data) + case knownReadmeFiles.Has(fn): + data, err := fs.ReadFile(sdir, fn) + if err != nil { + return nil, fmt.Errorf("read README: %w", err) + } + exp.Status.Readme = string(data) + case knownYamlSuffixes.Has(filepath.Ext(fn)): + data, err := fs.ReadFile(sdir, fn) + if err != nil { + return nil, fmt.Errorf("read YAML: %w", err) + } + exp.Status.Content = string(data) + } + } + + exps = append(exps, exp) + } + + return exps, nil +} diff --git a/pkg/extensionapis/walrus/project.go b/pkg/extensionapis/walrus/project.go new file mode 100644 index 000000000..22d2e8c08 --- /dev/null +++ b/pkg/extensionapis/walrus/project.go @@ -0,0 +1,477 @@ +package walrus + +import ( + "context" + "errors" + "fmt" + "slices" + "sort" + + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" + core "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/kubemeta" + "github.com/seal-io/walrus/pkg/systemauthz" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemmeta" +) + +// ProjectHandler handles v1.Project objects. +// +// ProjectHandler maps the v1.Project object to a Kubernetes Namespace resource, +// which is named as the project's name. +type ProjectHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations + + Client ctrlcli.Client +} + +func (h *ProjectHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Configure field indexer. + fi := opts.Manager.GetFieldIndexer() + err = fi.IndexField(ctx, &core.Namespace{}, "metadata.name", + func(obj ctrlcli.Object) []string { + if obj == nil { + return nil + } + return []string{obj.GetName()} + }) + if err != nil { + return + } + + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("projects") + + // Create table convertor to pretty the kubectl's output. + var tc rest.TableConvertor + { + tc, err = extensionapi.NewJSONPathTableConvertor( + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Phase", + Type: "string", + }, + JSONPath: ".status.phase", + }) + if err != nil { + return + } + } + + // As storage. + h.ObjectInfo = &walrus.Project{} + h.CurdOperations = extensionapi.WithCurd(tc, h) + + // Set client. + h.Client = opts.Manager.GetClient() + + // Create subresource handlers. + srs = map[string]rest.Storage{} + { + // Handle /subjects. + srs["subjects"] = newProjectSubjectsHandler(opts) + } + + return +} + +var ( + _ rest.Storage = (*ProjectHandler)(nil) + _ rest.Creater = (*ProjectHandler)(nil) + _ rest.Lister = (*ProjectHandler)(nil) + _ rest.Watcher = (*ProjectHandler)(nil) + _ rest.Getter = (*ProjectHandler)(nil) + _ rest.Updater = (*ProjectHandler)(nil) + _ rest.Patcher = (*ProjectHandler)(nil) + _ rest.GracefulDeleter = (*ProjectHandler)(nil) + _ rest.CollectionDeleter = (*ProjectHandler)(nil) +) + +func (h *ProjectHandler) New() runtime.Object { + return &walrus.Project{} +} + +func (h *ProjectHandler) Destroy() { +} + +func (h *ProjectHandler) OnCreate(ctx context.Context, obj runtime.Object, opts ctrlcli.CreateOptions) (runtime.Object, error) { + // Validate. + proj := obj.(*walrus.Project) + { + var errs field.ErrorList + if proj.Namespace != systemkuberes.SystemNamespaceName { + errs = append(errs, field.Invalid(field.NewPath("metadata.namespace"), + proj.Namespace, "project namespace must be "+systemkuberes.SystemNamespaceName)) + } + if slices.Contains([]string{"kube-system", "kube-public"}, proj.Name) { + errs = append(errs, field.Invalid(field.NewPath("metadata.name"), + proj.Name, "project name is reserved")) + } + if stringx.StringWidth(proj.Name) > 30 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("metadata.name"), stringx.StringWidth(proj.Name), 30)) + } + if stringx.StringWidth(proj.Spec.DisplayName) > 30 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.displayName"), stringx.StringWidth(proj.Spec.DisplayName), 30)) + } + if stringx.StringWidth(proj.Spec.Description) > 50 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.description"), stringx.StringWidth(proj.Spec.Description), 50)) + } + if len(errs) > 0 { + return nil, kerrors.NewInvalid(walrus.SchemeKind("projects"), proj.Name, errs) + } + } + + // Create. + if proj.Name == systemkuberes.DefaultProjectName { + // NB(thxCode): The default project is created by the system, + // so we need another approach to adopt the default project. + ns := convertNamespaceFromProject(proj) + { + // Refill UID and ResourceVersion. + aNs := new(core.Namespace) + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(ns), aNs) + if err != nil { + return nil, kerrors.NewInternalError(fmt.Errorf("get default namespace: %w", err)) + } + ns.UID = aNs.UID + ns.ResourceVersion = aNs.ResourceVersion + } + err := h.Client.Update(ctx, ns) + if err != nil { + return nil, kerrors.NewInternalError(fmt.Errorf("create default project: %w", err)) + } + proj = convertProjectFromNamespace(ns) + } else { + ns := convertNamespaceFromProject(proj) + err := h.Client.Create(ctx, ns, &opts) + if err != nil { + return nil, err + } + proj = convertProjectFromNamespace(ns) + } + + // Create RBAC. + err := systemauthz.CreateProjectSpace(ctx, h.Client, proj) + if err != nil { + return nil, kerrors.NewInternalError(fmt.Errorf("create project space: %w", err)) + } + + return proj, nil +} + +func (h *ProjectHandler) NewList() runtime.Object { + return &walrus.ProjectList{} +} + +func (h *ProjectHandler) OnList(ctx context.Context, opts ctrlcli.ListOptions) (runtime.Object, error) { + // List. + nsList := new(core.NamespaceList) + err := h.Client.List(ctx, nsList, + convertNamespaceListOptsFromProjectListOpts(opts)) + if err != nil { + return nil, err + } + + // TODO Validate RBAC + + // Convert. + pList := convertProjectListFromNamespaceList(nsList, opts) + return pList, nil +} + +func (h *ProjectHandler) OnWatch(ctx context.Context, opts ctrlcli.ListOptions) (watch.Interface, error) { + // Watch. + uw, err := h.Client.(ctrlcli.WithWatch).Watch(ctx, new(core.NamespaceList), + convertNamespaceListOptsFromProjectListOpts(opts)) + if err != nil { + return nil, err + } + + c := make(chan watch.Event) + dw := watch.NewProxyWatcher(c) + gopool.Go(func() { + defer close(c) + defer uw.Stop() + + for { + select { + case <-ctx.Done(): + // Cancel by context. + return + case <-dw.StopChan(): + // Stop by downstream. + return + case e, ok := <-uw.ResultChan(): + if !ok { + // Close by upstream. + return + } + + // Nothing to do. + if e.Object == nil { + c <- e + continue + } + + // TODO RBAC + + // Type assert. + ns, ok := e.Object.(*core.Namespace) + if !ok { + c <- e + continue + } + + // Process bookmark. + if e.Type == watch.Bookmark { + e.Object = &walrus.Project{ObjectMeta: ns.ObjectMeta} + c <- e + continue + } + + // Convert. + proj := safeConvertProjectFromNamespace(ns, opts.Namespace) + if proj == nil { + continue + } + + // Dispatch. + e.Object = proj + c <- e + } + } + }) + + return dw, nil +} + +func (h *ProjectHandler) OnGet(ctx context.Context, key types.NamespacedName, opts ctrlcli.GetOptions) (runtime.Object, error) { + // Validate. + if key.Namespace != systemkuberes.SystemNamespaceName { + return nil, kerrors.NewNotFound(walrus.SchemeResource("projects"), key.Name) + } + + // Get. + ns := &core.Namespace{ + ObjectMeta: meta.ObjectMeta{ + Name: key.Name, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(ns), ns, &opts) + if err != nil { + return nil, err + } + + // TODO Validate RBAC + + // Convert. + proj := convertProjectFromNamespace(ns) + if proj == nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("projects"), key.Name) + } + return proj, nil +} + +func (h *ProjectHandler) OnUpdate(ctx context.Context, obj, _ runtime.Object, opts ctrlcli.UpdateOptions) (runtime.Object, error) { + // Validate. + proj := obj.(*walrus.Project) + { + var errs field.ErrorList + if stringx.StringWidth(proj.Spec.DisplayName) > 30 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.displayName"), stringx.StringWidth(proj.Spec.DisplayName), 30)) + } + if stringx.StringWidth(proj.Spec.Description) > 50 { + errs = append(errs, field.TooLongMaxLength( + field.NewPath("spec.description"), stringx.StringWidth(proj.Spec.Description), 50)) + } + if len(errs) > 0 { + return nil, kerrors.NewInvalid(walrus.SchemeKind("projects"), proj.Name, errs) + } + } + + // TODO Validate RBAC + + // Update. + { + ns := convertNamespaceFromProject(proj) + err := h.Client.Update(ctx, ns, &opts) + if err != nil { + return nil, err + } + proj = convertProjectFromNamespace(ns) + } + + return proj, nil +} + +func (h *ProjectHandler) OnDelete(ctx context.Context, obj runtime.Object, opts ctrlcli.DeleteOptions) error { + proj := obj.(*walrus.Project) + + // Validate. + { + // Prevent deleting default project. + if proj.Name == core.NamespaceDefault { + return kerrors.NewBadRequest("cannot delete default project") + } + // Prevent deleting if it has environments. + envList := new(walrus.EnvironmentList) + err := h.Client.List(ctx, envList, &ctrlcli.ListOptions{ + Namespace: proj.Name, + }) + if err != nil { + return kerrors.NewInternalError(fmt.Errorf("list environments below the project: %w", err)) + } + if len(envList.Items) != 0 { + return kerrors.NewConflict(walrus.SchemeResource("projects"), proj.Name, + errors.New("project has environments")) + } + } + + // Unlock if needed. + ns := convertNamespaceFromProject(proj) + unlocked := systemmeta.Unlock(ns) + if !unlocked { + err := h.Client.Update(ctx, ns) + if err != nil { + return fmt.Errorf("unset finalizer: %w", err) + } + } + + // Delete. + err := h.Client.Delete(ctx, ns, &opts) + if err != nil && kerrors.IsNotFound(err) && !unlocked { + // NB(thxCode): If deleting resource has been locked, + // we ignore the not found error after we unlock it. + return nil + } + return err +} + +func convertNamespaceListOptsFromProjectListOpts(in ctrlcli.ListOptions) (out *ctrlcli.ListOptions) { + if in.Namespace != systemkuberes.SystemNamespaceName { + return &in + } + + // Ignore namespace selector. + in.Namespace = "" + if in.FieldSelector != nil { + reqs := slices.DeleteFunc(in.FieldSelector.Requirements(), func(req fields.Requirement) bool { + return req.Field == "metadata.namespace" && + ((req.Operator == selection.Equals && req.Value == systemkuberes.SystemNamespaceName) || + (req.Operator == selection.NotEquals && req.Value != systemkuberes.SystemNamespaceName)) + }) + if len(reqs) == 0 { + in.FieldSelector = nil + } else { + in.FieldSelector = kubemeta.FieldSelectorFromRequirements(reqs) + } + } + + // Add necessary label selector. + if lbs := systemmeta.GetResourcesLabelSelectorOfType("projects"); in.LabelSelector == nil { + in.LabelSelector = lbs + } else { + reqs, _ := lbs.Requirements() + in.LabelSelector = in.LabelSelector.DeepCopySelector().Add(reqs...) + } + + return &in +} + +func convertNamespaceFromProject(proj *walrus.Project) *core.Namespace { + ns := &core.Namespace{ + ObjectMeta: proj.ObjectMeta, + } + systemmeta.NoteResource(ns, "projects", map[string]string{ + "displayName": proj.Spec.DisplayName, + "description": proj.Spec.Description, + }) + ns.Namespace = "" + if ns.DeletionTimestamp == nil { + systemmeta.Lock(ns) + } + return ns +} + +func convertProjectFromNamespace(ns *core.Namespace) *walrus.Project { + if ns == nil { + return nil + } + + resType, notes := systemmeta.UnnoteResource(ns) + if resType != "projects" { + return nil + } + + proj := &walrus.Project{ + ObjectMeta: ns.ObjectMeta, + Spec: walrus.ProjectSpec{ + DisplayName: notes["displayName"], + Description: notes["description"], + }, + Status: walrus.ProjectStatus{ + Phase: ns.Status.Phase, + }, + } + proj.Namespace = systemkuberes.SystemNamespaceName + return proj +} + +func safeConvertProjectFromNamespace(ns *core.Namespace, reqNamespace string) *walrus.Project { + proj := convertProjectFromNamespace(ns) + if proj != nil && reqNamespace != "" && reqNamespace != proj.Namespace { + // NB(thxCode): sanitize if the project's namespace doesn't match requested namespace. + proj = nil + } + return proj +} + +func convertProjectListFromNamespaceList(nsList *core.NamespaceList, opts ctrlcli.ListOptions) *walrus.ProjectList { + if nsList == nil { + return &walrus.ProjectList{} + } + + // Sort by resource version. + sort.SliceStable(nsList.Items, func(i, j int) bool { + l, r := nsList.Items[i].ResourceVersion, nsList.Items[j].ResourceVersion + return len(l) < len(r) || + (len(l) == len(r) && l < r) + }) + + pList := &walrus.ProjectList{ + Items: make([]walrus.Project, 0, len(nsList.Items)), + } + + for i := range nsList.Items { + proj := safeConvertProjectFromNamespace(&nsList.Items[i], opts.Namespace) + if proj == nil { + continue + } + pList.Items = append(pList.Items, *proj) + } + + return pList +} diff --git a/pkg/extensionapis/walrus/project.subjects.go b/pkg/extensionapis/walrus/project.subjects.go new file mode 100644 index 000000000..ac76d02f4 --- /dev/null +++ b/pkg/extensionapis/walrus/project.subjects.go @@ -0,0 +1,207 @@ +package walrus + +import ( + "context" + "fmt" + + rbac "k8s.io/api/rbac/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + authnuser "k8s.io/apiserver/pkg/authentication/user" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/systemauthz" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemmeta" +) + +type ProjectSubjectsHandler struct { + extensionapi.ObjectInfo + extensionapi.GetOperation + extensionapi.UpdateOperation + + Client ctrlcli.Client +} + +func newProjectSubjectsHandler(opts extensionapi.SetupOptions) *ProjectSubjectsHandler { + h := &ProjectSubjectsHandler{} + + // As storage. + h.ObjectInfo = &walrus.ProjectSubjects{} + h.GetOperation = extensionapi.WithGet(h) + h.UpdateOperation = extensionapi.WithUpdate(h) + + // Set client. + h.Client = opts.Manager.GetClient() + + return h +} + +var ( + _ rest.Storage = (*ProjectSubjectsHandler)(nil) + _ rest.Getter = (*ProjectSubjectsHandler)(nil) + _ rest.Updater = (*ProjectSubjectsHandler)(nil) + _ rest.Patcher = (*ProjectSubjectsHandler)(nil) +) + +func (h *ProjectSubjectsHandler) New() runtime.Object { + return &walrus.ProjectSubjects{} +} + +func (h *ProjectSubjectsHandler) Destroy() {} + +func (h *ProjectSubjectsHandler) OnGet(ctx context.Context, key types.NamespacedName, opts ctrlcli.GetOptions) (runtime.Object, error) { + // Validate. + if key.Namespace != systemkuberes.SystemNamespaceName { + return nil, kerrors.NewNotFound(walrus.SchemeResource("projectsubjects"), key.Name) + } + + // List. + crbList := new(rbac.ClusterRoleBindingList) + err := h.Client.List(ctx, crbList, + ctrlcli.MatchingLabelsSelector{ + Selector: systemmeta.GetResourcesLabelSelectorOfType("rolebindings"), + }) + if err != nil { + return nil, kerrors.NewInternalError(err) + } + crbList = systemmeta.FilterResourceListByNotes(crbList, "project", key.Name) + + // Convert. + psbjs := convertProjectSubjectsFromClusterRoleBindingList(crbList) + if psbjs == nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("projectsubjects"), key.Name) + } + + // Get and refill. + proj := new(walrus.Project) + err = h.Client.Get(ctx, key, proj) + if err != nil { + return nil, kerrors.NewInternalError(err) + } + psbjs.ObjectMeta = proj.ObjectMeta + + return psbjs, nil +} + +func (h *ProjectSubjectsHandler) OnUpdate(ctx context.Context, obj, objOld runtime.Object, opts ctrlcli.UpdateOptions) (runtime.Object, error) { + psbjs, psbjsOld := obj.(*walrus.ProjectSubjects), objOld.(*walrus.ProjectSubjects) + + // Figure out delta. + psbjsReverseIndex := make(map[walrus.ProjectSubject]int) + { + for i := range psbjs.Items { + // Default. + if psbjs.Items[i].Kind == "" { + psbjs.Items[i].Kind = "User" + } + psbjsReverseIndex[psbjs.Items[i]] = i + } + } + psbjsOldSet := make(map[walrus.ProjectSubject]sets.Empty) + { + for i := range psbjsOld.Items { + psbjsOldSet[psbjsOld.Items[i]] = sets.Empty{} + } + } + for psbj := range psbjsReverseIndex { + // Delete the one exists in both of the new set and old set, + // then the remaining items of the new set are need to create, + // and the remaining items of the old set are need to delete. + if _, existed := psbjsOldSet[psbj]; existed { + delete(psbjsReverseIndex, psbj) + delete(psbjsOldSet, psbj) + } + } + + // Validate. + var errs field.ErrorList + for psbj, psbjIdx := range psbjsReverseIndex { + if psbj.Name == "" { + errs = append(errs, field.Forbidden( + field.NewPath(fmt.Sprintf("items[%d].name", psbjIdx)), "blank string")) + } + if err := psbj.Role.Validate(); err != nil { + errs = append(errs, field.Invalid( + field.NewPath(fmt.Sprintf("items[%d].role", psbjIdx)), psbj.Role, err.Error())) + } + } + if len(errs) > 0 { + return nil, kerrors.NewInvalid(walrus.SchemeKind("projectsubjects"), psbjs.Name, errs) + } + + // Unbind. + for psbj := range psbjsOldSet { + uInfo := &authnuser.DefaultInfo{ + Name: psbj.Name, + } + err := systemauthz.UnbindProjectSubjectRoleFor(ctx, h.Client, psbj.Role, uInfo) + if err != nil { + return nil, kerrors.NewInternalError(fmt.Errorf("unbind project subject role: %w", err)) + } + } + + // NB(thxCode): without retrieving again, + // we can simply construct a Project object from the old ProjectSubjects. + proj := &walrus.Project{ + ObjectMeta: psbjsOld.ObjectMeta, + } + + // Bind. + for psbj := range psbjsReverseIndex { + uInfo := &authnuser.DefaultInfo{ + Name: psbj.Name, + } + err := systemauthz.BindProjectSubjectRoleFor(ctx, h.Client, proj, psbj.Role, uInfo) + if err != nil { + return nil, kerrors.NewInternalError(fmt.Errorf("bind project subject role: %w", err)) + } + } + + // Get. + return h.OnGet(ctx, ctrlcli.ObjectKeyFromObject(psbjs), ctrlcli.GetOptions{}) +} + +func convertProjectSubjectFromClusterRoleBinding(crb *rbac.ClusterRoleBinding) *walrus.ProjectSubject { + if crb == nil || len(crb.Subjects) != 1 { + return nil + } + + psbjr := walrus.ProjectSubjectRole(crb.RoleRef.Name) + if psbjr.Validate() != nil { + return nil + } + + psbj := &walrus.ProjectSubject{ + Name: crb.Subjects[0].Name, + Kind: crb.Subjects[0].Kind, + Role: psbjr, + } + return psbj +} + +func convertProjectSubjectsFromClusterRoleBindingList(crbList *rbac.ClusterRoleBindingList) *walrus.ProjectSubjects { + if crbList == nil { + return nil + } + + psbjs := &walrus.ProjectSubjects{ + Items: make([]walrus.ProjectSubject, 0, len(crbList.Items)), + } + + for i := range crbList.Items { + psbj := convertProjectSubjectFromClusterRoleBinding(&crbList.Items[i]) + if psbj == nil { + continue + } + psbjs.Items = append(psbjs.Items, *psbj) + } + + return psbjs +} diff --git a/pkg/extensionapis/walrus/resource.go b/pkg/extensionapis/walrus/resource.go new file mode 100644 index 000000000..c9a26d425 --- /dev/null +++ b/pkg/extensionapis/walrus/resource.go @@ -0,0 +1,77 @@ +package walrus + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/extensionapi" +) + +// ResourceHandler handles v1.Resource objects. +// +// ResourceHandler proxies the v1.Resource objects to the walrus core. +type ResourceHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations +} + +func (h *ResourceHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("resources") + + // As storage. + h.ObjectInfo = &walrus.Resource{} + h.CurdOperations = extensionapi.WithCurdProxy[ + *walrus.Resource, *walrus.ResourceList, *walruscore.Resource, *walruscore.ResourceList, + ](nil, h, opts.Manager.GetClient().(ctrlcli.WithWatch)) + + return +} + +var ( + _ rest.Storage = (*ResourceHandler)(nil) + _ rest.Creater = (*ResourceHandler)(nil) + _ rest.Lister = (*ResourceHandler)(nil) + _ rest.Watcher = (*ResourceHandler)(nil) + _ rest.Getter = (*ResourceHandler)(nil) + _ rest.Updater = (*ResourceHandler)(nil) + _ rest.Patcher = (*ResourceHandler)(nil) + _ rest.GracefulDeleter = (*ResourceHandler)(nil) + _ rest.CollectionDeleter = (*ResourceHandler)(nil) +) + +func (h *ResourceHandler) Destroy() { +} + +func (h *ResourceHandler) New() runtime.Object { + return &walrus.Resource{} +} + +func (h *ResourceHandler) NewList() runtime.Object { + return &walrus.ResourceList{} +} + +func (h *ResourceHandler) CastObjectTo(do *walrus.Resource) (uo *walruscore.Resource) { + return (*walruscore.Resource)(do) +} + +func (h *ResourceHandler) CastObjectFrom(uo *walruscore.Resource) (do *walrus.Resource) { + return (*walrus.Resource)(uo) +} + +func (h *ResourceHandler) CastObjectListTo(dol *walrus.ResourceList) (uol *walruscore.ResourceList) { + return (*walruscore.ResourceList)(dol) +} + +func (h *ResourceHandler) CastObjectListFrom(uol *walruscore.ResourceList) (dol *walrus.ResourceList) { + return (*walrus.ResourceList)(uol) +} diff --git a/pkg/extensionapis/walrus/resource_definition.go b/pkg/extensionapis/walrus/resource_definition.go new file mode 100644 index 000000000..8f6df86bc --- /dev/null +++ b/pkg/extensionapis/walrus/resource_definition.go @@ -0,0 +1,106 @@ +package walrus + +import ( + "context" + + kerrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/systemkuberes" +) + +// ResourceDefinitionHandler handles v1.ResourceDefinition objects. +// +// ResourceDefinitionHandler proxies the v1.ResourceDefinition objects to the walrus core. +type ResourceDefinitionHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations +} + +func (h *ResourceDefinitionHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("resourcedefinitions") + + // As storage. + h.ObjectInfo = &walrus.ResourceDefinition{} + h.CurdOperations = extensionapi.WithCurdProxy[ + *walrus.ResourceDefinition, *walrus.ResourceDefinitionList, *walruscore.ResourceDefinition, *walruscore.ResourceDefinitionList, + ](nil, h, opts.Manager.GetClient().(ctrlcli.WithWatch)) + + return +} + +var ( + _ rest.Storage = (*ResourceDefinitionHandler)(nil) + _ rest.Creater = (*ResourceDefinitionHandler)(nil) + _ rest.Lister = (*ResourceDefinitionHandler)(nil) + _ rest.Watcher = (*ResourceDefinitionHandler)(nil) + _ rest.Getter = (*ResourceDefinitionHandler)(nil) + _ rest.Updater = (*ResourceDefinitionHandler)(nil) + _ rest.Patcher = (*ResourceDefinitionHandler)(nil) + _ rest.GracefulDeleter = (*ResourceDefinitionHandler)(nil) + _ rest.CollectionDeleter = (*ResourceDefinitionHandler)(nil) +) + +func (h *ResourceDefinitionHandler) BeforeOnCreate(ctx context.Context, obj *walrus.ResourceDefinition, opts *ctrlcli.CreateOptions) error { + if obj.Namespace != systemkuberes.SystemNamespaceName { + errs := field.ErrorList{ + field.Invalid(field.NewPath("metadata.namespace"), obj.Namespace, + "resource definition namespace must be "+systemkuberes.SystemNamespaceName), + } + return kerrors.NewInvalid(walrus.SchemeKind("resourcedefinitions"), obj.Name, errs) + } + return nil +} + +func (h *ResourceDefinitionHandler) BeforeOnGet(ctx context.Context, key types.NamespacedName, opts *ctrlcli.GetOptions) error { + if key.Namespace != systemkuberes.SystemNamespaceName { + return kerrors.NewNotFound(walrus.SchemeResource("resourcedefinitions"), key.Name) + } + return nil +} + +func (h *ResourceDefinitionHandler) BeforeOnListWatch(ctx context.Context, opts *ctrlcli.ListOptions) error { + if opts.Namespace == "" { + opts.Namespace = systemkuberes.SystemNamespaceName + } + return nil +} + +func (h *ResourceDefinitionHandler) Destroy() { +} + +func (h *ResourceDefinitionHandler) New() runtime.Object { + return &walrus.ResourceDefinition{} +} + +func (h *ResourceDefinitionHandler) NewList() runtime.Object { + return &walrus.ResourceDefinitionList{} +} + +func (h *ResourceDefinitionHandler) CastObjectTo(do *walrus.ResourceDefinition) (uo *walruscore.ResourceDefinition) { + return (*walruscore.ResourceDefinition)(do) +} + +func (h *ResourceDefinitionHandler) CastObjectFrom(uo *walruscore.ResourceDefinition) (do *walrus.ResourceDefinition) { + return (*walrus.ResourceDefinition)(uo) +} + +func (h *ResourceDefinitionHandler) CastObjectListTo(dol *walrus.ResourceDefinitionList) (uol *walruscore.ResourceDefinitionList) { + return (*walruscore.ResourceDefinitionList)(dol) +} + +func (h *ResourceDefinitionHandler) CastObjectListFrom(uol *walruscore.ResourceDefinitionList) (dol *walrus.ResourceDefinitionList) { + return (*walrus.ResourceDefinitionList)(uol) +} diff --git a/pkg/extensionapis/walrus/resource_run.go b/pkg/extensionapis/walrus/resource_run.go new file mode 100644 index 000000000..89c426363 --- /dev/null +++ b/pkg/extensionapis/walrus/resource_run.go @@ -0,0 +1,77 @@ +package walrus + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/extensionapi" +) + +// ResourceRunHandler handles v1.ResourceRun objects. +// +// ResourceRunHandler proxies the v1.ResourceRun objects to the walrus core. +type ResourceRunHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations +} + +func (h *ResourceRunHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("resourceruns") + + // As storage. + h.ObjectInfo = &walrus.ResourceRun{} + h.CurdOperations = extensionapi.WithCurdProxy[ + *walrus.ResourceRun, *walrus.ResourceRunList, *walruscore.ResourceRun, *walruscore.ResourceRunList, + ](nil, h, opts.Manager.GetClient().(ctrlcli.WithWatch)) + + return +} + +var ( + _ rest.Storage = (*ResourceRunHandler)(nil) + _ rest.Creater = (*ResourceRunHandler)(nil) + _ rest.Lister = (*ResourceRunHandler)(nil) + _ rest.Watcher = (*ResourceRunHandler)(nil) + _ rest.Getter = (*ResourceRunHandler)(nil) + _ rest.Updater = (*ResourceRunHandler)(nil) + _ rest.Patcher = (*ResourceRunHandler)(nil) + _ rest.GracefulDeleter = (*ResourceRunHandler)(nil) + _ rest.CollectionDeleter = (*ResourceRunHandler)(nil) +) + +func (h *ResourceRunHandler) Destroy() { +} + +func (h *ResourceRunHandler) New() runtime.Object { + return &walrus.ResourceRun{} +} + +func (h *ResourceRunHandler) NewList() runtime.Object { + return &walrus.ResourceRunList{} +} + +func (h *ResourceRunHandler) CastObjectTo(do *walrus.ResourceRun) (uo *walruscore.ResourceRun) { + return (*walruscore.ResourceRun)(do) +} + +func (h *ResourceRunHandler) CastObjectFrom(uo *walruscore.ResourceRun) (do *walrus.ResourceRun) { + return (*walrus.ResourceRun)(uo) +} + +func (h *ResourceRunHandler) CastObjectListTo(dol *walrus.ResourceRunList) (uol *walruscore.ResourceRunList) { + return (*walruscore.ResourceRunList)(dol) +} + +func (h *ResourceRunHandler) CastObjectListFrom(uol *walruscore.ResourceRunList) (dol *walrus.ResourceRunList) { + return (*walrus.ResourceRunList)(uol) +} diff --git a/pkg/extensionapis/walrus/setting.go b/pkg/extensionapis/walrus/setting.go new file mode 100644 index 000000000..7bde1cd25 --- /dev/null +++ b/pkg/extensionapis/walrus/setting.go @@ -0,0 +1,412 @@ +package walrus + +import ( + "context" + "errors" + + "github.com/seal-io/utils/pools/gopool" + core "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/systemmeta" + "github.com/seal-io/walrus/pkg/systemsetting" +) + +// SettingHandler handles v1.Setting objects. +// +// SettingHandler maps all v1.Setting objects to a Kubernetes Secret resource, +// which is named as "walrus-system/walrus-settings". +// +// Each v1.Setting object records as a key-value pair in the Secret's Data field. +type SettingHandler struct { + extensionapi.ObjectInfo + extensionapi.ListWatchOperation + extensionapi.GetOperation + extensionapi.UpdateOperation + + Client ctrlcli.Client +} + +func (h *SettingHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Configure field indexer. + fi := opts.Manager.GetFieldIndexer() + err = fi.IndexField(ctx, &core.Secret{}, "metadata.name", + func(obj ctrlcli.Object) []string { + if obj == nil { + return nil + } + return []string{obj.GetName()} + }) + if err != nil { + return + } + + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("settings") + + // Create table convertor to pretty the kubectl's output. + var tc rest.TableConvertor + { + tc, err = extensionapi.NewJSONPathTableConvertor( + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Value", + Type: "string", + }, + JSONPath: ".status.value", + }) + if err != nil { + return + } + } + + // As storage. + h.ObjectInfo = &walrus.Setting{} + h.ListWatchOperation = extensionapi.WithListWatch(tc, h) + h.GetOperation = extensionapi.WithGet(h) + h.UpdateOperation = extensionapi.WithUpdate(h) + + // Set client. + h.Client = opts.Manager.GetClient() + + return +} + +var ( + _ rest.Storage = (*SettingHandler)(nil) + _ rest.Lister = (*SettingHandler)(nil) + _ rest.Watcher = (*SettingHandler)(nil) + _ rest.Getter = (*SettingHandler)(nil) + _ rest.Updater = (*SettingHandler)(nil) + _ rest.Patcher = (*SettingHandler)(nil) +) + +func (h *SettingHandler) New() runtime.Object { + return &walrus.Setting{} +} + +func (h *SettingHandler) Destroy() {} + +func (h *SettingHandler) NewList() runtime.Object { + return &walrus.SettingList{} +} + +func (h *SettingHandler) OnList(ctx context.Context, opts ctrlcli.ListOptions) (runtime.Object, error) { + // Support watch with `kubectl get -A`. + if opts.Namespace == "" { + opts.Namespace = systemsetting.DelegatedSecretNamespace + } + + // Get. + sec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: opts.Namespace, + Name: systemsetting.DelegatedSecretName, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(sec), sec) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, err + } + // We return an empty list if the secret is not found. + return &walrus.SettingList{}, nil + } + + // Convert. + sList := convertSettingListFromSecret(sec, opts) + return sList, nil +} + +func (h *SettingHandler) OnWatch(ctx context.Context, opts ctrlcli.ListOptions) (watch.Interface, error) { + // Support watch with `kubectl get -A`. + if opts.Namespace == "" { + opts.Namespace = systemsetting.DelegatedSecretNamespace + } + + // List and index. + setIndexer := map[string]walrus.Setting{} // [sn] -> set + { + listObj, err := h.OnList(ctx, opts) + if err != nil { + return nil, err + } + sList := listObj.(*walrus.SettingList) + for i := range sList.Items { + setIndexKey := sList.Items[i].Name + setIndexer[setIndexKey] = sList.Items[i] + } + } + + // Watch. + uw, err := h.Client.(ctrlcli.WithWatch).Watch(ctx, new(core.SecretList), + convertSecretListOptsFromSettingListOpts(opts)) + if err != nil { + return nil, err + } + + c := make(chan watch.Event) + dw := watch.NewProxyWatcher(c) + gopool.Go(func() { + defer close(c) + defer uw.Stop() + + for { + select { + case <-ctx.Done(): + // Cancel by context. + return + case <-dw.StopChan(): + // Stop by downstream. + return + case e, ok := <-uw.ResultChan(): + if !ok { + // Close by upstream. + return + } + + // Nothing to do. + if e.Object == nil { + c <- e + continue + } + + // Type assert. + sec, ok := e.Object.(*core.Secret) + if !ok { + c <- e + continue + } + + // Process bookmark. + if e.Type == watch.Bookmark { + e.Object = &walrus.Setting{ObjectMeta: sec.ObjectMeta} + c <- e + continue + } + + // Send. + for name := range sec.Data { + // Ignore if not be selected by `kubectl get --field-selector=metadata.name=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.name": name}) { + continue + } + + // Convert. + set := convertSettingFromSecret(sec, name) + if set == nil { + continue + } + + // Ignore if the same as previous. + setIndexKey := set.Name + prevSet, ok := setIndexer[setIndexKey] + switch { + default: + // ignore + continue + case !ok: + // insert + setIndexer[setIndexKey] = *set + case !set.Equal(&prevSet): + // update + setIndexer[setIndexKey] = *set + } + + // Dispatch. + e2 := e.DeepCopy() + e2.Object = set + c <- *e2 + } + } + } + }) + + return dw, nil +} + +func (h *SettingHandler) OnGet(ctx context.Context, key types.NamespacedName, opts ctrlcli.GetOptions) (runtime.Object, error) { + // Get. + sec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: key.Namespace, + Name: systemsetting.DelegatedSecretName, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(sec), sec) + if err != nil { + return nil, err + } + + // Convert. + set := convertSettingFromSecret(sec, key.Name) + if set == nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("settings"), key.Name) + } + return set, nil +} + +func (h *SettingHandler) OnUpdate(ctx context.Context, obj, _ runtime.Object, opts ctrlcli.UpdateOptions) (runtime.Object, error) { + // Validate. + set := obj.(*walrus.Setting) + if set.Namespace != systemsetting.DelegatedSecretNamespace { + return nil, kerrors.NewNotFound(walrus.SchemeResource("settings"), set.Name) + } + s, ok := systemsetting.Index(set.Name) + if !ok || !s.Editable() { + return nil, kerrors.NewForbidden(walrus.SchemeResource("settings"), set.Name, + errors.New("setting is not editable")) + } + if set.Spec.Value == nil { + return nil, kerrors.NewInvalid(walrus.SchemeKind("settings"), set.Name, + field.ErrorList{field.Required(field.NewPath("spec.value"), "setting value is required")}) + } + + // Update. + err := s.Configure(ctx, *set.Spec.Value) + if err != nil { + return nil, kerrors.NewConflict(walrus.SchemeResource("settings"), set.Name, err) + } + + // Get. + return h.OnGet(ctx, ctrlcli.ObjectKeyFromObject(set), ctrlcli.GetOptions{}) +} + +func convertSecretListOptsFromSettingListOpts(in ctrlcli.ListOptions) (out *ctrlcli.ListOptions) { + // Lock field selector. + in.FieldSelector = fields.SelectorFromSet(fields.Set{ + "metadata.namespace": in.Namespace, + "metadata.name": systemsetting.DelegatedSecretName, + }) + + // Add necessary label selector. + if lbs := systemmeta.GetResourcesLabelSelectorOfType("settings"); in.LabelSelector == nil { + in.LabelSelector = lbs + } else { + reqs, _ := lbs.Requirements() + in.LabelSelector = in.LabelSelector.DeepCopySelector().Add(reqs...) + } + + return &in +} + +func convertSettingFromSecret(sec *core.Secret, reqName string) *walrus.Setting { + resType := systemmeta.DescribeResourceType(sec) + if resType != "settings" { + return nil + } + + // Filter out. + s, ok := systemsetting.Index(reqName) + if !ok || s.Private() || sec.Data == nil { + return nil + } + + uid := sec.UID + if uidS := systemmeta.DescribeResourceNote(sec, reqName+"-uid"); len(uidS) != 0 { + uid = types.UID(uidS) + } + var ( + value = []byte("") + value_ = sec.Data[reqName] + ) + if len(value_) != 0 && s.Sensitive() { + value = []byte("(sensitive)") + } else if len(value_) != 0 { + value = value_ + } + + return &walrus.Setting{ + ObjectMeta: meta.ObjectMeta{ + Namespace: sec.Namespace, + Name: reqName, + UID: uid, + ResourceVersion: sec.ResourceVersion, + CreationTimestamp: sec.CreationTimestamp, + }, + Status: walrus.SettingStatus{ + Description: s.Description(), + Hidden: s.Hidden(), + Editable: s.Editable(), + Sensitive: s.Sensitive(), + Value: string(value), + Value_: string(value_), + }, + } +} + +func convertSettingListFromSecret(sec *core.Secret, opts ctrlcli.ListOptions) *walrus.SettingList { + resType, notes := systemmeta.DescribeResource(sec) + if resType != "settings" { + return &walrus.SettingList{} + } + + sList := &walrus.SettingList{ + Items: make([]walrus.Setting, 0, len(sec.Data)), + } + + // Sort by name. + for _, name := range sets.List(sets.KeySet(sec.Data)) { + // Ignore if not be selected by `kubectl get --field-selector=metadata.name=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.name": name}) { + continue + } + + // Filter out. + s, ok := systemsetting.Index(name) + if !ok || s.Private() { + continue + } + + uid := sec.UID + if uidS := notes[name+"-uid"]; len(uidS) != 0 { + uid = types.UID(uidS) + } + var ( + value = []byte("") + value_ = sec.Data[name] + ) + if len(value_) != 0 && s.Sensitive() { + value = []byte("(sensitive)") + } else if len(value_) != 0 { + value = value_ + } + + sList.Items = append(sList.Items, walrus.Setting{ + ObjectMeta: meta.ObjectMeta{ + Namespace: sec.Namespace, + Name: name, + UID: uid, + ResourceVersion: sec.ResourceVersion, + CreationTimestamp: sec.CreationTimestamp, + }, + Status: walrus.SettingStatus{ + Description: s.Description(), + Hidden: s.Hidden(), + Editable: s.Editable(), + Sensitive: s.Sensitive(), + Value: string(value), + Value_: string(value_), + }, + }) + } + + return sList +} diff --git a/pkg/extensionapis/walrus/template.go b/pkg/extensionapis/walrus/template.go new file mode 100644 index 000000000..4db5a4c82 --- /dev/null +++ b/pkg/extensionapis/walrus/template.go @@ -0,0 +1,77 @@ +package walrus + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/extensionapi" +) + +// TemplateHandler handles v1.Template objects. +// +// TemplateHandler proxies the v1.Template objects to the walrus core. +type TemplateHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations +} + +func (h *TemplateHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("templates") + + // As storage. + h.ObjectInfo = &walrus.Template{} + h.CurdOperations = extensionapi.WithCurdProxy[ + *walrus.Template, *walrus.TemplateList, *walruscore.Template, *walruscore.TemplateList, + ](nil, h, opts.Manager.GetClient().(ctrlcli.WithWatch)) + + return +} + +var ( + _ rest.Storage = (*TemplateHandler)(nil) + _ rest.Creater = (*TemplateHandler)(nil) + _ rest.Lister = (*TemplateHandler)(nil) + _ rest.Watcher = (*TemplateHandler)(nil) + _ rest.Getter = (*TemplateHandler)(nil) + _ rest.Updater = (*TemplateHandler)(nil) + _ rest.Patcher = (*TemplateHandler)(nil) + _ rest.GracefulDeleter = (*TemplateHandler)(nil) + _ rest.CollectionDeleter = (*TemplateHandler)(nil) +) + +func (h *TemplateHandler) Destroy() { +} + +func (h *TemplateHandler) New() runtime.Object { + return &walrus.Template{} +} + +func (h *TemplateHandler) NewList() runtime.Object { + return &walrus.TemplateList{} +} + +func (h *TemplateHandler) CastObjectTo(do *walrus.Template) (uo *walruscore.Template) { + return (*walruscore.Template)(do) +} + +func (h *TemplateHandler) CastObjectFrom(uo *walruscore.Template) (do *walrus.Template) { + return (*walrus.Template)(uo) +} + +func (h *TemplateHandler) CastObjectListTo(dol *walrus.TemplateList) (uol *walruscore.TemplateList) { + return (*walruscore.TemplateList)(dol) +} + +func (h *TemplateHandler) CastObjectListFrom(uol *walruscore.TemplateList) (dol *walrus.TemplateList) { + return (*walrus.TemplateList)(uol) +} diff --git a/pkg/extensionapis/walrus/variable.go b/pkg/extensionapis/walrus/variable.go new file mode 100644 index 000000000..bbd600c6b --- /dev/null +++ b/pkg/extensionapis/walrus/variable.go @@ -0,0 +1,648 @@ +package walrus + +import ( + "context" + "sort" + "strconv" + "strings" + "time" + + "github.com/google/uuid" + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" + "golang.org/x/exp/maps" + core "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/registry/rest" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/extensionapi" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubemeta" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemmeta" +) + +// VariableHandler handles v1.Variable objects. +// +// VariableHandler maps all v1.Variable objects to a Kubernetes Secret resource, +// which is named as "${namespace}/walrus-variables". +// +// Each v1.Variable object records as a key-value pair in the Secret's Data field. +type VariableHandler struct { + extensionapi.ObjectInfo + extensionapi.CurdOperations + + Client ctrlcli.Client +} + +func (h *VariableHandler) SetupHandler( + ctx context.Context, + opts extensionapi.SetupOptions, +) (gvr schema.GroupVersionResource, srs map[string]rest.Storage, err error) { + // Configure field indexer. + fi := opts.Manager.GetFieldIndexer() + err = fi.IndexField(ctx, &core.Secret{}, "metadata.name", + func(obj ctrlcli.Object) []string { + if obj == nil { + return nil + } + return []string{obj.GetName()} + }) + if err != nil { + return + } + + // Declare GVR. + gvr = walrus.SchemeGroupVersionResource("variables") + + // Create table convertor to pretty the kubectl's output. + var tc rest.TableConvertor + { + tc, err = extensionapi.NewJSONPathTableConvertor( + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Value", + Type: "string", + }, + JSONPath: ".status.value", + }, + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Environment", + Type: "string", + }, + JSONPath: ".status.environment", + }, + extensionapi.JSONPathTableColumnDefinition{ + TableColumnDefinition: meta.TableColumnDefinition{ + Name: "Project", + Type: "string", + }, + JSONPath: ".status.project", + }) + if err != nil { + return + } + } + + // As storage. + h.ObjectInfo = &walrus.Variable{} + h.CurdOperations = extensionapi.WithCurd(tc, h) + + // Set client. + h.Client = opts.Manager.GetClient() + + return +} + +var ( + _ rest.Storage = (*VariableHandler)(nil) + _ rest.Creater = (*VariableHandler)(nil) + _ rest.Lister = (*VariableHandler)(nil) + _ rest.Watcher = (*VariableHandler)(nil) + _ rest.Getter = (*VariableHandler)(nil) + _ rest.Updater = (*VariableHandler)(nil) + _ rest.Patcher = (*VariableHandler)(nil) + _ rest.GracefulDeleter = (*VariableHandler)(nil) + _ rest.CollectionDeleter = (*VariableHandler)(nil) +) + +func (h *VariableHandler) New() runtime.Object { + return &walrus.Variable{} +} + +func (h *VariableHandler) Destroy() {} + +func (h *VariableHandler) OnCreate(ctx context.Context, obj runtime.Object, opts ctrlcli.CreateOptions) (runtime.Object, error) { + // Validate. + vra := obj.(*walrus.Variable) + if vra.Spec.Value == nil { + errs := field.ErrorList{ + field.Required(field.NewPath("spec.value"), "variable value is required"), + } + return nil, kerrors.NewInvalid(walrus.SchemeKind("variables"), vra.Name, errs) + } + + // Check affiliation. + var project, environment string + if vra.Namespace != systemkuberes.SystemNamespaceName { + owner := &core.Namespace{ + ObjectMeta: meta.ObjectMeta{ + Name: vra.Namespace, + }, + } + _ = h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(owner), owner) + resType := systemmeta.DescribeResourceType(owner) + switch resType { + default: + errs := field.ErrorList{ + field.Invalid(field.NewPath("metadata.namespace"), + vra.Namespace, "namespace is not a project or environment"), + } + return nil, kerrors.NewInvalid(walrus.SchemeKind("variables"), vra.Name, errs) + case "projects": + project = owner.Name + case "environments": + environment = owner.Name + proj := kubemeta.GetOwnerRefOfNoCopy(owner, walrus.SchemeGroupVersionKind("Project")) + if proj == nil { + errs := field.ErrorList{ + field.Invalid(field.NewPath("metadata.namespace"), + vra.Namespace, "environment is not belong to any project"), + } + return nil, kerrors.NewInvalid(walrus.SchemeKind("variables"), vra.Name, errs) + } + project = proj.Name + } + } + + // Update or Create. + eSec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: vra.Namespace, + Name: systemkuberes.VariablesDelegatedSecretName, + }, + Data: map[string][]byte{ + vra.Name: []byte(*vra.Spec.Value), + }, + } + eResType := "variables" + eNotes := map[string]string{ + "project": project, + "environment": environment, + vra.Name + "-uid": uuid.NewString(), + vra.Name + "-create-at": time.Now().Format(time.RFC3339), + vra.Name + "-sensitive": strconv.FormatBool(vra.Spec.Sensitive), + } + systemmeta.NoteResource(eSec, eResType, eNotes) + alignFn := func(aSec *core.Secret) (*core.Secret, bool, error) { + // Validate. + if aSec.Data == nil { + aSec.Data = make(map[string][]byte) + } + if _, ok := aSec.Data[vra.Name]; ok { + return nil, true, kerrors.NewAlreadyExists(walrus.SchemeResource("variables"), vra.Name) + } + // Align data. + aSec.Data[vra.Name] = eSec.Data[vra.Name] + // Align delegated info. + _, aNotes := systemmeta.DescribeResource(aSec) + eNotes := maps.Clone(eNotes) + maps.Copy(eNotes, aNotes) + systemmeta.NoteResource(aSec, eResType, eNotes) + return aSec, false, nil + } + + sec, err := kubeclientset.UpdateWithCtrlClient(ctx, h.Client, eSec, + kubeclientset.WithUpdateAlign(alignFn), + kubeclientset.WithCreateIfNotExisted[*core.Secret]()) + if err != nil { + return nil, err + } + + // Convert. + vra = convertVariableFromSecret(sec, vra.Name) + return vra, nil +} + +func (h *VariableHandler) NewList() runtime.Object { + return &walrus.VariableList{} +} + +func (h *VariableHandler) OnList(ctx context.Context, opts ctrlcli.ListOptions) (runtime.Object, error) { + // List. + if opts.Namespace == "" { + secList := new(core.SecretList) + err := h.Client.List(ctx, secList, + convertSecretListOptsFromVariableListOpts(opts)) + if err != nil { + return nil, err + } + + // Convert. + return convertVariableListFromSecretList(secList, opts), nil + } + + // Get. + sec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: opts.Namespace, + Name: systemkuberes.VariablesDelegatedSecretName, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(sec), sec) + if err != nil { + if !kerrors.IsNotFound(err) { + return nil, err + } + // We return an empty list if the secret is not found. + return &walrus.VariableList{}, nil + } + + // Convert. + vList := convertVariableListFromSecret(sec, opts) + return vList, nil +} + +func (h *VariableHandler) OnWatch(ctx context.Context, opts ctrlcli.ListOptions) (watch.Interface, error) { + // Index. + vraIndexer := map[string]walrus.Variable{} // [pn/en/vn] -> vra + { + listObj, err := h.OnList(ctx, opts) + if err != nil { + return nil, err + } + vList := listObj.(*walrus.VariableList) + for i := range vList.Items { + vraL1IndexKey := stringx.Join("/", vList.Items[i].Status.Project, vList.Items[i].Status.Environment) + vraIndexKey := stringx.Join("/", vraL1IndexKey, vList.Items[i].Name) + vraIndexer[vraIndexKey] = vList.Items[i] + } + } + + // Watch. + uw, err := h.Client.(ctrlcli.WithWatch).Watch(ctx, new(core.SecretList), + convertSecretListOptsFromVariableListOpts(opts)) + if err != nil { + return nil, err + } + + c := make(chan watch.Event) + dw := watch.NewProxyWatcher(c) + gopool.Go(func() { + defer close(c) + defer uw.Stop() + + for { + select { + case <-ctx.Done(): + // Cancel by context. + return + case <-dw.StopChan(): + // Stop by downstream. + return + case e, ok := <-uw.ResultChan(): + if !ok { + // Close by upstream. + return + } + + // Nothing to do + if e.Object == nil { + c <- e + continue + } + + // Type assert. + sec, ok := e.Object.(*core.Secret) + if !ok { + c <- e + continue + } + + // Process bookmark. + if e.Type == watch.Bookmark { + e.Object = &walrus.Variable{ObjectMeta: sec.ObjectMeta} + c <- e + continue + } + + notes := systemmeta.DescribeResourceNotes(sec, []string{"project", "environment"}) + vraL1IndexKey := stringx.Join("/", notes["project"], notes["environment"]) + vraIndexKeySet := sets.NewString() + + // Send. + for name := range sec.Data { + // Ignore if not be selected by `kubectl get --field-selector=metadata.namespace=...,metadata.name=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.namespace": sec.Namespace, "metadata.name": name}) { + continue + } + + // Convert. + vra := convertVariableFromSecret(sec, name) + if vra == nil { + continue + } + + vraIndexKey := stringx.Join("/", vra.Status.Project, vra.Status.Environment, vra.Name) + vraIndexKeySet.Insert(vraIndexKey) + + // Ignore if the same as previous. + prevVra, ok := vraIndexer[vraIndexKey] + switch { + default: + // ignore + continue + case !ok: + // insert + vraIndexer[vraIndexKey] = *vra + case !vra.Equal(&prevVra): + // update + vraIndexer[vraIndexKey] = *vra + } + + // Dispatch. + e2 := e.DeepCopy() + e2.Object = vra + c <- *e2 + } + + // GC. + for vraIndexKey := range vraIndexer { + if !strings.HasPrefix(vraIndexKey, vraL1IndexKey+"/") { + continue + } + switch { + default: + continue + case e.Type == watch.Deleted: + case !vraIndexKeySet.Has(vraIndexKey): + } + + vra := vraIndexer[vraIndexKey] + delete(vraIndexer, vraIndexKey) + + // Ignore if not be selected by `kubectl get --field-selector=metadata.namespace=...,metadata.name=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.namespace": vra.Namespace, "metadata.name": vra.Name}) { + continue + } + + // Dispatch a delete event. + e2 := e.DeepCopy() + e2.Type = watch.Deleted + e2.Object = &vra + c <- *e2 + } + } + } + }) + + return dw, nil +} + +func (h *VariableHandler) OnGet(ctx context.Context, name types.NamespacedName, opts ctrlcli.GetOptions) (runtime.Object, error) { + // Get. + sec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: name.Namespace, + Name: systemkuberes.VariablesDelegatedSecretName, + }, + } + err := h.Client.Get(ctx, ctrlcli.ObjectKeyFromObject(sec), sec) + if err != nil { + return nil, err + } + + // Convert. + vra := convertVariableFromSecret(sec, name.Name) + if vra == nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("variables"), name.Name) + } + return vra, nil +} + +func (h *VariableHandler) OnUpdate(ctx context.Context, obj, _ runtime.Object, opts ctrlcli.UpdateOptions) (runtime.Object, error) { + // Validate. + vra := obj.(*walrus.Variable) + if vra.Spec.Value == nil { + errs := field.ErrorList{ + field.Required(field.NewPath("spec.value"), "variable value is required"), + } + return nil, kerrors.NewInvalid(walrus.SchemeKind("variables"), vra.Name, errs) + } + + // Update. + eSec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: vra.Namespace, + Name: systemkuberes.VariablesDelegatedSecretName, + }, + Data: map[string][]byte{ + vra.Name: []byte(*vra.Spec.Value), + }, + } + eNotes := map[string]string{ + vra.Name + "-sensitive": strconv.FormatBool(vra.Spec.Sensitive), + } + systemmeta.NoteResource(eSec, "variables", eNotes) + alignFn := func(aSec *core.Secret) (*core.Secret, bool, error) { + // Validate. + if aSec.Data == nil || aSec.Data[vra.Name] == nil { + return nil, true, kerrors.NewNotFound(walrus.SchemeResource("variables"), vra.Name) + } + // Align data. + aSec.Data[vra.Name] = eSec.Data[vra.Name] + // Align delegated info. + systemmeta.NoteResource(aSec, "variables", eNotes) + return aSec, false, nil + } + + sec, err := kubeclientset.UpdateWithCtrlClient(ctx, h.Client, eSec, + kubeclientset.WithUpdateAlign(alignFn)) + if err != nil { + return nil, err + } + + // Convert. + vra = convertVariableFromSecret(sec, vra.Name) + if vra == nil { + return nil, kerrors.NewNotFound(walrus.SchemeResource("variables"), vra.Name) + } + return vra, nil +} + +func (h *VariableHandler) OnDelete(ctx context.Context, obj runtime.Object, opts ctrlcli.DeleteOptions) error { + vra := obj.(*walrus.Variable) + + // Update. + eSec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Namespace: vra.Namespace, + Name: systemkuberes.VariablesDelegatedSecretName, + }, + } + alignFn := func(aSec *core.Secret) (*core.Secret, bool, error) { + // Validate. + if aSec.Data == nil || aSec.Data[vra.Name] == nil { + return nil, true, kerrors.NewNotFound(walrus.SchemeResource("variables"), vra.Name) + } + // Align data. + delete(aSec.Data, vra.Name) + // Align delegated info. + systemmeta.PopResourceNotes(aSec, []string{ + vra.Name + "-uid", + vra.Name + "-create-at", + vra.Name + "-sensitive", + }) + return aSec, false, nil + } + + _, err := kubeclientset.UpdateWithCtrlClient(ctx, h.Client, eSec, + kubeclientset.WithUpdateAlign(alignFn)) + return err +} + +func convertVariableFromSecret(sec *core.Secret, name string) *walrus.Variable { + resType, notes := systemmeta.DescribeResource(sec) + if resType != "variables" { + return nil + } + + // Filter out. + if _, ok := sec.Data[name]; !ok { + return nil + } + + uid := sec.UID + if uidS := notes[name+"-uid"]; len(uidS) != 0 { + uid = types.UID(uidS) + } + createAt := sec.CreationTimestamp + if createS := notes[name+"-create-at"]; len(createS) != 0 { + if createAt_, err := time.Parse(time.RFC3339, createS); err == nil { + createAt = meta.NewTime(createAt_) + } + } + sensitive := notes[name+"-sensitive"] == "true" + var ( + value = []byte("") + value_ = sec.Data[name] + ) + if len(value_) != 0 && sensitive { + value = []byte("(sensitive)") + } else if len(value_) != 0 { + value = value_ + } + + return &walrus.Variable{ + ObjectMeta: meta.ObjectMeta{ + Namespace: sec.Namespace, + Name: name, + UID: uid, + ResourceVersion: sec.ResourceVersion, + CreationTimestamp: createAt, + }, + Spec: walrus.VariableSpec{ + Sensitive: sensitive, + }, + Status: walrus.VariableStatus{ + Project: notes["project"], + Environment: notes["environment"], + Value: string(value), + Value_: string(value_), + }, + } +} + +func convertSecretListOptsFromVariableListOpts(in ctrlcli.ListOptions) (out *ctrlcli.ListOptions) { + // Lock field selector. + in.FieldSelector = fields.SelectorFromSet(fields.Set{ + "metadata.name": systemkuberes.VariablesDelegatedSecretName, + }) + + // Add necessary label selector. + if lbs := systemmeta.GetResourcesLabelSelectorOfType("variables"); in.LabelSelector == nil { + in.LabelSelector = lbs + } else { + reqs, _ := lbs.Requirements() + in.LabelSelector = in.LabelSelector.DeepCopySelector().Add(reqs...) + } + + return &in +} + +func convertVariableListFromSecret(sec *core.Secret, opts ctrlcli.ListOptions) *walrus.VariableList { + resType, notes := systemmeta.DescribeResource(sec) + if resType != "variables" { + return &walrus.VariableList{} + } + + vList := &walrus.VariableList{ + Items: make([]walrus.Variable, 0, len(sec.Data)), + } + + for _, name := range sets.KeySet(sec.Data).UnsortedList() { + // Ignore if not be selected by `kubectl get --field-selector=metadata.namespace=...,metadata.name=...`. + if fs := opts.FieldSelector; fs != nil && + !fs.Matches(fields.Set{"metadata.namespace": sec.Namespace, "metadata.name": name}) { + continue + } + + uid := sec.UID + if uidS := notes[name+"-uid"]; len(uidS) != 0 { + uid = types.UID(uidS) + } + createAt := sec.CreationTimestamp + if createS := notes[name+"-create-at"]; len(createS) != 0 { + if createAt_, err := time.Parse(time.RFC3339, createS); err == nil { + createAt = meta.NewTime(createAt_) + } + } + sensitive := notes[name+"-sensitive"] == "true" + var ( + value = []byte("") + value_ = sec.Data[name] + ) + if len(value_) != 0 && sensitive { + value = []byte("(sensitive)") + } else if len(value_) != 0 { + value = value_ + } + + vList.Items = append(vList.Items, walrus.Variable{ + ObjectMeta: meta.ObjectMeta{ + Namespace: sec.Namespace, + Name: name, + UID: uid, + ResourceVersion: sec.ResourceVersion, + CreationTimestamp: createAt, + }, + Spec: walrus.VariableSpec{ + Sensitive: sensitive, + }, + Status: walrus.VariableStatus{ + Project: notes["project"], + Environment: notes["environment"], + Value: string(value), + Value_: string(value_), + }, + }) + } + + return vList +} + +func convertVariableListFromSecretList(secList *core.SecretList, opts ctrlcli.ListOptions) *walrus.VariableList { + // Sort by resource version. + sort.SliceStable(secList.Items, func(i, j int) bool { + l, r := secList.Items[i].ResourceVersion, secList.Items[j].ResourceVersion + return len(l) < len(r) || + (len(l) == len(r) && l < r) + }) + + vList := &walrus.VariableList{ + Items: make([]walrus.Variable, 0, len(secList.Items)), + } + + for i := range secList.Items { + svList := convertVariableListFromSecret(&secList.Items[i], opts) + if svList == nil { + continue + } + vList.Items = append(vList.Items, svList.Items...) + } + + return vList +} diff --git a/pkg/internalprocesses/kubernetes/embed.go b/pkg/internalprocesses/kubernetes/embed.go new file mode 100644 index 000000000..356ebd41a --- /dev/null +++ b/pkg/internalprocesses/kubernetes/embed.go @@ -0,0 +1,218 @@ +package kubernetes + +import ( + "context" + "errors" + "fmt" + "os" + "os/exec" + "path" + "path/filepath" + "strings" + "time" + + "github.com/seal-io/utils/netx" + "github.com/seal-io/utils/osx" + "github.com/seal-io/utils/stringx" + "github.com/seal-io/utils/waitx" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" + "k8s.io/klog/v2" + + "github.com/seal-io/walrus/pkg/kubeconfig" + "github.com/seal-io/walrus/pkg/system" +) + +var embeddedKubeConfigPath = filepath.Join(clientcmd.RecommendedConfigDir, "k3s.yaml") + +// Embedded represents the embedded Kubernetes cluster, +// which driven by k3s. +type Embedded struct{} + +func (Embedded) Start(ctx context.Context) error { + // Validate if run with privileged. + if !osx.ExistsDevice("/dev/kmsg") { + if os.Getenv("KUBERNETES_SERVICE_HOST") != "" { + return errors.New(`require "securityContext.privileged" feature of walrus pod`) + } + + return errors.New(`require "--privileged" flag to run walrus container`) + } + + // NB(thxCode): With cgroup v2, + // in order to nest walrus multiple times, + // we need to create specific cgroup for k3s. + cgroupRoot := "/" + + // Enable nested cgroup v2, + // ref to https://github.com/moby/moby/issues/43093. + if osx.ExistsFile("/sys/fs/cgroup/cgroup.controllers") { + // Move the processes from the root group to the /init group, + // otherwise writing subtree_control fails with EBUSY. + if !osx.ExistsFile("/sys/fs/cgroup/init/cgroup.procs") { + err := osx.Copy( + "/sys/fs/cgroup/cgroup.procs", + "/sys/fs/cgroup/init/cgroup.procs") + if err != nil { + return fmt.Errorf("error moving processes to root init group: %w", err) + } + } + // Enable controllers to allow nesting. + err := osx.Copy( + "/sys/fs/cgroup/cgroup.controllers", + "/sys/fs/cgroup/cgroup.subtree_control", + osx.CopyWithModifier(func(data []byte) ([]byte, error) { + if len(data) == 0 { + return data, nil + } + cs := strings.Split(stringx.FromBytes(&data), " ") + s := "+" + stringx.Join(" +", cs...) + + return stringx.ToBytes(&s), nil + })) + if err != nil { + return fmt.Errorf("error enabling root group controllers: %w", err) + } + + // Calculate specific cgroup root. + cgroupRoot = "/k3s-" + stringx.SumByFNV64a(system.PrimarySubnet.Get()) + + // Create specific cgroup root. + err = os.Mkdir(path.Join("/sys/fs/cgroup", cgroupRoot), 0o755) + if err != nil && !os.IsExist(err) { + return fmt.Errorf("error creating cgroup: %w", err) + } + + // Enable controllers to run k3s. + err = osx.Copy( + "/sys/fs/cgroup/cgroup.subtree_control", + path.Join("/sys/fs/cgroup", cgroupRoot, "cgroup.subtree_control"), + osx.CopyWithModifier(func(data []byte) ([]byte, error) { + if len(data) == 0 { + return data, nil + } + cs := strings.Split(stringx.FromBytes(&data), " ") + s := "+" + stringx.Join(" +", cs...) + + return stringx.ToBytes(&s), nil + })) + if err != nil { + return fmt.Errorf("error enabling %q group controllers: %w", cgroupRoot, err) + } + } + + var ( + k3sDataDir = osx.Getenv("K3S_DATA_DIR", "/var/lib/k3s") + k3sServerDataDir = filepath.Join(k3sDataDir, "server") + runDataPath = filepath.Join(system.DataDir, "k3s") + ) + + // Link run data directory. + err := osx.Link( + runDataPath, + k3sServerDataDir, + osx.LinkEvenIfNotFound(false, 0o766), + osx.LinkInReplace()) + if err != nil { + return fmt.Errorf("error link server data: %w", err) + } + + // Reset server database. + if osx.ExistsDir(filepath.Join(k3sServerDataDir, "db", "etcd")) { + _ = os.Remove(filepath.Join(k3sServerDataDir, "db", "reset-flag")) // Clean reset flag. + + cmdArgs := []string{ + "server", + "--cluster-reset", + "--data-dir=" + k3sDataDir, + } + if err = runK3sWith(ctx, cmdArgs); err != nil { + return err + } + } + + cmdArgs := []string{ + "server", + "--cluster-init", + "--etcd-disable-snapshots", + "--disable=traefik,servicelb,metrics-server", + "--disable-cloud-controller", + "--disable-network-policy", + "--disable-helm-controller", + "--flannel-backend=host-gw", + "--node-name=local", + "--data-dir=" + k3sDataDir, + "--write-kubeconfig=" + embeddedKubeConfigPath, + "--kubelet-arg=cgroup-root=" + cgroupRoot, + "--kubelet-arg=system-reserved=cpu=300m,memory=256Mi", + "--kubelet-arg=kube-reserved=cpu=200m,memory=256Mi", + "--kube-apiserver-arg=service-node-port-range=30000-30100", + } + + // NB(thxCode): With embedded cluster, + // in order to avoid the conflict with the default cluster CIDR when running in Kubernetes cluster, + // we need to adjust the embedded cluster CIDR. + if v := system.PrimarySubnet.Get(); v != "" { + sn := netx.MustIPv4FromCIDR(v) + cls := sn.Next().Next() // Offset 2 positions to get cluster CIDR. + svc := cls.Next() // Offset 1 position of cluster CIDR to get service CIDR. + cmdArgs = append(cmdArgs, + "--cluster-cidr="+cls.String(), + "--service-cidr="+svc.String()) + + // NB(thxCode): At present, it's impossible to reset the PodCIDR of a joined Kubernetes Node, + // even the `--cluster-reset` introduced by k3s. + // Embedded Kubernetes cluster is for demonstration purpose, + // we never guarantee it for production using. + // In order to restart from the mutable networking env, + // we compare with the previous cluster CIDR here to determine erasing the data directory or not. + clsFp := filepath.Join(k3sServerDataDir, "cluster.cidr") + if osx.ExistsFile(clsFp) { + bs, _ := os.ReadFile(clsFp) + if string(bs) != cls.String() { + _ = os.RemoveAll(filepath.Join(k3sServerDataDir, "db", "etcd")) + } + } + _ = os.WriteFile(clsFp, []byte(cls.String()), 0o600) + } + + return runK3sWith(ctx, cmdArgs) +} + +func (Embedded) GetConfig(ctx context.Context) (string, *rest.Config, error) { + err := waitx.PollUntilContextTimeout(ctx, time.Second, 300*time.Second, true, + func(ctx context.Context) error { + if osx.ExistsFile(embeddedKubeConfigPath) { + return nil + } + return errors.New("wait for embedded kubeconfig") + }) + if err != nil { + return "", nil, err + } + + cfg, err := kubeconfig.LoadRestConfig(embeddedKubeConfigPath) + if err != nil { + return "", nil, err + } + + return embeddedKubeConfigPath, cfg, err +} + +func runK3sWith(ctx context.Context, cmdArgs []string) error { + const cmdName = "k3s" + + logger := klog.Background().WithName(cmdName) + logger.Infof("run: %s %s", cmdName, stringx.Join(" ", cmdArgs...)) + cmd := exec.CommandContext(ctx, cmdName, cmdArgs...) + cmd.SysProcAttr = getSysProcAttr() + cmd.Stdout = logger.V(6) + cmd.Stderr = logger.V(6) + + err := cmd.Run() + if err != nil && !errors.Is(err, context.Canceled) { + return err + } + + return nil +} diff --git a/pkg/internalprocesses/kubernetes/embed_linux.go b/pkg/internalprocesses/kubernetes/embed_linux.go new file mode 100644 index 000000000..f139dbb94 --- /dev/null +++ b/pkg/internalprocesses/kubernetes/embed_linux.go @@ -0,0 +1,9 @@ +package kubernetes + +import "syscall" + +func getSysProcAttr() *syscall.SysProcAttr { + return &syscall.SysProcAttr{ + Pdeathsig: syscall.SIGKILL, + } +} diff --git a/pkg/internalprocesses/kubernetes/embed_nonlinux.go b/pkg/internalprocesses/kubernetes/embed_nonlinux.go new file mode 100644 index 000000000..4eecf5e3c --- /dev/null +++ b/pkg/internalprocesses/kubernetes/embed_nonlinux.go @@ -0,0 +1,9 @@ +//go:build !linux + +package kubernetes + +import "syscall" + +func getSysProcAttr() *syscall.SysProcAttr { + return nil +} diff --git a/pkg/kubeclientset/operate.go b/pkg/kubeclientset/operate.go new file mode 100644 index 000000000..5c11c63c8 --- /dev/null +++ b/pkg/kubeclientset/operate.go @@ -0,0 +1,734 @@ +package kubeclientset + +import ( + "context" + "errors" + "fmt" + "reflect" + "time" + + "github.com/seal-io/utils/json" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ( + // MetaObject is the interface for the object with metadata. + MetaObject = ctrlcli.Object + + // AlignWithFn is a function to compare the actual object with the expected object, + // and returns aligned object if the actual object is no the same with the expected object. + AlignWithFn[T MetaObject] func(actualCopied T) (aligned T, skip bool, err error) + + // CompareWithFn is a function to compare the actual object with the expected object, + // and returns true if the actual object is the same with the expected object. + CompareWithFn[T MetaObject] func(actualCopied T) (skip bool) +) + +type ( + ApplyClient[T MetaObject] interface { + Create(ctx context.Context, obj T, opts meta.CreateOptions) (T, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (T, error) + Get(ctx context.Context, name string, opts meta.GetOptions) (T, error) + } + + _ApplyOptions struct { + meta.ApplyOptions + StatusOnly bool + } + + ApplyOption func(*_ApplyOptions) +) + +// WithApplyMetaOptions sets the apply options. +func WithApplyMetaOptions(opts meta.ApplyOptions) ApplyOption { + return func(ao *_ApplyOptions) { + ao.ApplyOptions = opts + } +} + +// WithStatusOnly patches the status if the resource exists. +func WithStatusOnly() ApplyOption { + return func(ao *_ApplyOptions) { + ao.StatusOnly = true + } +} + +// Apply is similar to the clientset Apply function generated by applyconfiguration-gen, +// but no need to convert the raw object to the applyconfiguration object. +// +// Apply will create the resource if it does not exist, +// otherwise, it will patch the resource. +// +// Apply only patched the status if WithStatusOnly provided. +func Apply[T MetaObject](ctx context.Context, cli ApplyClient[T], expected T, opts ...ApplyOption) (T, error) { + if reflect.ValueOf(expected).IsZero() { + return expected, errors.New("expected is nil") + } + + var ao _ApplyOptions + for i := range opts { + opts[i](&ao) + } + + var ( + name = expected.GetName() + err = errors.New("resource name may not be empty") + actual T + ) + + if name != "" { + actual, err = cli.Get(ctx, name, meta.GetOptions{ + ResourceVersion: "0", + }) + if err != nil && !kerrors.IsNotFound(err) { + return actual, err + } + } + + switch { + case err != nil && ao.StatusOnly: + // Patching subresource only supports for existing resource. + return actual, err + case err != nil || actual.GetDeletionTimestamp() != nil: + // Create if not found or deleting. + actual, err = cli.Create(ctx, expected, meta.CreateOptions{ + DryRun: ao.DryRun, + }) + if err != nil { + if !kerrors.IsAlreadyExists(err) { + return actual, err + } + // Retry if already existed. + return Apply(ctx, cli, expected, opts...) + } + // Return directly if new created. + return actual, nil + } + + data, err := json.Marshal(expected) + if err != nil { + return actual, fmt.Errorf("json marshal %q: %w", name, err) + } + + var subres []string + if ao.StatusOnly { + subres = []string{"status"} + } + return cli.Patch(ctx, name, types.ApplyPatchType, data, ao.ToPatchOptions(), subres...) +} + +// ApplyWithCtrlClient is similar to Apply, but uses the ctrl client. +// +// ApplyWithCtrlClient doesn't support WithStatusOnly. +func ApplyWithCtrlClient[T MetaObject](ctx context.Context, cli ctrlcli.Client, expected T, opts ...ApplyOption) (T, error) { + if reflect.ValueOf(expected).IsZero() { + return expected, errors.New("expected is nil") + } + + var ao _ApplyOptions + for i := range opts { + opts[i](&ao) + } + + if ao.StatusOnly { + return expected, errors.New("status only is not supported by ctrl client") + } + + var ( + name = expected.GetName() + err = errors.New("resource name may not be empty") + actual = expected.DeepCopyObject().(T) + ) + + if name != "" { + err = cli.Get(ctx, ctrlcli.ObjectKeyFromObject(expected), actual) + if err != nil && !kerrors.IsNotFound(err) { + return actual, err + } + } + + if err != nil || actual.GetDeletionTimestamp() != nil { + // Create if not found or deleting. + err = cli.Create(ctx, actual, &ctrlcli.CreateOptions{ + DryRun: ao.DryRun, + }) + if err != nil { + if !kerrors.IsAlreadyExists(err) { + return actual, err + } + // Retry if already existed. + return ApplyWithCtrlClient(ctx, cli, expected, opts...) + } + // Return directly if new created. + return actual, nil + } + + err = cli.Patch(ctx, expected, ctrlcli.Apply, &ctrlcli.PatchOptions{ + DryRun: ao.DryRun, + Force: ptr.To(ao.Force), + FieldManager: ao.FieldManager, + Raw: ptr.To(ao.ApplyOptions.ToPatchOptions()), + }) + return expected, err +} + +type ( + CreateClient[T MetaObject] interface { + Create(ctx context.Context, obj T, opts meta.CreateOptions) (T, error) + Update(ctx context.Context, obj T, opts meta.UpdateOptions) (T, error) + Get(ctx context.Context, name string, opts meta.GetOptions) (T, error) + Delete(ctx context.Context, name string, opts meta.DeleteOptions) error + } + + _CreateOptions[T MetaObject] struct { + meta.CreateOptions + UpdateAlignFunc AlignWithFn[T] + RecreateCompareFunc CompareWithFn[T] + } + + CreateOption[T MetaObject] func(*_CreateOptions[T]) +) + +// WithCreateMetaOptions sets the create options. +func WithCreateMetaOptions[T MetaObject](opts meta.CreateOptions) CreateOption[T] { + return func(co *_CreateOptions[T]) { + co.CreateOptions = opts + } +} + +// WithUpdateIfExisted with the align function to update the resource if existed. +// +// WithUpdateIfExisted is conflict to WithRecreateIfDuplicated, if both provided, +// WithUpdateIfExisted will be used. +func WithUpdateIfExisted[T MetaObject](fn AlignWithFn[T]) CreateOption[T] { + return func(co *_CreateOptions[T]) { + co.UpdateAlignFunc = fn + } +} + +// WithRecreateIfDuplicated with the compare function to recreate the resource if different. +// +// WithRecreateIfDuplicated is conflict to WithUpdateIfExisted, if both provided, +// WithUpdateIfExisted will be used. +func WithRecreateIfDuplicated[T MetaObject](fn CompareWithFn[T]) CreateOption[T] { + return func(co *_CreateOptions[T]) { + co.RecreateCompareFunc = fn + } +} + +// Create is similar to Apply, will create the resource if it does not exist. +// +// Create updates the resource if WithUpdateIfExisted provided, +// or recreate the resource if WithRecreateIfDuplicated provided. +// Select one from WithUpdateIfExisted and WithRecreateIfDuplicated, if both provided, +// WithUpdateIfExisted will be used. +func Create[T MetaObject](ctx context.Context, cli CreateClient[T], expected T, opts ...CreateOption[T]) (T, error) { + if reflect.ValueOf(expected).IsZero() { + return expected, errors.New("expected is nil") + } + + var co _CreateOptions[T] + for i := range opts { + opts[i](&co) + } + + var ( + name = expected.GetName() + err = errors.New("resource name may not be empty") + actual T + ) + + if name != "" { + actual, err = cli.Get(ctx, name, meta.GetOptions{ + ResourceVersion: "0", + }) + if err != nil && !kerrors.IsNotFound(err) { + return actual, err + } + } + + // Create if not found or deleting. + if err != nil || actual.GetDeletionTimestamp() != nil { + deleting := actual.GetDeletionTimestamp() != nil && len(actual.GetFinalizers()) == 0 + if deleting { + // NB(thxCode): sleep a while to avoid server flipping. + time.Sleep(10 * time.Millisecond) + } + actual, err = cli.Create(ctx, expected, meta.CreateOptions{ + DryRun: co.DryRun, + }) + if err != nil && kerrors.IsAlreadyExists(err) { + // Retry on already existed if: + // - configure align function. + // - configure compare function. + // - the resource is deleting without finalizers. + if co.UpdateAlignFunc != nil || co.RecreateCompareFunc != nil || deleting { + return Create(ctx, cli, expected, opts...) + } + err = nil + } + return actual, err + } + + switch { + case co.UpdateAlignFunc != nil: + var ( + copied T + skip bool + ) + copied, skip, err = co.UpdateAlignFunc(actual.DeepCopyObject().(T)) + if err != nil { + return actual, err + } + if skip { + return actual, nil + } + + // Copy resource version for update. + // + // And keep the original labels, annotations, finalizers, and owner references if they are not set. + // If you want to clean the above fields, please set them to empty in the expected object. + copiedOm, actualOm := copied, actual + copiedOm.SetResourceVersion(actualOm.GetResourceVersion()) + if copiedOm.GetLabels() == nil { + copiedOm.SetLabels(actualOm.GetLabels()) + } + if copiedOm.GetAnnotations() == nil { + copiedOm.SetAnnotations(actualOm.GetAnnotations()) + } + if copiedOm.GetFinalizers() == nil { + copiedOm.SetFinalizers(actualOm.GetFinalizers()) + } + if copiedOm.GetOwnerReferences() == nil { + copiedOm.SetOwnerReferences(actualOm.GetOwnerReferences()) + } + + updated, err := cli.Update(ctx, copied, meta.UpdateOptions{ + DryRun: co.DryRun, + }) + if err == nil || !kerrors.IsConflict(err) || !kerrors.IsNotAcceptable(err) { + return updated, err + } + + // Retry if conflicted. + return Create(ctx, cli, expected, opts...) + case co.RecreateCompareFunc != nil: + skip := co.RecreateCompareFunc(actual.DeepCopyObject().(T)) + if skip { + return actual, nil + } + + err = cli.Delete(ctx, name, meta.DeleteOptions{ + DryRun: co.DryRun, + PropagationPolicy: ptr.To(meta.DeletePropagationForeground), + }) + if err != nil && !kerrors.IsNotFound(err) { + return actual, err + } + + // Recreate. + return Create(ctx, cli, expected, opts...) + } + + return actual, nil +} + +// CreateWithCtrlClient is similar to Create, but uses the ctrl client. +func CreateWithCtrlClient[T MetaObject](ctx context.Context, cli ctrlcli.Client, expected T, opts ...CreateOption[T]) (T, error) { + if reflect.ValueOf(expected).IsZero() { + return expected, errors.New("expected is nil") + } + + var co _CreateOptions[T] + for i := range opts { + opts[i](&co) + } + + var ( + name = expected.GetName() + err = errors.New("resource name may not be empty") + actual = expected.DeepCopyObject().(T) + ) + + if name != "" { + err = cli.Get(ctx, ctrlcli.ObjectKeyFromObject(expected), actual) + if err != nil && !kerrors.IsNotFound(err) { + return actual, err + } + } + + // Create if not found or deleting. + if err != nil || actual.GetDeletionTimestamp() != nil { + deleting := actual.GetDeletionTimestamp() != nil && len(actual.GetFinalizers()) == 0 + if deleting { + // NB(thxCode): sleep a while to avoid server flipping. + time.Sleep(10 * time.Millisecond) + } + err = cli.Create(ctx, expected, &ctrlcli.CreateOptions{ + DryRun: co.DryRun, + FieldManager: co.FieldManager, + Raw: ptr.To(co.CreateOptions), + }) + if err != nil && kerrors.IsAlreadyExists(err) { + // Retry on already existed if: + // - configure align function. + // - configure compare function. + // - the resource is deleting without finalizers. + if co.UpdateAlignFunc != nil || co.RecreateCompareFunc != nil || deleting { + return CreateWithCtrlClient(ctx, cli, expected, opts...) + } + err = nil + } + return actual, err + } + + switch { + case co.UpdateAlignFunc != nil: + var ( + copied T + skip bool + ) + copied, skip, err = co.UpdateAlignFunc(actual.DeepCopyObject().(T)) + if err != nil { + return actual, err + } + if skip { + return actual, nil + } + + // Copy resource version for update. + // + // And keep the original labels, annotations, finalizers, and owner references if they are not set. + // If you want to clean the above fields, please set them to empty in the expected object. + copiedOm, actualOm := copied, actual + copiedOm.SetResourceVersion(actualOm.GetResourceVersion()) + if copiedOm.GetLabels() == nil { + copiedOm.SetLabels(actualOm.GetLabels()) + } + if copiedOm.GetAnnotations() == nil { + copiedOm.SetAnnotations(actualOm.GetAnnotations()) + } + if copiedOm.GetFinalizers() == nil { + copiedOm.SetFinalizers(actualOm.GetFinalizers()) + } + if copiedOm.GetOwnerReferences() == nil { + copiedOm.SetOwnerReferences(actualOm.GetOwnerReferences()) + } + + err = cli.Update(ctx, copied, &ctrlcli.UpdateOptions{ + DryRun: co.DryRun, + Raw: &meta.UpdateOptions{DryRun: co.DryRun}, + }) + if err == nil || !kerrors.IsConflict(err) || !kerrors.IsNotAcceptable(err) { + return copied, err + } + + // Retry if conflicted. + return CreateWithCtrlClient(ctx, cli, expected, opts...) + case co.RecreateCompareFunc != nil: + skip := co.RecreateCompareFunc(actual.DeepCopyObject().(T)) + if skip { + return actual, nil + } + + err = cli.Delete(ctx, expected, &ctrlcli.DeleteOptions{ + DryRun: co.DryRun, + PropagationPolicy: ptr.To(meta.DeletePropagationForeground), + }) + if err != nil && !kerrors.IsNotFound(err) { + return actual, err + } + + // Recreate. + return CreateWithCtrlClient(ctx, cli, expected, opts...) + } + + return actual, nil +} + +type ( + UpdateClient[T MetaObject] interface { + Create(ctx context.Context, obj T, opts meta.CreateOptions) (T, error) + Update(ctx context.Context, obj T, opts meta.UpdateOptions) (T, error) + Get(ctx context.Context, name string, opts meta.GetOptions) (T, error) + } + + _UpdateOptions[T MetaObject] struct { + meta.UpdateOptions + AlignFunc AlignWithFn[T] + CreateIfNotExisted bool + } + + UpdateOption[T MetaObject] func(*_UpdateOptions[T]) +) + +// WithUpdateMetaOptions sets the update options. +func WithUpdateMetaOptions[T MetaObject](opts meta.UpdateOptions) UpdateOption[T] { + return func(uo *_UpdateOptions[T]) { + uo.UpdateOptions = opts + } +} + +// WithUpdateAlign with the align function to update the resource. +func WithUpdateAlign[T MetaObject](fn AlignWithFn[T]) UpdateOption[T] { + return func(uo *_UpdateOptions[T]) { + uo.AlignFunc = fn + } +} + +// WithCreateIfNotExisted will create the resource if it does not exist. +func WithCreateIfNotExisted[T MetaObject]() UpdateOption[T] { + return func(uo *_UpdateOptions[T]) { + uo.CreateIfNotExisted = true + } +} + +// Update will update the resource if it exists, +// and returns the updated resource. +// +// Update returns error if the resource is not found or updating failed. +// +// Update will retry if the resource is updating conflicted when AlignWithFn is provided. +func Update[T MetaObject](ctx context.Context, cli UpdateClient[T], expected T, opts ...UpdateOption[T]) (T, error) { + if reflect.ValueOf(expected).IsZero() { + return expected, errors.New("expected is nil") + } + + var uo _UpdateOptions[T] + for i := range opts { + opts[i](&uo) + } + + name := expected.GetName() + if name == "" { + return expected, errors.New("resource name may not be empty") + } + + actual, err := cli.Get(ctx, name, meta.GetOptions{ + ResourceVersion: "0", + }) + if err != nil { + if kerrors.IsNotFound(err) && uo.CreateIfNotExisted { + actual, err = cli.Create(ctx, expected, meta.CreateOptions{ + DryRun: uo.DryRun, + }) + if err != nil && kerrors.IsAlreadyExists(err) { + // Retry if already existed. + return Update(ctx, cli, expected, opts...) + } + } + return actual, err + } + + var copied T + if uo.AlignFunc != nil { + var skip bool + copied, skip, err = uo.AlignFunc(actual.DeepCopyObject().(T)) + if err != nil { + return actual, err + } + if skip { + return actual, nil + } + } else { + copied = expected.DeepCopyObject().(T) + // Copy resource version for update. + // + // And keep the original labels, annotations, finalizers, and owner references if they are not set. + // If you want to clean the above fields, please set them to empty in the expected object. + copiedOm, actualOm := copied, actual + copiedOm.SetResourceVersion(actualOm.GetResourceVersion()) + if copiedOm.GetLabels() == nil { + copiedOm.SetLabels(actualOm.GetLabels()) + } + if copiedOm.GetAnnotations() == nil { + copiedOm.SetAnnotations(actualOm.GetAnnotations()) + } + if copiedOm.GetFinalizers() == nil { + copiedOm.SetFinalizers(actualOm.GetFinalizers()) + } + if copiedOm.GetOwnerReferences() == nil { + copiedOm.SetOwnerReferences(actualOm.GetOwnerReferences()) + } + } + + updated, err := cli.Update(ctx, copied, meta.UpdateOptions{ + DryRun: uo.DryRun, + }) + if err != nil { + if !kerrors.IsConflict(err) && !kerrors.IsNotAcceptable(err) { + return actual, err + } + + // Retry if conflicted when align function is provided. + if uo.AlignFunc != nil { + return Update(ctx, cli, expected, opts...) + } + } + + return updated, err +} + +// UpdateWithCtrlClient is similar to Update, but uses the ctrl client. +func UpdateWithCtrlClient[T MetaObject](ctx context.Context, cli ctrlcli.Client, expected T, opts ...UpdateOption[T]) (T, error) { + if reflect.ValueOf(expected).IsZero() { + return expected, errors.New("expected is nil") + } + + var uo _UpdateOptions[T] + for i := range opts { + opts[i](&uo) + } + + name := expected.GetName() + if name == "" { + return expected, errors.New("resource name may not be empty") + } + + actual := expected.DeepCopyObject().(T) + err := cli.Get(ctx, ctrlcli.ObjectKeyFromObject(expected), actual) + if err != nil { + if kerrors.IsNotFound(err) && uo.CreateIfNotExisted { + actual = expected.DeepCopyObject().(T) + err = cli.Create(ctx, actual, &ctrlcli.CreateOptions{ + DryRun: uo.DryRun, + FieldManager: uo.FieldManager, + }) + if err != nil && kerrors.IsAlreadyExists(err) { + // Retry if already existed. + return UpdateWithCtrlClient(ctx, cli, expected, opts...) + } + } + return actual, err + } + + var copied T + if uo.AlignFunc != nil { + var skip bool + copied, skip, err = uo.AlignFunc(actual.DeepCopyObject().(T)) + if err != nil { + return actual, err + } + if skip { + return actual, nil + } + } else { + copied = expected.DeepCopyObject().(T) + // Copy resource version for update. + // + // And keep the original labels, annotations, finalizers, and owner references if they are not set. + // If you want to clean the above fields, please set them to empty in the expected object. + copiedOm, actualOm := copied, actual + copiedOm.SetResourceVersion(actualOm.GetResourceVersion()) + if copiedOm.GetLabels() == nil { + copiedOm.SetLabels(actualOm.GetLabels()) + } + if copiedOm.GetAnnotations() == nil { + copiedOm.SetAnnotations(actualOm.GetAnnotations()) + } + if copiedOm.GetFinalizers() == nil { + copiedOm.SetFinalizers(actualOm.GetFinalizers()) + } + if copiedOm.GetOwnerReferences() == nil { + copiedOm.SetOwnerReferences(actualOm.GetOwnerReferences()) + } + } + + updated := copied + err = cli.Update(ctx, updated, &ctrlcli.UpdateOptions{ + DryRun: uo.DryRun, + FieldManager: uo.FieldManager, + Raw: ptr.To(uo.UpdateOptions), + }) + if err != nil { + if !kerrors.IsConflict(err) && !kerrors.IsNotAcceptable(err) { + return actual, err + } + + // Retry if conflicted when align function is provided. + if uo.AlignFunc != nil { + return UpdateWithCtrlClient(ctx, cli, expected, opts...) + } + } + + return updated, err +} + +type ( + DeleteClient interface { + Delete(ctx context.Context, name string, opts meta.DeleteOptions) error + } + + _DeleteOptions struct { + meta.DeleteOptions + } + + DeleteOption func(*_DeleteOptions) +) + +// WithDeleteMetaOptions sets the delete options. +func WithDeleteMetaOptions(opts meta.DeleteOptions) DeleteOption { + return func(do *_DeleteOptions) { + do.DeleteOptions = opts + } +} + +// Delete will delete the resource if it exists. +// +// Delete doesn't return error if the resource is not found. +func Delete(ctx context.Context, cli DeleteClient, expected MetaObject, opts ...DeleteOption) error { + if reflect.ValueOf(expected).IsZero() { + return errors.New("expected is nil") + } + + name := expected.GetName() + if name == "" { + return errors.New("resource name may not be empty") + } + + var do _DeleteOptions + for i := range opts { + opts[i](&do) + } + + err := cli.Delete(ctx, name, do.DeleteOptions) + if err != nil && !kerrors.IsNotFound(err) { + return err + } + + return nil +} + +// DeleteWithCtrlClient is similar to Delete, but uses the ctrl client. +func DeleteWithCtrlClient(ctx context.Context, cli ctrlcli.Client, expected MetaObject, opts ...DeleteOption) error { + if reflect.ValueOf(expected).IsZero() { + return errors.New("expected is nil") + } + + name := expected.GetName() + if name == "" { + return errors.New("resource name may not be empty") + } + + var do _DeleteOptions + for i := range opts { + opts[i](&do) + } + + err := cli.Delete(ctx, expected, &ctrlcli.DeleteOptions{ + GracePeriodSeconds: do.GracePeriodSeconds, + Preconditions: do.Preconditions, + PropagationPolicy: do.PropagationPolicy, + DryRun: do.DryRun, + Raw: ptr.To(do.DeleteOptions), + }) + if err != nil && !kerrors.IsNotFound(err) { + return err + } + + return nil +} diff --git a/pkg/kubeclientset/review/operate.go b/pkg/kubeclientset/review/operate.go new file mode 100644 index 000000000..a1c920700 --- /dev/null +++ b/pkg/kubeclientset/review/operate.go @@ -0,0 +1,152 @@ +package review + +import ( + "context" + "slices" + + authz "k8s.io/api/authorization/v1" + authzcli "k8s.io/client-go/kubernetes/typed/authorization/v1" + + "github.com/seal-io/walrus/pkg/kubereviewself" +) + +type ( + // Simple holds the attributes for simply reviewing. + Simple struct { + // Namespace is the namespace of the action being requested. + // Currently, there is no distinction between no namespace and all namespaces。 + Namespace string + // Group is the API Group of the Resource. + // "*" means all. + Group string + // Version is the API Version of the Resource. + // "*" means all. + Version string + // Resource is one of the existing resource types. + // "*" means all. + Resource string + // Name is the name of the resource being requested for a "get" or deleted for a "delete". + // "" (empty) means all. + Name string + } + // Simples is the list of Simple. + Simples = []Simple +) + +type ApplyOption func([]string, string) ([]string, string) + +// WithStatusOnly checks if the subject can do kubeclientset.Apply +// with kubeclientset.WithStatusOnly for something. +func WithStatusOnly() ApplyOption { + return func(verbs []string, _ string) ([]string, string) { + return slices.DeleteFunc(verbs, func(s string) bool { + return s == "create" + }), "status" + } +} + +// CanDoApply checks if the current subject can do kubeclientset.Apply for something. +func CanDoApply(ctx context.Context, + cli authzcli.SelfSubjectAccessReviewInterface, reviews Simples, + opts ...ApplyOption, +) error { + verbs := []string{"get", "create", "patch"} + subres := "" + for i := range opts { + verbs, subres = opts[i](verbs, subres) + } + + return canDoSimple(ctx, cli, reviews, verbs, subres) +} + +type CreateOption func([]string, string) ([]string, string) + +// WithUpdateIfExisted checks if the subject can do kubeclientset.Create +// with kubeclientset.WithUpdateIfExisted for something. +func WithUpdateIfExisted() CreateOption { + return func(verbs []string, subres string) ([]string, string) { + return append(verbs, "update"), subres + } +} + +// WithRecreateIfDuplicated checks if the subject can do kubeclientset.Create +// with kubeclientset.WithRecreateIfDuplicated for something. +func WithRecreateIfDuplicated() CreateOption { + return func(verbs []string, subres string) ([]string, string) { + return append(verbs, "delete"), subres + } +} + +// CanDoCreate checks if the current subject can do kubeclientset.Create for something. +func CanDoCreate(ctx context.Context, + cli authzcli.SelfSubjectAccessReviewInterface, reviews Simples, + opts ...CreateOption, +) error { + verbs := []string{"get", "create"} + subres := "" + for i := range opts { + verbs, subres = opts[i](verbs, subres) + } + + return canDoSimple(ctx, cli, reviews, verbs, subres) +} + +type UpdateOption func([]string, string) ([]string, string) + +// WithCreateIfNotExisted checks if the subject can do kubeclientset.Update +// with kubeclientset.WithCreateIfNotExisted for something. +func WithCreateIfNotExisted() UpdateOption { + return func(verbs []string, subres string) ([]string, string) { + return append(verbs, "create"), subres + } +} + +// CanDoUpdate checks if the current subject can do kubeclientset.Update for something. +func CanDoUpdate(ctx context.Context, + cli authzcli.SelfSubjectAccessReviewInterface, reviews Simples, + opts ...UpdateOption, +) error { + verbs := []string{"get", "update"} + subres := "" + for i := range opts { + verbs, subres = opts[i](verbs, subres) + } + + return canDoSimple(ctx, cli, reviews, verbs, subres) +} + +// CanDoDelete checks if the current subject can do kubeclientset.Delete for something. +func CanDoDelete(ctx context.Context, + cli authzcli.SelfSubjectAccessReviewInterface, reviews Simples, +) error { + verbs := []string{"delete"} + subres := "" + + return canDoSimple(ctx, cli, reviews, verbs, subres) +} + +func canDoSimple( + ctx context.Context, + cli authzcli.SelfSubjectAccessReviewInterface, reviews Simples, + verbs []string, subresource string, +) error { + advances := make(kubereviewself.Reviews, 0, len(reviews)*len(verbs)) + for i := range reviews { + simple := &reviews[i] + for _, verb := range verbs { + advances = append(advances, kubereviewself.Review{ + ResourceAttributes: &authz.ResourceAttributes{ + Verb: verb, + Group: simple.Group, + Version: simple.Version, + Resource: simple.Resource, + Subresource: subresource, + Namespace: simple.Namespace, + Name: simple.Name, + }, + }) + } + } + + return kubereviewself.CanDo(ctx, cli, advances) +} diff --git a/pkg/kubeconfig/convert.go b/pkg/kubeconfig/convert.go new file mode 100644 index 000000000..277f4be62 --- /dev/null +++ b/pkg/kubeconfig/convert.go @@ -0,0 +1,119 @@ +package kubeconfig + +import ( + "errors" + "fmt" + "os" + + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd/api" +) + +// ConvertRestConfigToApiConfig converts a rest config to an api config, +// all data locate with a file path will be load into the api config. +func ConvertRestConfigToApiConfig(cfg *rest.Config) (api.Config, error) { + if cfg == nil { + return api.Config{}, errors.New("nil rest config") + } + + const context = "default" + + cc := *api.NewConfig() + + // Convert context info. + { + info := api.NewContext() + + info.Cluster = context + info.AuthInfo = context + + // TODO: Namespace, Extensions. + + cc.Contexts[context] = info + } + + cc.CurrentContext = context + + // Convert cluster info. + { + info := api.NewCluster() + + info.Server = cfg.Host + info.TLSServerName = cfg.TLSClientConfig.ServerName + info.InsecureSkipTLSVerify = cfg.Insecure + info.DisableCompression = cfg.DisableCompression + + info.CertificateAuthorityData = cfg.CAData + if cfg.CAFile != "" { + // Load the CA data from the file. + d, err := os.ReadFile(cfg.CAFile) + if err != nil { + return api.Config{}, fmt.Errorf("read CA file: %w", err) + } + info.CertificateAuthorityData = d + } + + if cfg.Proxy != nil { + // Get the proxy URL with a nil request. + u, err := cfg.Proxy(nil) + if err == nil { + info.ProxyURL = u.String() + } + } + + // TODO: Extensions. + + cc.Clusters[context] = info + } + + // Convert auth info. + { + info := api.NewAuthInfo() + + info.ClientCertificateData = cfg.CertData + if cfg.CertFile != "" { + // Load the certificate data from the file. + d, err := os.ReadFile(cfg.CertFile) + if err != nil { + return api.Config{}, fmt.Errorf("read certificate file: %w", err) + } + info.ClientCertificateData = d + } + + info.ClientKeyData = cfg.KeyData + if cfg.KeyFile != "" { + // Load the key data from the file. + d, err := os.ReadFile(cfg.KeyFile) + if err != nil { + return api.Config{}, fmt.Errorf("read key file: %w", err) + } + info.ClientKeyData = d + } + + info.Token = cfg.BearerToken + if cfg.BearerTokenFile != "" { + // Load the token from the file. + d, err := os.ReadFile(cfg.BearerTokenFile) + if err != nil { + return api.Config{}, fmt.Errorf("read bearer token file: %w", err) + } + info.Token = string(d) + } + + info.Impersonate = cfg.Impersonate.UserName + info.ImpersonateGroups = cfg.Impersonate.Groups + info.ImpersonateUserExtra = cfg.Impersonate.Extra + + info.Username = cfg.Username + info.Password = cfg.Password + + info.AuthProvider = cfg.AuthProvider + info.Exec = cfg.ExecProvider + + // TODO: Extensions. + + cc.AuthInfos[context] = info + } + + return cc, nil +} diff --git a/pkg/kubeconfig/load.go b/pkg/kubeconfig/load.go new file mode 100644 index 000000000..cd67bbbff --- /dev/null +++ b/pkg/kubeconfig/load.go @@ -0,0 +1,62 @@ +package kubeconfig + +import ( + "errors" + + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" +) + +// LoadRestConfigNonInteractive loads a rest config according to the following rules. +// +// 1. assume that running as a Pod and try to connect to +// the Kubernetes cluster with the mounted ServiceAccount. +// 2. load from recommended home file if none of the above conditions are met. +func LoadRestConfigNonInteractive() (cfgPath string, restCfg *rest.Config, inside bool, err error) { + // Try the in-cluster config. + restCfg, err = rest.InClusterConfig() + switch { + case err == nil: + return "", restCfg, true, nil + case err != nil && !errors.Is(err, rest.ErrNotInCluster): + return "", nil, false, err + } + + // Try the recommended config. + var ( + ld = &clientcmd.ClientConfigLoadingRules{ + Precedence: []string{clientcmd.RecommendedHomeFile}, + } + od = &clientcmd.ConfigOverrides{} + ) + restCfg, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(ld, od).ClientConfig() + return clientcmd.RecommendedHomeFile, restCfg, false, err +} + +// LoadClientConfig loads a client config from the specified path, +// the given path must exist. +func LoadClientConfig(path string) (clientcmd.ClientConfig, error) { + if path == "" { + return nil, errors.New("blank kubeconfig path") + } + + var ( + ld = &clientcmd.ClientConfigLoadingRules{ + ExplicitPath: path, + } + od = &clientcmd.ConfigOverrides{} + ) + + return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(ld, od), nil +} + +// LoadRestConfig loads a rest config from the specified path, +// the given path must exist. +func LoadRestConfig(path string) (*rest.Config, error) { + cc, err := LoadClientConfig(path) + if err != nil { + return nil, err + } + + return cc.ClientConfig() +} diff --git a/pkg/kubemeta/filed_selector.go b/pkg/kubemeta/filed_selector.go new file mode 100644 index 000000000..a6723e842 --- /dev/null +++ b/pkg/kubemeta/filed_selector.go @@ -0,0 +1,30 @@ +package kubemeta + +import ( + "strings" + + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/selection" +) + +func FieldSelectorFromRequirements(requirements fields.Requirements) fields.Selector { + s := make([]string, 0, len(requirements)) + for _, r := range requirements { + switch r.Operator { + case selection.DoubleEquals, selection.Equals, selection.NotEquals: + s = append(s, r.Field+string(r.Operator)+fields.EscapeValue(r.Value)) + case selection.In, selection.NotIn: + s = append(s, r.Field+string(r.Operator)+"("+r.Value+")") + case selection.DoesNotExist: + s = append(s, "!"+r.Field) + case selection.Exists: + s = append(s, r.Field) + case selection.GreaterThan: + s = append(s, r.Field+">"+r.Value) + case selection.LessThan: + s = append(s, r.Field+"<"+r.Value) + } + } + fs, _ := fields.ParseSelector(strings.Join(s, ",")) + return fs +} diff --git a/pkg/kubemeta/finalizer.go b/pkg/kubemeta/finalizer.go new file mode 100644 index 000000000..52458d640 --- /dev/null +++ b/pkg/kubemeta/finalizer.go @@ -0,0 +1,44 @@ +package kubemeta + +import "slices" + +// AddFinalizer adds a finalizer to the given resource. +func AddFinalizer(obj MetaObject, finalizer string) { + if obj == nil { + panic("object is nil") + } + + fs := obj.GetFinalizers() + if slices.Contains(fs, finalizer) { + return + } + + fs = append(fs, finalizer) + obj.SetFinalizers(fs) +} + +// RemoveFinalizer removes a finalizer from the given resource. +func RemoveFinalizer(obj MetaObject, finalizer string) { + if obj == nil { + panic("object is nil") + } + + fs := obj.GetFinalizers() + fs2 := slices.DeleteFunc(fs, func(s string) bool { + return s == finalizer + }) + if len(fs) == len(fs2) { + return + } + obj.SetFinalizers(fs2) +} + +// HasFinalizer returns true if the given resource has the finalizer. +func HasFinalizer(obj MetaObject, finalizer string) bool { + if obj == nil { + panic("object is nil") + } + + fs := obj.GetFinalizers() + return slices.Contains(fs, finalizer) +} diff --git a/pkg/kubemeta/owner_reference.go b/pkg/kubemeta/owner_reference.go new file mode 100644 index 000000000..c8e573148 --- /dev/null +++ b/pkg/kubemeta/owner_reference.go @@ -0,0 +1,212 @@ +package kubemeta + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/utils/ptr" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +// MetaObject is the interface for the object with metadata. +type MetaObject = ctrlcli.Object + +// IsControlledBy checks if the object has a controller owner reference set to the given owner. +func IsControlledBy(obj, owner MetaObject) bool { + ref := GetControllerOfNoCopy(obj) + if ref == nil { + return false + } + return ref.UID == owner.GetUID() +} + +// IsControlledByGVK checks if the object has a controller owner reference set to the given owner GVK. +func IsControlledByGVK(obj MetaObject, ownerGVK schema.GroupVersionKind) bool { + ref := GetOwnerRefOfNoCopy(obj, ownerGVK) + if ref == nil { + return false + } + return ptr.Deref(ref.Controller, false) +} + +// GetControllerOfNoCopy returns a pointer to the controller owner reference if obj has a controller. +func GetControllerOfNoCopy(obj MetaObject) *meta.OwnerReference { + refs := obj.GetOwnerReferences() + for i := range refs { + if refs[i].Controller != nil && *refs[i].Controller { + return &refs[i] + } + } + return nil +} + +// GetControllerOf returns a pointer to a copy of the controller owner reference if obj has a controller. +func GetControllerOf(obj MetaObject) *meta.OwnerReference { + ref := GetControllerOfNoCopy(obj) + if ref == nil { + return nil + } + cp := *ref + return &cp +} + +// NewControllerRef creates a blocked owner reference pointing to the given owner. +func NewControllerRef(owner MetaObject, gvk schema.GroupVersionKind) *meta.OwnerReference { + return &meta.OwnerReference{ + APIVersion: gvk.GroupVersion().String(), + Kind: gvk.Kind, + Name: owner.GetName(), + UID: owner.GetUID(), + BlockOwnerDeletion: ptr.To(true), + Controller: ptr.To(true), + } +} + +// ControlOn sets the owner reference of obj to owner with the given GVK. +// +// ControlOn will append a new owner reference if obj does not have the given kind of owner, +// otherwise it will replace the existing owner reference. +func ControlOn(obj, owner MetaObject, gvk schema.GroupVersionKind) { + var ( + gv = gvk.GroupVersion().String() + ors = obj.GetOwnerReferences() + ref = NewControllerRef(owner, gvk) + ) + + idx := -1 + for i := range ors { + if ors[i].APIVersion == gv && ors[i].Kind == gvk.Kind { + idx = i + break + } + } + if idx == -1 { + // Append. + ors = append(ors, *ref) + } else { + // Replace. + ors[idx] = *ref + } + obj.SetOwnerReferences(ors) +} + +// ControlOnWithoutBlock is similar to ControlOn, +// which sets the owner reference of obj to owner with the given GVK without block. +// +// ControlOnWithoutBlock will append a new owner reference if obj does not have the given kind of owner, +// otherwise it will replace the existing owner reference. +func ControlOnWithoutBlock(obj, owner MetaObject, gvk schema.GroupVersionKind) { + var ( + gv = gvk.GroupVersion().String() + ors = obj.GetOwnerReferences() + ref = NewControllerRef(owner, gvk) + ) + + ref.BlockOwnerDeletion = ptr.To(false) + + idx := -1 + for i := range ors { + if ors[i].APIVersion == gv && ors[i].Kind == gvk.Kind { + idx = i + break + } + } + if idx == -1 { + // Append. + ors = append(ors, *ref) + } else { + // Replace. + ors[idx] = *ref + } + obj.SetOwnerReferences(ors) +} + +// ControlOff removes the owner reference of obj to owner with the given GVK. +// +// ControlOff will remove the owner reference if obj has the given kind of owner. +func ControlOff(obj, owner MetaObject, gvk schema.GroupVersionKind) { + var ( + gv = gvk.GroupVersion().String() + ors = obj.GetOwnerReferences() + ) + + for i := range ors { + if ors[i].APIVersion == gv && ors[i].Kind == gvk.Kind && ors[i].UID == owner.GetUID() { + ors = append(ors[:i], ors[i+1:]...) + break + } + } + obj.SetOwnerReferences(ors) +} + +// TryControlOn is similar to ControlOn, +// but it will not change the owner reference if obj has the given kind of owner. +func TryControlOn(obj, owner MetaObject, gvk schema.GroupVersionKind) (controlled bool) { + var ( + gv = gvk.GroupVersion().String() + ors = obj.GetOwnerReferences() + ref = NewControllerRef(owner, gvk) + ) + + for i := range ors { + if ors[i].APIVersion == gv && ors[i].Kind == gvk.Kind { + return false + } + } + + // Append. + ors = append(ors, *ref) + obj.SetOwnerReferences(ors) + return true +} + +// GetOwnerRefOfNoCopy returns a pointer to the owner reference if obj has the given kind of owner. +func GetOwnerRefOfNoCopy(obj MetaObject, gvk schema.GroupVersionKind) *meta.OwnerReference { + var ( + gv = gvk.GroupVersion().String() + ors = obj.GetOwnerReferences() + ) + for i := range ors { + if ors[i].APIVersion == gv && ors[i].Kind == gvk.Kind { + return &ors[i] + } + } + return nil +} + +// GetOwnerRefOf returns a pointer to a copy of the owner reference if obj has the given kind of owner. +func GetOwnerRefOf(obj MetaObject, gvk schema.GroupVersionKind) *meta.OwnerReference { + ownerRef := GetOwnerRefOfNoCopy(obj, gvk) + if ownerRef == nil { + return nil + } + cp := *ownerRef + return &cp +} + +// GetOwnerRefsOfNoCopy returns a pointer to the owner references if obj has the given kind of owner. +func GetOwnerRefsOfNoCopy(obj MetaObject, gvk schema.GroupVersionKind) []*meta.OwnerReference { + var ( + gv = gvk.GroupVersion().String() + ors = obj.GetOwnerReferences() + ) + + refs := make([]*meta.OwnerReference, 0, 4) // Usually there is only one owner reference. + for i := range ors { + if ors[i].APIVersion == gv && ors[i].Kind == gvk.Kind { + refs = append(refs, &ors[i]) + } + } + return refs +} + +// GetOwnerRefsOf returns a pointer to the owner references if obj has the given kind of owner. +func GetOwnerRefsOf(obj MetaObject, gvk schema.GroupVersionKind) []*meta.OwnerReference { + ors := GetOwnerRefsOfNoCopy(obj, gvk) + + refs := make([]*meta.OwnerReference, 0, len(ors)) + for i := range ors { + cp := *ors[i] + refs = append(refs, &cp) + } + return refs +} diff --git a/pkg/kuberest/connect.go b/pkg/kuberest/connect.go new file mode 100644 index 000000000..e92a1c22b --- /dev/null +++ b/pkg/kuberest/connect.go @@ -0,0 +1,71 @@ +package kuberest + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/seal-io/utils/json" + "github.com/seal-io/utils/waitx" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" +) + +// WaitUntilAvailable waits until the Kubernetes to be available, +// or returns an error if the context is canceled. +func WaitUntilAvailable(ctx context.Context, cli rest.Interface) error { + if cli == nil { + return errors.New("rest client is invalid") + } + + return waitx.PollUntilContextCancel(ctx, time.Second, true, + func(ctx context.Context) error { + return IsAvailable(ctx, cli) + }, + ) +} + +// WaitConfigUntilAvailable is similar to WaitUntilAvailable, +// accepts rest.Config as input. +func WaitConfigUntilAvailable(ctx context.Context, cfg *rest.Config) error { + if cfg == nil { + return errors.New("rest config is invalid") + } + + cli, err := rest.UnversionedRESTClientFor(dynamic.ConfigFor(cfg)) + if err != nil { + return fmt.Errorf("create rest client to check kubernetes cluster: %w", err) + } + + return WaitUntilAvailable(ctx, cli) +} + +// IsAvailable returns true if the Kubernetes cluster is available. +func IsAvailable(ctx context.Context, cli rest.Interface) error { + if cli == nil { + return errors.New("rest client is invalid") + } + + body, err := cli.Get(). + AbsPath("/version"). + Do(ctx). + Raw() + if err != nil { + return err + } + + var info struct { + Major string `json:"major"` + Minor string `json:"minor"` + Compiler string `json:"compiler"` + Platform string `json:"platform"` + } + + err = json.Unmarshal(body, &info) + if err != nil { + return fmt.Errorf("unable to parse the server version: %w", err) + } + + return nil +} diff --git a/pkg/kubereviewself/review.go b/pkg/kubereviewself/review.go new file mode 100644 index 000000000..ad6a27b77 --- /dev/null +++ b/pkg/kubereviewself/review.go @@ -0,0 +1,97 @@ +package kubereviewself + +import ( + "context" + "errors" + "fmt" + + authz "k8s.io/api/authorization/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + authzcli "k8s.io/client-go/kubernetes/typed/authorization/v1" + "k8s.io/klog/v2" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ( + // Review holds the attributes for advanced reviewing. + Review = authz.SelfSubjectAccessReviewSpec + // Reviews is the list of Review. + Reviews = []Review + + // DeniedError is an error indicate which Review target has been denied. + DeniedError struct { + Review Review + } +) + +func (e DeniedError) Error() string { + return fmt.Sprintf("denied %s", e.Review) +} + +// IsDeniedError checks if the error is a DeniedError. +func IsDeniedError(err error) bool { + return errors.As(err, &DeniedError{}) +} + +// Try ignores the DeniedError. +func Try(err error) error { + if err != nil { + if !IsDeniedError(err) { + return err + } + klog.Error(err, "ignored self review denied error, need fixing manually") + } + return nil +} + +// CanDo checks if the current subject can do the specified actions. +func CanDo(ctx context.Context, cli authzcli.SelfSubjectAccessReviewInterface, reviews Reviews) error { + if len(reviews) == 0 { + return errors.New("no self review to check") + } + + allowed := true + for i := range reviews { + sar := &authz.SelfSubjectAccessReview{ + Spec: reviews[i], + } + + sar, err := cli.Create(ctx, sar, meta.CreateOptions{}) + if err != nil { + return fmt.Errorf("create self subject access review %s: %w", reviews[i], err) + } + + allowed = allowed && sar.Status.Allowed + if !allowed { + return DeniedError{Review: reviews[i]} + } + } + + return nil +} + +// CanDoWithCtrlClient is similar to CanDo, but uses the ctrl client. +func CanDoWithCtrlClient(ctx context.Context, cli ctrlcli.Client, reviews Reviews) error { + if len(reviews) == 0 { + return errors.New("no self review to check") + } + + allowed := true + for i := range reviews { + sar := &authz.SelfSubjectAccessReview{ + Spec: reviews[i], + } + + err := cli.Create(ctx, sar, &ctrlcli.CreateOptions{}) + if err != nil { + return fmt.Errorf("create self subject access review %s: %w", reviews[i], err) + } + + allowed = allowed && sar.Status.Allowed + if !allowed { + return DeniedError{Review: reviews[i]} + } + } + + return nil +} diff --git a/pkg/kubereviewsubject/review.go b/pkg/kubereviewsubject/review.go new file mode 100644 index 000000000..158276dce --- /dev/null +++ b/pkg/kubereviewsubject/review.go @@ -0,0 +1,162 @@ +package kubereviewsubject + +import ( + "context" + "errors" + "fmt" + "slices" + + authz "k8s.io/api/authorization/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + authzcli "k8s.io/client-go/kubernetes/typed/authorization/v1" + "k8s.io/klog/v2" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ( + // Review holds the attributes for advanced reviewing. + Review = authz.SubjectAccessReviewSpec + // Reviews is the list of Review. + Reviews = []Review + + // DeniedError is an error indicate which Review target has been denied. + DeniedError struct { + // Review holds the + Review Review + } +) + +func (e DeniedError) Error() string { + return fmt.Sprintf("denied %s", e.Review) +} + +// IsDeniedError checks if the error is a DeniedError. +func IsDeniedError(err error) bool { + return errors.As(err, &DeniedError{}) +} + +// Try ignores the DeniedError. +func Try(err error) error { + if err != nil { + if !IsDeniedError(err) { + return err + } + klog.Error(err, "ignored subject review denied error, need fixing manually") + } + return nil +} + +// CanDo checks if the given subject can do the specified actions. +func CanDo(ctx context.Context, cli authzcli.SubjectAccessReviewInterface, reviews Reviews) error { + if len(reviews) == 0 { + return errors.New("no self review to check") + } + + allowed := true + for i := range reviews { + sar := &authz.SubjectAccessReview{ + Spec: reviews[i], + } + + sar, err := cli.Create(ctx, sar, meta.CreateOptions{}) + if err != nil { + return fmt.Errorf("create subject access review %s: %w", reviews[i], err) + } + + allowed = allowed && sar.Status.Allowed + if !allowed { + return DeniedError{Review: reviews[i]} + } + } + + return nil +} + +// CanDoWithCtrlClient is similar to CanDo, but uses the ctrl client. +func CanDoWithCtrlClient(ctx context.Context, cli ctrlcli.Client, reviews Reviews) error { + if len(reviews) == 0 { + return errors.New("no self review to check") + } + + allowed := true + for i := range reviews { + sar := &authz.SubjectAccessReview{ + Spec: reviews[i], + } + + err := cli.Create(ctx, sar, &ctrlcli.CreateOptions{}) + if err != nil { + return fmt.Errorf("create subject access review %s: %w", reviews[i], err) + } + + allowed = allowed && sar.Status.Allowed + if !allowed { + return DeniedError{Review: reviews[i]} + } + } + + return nil +} + +// CanRequestUserDo leverages CanDo to review the requesting subject can do the specified actions or not. +// +// CanRequestUserDo overrides all given reviews' user information +// after it successfully parse from the given context. +func CanRequestUserDo(ctx context.Context, cli authzcli.SubjectAccessReviewInterface, reviews Reviews) error { + reviews, err := overrideUserInfo(ctx, reviews) + if err != nil { + return err + } + + return CanDo(ctx, cli, reviews) +} + +// CanRequestUserDoWithCtrlClient is similar to CanRequestUserDo, but uses the ctrl client. +func CanRequestUserDoWithCtrlClient(ctx context.Context, cli ctrlcli.Client, reviews Reviews) error { + reviews, err := overrideUserInfo(ctx, reviews) + if err != nil { + return err + } + + return CanDoWithCtrlClient(ctx, cli, reviews) +} + +// overrideUserInfo extracts the user info from the given context, +// and then override the user information of the given Reviews with the extracted result. +func overrideUserInfo(ctx context.Context, reviews Reviews) (Reviews, error) { + ui, ok := genericapirequest.UserFrom(ctx) + if !ok { + return nil, errors.New("cannot retrieve kubernetes request user information from context") + } + + var ( + user = ui.GetName() + uid = ui.GetUID() + extra = func() (out map[string]authz.ExtraValue) { + in := ui.GetExtra() + if len(in) == 0 { + return + } + out = make(map[string]authz.ExtraValue, len(in)) + for i := range in { + if len(in[i]) == 0 { + continue + } + out[i] = slices.Clone(in[i]) + } + return + }() + groups = ui.GetGroups() + ) + + // Override user information. + for i := range reviews { + reviews[i].User = user + reviews[i].UID = uid + reviews[i].Extra = extra + reviews[i].Groups = groups + } + + return reviews, nil +} diff --git a/pkg/manager/cmd.go b/pkg/manager/cmd.go new file mode 100644 index 000000000..d835ac566 --- /dev/null +++ b/pkg/manager/cmd.go @@ -0,0 +1,39 @@ +package manager + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// NewCommand returns a new cobra command for the manager. +func NewCommand(name, brief string) *cobra.Command { + o := NewOptions() + + c := &cobra.Command{ + Use: name, + Short: brief, + PreRunE: func(c *cobra.Command, args []string) error { + return o.Validate(c.Context()) + }, + RunE: func(c *cobra.Command, args []string) error { + cfg, err := o.Complete(c.Context()) + if err != nil { + return fmt.Errorf("complete config: %w", err) + } + mgr, err := cfg.Apply(c.Context()) + if err != nil { + return fmt.Errorf("apply config: %w", err) + } + err = mgr.Prepare(c.Context()) + if err != nil { + return fmt.Errorf("prepare manager: %w", err) + } + return mgr.Start(c.Context()) + }, + } + + o.AddFlags(c.Flags()) + + return c +} diff --git a/pkg/manager/config.go b/pkg/manager/config.go new file mode 100644 index 000000000..941dc355e --- /dev/null +++ b/pkg/manager/config.go @@ -0,0 +1,134 @@ +package manager + +import ( + "context" + "fmt" + "net" + "net/http" + "time" + + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/client-go/rest" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + ctrl "sigs.k8s.io/controller-runtime" + ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + ctrlmetricsrv "sigs.k8s.io/controller-runtime/pkg/metrics/server" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/clients/clientset/scheme" + "github.com/seal-io/walrus/pkg/manager/webhookserver" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" +) + +type Config struct { + InformerCacheResyncPeriod time.Duration + KubeConfigPath string + KubeClientConfig rest.Config + KubeHTTPClient *http.Client + KubeClient clientset.Interface + KubeLeaderElection bool + KubeLeaderLease time.Duration + KubeLeaderRenewTimeout time.Duration + ServeListenerCertDir string + ServeListener net.Listener +} + +func (c *Config) Apply(_ context.Context) (*Manager, error) { + ctrlMgrOpts := ctrl.Options{ + // General. + GracefulShutdownTimeout: ptr.To(30 * time.Second), + Scheme: scheme.Scheme, + Logger: klog.Background().WithName("ctrl"), + + // Client. + Client: ctrlcli.Options{ + HTTPClient: c.KubeHTTPClient, + }, + NewClient: func(config *rest.Config, options ctrlcli.Options) (ctrlcli.Client, error) { + return ctrlcli.NewWithWatch(config, options) + }, + + // Cache. + Cache: ctrlcache.Options{ + HTTPClient: c.KubeHTTPClient, + SyncPeriod: ptr.To(c.InformerCacheResyncPeriod), + }, + + // Leader election. + LeaderElectionReleaseOnCancel: true, + LeaderElectionNamespace: systemkuberes.SystemNamespaceName, + LeaderElectionID: "walrus-leader", + LeaderElection: c.KubeLeaderElection, + LeaseDuration: ptr.To(c.KubeLeaderLease), + RenewDeadline: ptr.To(c.KubeLeaderRenewTimeout), + RetryPeriod: ptr.To(2 * time.Second), + + // Disable default webhook server. + WebhookServer: webhookserver.Dummy(), + // Disable default metrics service. + Metrics: ctrlmetricsrv.Options{BindAddress: "0"}, + // Disable default healthcheck service. + HealthProbeBindAddress: "0", + // Disable default profiling service. + PprofBindAddress: "0", + } + + // Enable webhook serving, + // includes configurations installation. + if c.ServeListener != nil { + ctrlMgrOpts.WebhookServer = webhookserver.Enhance(c.ServeListener, c.ServeListenerCertDir, c.KubeClient) + } + + ctrlManager, err := ctrl.NewManager(rest.CopyConfig(&c.KubeClientConfig), ctrlMgrOpts) + if err != nil { + return nil, fmt.Errorf("create controller manager: %w", err) + } + + system.ConfigureLoopbackCtrlRuntime(ctrlManager.GetClient(), ctrlManager.GetCache()) + + return &Manager{ + CtrlManager: &_CtrlManager{ + Manager: ctrlManager, + IndexedFields: sets.Set[string]{}, + }, + }, nil +} + +type ( + // _CtrlManager is a wrapper around ctrl.Manager. + _CtrlManager struct { + ctrl.Manager + IndexedFields sets.Set[string] + } + + // _CtrlClientFieldIndexer is a wrapper around ctrl.FieldIndexer. + _CtrlClientFieldIndexer struct { + ctrl.Manager + IndexedFields sets.Set[string] + } +) + +func (m *_CtrlManager) GetFieldIndexer() ctrlcli.FieldIndexer { + return &_CtrlClientFieldIndexer{ + Manager: m.Manager, + IndexedFields: m.IndexedFields, + } +} + +func (i *_CtrlClientFieldIndexer) IndexField(ctx context.Context, obj ctrlcli.Object, field string, extractValue ctrlcli.IndexerFunc) error { + gvk, err := apiutil.GVKForObject(obj, i.Manager.GetScheme()) + if err != nil { + return err + } + key := gvk.String() + "/" + field + if i.IndexedFields.Has(key) { + // If the field is already indexed, skip. + return nil + } + i.IndexedFields.Insert(key) + return i.Manager.GetFieldIndexer().IndexField(ctx, obj, field, extractValue) +} diff --git a/pkg/manager/helper.go b/pkg/manager/helper.go new file mode 100644 index 000000000..f5a359e68 --- /dev/null +++ b/pkg/manager/helper.go @@ -0,0 +1,79 @@ +package manager + +import ( + "net" + "net/url" + "slices" + "strings" + + "github.com/seal-io/utils/netx" + "k8s.io/client-go/rest" + + "github.com/seal-io/walrus/pkg/system" +) + +func isLoopbackClusterNearby(restCfg *rest.Config) bool { + // Extract host from rest config. + var host string + if strings.Contains(restCfg.Host, "://") { + u, _ := url.Parse(restCfg.Host) + host = u.Host + } else { + host = restCfg.Host + } + if h, _, err := net.SplitHostPort(host); err == nil { + host = h + } else if strings.Contains(host, ":") { + host = strings.Split(host, ":")[0] + } + + // Detect host in a fast pass way. + knownLoopbackHosts := []string{ + "kubernetes.docker.internal", + "host.docker.internal", + "localhost", + "127.0.0.1", + "[::1]", + "[::1%lo0]", + } + if slices.Contains(knownLoopbackHosts, host) { + return true + } + + // Detect host in a slow pass way. + subnets := make([]netx.IPv4, 0, system.Subnets.Get().Len()) + for _, v := range system.Subnets.Get().List() { + sn := netx.MustIPv4FromCIDR(v) + subnets = append(subnets, sn) + } + + // IP detect. + if ip := net.ParseIP(host); ip != nil { + for j := range subnets { + if subnets[j].Contains(ip) { + return true + } + } + + return false + } + + // Or DNS lookup. + ips, err := net.LookupIP(host) + if err != nil { + return false + } + + for i := range ips { + if ips[i].IsLoopback() { + return true + } + for j := range subnets { + if subnets[j].Contains(ips[i]) { + return true + } + } + } + + return false +} diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go new file mode 100644 index 000000000..e730f2a5f --- /dev/null +++ b/pkg/manager/manager.go @@ -0,0 +1,156 @@ +package manager + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/http/pprof" + "runtime" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/collectors" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/seal-io/utils/funcx" + "github.com/seal-io/utils/httpx" + "github.com/seal-io/utils/pools/gopool" + "k8s.io/apiserver/pkg/server/healthz" + "k8s.io/apiserver/pkg/server/routes" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" + "k8s.io/component-base/logs" + "k8s.io/klog/v2" + ctrl "sigs.k8s.io/controller-runtime" + ctrlhealthz "sigs.k8s.io/controller-runtime/pkg/healthz" + ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics" + + "github.com/seal-io/walrus/pkg/apis" + "github.com/seal-io/walrus/pkg/controllers" + "github.com/seal-io/walrus/pkg/kuberest" + "github.com/seal-io/walrus/pkg/kubereviewself" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemdeployer" + "github.com/seal-io/walrus/pkg/webhooks" +) + +type Manager struct { + CtrlManager ctrl.Manager +} + +func (m *Manager) Prepare(ctx context.Context) error { + loopbackKubeCli := system.LoopbackKubeClient.Get() + + // Initialize CRDs. + err := kubereviewself.Try(apis.InstallCustomResourceDefinitions(ctx, loopbackKubeCli)) + if err != nil { + return fmt.Errorf("install CRDs: %w", err) + } + + // Initialize deployer cluster role. + err = kubereviewself.Try(systemdeployer.Initialize(ctx, loopbackKubeCli)) + if err != nil { + return fmt.Errorf("install deployer cluster role: %w", err) + } + + // Register metric collectors. + { + reg := ctrlmetrics.Registry + cs := []prometheus.Collector{ + collectors.NewBuildInfoCollector(), + gopool.NewStatsCollector(), + } + for i := range cs { + err = reg.Register(cs[i]) + if err != nil { + return fmt.Errorf("register metric collector: %w", err) + } + } + } + + // Set controller manager's logger. + ctrl.SetLogger(klog.Background().WithName("ctrlmgr")) + + // Setup controllers. + err = controllers.Setup(ctx, m.CtrlManager) + if err != nil { + return fmt.Errorf("setup controllers: %w", err) + } + + return nil +} + +func (m *Manager) Start(ctx context.Context) error { + cm := m.CtrlManager + ms := cm.GetWebhookServer() + + // Register /validate-*, /mutate-*. + err := webhooks.Setup(ctx, cm, ms.WebhookMux()) + if err != nil { + return fmt.Errorf("setup webhooks: %w", err) + } + + // Register /metrics. + { + h := promhttp.HandlerOpts{ + ErrorLog: klog.NewStandardLogger("WARNING"), + ErrorHandling: promhttp.HTTPErrorOnError, + } + ms.Register("/metrics", promhttp.HandlerFor(ctrlmetrics.Registry, h)) + } + + // Register /readyz. + { + p := "/readyz" + h := &ctrlhealthz.Handler{ + Checks: map[string]ctrlhealthz.Checker{ + "ping": ctrlhealthz.Ping, + "log": healthz.LogHealthz.Check, + "informer": func(r *http.Request) error { + if cm.GetCache().WaitForCacheSync(r.Context()) { + return nil + } + return errors.New("informer cache is not synced yet") + }, + }, + } + ms.Register(p, http.StripPrefix(p, h)) + } + + // Register /livez. + { + p := "/livez" + h := &ctrlhealthz.Handler{ + Checks: map[string]ctrlhealthz.Checker{ + "ping": ctrlhealthz.Ping, + "log": healthz.LogHealthz.Check, + "gopool": func(r *http.Request) error { + return gopool.IsHealthy() + }, + "loopback": func(r *http.Request) error { + restCli := funcx.MustNoError( + rest.UnversionedRESTClientForConfigAndClient( + dynamic.ConfigFor(cm.GetConfig()), + cm.GetHTTPClient(), + ), + ) + return kuberest.IsAvailable(r.Context(), restCli) + }, + }, + } + ms.Register(p, http.StripPrefix(p, h)) + } + + // Register /debug. + { + runtime.SetBlockProfileRate(1) + ms.Register("/debug/pprof/", httpx.LoopbackAccessHandlerFunc(pprof.Index)) + ms.Register("/debug/pprof/cmdline", httpx.LoopbackAccessHandlerFunc(pprof.Cmdline)) + ms.Register("/debug/pprof/profile", httpx.LoopbackAccessHandlerFunc(pprof.Profile)) + ms.Register("/debug/pprof/symbol", httpx.LoopbackAccessHandlerFunc(pprof.Symbol)) + ms.Register("/debug/pprof/trace", httpx.LoopbackAccessHandlerFunc(pprof.Trace)) + ms.Register("/debug/flags/v", httpx.LoopbackAccessHandlerFunc(routes.StringFlagPutHandler(logs.GlogSetter))) + } + + // Start. + return cm.Start(ctx) +} diff --git a/pkg/manager/option.go b/pkg/manager/option.go new file mode 100644 index 000000000..c1168793b --- /dev/null +++ b/pkg/manager/option.go @@ -0,0 +1,282 @@ +package manager + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "path/filepath" + "time" + + certcache "github.com/seal-io/utils/certs/cache" + "github.com/seal-io/utils/certs/kubecert" + "github.com/seal-io/utils/osx" + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" + "github.com/seal-io/utils/version" + "github.com/spf13/pflag" + "go.uber.org/automaxprocs/maxprocs" + "k8s.io/client-go/rest" + "k8s.io/klog/v2" + "sigs.k8s.io/controller-runtime/pkg/certwatcher" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/internalprocesses/kubernetes" + "github.com/seal-io/walrus/pkg/kubeconfig" + "github.com/seal-io/walrus/pkg/kuberest" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" +) + +type Options struct { + // Establish. + BindAddress net.IP + BindPort int + CertDir string + + // Control. + GopoolWorkerFactor int + InformerCacheResyncPeriod time.Duration + + // Connect Kubernetes. + KubeConnTimeout time.Duration + KubeConnQPS float64 + KubeConnBurst int + KubeLeaderElection bool + KubeLeaderLease time.Duration + KubeLeaderRenewTimeout time.Duration + + // Internal. + Serve bool +} + +func NewOptions() *Options { + return &Options{ + // Establish. + BindAddress: net.ParseIP("0.0.0.0"), + BindPort: 443, + + // Control. + GopoolWorkerFactor: 100, + InformerCacheResyncPeriod: 1 * time.Hour, + + // Connect Kubernetes. + KubeConnTimeout: 5 * time.Minute, + KubeConnQPS: 200, + KubeConnBurst: 400, + KubeLeaderElection: true, + KubeLeaderLease: 15 * time.Second, + KubeLeaderRenewTimeout: 10 * time.Second, + + // Internal. + Serve: true, + } +} + +func (o *Options) AddFlags(fs *pflag.FlagSet) { + // Establish. + fs.IPVar(&o.BindAddress, "bind-address", o.BindAddress, + "the IP address(without port) on which to serve.") + fs.IntVar(&o.BindPort, "secure-port", o.BindPort, + "the port on which to serve HTTPS.") + fs.StringVar(&o.CertDir, "cert-dir", o.CertDir, + "the directory where the TLS certs are located. "+ + "if provided, must place tls.crt and tls.key under --cert-dir. ") + + // Control. + fs.IntVar(&o.GopoolWorkerFactor, "gopool-worker-factor", o.GopoolWorkerFactor, + "the number of tasks of the goroutine worker pool, "+ + "it is calculated by the number of CPU cores multiplied by this factor.") + fs.DurationVar(&o.InformerCacheResyncPeriod, "informer-cache-resync-period", o.InformerCacheResyncPeriod, + "the period at which the informer's cache is resynced.") + + // Connect Kubernetes. + fs.DurationVar(&o.KubeConnTimeout, "kube-conn-timeout", o.KubeConnTimeout, + "the timeout for dialing the loopback Kubernetes cluster.") + fs.Float64Var(&o.KubeConnQPS, "kube-conn-qps", o.KubeConnQPS, + "the QPS(maximum average number per second) when dialing the loopback Kubernetes cluster.") + fs.IntVar(&o.KubeConnBurst, "kube-conn-burst", o.KubeConnBurst, + "the burst(maximum number at the same moment) when dialing the loopback Kubernetes cluster.") + fs.BoolVar(&o.KubeLeaderElection, "kube-leader-election", o.KubeLeaderElection, + "the config to determines whether or not to use leader election, "+ + "leader election is primarily used in multi-instance deployments.") + fs.DurationVar(&o.KubeLeaderLease, "kube-leader-lease", o.KubeLeaderLease, + "the duration to keep the leadership. "+ + "if --kube-leader-election=false, this flag will be ignored. "+ + "when the network environment is not ideal or do not want to cause frequent access to the cluster, "+ + "please increase the value appropriately.") + fs.DurationVar(&o.KubeLeaderRenewTimeout, "kube-leader-renew-timeout", o.KubeLeaderRenewTimeout, + "the duration to renew the leadership before give up, "+ + "must be less than the duration of --kube-leader-lease."+ + "if --kube-leader-election=false, this flag will be ignored. "+ + "when the network environment is not ideal, please increase the value appropriately.") +} + +func (o *Options) Validate(_ context.Context) error { + // Establish. + if o.BindPort < 1 || o.BindPort > 65535 { + return errors.New("--secure-port: out of range") + } + if o.CertDir != "" && !osx.ExistsDir(o.CertDir) { + return errors.New("--cert-dir: no found directory") + } + + // Control. + if o.GopoolWorkerFactor < 100 { + return errors.New("--gopool-worker-factor: less than 100") + } + if o.InformerCacheResyncPeriod < 5*time.Minute { + return errors.New("--informer-cache-resync-period: less than 5 minutes") + } + + // Connect Kubernetes. + if o.KubeConnTimeout < 10*time.Second { + return errors.New("--kube-conn-timeout: less than 10 seconds") + } + switch { + case o.KubeConnQPS < 10: + return errors.New("--kube-conn-qps: less than 10") + case o.KubeConnBurst < 10: + return errors.New("--kube-conn-burst: less than 10") + case float64(o.KubeConnBurst) <= o.KubeConnQPS: + return errors.New("--kube-conn-burst: less than --kube-conn-qps") + } + if o.KubeLeaderElection { + switch { + case o.KubeLeaderLease < 5*time.Second: + return errors.New("--kube-leader-lease: less than 5 seconds") + case o.KubeLeaderRenewTimeout < 5*time.Second: + return errors.New("--kube-leader-renew-timeout: less than 5 seconds") + case o.KubeLeaderLease <= o.KubeLeaderRenewTimeout: + return errors.New("--kube-leader-lease: less than --kube-leader-renew-timeout") + } + } + + return nil +} + +func (o *Options) Complete(ctx context.Context) (*Config, error) { + // Configure goruntime, + // which is able to query by `runtime.GOMAXPROCS(0)`. + _, err := maxprocs.Set(maxprocs.Logger(klog.NewStandardLogger("INFO").Printf)) + if err != nil { + return nil, fmt.Errorf("set maxprocs: %w", err) + } + + // Configure goroutine pool. + gopool.Configure(o.GopoolWorkerFactor) + + // Configure system network. + err = system.ConfigureNetwork() + if err != nil { + return nil, fmt.Errorf("configure system network: %w", err) + } + + // Get loopback config. + lpCfgPath, lpCliCfg, lpInside, err := kubeconfig.LoadRestConfigNonInteractive() + if err != nil { + var ( + embedded kubernetes.Embedded + ctx, cancel = context.WithCancel(ctx) + ) + gopool.Go(func() { + defer cancel() + klog.Info("!!! starting embedded Kubernetes !!!") + + err := embedded.Start(ctx) + if err != nil { + klog.Error(err, "start embedded Kubernetes") + } + }) + + lpCfgPath, lpCliCfg, err = embedded.GetConfig(ctx) + if err != nil { + return nil, fmt.Errorf("get embedded Kubernetes config: %w", err) + } + } + + // Set the timeout, QPS and burst of the rest config. + lpCliCfg.Timeout = o.KubeConnTimeout + lpCliCfg.QPS = float32(o.KubeConnQPS) + lpCliCfg.Burst = o.KubeConnBurst + lpCliCfg.UserAgent = version.GetUserAgent() + lpNearby := lpInside || isLoopbackClusterNearby(lpCliCfg) + + // Get loopback client. + lpHttpCli, err := rest.HTTPClientFor(lpCliCfg) + if err != nil { + return nil, fmt.Errorf("create http client: %w", err) + } + + lpCli, err := clientset.NewForConfigAndClient(rest.CopyConfig(lpCliCfg), lpHttpCli) + if err != nil { + return nil, fmt.Errorf("create authorization client: %w", err) + } else { + klog.Info("waiting loopback Kubernetes cluster to be available") + err = kuberest.WaitUntilAvailable(ctx, lpCli.RESTClient()) + if err != nil { + return nil, fmt.Errorf("wait loopback Kubernetes cluster ready: %w", err) + } + } + + // Get serve listener. + var srvListener net.Listener + if o.Serve { + if !lpNearby { + return nil, errors.New("loopback Kubernetes cluster is not nearby, must provide a nearby cluster") + } + + tlsCfg := &tls.Config{ + NextProtos: []string{"h2", "http/1.1"}, + MinVersion: tls.VersionTLS12, + } + if o.CertDir == "" { + klog.Info("no cert dir provided, going to use Kubecert to serve") + certCache, err := certcache.NewK8sCache(ctx, "walrus", lpCli.CoreV1().Secrets(systemkuberes.SystemNamespaceName)) + if err != nil { + return nil, fmt.Errorf("create cert cache: %w", err) + } + certMgr := &kubecert.DynamicManager{ + CertCli: lpCli.CertificatesV1().CertificateSigningRequests(), + Cache: certCache, + } + tlsCfg.GetCertificate = certMgr.GetCertificate + } else { + klog.Info("cert dir provided, going to use cert dir to serve") + certPath, keyPath := filepath.Join(o.CertDir, "tls.crt"), filepath.Join(o.CertDir, "tls.key") + certWatcher, err := certwatcher.New(certPath, keyPath) + if err != nil { + return nil, fmt.Errorf("create cert watcher: %w", err) + } + gopool.Go(func() { + err := certWatcher.Start(ctx) + if err != nil { + klog.Error("certificate watcher error", err) + } + }) + tlsCfg.GetCertificate = certWatcher.GetCertificate + } + + address := net.JoinHostPort(o.BindAddress.String(), stringx.FromInt(o.BindPort)) + srvListener, err = tls.Listen("tcp", address, tlsCfg) + if err != nil { + return nil, fmt.Errorf("create tls listener: %w", err) + } + } + + system.ConfigureLoopbackKube(lpInside, lpNearby, lpCfgPath, *lpCliCfg, lpCli) + + return &Config{ + InformerCacheResyncPeriod: o.InformerCacheResyncPeriod, + KubeConfigPath: lpCfgPath, + KubeClientConfig: *lpCliCfg, + KubeHTTPClient: lpHttpCli, + KubeClient: lpCli, + KubeLeaderElection: o.KubeLeaderElection, + KubeLeaderLease: o.KubeLeaderLease, + KubeLeaderRenewTimeout: o.KubeLeaderRenewTimeout, + ServeListenerCertDir: o.CertDir, + ServeListener: srvListener, + }, nil +} diff --git a/pkg/manager/webhookserver/dummy.go b/pkg/manager/webhookserver/dummy.go new file mode 100644 index 000000000..48682d568 --- /dev/null +++ b/pkg/manager/webhookserver/dummy.go @@ -0,0 +1,41 @@ +package webhookserver + +import ( + "context" + "net/http" + + "sigs.k8s.io/controller-runtime/pkg/healthz" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" +) + +func Dummy() ctrlwebhook.Server { + return &dummy{} +} + +type dummy struct{} + +func (dummy) NeedLeaderElection() bool { + return false +} + +func (dummy) Register(path string, hook http.Handler) { +} + +func (dummy) Start(ctx context.Context) error { + <-ctx.Done() + return nil +} + +func (dummy) StartedChecker() healthz.Checker { + return func(req *http.Request) error { + return nil + } +} + +func (dummy) WebhookMux() *http.ServeMux { + return http.NewServeMux() +} + +func (dummy) IsDummy() bool { + return true +} diff --git a/pkg/manager/webhookserver/enhanced.go b/pkg/manager/webhookserver/enhanced.go new file mode 100644 index 000000000..035479989 --- /dev/null +++ b/pkg/manager/webhookserver/enhanced.go @@ -0,0 +1,139 @@ +package webhookserver + +import ( + "context" + "errors" + "fmt" + "net" + "net/http" + "time" + + "github.com/seal-io/utils/netx" + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" + "github.com/seal-io/utils/waitx" + admreg "k8s.io/api/admissionregistration/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + "sigs.k8s.io/controller-runtime/pkg/healthz" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/webhooks" +) + +func Enhance(ln net.Listener, certDir string, cli clientset.Interface) ctrlwebhook.Server { + addr := ln.Addr().(*net.TCPAddr) + return enhanced{ + DefaultServer: &ctrlwebhook.DefaultServer{ + Options: ctrlwebhook.Options{ + Host: addr.IP.String(), + Port: addr.Port, + WebhookMux: http.NewServeMux(), + CertDir: certDir, + }, + }, + ln: ln, + cli: cli, + } +} + +type enhanced struct { + *ctrlwebhook.DefaultServer + + ln net.Listener + cli clientset.Interface +} + +func (s enhanced) Start(ctx context.Context) error { + // By default, we suggest to deploy with HA mode(by all-in-one YAML or Helm Chart), + // which means we stay inside the loopback Kubernetes cluster. + // So the system Kubernetes Service is created before webhook server start. + cc := admreg.WebhookClientConfig{ + Service: &admreg.ServiceReference{ + Namespace: systemkuberes.SystemNamespaceName, + Name: systemkuberes.SystemRoutingServiceName, + Port: ptr.To(int32(s.Options.Port)), + }, + } + // However, if we stand closed to loopback Kubernetes cluster but not inside, + // we can use the primary IP address to access the webhook server. + if !system.LoopbackKubeInside.Get() && system.LoopbackKubeNearby.Get() { + // NB(thxCode): launch multiple instances, only one takes working. + ep := fmt.Sprintf("https://%s:%d", system.PrimaryIP.Get(), s.Options.Port) + cc = admreg.WebhookClientConfig{ + URL: ptr.To(ep), + } + } + // When no cert provided, we will use Kubernetes CertificateSigningRequest to generate the server cert, + // we should load the root CA bundle for webhook configuration. + if s.Options.CertDir == "" { + // TODO(thxCode): The root CA might be expired, + // we can refresh the CA bundle in the future with restarting. + // A restarting-less way is needed in the future. + err := waitx.PollUntilContextTimeout(ctx, time.Second, 30*time.Second, true, + func(ctx context.Context) error { + cm, err := s.cli.CoreV1(). + ConfigMaps(meta.NamespaceSystem). + Get(ctx, "kube-root-ca.crt", meta.GetOptions{ResourceVersion: "0"}) + if err != nil { + return fmt.Errorf("get kube-root-ca.crt configmap: %w", err) + } + if cm.Data["ca.crt"] == "" { + return fmt.Errorf("empty ca.crt in kube-root-ca.crt configmap") + } + cc.CABundle = []byte(cm.Data["ca.crt"]) + return nil + }) + if err != nil { + return fmt.Errorf("get kube-root-ca.crt: %w", err) + } + } + // Install webhook configurations. + err := webhooks.InstallWebhookConfigurations(ctx, s.cli, cc) + if err != nil { + return err + } + + srv := &http.Server{ + Handler: s.WebhookMux(), + MaxHeaderBytes: 1 << 20, + IdleTimeout: 90 * time.Second, + ReadHeaderTimeout: 32 * time.Second, + } + + gopool.Go(func() { + <-ctx.Done() + + klog.Info("shutting down the webhook server with timeout of 1 minute") + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + _ = srv.Shutdown(ctx) + }) + + err = srv.Serve(s.ln) + if err != nil && !errors.Is(err, http.ErrServerClosed) { + return err + } + return nil +} + +func (s enhanced) StartedChecker() healthz.Checker { + addr := net.JoinHostPort(s.Options.Host, stringx.FromInt(s.Options.Port)) + + return func(req *http.Request) error { + return netx.IsConnected(req.Context(), "tls", addr, 10*time.Second) + } +} + +func (s enhanced) WebhookMux() *http.ServeMux { + return s.Options.WebhookMux +} + +func (enhanced) IsDummy() bool { + return false +} diff --git a/pkg/server/clis/handler.go b/pkg/server/clis/handler.go new file mode 100644 index 000000000..7e55533fa --- /dev/null +++ b/pkg/server/clis/handler.go @@ -0,0 +1,34 @@ +package clis + +import ( + "context" + "fmt" + "net/http" + "path" + "path/filepath" + + "github.com/seal-io/utils/httpx" + "github.com/seal-io/utils/osx" + + "github.com/seal-io/walrus/pkg/system" +) + +var Dir = system.SubDataDir("clis") + +func Index(_ context.Context) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + reqFile := path.Base(r.URL.Path) + locFile := filepath.Join(Dir, reqFile) + + if !osx.ExistsFile(locFile) { + httpx.Error(rw, http.StatusNotFound) + return + } + + rwh := rw.Header() + rwh.Add("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, reqFile)) + rwh.Add("Content-Type", "application/octet-stream") + + http.ServeFile(rw, r, locFile) + }) +} diff --git a/pkg/server/cmd.go b/pkg/server/cmd.go new file mode 100644 index 000000000..e74cd333a --- /dev/null +++ b/pkg/server/cmd.go @@ -0,0 +1,39 @@ +package server + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// NewCommand returns a new cobra command for the server. +func NewCommand(name, brief string) *cobra.Command { + o := NewOptions() + + c := &cobra.Command{ + Use: name, + Short: brief, + PreRunE: func(c *cobra.Command, args []string) error { + return o.Validate(c.Context()) + }, + RunE: func(c *cobra.Command, args []string) error { + cfg, err := o.Complete(c.Context()) + if err != nil { + return fmt.Errorf("complete config: %w", err) + } + srv, err := cfg.Apply(c.Context()) + if err != nil { + return fmt.Errorf("apply config: %w", err) + } + err = srv.Prepare(c.Context()) + if err != nil { + return fmt.Errorf("prepare server: %w", err) + } + return srv.Start(c.Context()) + }, + } + + o.AddFlags(c.Flags()) + + return c +} diff --git a/pkg/server/config.go b/pkg/server/config.go new file mode 100644 index 000000000..e4134043b --- /dev/null +++ b/pkg/server/config.go @@ -0,0 +1,152 @@ +package server + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/seal-io/utils/version" + "github.com/seal-io/utils/waitx" + admreg "k8s.io/api/admissionregistration/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + utilversion "k8s.io/apimachinery/pkg/version" + openapinamer "k8s.io/apiserver/pkg/endpoints/openapi" + genericapiserver "k8s.io/apiserver/pkg/server" + genericoptions "k8s.io/apiserver/pkg/server/options" + "k8s.io/utils/ptr" + + "github.com/seal-io/walrus/pkg/apis" + "github.com/seal-io/walrus/pkg/manager" + "github.com/seal-io/walrus/pkg/servers/serverset/scheme" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/webhooks" +) + +type Config struct { + ManagerConfig *manager.Config + APIServerConfig *genericapiserver.Config + Serve *genericoptions.SecureServingOptions + Authn *genericoptions.DelegatingAuthenticationOptions + Authz *genericoptions.DelegatingAuthorizationOptions + Audit *genericoptions.AuditOptions +} + +func (c *Config) Apply(ctx context.Context) (*Server, error) { + mgr, err := c.ManagerConfig.Apply(ctx) + if err != nil { + return nil, err + } + + apiSrvCfg := c.APIServerConfig + + // Apply the server configuration. + err = c.Serve.ApplyTo(&apiSrvCfg.SecureServing) + if err != nil { + return nil, fmt.Errorf("apply server config: %w", err) + } + + if c.Authn != nil { + // Apply the authentication configuration. + err = c.Authn.ApplyTo(&apiSrvCfg.Authentication, apiSrvCfg.SecureServing, nil) + if err != nil { + return nil, fmt.Errorf("apply authentication config: %w", err) + } + } + + if c.Authz != nil { + // Apply the authorization configuration. + err = c.Authz.ApplyTo(&apiSrvCfg.Authorization) + if err != nil { + return nil, fmt.Errorf("apply authorization config: %w", err) + } + } + + // Apply the audit configuration. + err = c.Audit.ApplyTo(apiSrvCfg) + if err != nil { + return nil, fmt.Errorf("apply audit config: %w", err) + } + + // Apply OpenAPI configuration. + var ( + title = "Walrus - Open Source XaC Platform" + fullVersion = version.Get() + majorVersion = version.Major() + minorVersion = strings.TrimPrefix(version.MajorMinor(), majorVersion+".") + ) + apiSrvCfg.Version = &utilversion.Info{ + Major: majorVersion, + Minor: minorVersion, + GitVersion: fullVersion, + GitCommit: version.GitCommit, + } + apiSrvCfg.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig( + apis.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme.Scheme)) + apiSrvCfg.OpenAPIConfig.Info.Title = title + apiSrvCfg.OpenAPIConfig.Info.Version = fullVersion + apiSrvCfg.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config( + apis.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme.Scheme)) + apiSrvCfg.OpenAPIV3Config.Info.Title = title + apiSrvCfg.OpenAPIV3Config.Info.Version = fullVersion + + apiSrvCompletedCfg := apiSrvCfg.Complete(nil) + apiSrv, err := apiSrvCompletedCfg.New("walrus", genericapiserver.NewEmptyDelegate()) + if err != nil { + return nil, fmt.Errorf("create APIServer: %w", err) + } + + // By default, we suggest to deploy with HA mode(by all-in-one YAML or Helm Chart), + // which means we stay inside the loopback Kubernetes cluster. + // So the system Kubernetes Service is created before webhook server start. + cc := admreg.WebhookClientConfig{ + Service: &admreg.ServiceReference{ + Namespace: systemkuberes.SystemNamespaceName, + Name: systemkuberes.SystemRoutingServiceName, + Port: ptr.To(int32(c.Serve.BindPort)), + }, + } + // However, if we stand closed to loopback Kubernetes cluster but not inside, + // we can use the primary IP address to access the webhook server. + if !system.LoopbackKubeInside.Get() && system.LoopbackKubeNearby.Get() { + // NB(thxCode): launch multiple instances, only one takes working. + ep := fmt.Sprintf("https://%s:%d", system.PrimaryIP.Get(), c.Serve.BindPort) + cc = admreg.WebhookClientConfig{ + URL: ptr.To(ep), + } + } + // When no cert provided, we will use Kubernetes CertificateSigningRequest to generate the server cert, + // we should load the root CA bundle for webhook configuration. + if c.Serve.ServerCert.CertDirectory == "" { + // TODO(thxCode): The root CA might be expired, + // we can refresh the CA bundle in the future with restarting. + // A restarting-less way is needed in the future. + err = waitx.PollUntilContextTimeout(ctx, time.Second, 30*time.Second, true, + func(ctx context.Context) error { + cm, err := system.LoopbackKubeClient.Get().CoreV1().ConfigMaps(meta.NamespaceSystem). + Get(ctx, "kube-root-ca.crt", meta.GetOptions{ResourceVersion: "0"}) + if err != nil { + return fmt.Errorf("get kube-root-ca.crt configmap: %w", err) + } + if cm.Data["ca.crt"] == "" { + return fmt.Errorf("empty ca.crt in kube-root-ca.crt configmap") + } + cc.CABundle = []byte(cm.Data["ca.crt"]) + return nil + }) + if err != nil { + return nil, fmt.Errorf("get kube-root-ca.crt: %w", err) + } + } + // Install webhook configurations. + err = webhooks.InstallWebhookConfigurations(ctx, system.LoopbackKubeClient.Get(), cc) + if err != nil { + return nil, err + } + + return &Server{ + Manager: mgr, + APIServer: apiSrv, + }, nil +} diff --git a/pkg/server/option.go b/pkg/server/option.go new file mode 100644 index 000000000..ec626c461 --- /dev/null +++ b/pkg/server/option.go @@ -0,0 +1,251 @@ +package server + +import ( + "context" + "errors" + "fmt" + "net" + "path/filepath" + "time" + + certcache "github.com/seal-io/utils/certs/cache" + "github.com/seal-io/utils/certs/kubecert" + "github.com/seal-io/utils/osx" + "github.com/spf13/pflag" + genericapiserver "k8s.io/apiserver/pkg/server" + genericoptions "k8s.io/apiserver/pkg/server/options" + "k8s.io/client-go/rest" + cliflag "k8s.io/component-base/cli/flag" + + "github.com/seal-io/walrus/pkg/manager" + "github.com/seal-io/walrus/pkg/servers/serverset/scheme" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" +) + +type Options struct { + ManagerOptions *manager.Options + + // Control. + DisableAuths bool + + // Authentication. + AuthnTokenWebhookCacheTTL time.Duration + AuthnTokenRequestTimeout time.Duration + + // Authorization. + AuthzAllowCacheTTL time.Duration + AuthzDenyCacheTTL time.Duration + + // Audit. + AuditPolicyFile string + AuditLogFile string + AuditWebhookConfigFile string +} + +func NewOptions() *Options { + mgrOptions := manager.NewOptions() + mgrOptions.Serve = false + + return &Options{ + ManagerOptions: mgrOptions, + + // Control. + DisableAuths: false, + + // Authentication. + AuthnTokenWebhookCacheTTL: 10 * time.Second, + AuthnTokenRequestTimeout: 10 * time.Second, + + // Authorization. + AuthzAllowCacheTTL: 10 * time.Second, + AuthzDenyCacheTTL: 10 * time.Second, + + // Audit. + AuditPolicyFile: "", + AuditLogFile: "", + AuditWebhookConfigFile: "", + } +} + +func (o *Options) AddFlags(fs *pflag.FlagSet) { + o.ManagerOptions.AddFlags(fs) + + // Control. + fs.BoolVar(&o.DisableAuths, "disable-auths", o.DisableAuths, + "disable authentication and authorization.") + + // Authentication. + fs.DurationVar(&o.AuthnTokenWebhookCacheTTL, "authentication-token-webhook-cache-ttl", + o.AuthnTokenWebhookCacheTTL, + "the duration to cache responses from the webhook token authenticator.") + fs.DurationVar(&o.AuthnTokenRequestTimeout, "authentication-token-request-timeout", + o.AuthnTokenRequestTimeout, + "the duration to wait for a response from the webhook token authenticator.") + + // Authorization. + fs.DurationVar(&o.AuthzAllowCacheTTL, "authorization-webhook-cache-authorized-ttl", + o.AuthzAllowCacheTTL, + "the duration to cache 'authorized' responses from the webhook authorizer.") + fs.DurationVar(&o.AuthzDenyCacheTTL, "authorization-webhook-cache-unauthorized-ttl", + o.AuthzDenyCacheTTL, + "the duration to cache 'unauthorized' responses from the webhook authorizer.") + + // Audit. + fs.StringVar(&o.AuditPolicyFile, "audit-policy-file", o.AuditPolicyFile, + "path to the file that defines the audit policy configuration.") + fs.StringVar(&o.AuditLogFile, "audit-log-path", o.AuditLogFile, + "if set, all requests coming to the server will be logged to this file. "+ + "'-' means standard out.") + fs.StringVar(&o.AuditWebhookConfigFile, "audit-webhook-config-file", o.AuditWebhookConfigFile, + "path to a kubeconfig formatted file that defines the audit webhook configuration.") +} + +func (o *Options) Validate(ctx context.Context) error { + if err := o.ManagerOptions.Validate(ctx); err != nil { + return err + } + + if !o.DisableAuths { + // Authentication. + if o.AuthnTokenWebhookCacheTTL < 10*time.Second { + return errors.New("--authentication-token-webhook-cache-ttl: less than 10s") + } + if o.AuthnTokenRequestTimeout < 10*time.Second { + return errors.New("--authentication-token-request-timeout: less than 10s") + } + + // Authorization. + if o.AuthzAllowCacheTTL < 10*time.Second { + return errors.New("--authorization-webhook-cache-authorized-ttl: less than 10s") + } + if o.AuthzDenyCacheTTL < 10*time.Second { + return errors.New("--authorization-webhook-cache-unauthorized-ttl: less than 10s") + } + } + + // Audit. + if o.AuditPolicyFile != "" && !osx.ExistsFile(o.AuditPolicyFile) { + return errors.New("--audit-policy-file: no found file") + } + if o.AuditLogFile != "" && o.AuditLogFile != "-" && !osx.ExistsDir(filepath.Dir(o.AuditLogFile)) { + return errors.New("--audit-log-path: no found parent directory") + } + if o.AuditWebhookConfigFile != "" && !osx.ExistsFile(o.AuditWebhookConfigFile) { + return errors.New("--audit-webhook-config-file: no found file") + } + + return nil +} + +func (o *Options) Complete(ctx context.Context) (*Config, error) { + mgrConfig, err := o.ManagerOptions.Complete(ctx) + if err != nil { + return nil, err + } + + serve := &genericoptions.SecureServingOptions{ + BindAddress: o.ManagerOptions.BindAddress, + BindPort: o.ManagerOptions.BindPort, + ServerCert: genericoptions.GeneratableKeyCert{ + PairName: "tls", + CertDirectory: o.ManagerOptions.CertDir, + }, + CipherSuites: cliflag.PreferredTLSCipherNames(), + MinTLSVersion: "VersionTLS12", + HTTP2MaxStreamsPerConnection: 1000, + } + if serve.ServerCert.CertDirectory == "" { + // Deploy in standalone mode(by Docker run) or laptop development, + // the loopback Kubernetes cluster is nearby. + certCache, err := certcache.NewK8sCache(ctx, + "server", system.LoopbackKubeClient.Get().CoreV1().Secrets(systemkuberes.SystemNamespaceName)) + if err != nil { + return nil, fmt.Errorf("create cert cache: %w", err) + } + certMgr := &kubecert.StaticManager{ + CertCli: system.LoopbackKubeClient.Get().CertificatesV1().CertificateSigningRequests(), + Cache: certCache, + Host: systemkuberes.SystemRoutingServiceName, + AlternateIPs: func() []net.IP { + if system.LoopbackKubeInside.Get() { + return nil + } + return []net.IP{ + net.ParseIP("127.0.0.1"), + net.ParseIP(system.PrimaryIP.Get()), + } + }(), + AlternateDNSNames: []string{ + fmt.Sprintf("%s.%s.svc", systemkuberes.SystemRoutingServiceName, systemkuberes.SystemNamespaceName), + fmt.Sprintf("%s.%s", systemkuberes.SystemRoutingServiceName, systemkuberes.SystemNamespaceName), + systemkuberes.SystemRoutingServiceName, + "localhost", + }, + } + serve.ServerCert.GeneratedCert = certMgr + } + + var authn *genericoptions.DelegatingAuthenticationOptions + if !o.DisableAuths { + authn = &genericoptions.DelegatingAuthenticationOptions{ + CacheTTL: o.AuthnTokenWebhookCacheTTL, + TokenRequestTimeout: o.AuthnTokenRequestTimeout, + WebhookRetryBackoff: genericoptions.DefaultAuthWebhookRetryBackoff(), + RemoteKubeConfigFile: mgrConfig.KubeConfigPath, + DisableAnonymous: false, + } + } + + var authz *genericoptions.DelegatingAuthorizationOptions + if !o.DisableAuths { + authz = &genericoptions.DelegatingAuthorizationOptions{ + AllowCacheTTL: o.AuthzAllowCacheTTL, + DenyCacheTTL: o.AuthzDenyCacheTTL, + WebhookRetryBackoff: genericoptions.DefaultAuthWebhookRetryBackoff(), + RemoteKubeConfigFile: mgrConfig.KubeConfigPath, + ClientTimeout: 10 * time.Second, + AlwaysAllowGroups: []string{"system:masters"}, + AlwaysAllowPaths: []string{ + "/", "/assets/*", "/favicon.ico", // UI assets + "/mutate-*", "/validate-*", // Webhooks + "/livez", "/readyz", "/metrics", "/debug/*", // Measure + "/clis/*", // Walrus CLI binaries + "/openapi/*", // OpenAPI + }, + } + } + + audit := genericoptions.NewAuditOptions() + audit.PolicyFile = o.AuditPolicyFile + audit.LogOptions.Path = o.AuditLogFile + audit.WebhookOptions.ConfigFile = o.AuditWebhookConfigFile + + apiSrvCfg := genericapiserver.NewConfig(scheme.Codecs) + { + // Feedback Kubernetes client configuration. + apiSrvCfg.LoopbackClientConfig = rest.CopyConfig(&mgrConfig.KubeClientConfig) + // Disable default metrics service. + apiSrvCfg.EnableMetrics = false + // Disable default profiling service. + apiSrvCfg.EnableProfiling = false + // Disable default index service. + apiSrvCfg.EnableIndex = false + // Disable following post start hooks, + // because the registered apiserver can manage them. + apiSrvCfg.DisabledPostStartHooks.Insert( + "priority-and-fairness-filter", + "max-in-flight-filter", + "storage-object-count-tracker-hook", + ) + } + + return &Config{ + ManagerConfig: mgrConfig, + APIServerConfig: apiSrvCfg, + Serve: serve, + Authn: authn, + Authz: authz, + Audit: audit, + }, nil +} diff --git a/pkg/server/server.go b/pkg/server/server.go new file mode 100644 index 000000000..0fda78529 --- /dev/null +++ b/pkg/server/server.go @@ -0,0 +1,216 @@ +package server + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/http/pprof" + "runtime" + "time" + + "github.com/prometheus/client_golang/prometheus" + "github.com/seal-io/utils/contextx" + "github.com/seal-io/utils/funcx" + "github.com/seal-io/utils/httpx" + "github.com/seal-io/utils/pools/gopool" + genericapiserver "k8s.io/apiserver/pkg/server" + "k8s.io/apiserver/pkg/server/healthz" + "k8s.io/apiserver/pkg/server/routes" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" + "k8s.io/component-base/logs" + "k8s.io/component-base/metrics/legacyregistry" + apireg "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + "k8s.io/utils/ptr" + ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics" + + "github.com/seal-io/walrus/pkg/apis" + "github.com/seal-io/walrus/pkg/extensionapis" + "github.com/seal-io/walrus/pkg/kuberest" + "github.com/seal-io/walrus/pkg/kubereviewself" + "github.com/seal-io/walrus/pkg/manager" + "github.com/seal-io/walrus/pkg/server/clis" + "github.com/seal-io/walrus/pkg/server/ui" + "github.com/seal-io/walrus/pkg/servers/serverset/scheme" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemauthz" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemsetting" + "github.com/seal-io/walrus/pkg/webhooks" +) + +func init() { + ctrlmetrics.Registry = struct { + prometheus.Registerer + prometheus.Gatherer + }{ + Registerer: legacyregistry.Registerer(), + Gatherer: legacyregistry.DefaultGatherer, + } +} + +type Server struct { + Manager *manager.Manager + APIServer *genericapiserver.GenericAPIServer +} + +func (s *Server) Prepare(ctx context.Context) error { + err := s.Manager.Prepare(ctx) + if err != nil { + return err + } + + loopbackKubeCli := system.LoopbackKubeClient.Get() + _, bindPort, _ := s.APIServer.SecureServingInfo.HostPort() + + // By default, we hope to deploy in HA mode(by all-in-one YAML or Helm Chart), + // so the system Kubernetes Service is created before webhook server start. + cc := apireg.ServiceReference{ + Namespace: systemkuberes.SystemNamespaceName, + Name: systemkuberes.SystemRoutingServiceName, + Port: ptr.To(int32(bindPort)), + } + // Install fake routing endpoint if needed. + if !system.LoopbackKubeInside.Get() && system.LoopbackKubeNearby.Get() { + // NB(thxCode): Need to enable the loopback Kubernetes APIServer's `--enable-aggregator-routing` flag also. + err = systemkuberes.InstallFakeSystemRoutingService(ctx, loopbackKubeCli, bindPort) + if err != nil { + return fmt.Errorf("install fake service: %w", err) + } + } + // Install extension API services. + err = kubereviewself.Try(apis.InstallAPIServices(ctx, loopbackKubeCli, cc, nil)) + if err != nil { + return fmt.Errorf("install extension API services: %w", err) + } + + // Initialize settings. + err = systemsetting.Initialize(ctx, loopbackKubeCli) + if err != nil { + return fmt.Errorf("install settings: %w", err) + } + + // Install authorization. + err = kubereviewself.Try(systemauthz.Initialize(ctx, loopbackKubeCli)) + if err != nil { + return fmt.Errorf("install authorization: %w", err) + } + + // Setup extension API handlers. + err = extensionapis.Setup(ctx, s.APIServer, scheme.Scheme, scheme.ParameterCodec, scheme.Codecs, s.Manager.CtrlManager) + if err != nil { + return fmt.Errorf("setup extension API handlers: %w", err) + } + + // Initialize builtin resources after cache synced. + err = s.APIServer.AddPostStartHook("install-builtin-resources", func(phc genericapiserver.PostStartHookContext) error { + ctx := contextx.Background(phc.StopCh) + + // After extension API is ready. + err := apis.WaitForAPIServicesReady(ctx, loopbackKubeCli) + if err != nil { + return fmt.Errorf("wait for extension API services ready: %w", err) + } + // After cache is synced. + if !s.Manager.CtrlManager.GetCache().WaitForCacheSync(ctx) { + return errors.New("wait for cache sync") + } + + // Initialize default project. + err = systemkuberes.InstallDefaultProject(ctx, loopbackKubeCli) + if err != nil { + return err + } + + // Initialize default environment. + err = systemkuberes.InstallDefaultEnvironment(ctx, loopbackKubeCli) + if err != nil { + return err + } + + return nil + }) + if err != nil { + return fmt.Errorf("add post-start hook: %w", err) + } + + return nil +} + +func (s *Server) Start(ctx context.Context) error { + cm := s.Manager.CtrlManager + mu := s.APIServer.Handler.NonGoRestfulMux + + // Register UI. + mu.NotFoundHandler(ui.Index(ctx)) + + // Register /validate-*, /mutate-*. + err := webhooks.Setup(ctx, cm, mu) + if err != nil { + return fmt.Errorf("setup webhooks: %w", err) + } + + // Register /metrics. + mu.Handle("/metrics", legacyregistry.Handler()) + + // Register /readyz. + { + err = s.APIServer.AddReadyzChecks( + healthz.NamedCheck("informer", func(r *http.Request) error { + if cm.GetCache().WaitForCacheSync(r.Context()) { + return nil + } + return errors.New("informer cache is not synced yet") + }), + ) + if err != nil { + return fmt.Errorf("add readyz checks: %w", err) + } + } + + // Register /livez. + { + err = s.APIServer.AddLivezChecks(10*time.Second, + healthz.NamedCheck("gopool", func(r *http.Request) error { + return gopool.IsHealthy() + }), + healthz.NamedCheck("loopback", func(r *http.Request) error { + restCli := funcx.MustNoError( + rest.UnversionedRESTClientForConfigAndClient( + dynamic.ConfigFor(cm.GetConfig()), + cm.GetHTTPClient(), + ), + ) + return kuberest.IsAvailable(r.Context(), restCli) + }), + ) + if err != nil { + return fmt.Errorf("add livez checks: %w", err) + } + } + + // Register /debug. + { + runtime.SetBlockProfileRate(1) + mu.Handle("/debug/pprof/", httpx.LoopbackAccessHandlerFunc(pprof.Index)) + mu.Handle("/debug/pprof/cmdline", httpx.LoopbackAccessHandlerFunc(pprof.Cmdline)) + mu.Handle("/debug/pprof/profile", httpx.LoopbackAccessHandlerFunc(pprof.Profile)) + mu.Handle("/debug/pprof/symbol", httpx.LoopbackAccessHandlerFunc(pprof.Symbol)) + mu.Handle("/debug/pprof/trace", httpx.LoopbackAccessHandlerFunc(pprof.Trace)) + mu.Handle("/debug/flags/v", httpx.LoopbackAccessHandlerFunc(routes.StringFlagPutHandler(logs.GlogSetter))) + } + + // Register /clis. + mu.HandlePrefix("/clis/", http.StripPrefix("/clis/", clis.Index(ctx))) + + // Start. + gp := gopool.GroupWithContextIn(ctx) + gp.Go(func(ctx context.Context) error { + return cm.Start(ctx) + }) + gp.Go(func(ctx context.Context) error { + return s.APIServer.PrepareRun().Run(ctx.Done()) + }) + return gp.Wait() +} diff --git a/pkg/server/ui/handler.go b/pkg/server/ui/handler.go new file mode 100644 index 000000000..751ff5bf6 --- /dev/null +++ b/pkg/server/ui/handler.go @@ -0,0 +1,55 @@ +package ui + +import ( + "context" + "io" + "net/http" + "net/url" + "os" + + "github.com/seal-io/utils/funcx" + "github.com/seal-io/utils/httpx" + + "github.com/seal-io/walrus/pkg/system" +) + +var Dir = system.SubDataDir("ui") + +func Index(ctx context.Context) http.Handler { + // TODO: support settings. + uri := funcx.MustNoError(url.Parse( + "https://walrus-ui-1303613262.cos.ap-guangzhou.myqcloud.com/latest/index.html")) + return serve(uri) +} + +func serve(uri *url.URL) http.Handler { + if uri.Scheme == "file" { + return local(uri.Path) + } + return remote(uri.String()) +} + +func local(dir string) http.Handler { + return http.FileServer(httpx.FS(os.DirFS(dir))) +} + +func remote(uri string) http.HandlerFunc { + cli := httpx.DefaultClient + + return func(w http.ResponseWriter, r *http.Request) { + req, err := httpx.NewGetRequestWithContext(r.Context(), uri) + if err != nil { + httpx.Error(w, http.StatusNotFound) + return + } + + resp, err := cli.Do(req) + if err != nil { + httpx.Error(w, http.StatusGone) + return + } + defer httpx.Close(resp) + + _, _ = io.Copy(w, resp.Body) + } +} diff --git a/pkg/servers/serverset/scheme/doc.go b/pkg/servers/serverset/scheme/doc.go new file mode 100644 index 000000000..6736dedae --- /dev/null +++ b/pkg/servers/serverset/scheme/doc.go @@ -0,0 +1,3 @@ +// Package scheme is similar to the github.com/seal-io/walrus/pkg/clients/clientset/scheme package, +// but it is used to define the scheme for the server-side code. +package scheme diff --git a/pkg/servers/serverset/scheme/register.go b/pkg/servers/serverset/scheme/register.go new file mode 100644 index 000000000..4431278fd --- /dev/null +++ b/pkg/servers/serverset/scheme/register.go @@ -0,0 +1,22 @@ +package scheme + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + + clientsetscheme "github.com/seal-io/walrus/pkg/clients/clientset/scheme" +) + +var ( + Scheme = runtime.NewScheme() + Codecs = serializer.NewCodecFactory(Scheme) + ParameterCodec = runtime.NewParameterCodec(Scheme) +) + +func init() { + meta.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(clientsetscheme.AddToScheme(Scheme)) +} diff --git a/pkg/system/loopback.go b/pkg/system/loopback.go new file mode 100644 index 000000000..7495016f4 --- /dev/null +++ b/pkg/system/loopback.go @@ -0,0 +1,55 @@ +package system + +import ( + "github.com/seal-io/utils/varx" + "k8s.io/client-go/rest" + ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/seal-io/walrus/pkg/clients/clientset" +) + +var ( + // LoopbackKubeInside is a flag that indicates whether the system runs inside the loopback Kubernetes cluster. + LoopbackKubeInside varx.Once[bool] + + // LoopbackKubeNearby is a flag that indicates whether the system runs nearby the loopback Kubernetes cluster. + // If the system runs nearby, it can connect to the loopback Kubernetes cluster even if it is not inside the cluster. + LoopbackKubeNearby varx.Once[bool] + + // LoopbackKubeClientConfigPath is the path to the loopback Kubernetes client configuration file. + LoopbackKubeClientConfigPath varx.Once[string] + + // LoopbackKubeClientConfig is the loopback Kubernetes client configuration. + LoopbackKubeClientConfig varx.Once[rest.Config] + + // LoopbackKubeClient is the loopback Kubernetes client. + LoopbackKubeClient varx.Once[clientset.Interface] +) + +// ConfigureLoopbackKube configures the loopback Kubernetes. +func ConfigureLoopbackKube(inside, nearby bool, configPath string, config rest.Config, client clientset.Interface) { + LoopbackKubeInside.Configure(inside) + LoopbackKubeNearby.Configure(nearby) + LoopbackKubeClientConfigPath.Configure(configPath) + LoopbackKubeClientConfig.Configure(config) + LoopbackKubeClient.Configure(client) +} + +var ( + // LoopbackCtrlClient is the controller client for the loopback Kubernetes cluster. + // + // LoopbackCtrlClient is similar to LoopbackKubeClient, + // but it has a self-manager cache, + // which means we don't need to handle list/watch manually. + LoopbackCtrlClient varx.Once[ctrlcli.Client] + + // LoopbackCtrlCache is the controller cache for the loopback Kubernetes cluster. + LoopbackCtrlCache varx.Once[ctrlcache.Cache] +) + +// ConfigureLoopbackCtrlRuntime configures the loopback Kubernetes controller runtime. +func ConfigureLoopbackCtrlRuntime(client ctrlcli.Client, cache ctrlcache.Cache) { + LoopbackCtrlClient.Configure(client) + LoopbackCtrlCache.Configure(cache) +} diff --git a/pkg/system/network.go b/pkg/system/network.go new file mode 100644 index 000000000..29f44e03c --- /dev/null +++ b/pkg/system/network.go @@ -0,0 +1,81 @@ +package system + +import ( + "fmt" + "net" + + "github.com/seal-io/utils/varx" + knet "k8s.io/apimachinery/pkg/util/net" + "k8s.io/apimachinery/pkg/util/sets" +) + +var ( + // IPs is a set of non-loopback IP address of the system. + IPs = varx.NewOnce(sets.NewString()) + + // Subnets is a set of subnet of the system. + Subnets = varx.NewOnce(sets.NewString()) + + // PrimaryIP is the primary (outbound) IP address of the system. + PrimaryIP = varx.Once[string]{} + + // PrimarySubnet is the primary subnet of the system. + PrimarySubnet = varx.Once[string]{} +) + +// ConfigureNetwork configures the network of the system. +func ConfigureNetwork() error { + var ( + host, _ = knet.ChooseHostInterface() + ifaces, _ = net.Interfaces() + ips = sets.NewString() + subnets = sets.NewString() + primaryIP string + primarySubnet string + ) + + for _, _if := range ifaces { + if _if.Flags&net.FlagUp == 0 || _if.Flags&net.FlagLoopback != 0 { + // Skip down or loopback interfaces. + continue + } + + addrs, err := _if.Addrs() + if err != nil { + return fmt.Errorf("query addresses from interface %s(%d): %w", + _if.Name, _if.Index, err) + } + + for _, addr := range addrs { + if ipnet, ok := addr.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { + // NB(thxCode): There is no NAT for IPv6, + // so we only need to consider IPv4. + v4 := ipnet.IP.To4() + if v4 == nil || ips.Has(v4.String()) { + continue + } + if v4[3] == 0x01 { + continue + } + + ips.Insert(v4.String()) + subnets.Insert(ipnet.String()) + if host != nil && host.Equal(v4) { + primaryIP = v4.String() + primarySubnet = ipnet.String() + } + } + } + } + + if primaryIP == "" { + return fmt.Errorf("primary IP is not found") + } + + IPs.Configure(ips) + Subnets.Configure(subnets) + PrimaryIP.Configure(primaryIP) + PrimarySubnet.Configure(primarySubnet) + + return nil +} diff --git a/pkg/system/storage.go b/pkg/system/storage.go new file mode 100644 index 000000000..3c906dc80 --- /dev/null +++ b/pkg/system/storage.go @@ -0,0 +1,20 @@ +package system + +import ( + "path/filepath" + "time" + + "github.com/seal-io/utils/osx" +) + +// DataDir is the path to expose the data. +const DataDir = "/var/run/walrus" + +// SubDataDir returns the path to the subdirectory of DataDir. +func SubDataDir(sub string) string { + if osx.Getenv("_RUNNING_INSIDE_CONTAINER_", "false") == "true" { + return filepath.Join(DataDir, sub) + } + // NB(thxCode): nice for development. + return osx.SubTempDir(time.Now().Format(time.DateOnly)) +} diff --git a/pkg/systemauthz/environment.go b/pkg/systemauthz/environment.go new file mode 100644 index 000000000..5ad5f4f6f --- /dev/null +++ b/pkg/systemauthz/environment.go @@ -0,0 +1,117 @@ +package systemauthz + +import ( + "context" + "errors" + "fmt" + "reflect" + "slices" + + rbac "k8s.io/api/rbac/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubemeta" +) + +// CreateEnvironmentSpace adds the given environment to the project space cluster roles. +func CreateEnvironmentSpace(ctx context.Context, cli ctrlcli.Client, env *walrus.Environment) error { + ref := kubemeta.GetOwnerRefOfNoCopy(env, walrus.SchemeGroupVersionKind("Project")) + if ref == nil { + return errors.New("environment has no project owner reference") + } + + crs := []*rbac.ClusterRole{ + // Project space viewer. + { + ObjectMeta: meta.ObjectMeta{Name: getProjectSpaceViewerClusterRoleName(ref.Name)}, + Rules: []rbac.PolicyRule{getNamespaceViewerPolicyRuleFor(env.Name)}, + }, + // Project space editor. + { + ObjectMeta: meta.ObjectMeta{Name: getProjectSpaceEditorClusterRoleName(ref.Name)}, + Rules: []rbac.PolicyRule{getNamespaceEditorPolicyRuleFor(env.Name)}, + }, + } + createAlignFn := func(eCr *rbac.ClusterRole) kubeclientset.AlignWithFn[*rbac.ClusterRole] { + return func(aCr *rbac.ClusterRole) (_ *rbac.ClusterRole, skip bool, err error) { + included := slices.ContainsFunc(eCr.Rules, func(er rbac.PolicyRule) bool { + return slices.ContainsFunc(aCr.Rules, func(ar rbac.PolicyRule) bool { + return reflect.DeepEqual(er, ar) + }) + }) + if included { + return nil, true, nil + } + // Append the existing rules. + aCr.Rules = append(aCr.Rules, eCr.Rules...) + return aCr, false, nil + } + } + + for i := range crs { + alignFn := createAlignFn(crs[i]) + + // Update. + _, err := kubeclientset.UpdateWithCtrlClient(ctx, cli, crs[i], + kubeclientset.WithUpdateAlign(alignFn)) + if err != nil { + return fmt.Errorf("update project cluster role: %s: %w", crs[i].Name, err) + } + } + + return nil +} + +// DeleteEnvironmentSpace removes the given environment from the project space cluster roles. +func DeleteEnvironmentSpace(ctx context.Context, cli ctrlcli.Client, env *walrus.Environment) error { + ref := kubemeta.GetOwnerRefOfNoCopy(env, walrus.SchemeGroupVersionKind("Project")) + if ref == nil { + return errors.New("environment has no project owner reference") + } + + crs := []*rbac.ClusterRole{ + // Project space viewer. + { + ObjectMeta: meta.ObjectMeta{Name: getProjectSpaceViewerClusterRoleName(ref.Name)}, + Rules: []rbac.PolicyRule{getNamespaceViewerPolicyRuleFor(env.Name)}, + }, + // Project space editor. + { + ObjectMeta: meta.ObjectMeta{Name: getProjectSpaceEditorClusterRoleName(ref.Name)}, + Rules: []rbac.PolicyRule{getNamespaceEditorPolicyRuleFor(env.Name)}, + }, + } + createAlignFn := func(eCr *rbac.ClusterRole) kubeclientset.AlignWithFn[*rbac.ClusterRole] { + return func(aCr *rbac.ClusterRole) (_ *rbac.ClusterRole, skip bool, err error) { + aCrNewRules := slices.DeleteFunc(aCr.Rules, func(ar rbac.PolicyRule) bool { + return slices.ContainsFunc(eCr.Rules, func(er rbac.PolicyRule) bool { + return reflect.DeepEqual(er, ar) + }) + }) + exclude := len(aCr.Rules) == len(aCrNewRules) + if exclude { + return nil, true, nil + } + + // Update the rules. + aCr.Rules = aCrNewRules + return aCr, false, nil + } + } + + for i := range crs { + alignFn := createAlignFn(crs[i]) + + // Update. + _, err := kubeclientset.UpdateWithCtrlClient(ctx, cli, crs[i], + kubeclientset.WithUpdateAlign(alignFn)) + if err != nil { + return fmt.Errorf("update project cluster role: %s: %w", crs[i].Name, err) + } + } + + return nil +} diff --git a/pkg/systemauthz/helper.go b/pkg/systemauthz/helper.go new file mode 100644 index 000000000..f280961f6 --- /dev/null +++ b/pkg/systemauthz/helper.go @@ -0,0 +1,77 @@ +package systemauthz + +import ( + "fmt" + + core "k8s.io/api/core/v1" + rbac "k8s.io/api/rbac/v1" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" +) + +const ( + _ProjectSpaceViewerClusterRoleNameFormat = "walrus-project-%s-space-viewer" + _ProjectSpaceEditorClusterRoleNameFormat = "walrus-project-%s-space-editor" +) + +// GetProjectSpaceViewerClusterRoleName returns the project space viewer cluster role name of the given project. +func GetProjectSpaceViewerClusterRoleName(proj *walrus.Project) string { + return getProjectSpaceViewerClusterRoleName(proj.Name) +} + +// GetProjectSpaceEditorClusterRoleName returns the project space editor cluster role name of the given project. +func GetProjectSpaceEditorClusterRoleName(proj *walrus.Project) string { + return getProjectSpaceEditorClusterRoleName(proj.Name) +} + +func getProjectSpaceViewerClusterRoleName( + projName string, +) string { + return fmt.Sprintf(_ProjectSpaceViewerClusterRoleNameFormat, projName) +} + +func getProjectSpaceEditorClusterRoleName( + projName string, +) string { + return fmt.Sprintf(_ProjectSpaceEditorClusterRoleNameFormat, projName) +} + +func getNamespaceViewerPolicyRuleFor( + namespaceName string, +) rbac.PolicyRule { + return rbac.PolicyRule{ + APIGroups: []string{ + core.GroupName, + }, + Resources: []string{ + "namespaces", + }, + ResourceNames: []string{ + namespaceName, + }, + Verbs: []string{ + "get", + "list", + "watch", + }, + } +} + +func getNamespaceEditorPolicyRuleFor( + namespaceName string, +) rbac.PolicyRule { + return rbac.PolicyRule{ + APIGroups: []string{ + core.GroupName, + }, + Resources: []string{ + "namespaces", + }, + ResourceNames: []string{ + namespaceName, + }, + Verbs: []string{ + rbac.ResourceAll, + }, + } +} diff --git a/pkg/systemauthz/kuberes.go b/pkg/systemauthz/kuberes.go new file mode 100644 index 000000000..3dc549985 --- /dev/null +++ b/pkg/systemauthz/kuberes.go @@ -0,0 +1,158 @@ +package systemauthz + +import ( + "context" + "fmt" + "reflect" + "slices" + + rbac "k8s.io/api/rbac/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" +) + +// Initialize initializes Kubernetes resources for authorization. +// +// Initialize creates Kubernetes ClusterRoles for system and project. +func Initialize(ctx context.Context, cli clientset.Interface) error { + err := review.CanDoCreate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: rbac.SchemeGroupVersion.Group, + Version: rbac.SchemeGroupVersion.Version, + Resource: "clusterroles", + }, + }, + review.WithUpdateIfExisted(), + ) + if err != nil { + return err + } + + crCli := cli.RbacV1().ClusterRoles() + eCrs := []*rbac.ClusterRole{ + // Project viewer. + { + ObjectMeta: meta.ObjectMeta{ + Name: walrus.ProjectSubjectRoleViewer.String(), + }, + Rules: []rbac.PolicyRule{ + { + APIGroups: []string{ + walrus.GroupName, + walruscore.GroupName, + }, + Resources: []string{ + rbac.ResourceAll, + }, + Verbs: []string{ + "get", + "list", + "watch", + }, + }, + }, + }, + // Project member. + { + ObjectMeta: meta.ObjectMeta{ + Name: walrus.ProjectSubjectRoleMember.String(), + }, + Rules: []rbac.PolicyRule{ + { + APIGroups: []string{ + walrus.GroupName, + walruscore.GroupName, + }, + Resources: []string{ + rbac.ResourceAll, + }, + Verbs: []string{ + "get", + "list", + "watch", + }, + }, + { + APIGroups: []string{ + walrus.GroupName, + }, + Resources: []string{ + "environments", + "resourcecomponents", + }, + Verbs: []string{ + rbac.VerbAll, + }, + }, + { + APIGroups: []string{ + walruscore.GroupName, + }, + Resources: []string{ + "resources", + "resources/components", + }, + Verbs: []string{ + rbac.VerbAll, + }, + }, + }, + }, + // Project owner. + { + ObjectMeta: meta.ObjectMeta{ + Name: walrus.ProjectSubjectRoleOwner.String(), + }, + Rules: []rbac.PolicyRule{ + { + APIGroups: []string{ + walrus.GroupName, + walruscore.GroupName, + }, + Resources: []string{ + rbac.ResourceAll, + }, + Verbs: []string{ + rbac.VerbAll, + }, + }, + }, + }, + } + createAlignFn := func(eCr *rbac.ClusterRole) kubeclientset.AlignWithFn[*rbac.ClusterRole] { + return func(aCr *rbac.ClusterRole) (_ *rbac.ClusterRole, skip bool, err error) { + included := slices.ContainsFunc(eCr.Rules, func(er rbac.PolicyRule) bool { + return slices.ContainsFunc(aCr.Rules, func(ar rbac.PolicyRule) bool { + return reflect.DeepEqual(er, ar) + }) + }) + if included { + return nil, true, nil + } + + // Append the existing rules. + aCr.Rules = append(aCr.Rules, eCr.Rules...) + return aCr, false, nil + } + } + + for i := range eCrs { + alignFn := createAlignFn(eCrs[i]) + + // Create. + _, err = kubeclientset.Create(ctx, crCli, eCrs[i], + kubeclientset.WithUpdateIfExisted(alignFn)) + if err != nil { + return fmt.Errorf("install project cluster role %q: %w", eCrs[i].Name, err) + } + } + + return nil +} diff --git a/pkg/systemauthz/project.go b/pkg/systemauthz/project.go new file mode 100644 index 000000000..48644d110 --- /dev/null +++ b/pkg/systemauthz/project.go @@ -0,0 +1,182 @@ +package systemauthz + +import ( + "context" + "errors" + "fmt" + + "github.com/seal-io/utils/stringx" + rbac "k8s.io/api/rbac/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + authnuser "k8s.io/apiserver/pkg/authentication/user" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/utils/ptr" + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubemeta" + "github.com/seal-io/walrus/pkg/systemmeta" +) + +// CreateProjectSpace creates the project space cluster roles. +func CreateProjectSpace(ctx context.Context, cli ctrlcli.Client, proj *walrus.Project) error { + crs := []*rbac.ClusterRole{ + // Project space viewer. + { + ObjectMeta: meta.ObjectMeta{Name: getProjectSpaceViewerClusterRoleName(proj.Name)}, + Rules: []rbac.PolicyRule{getNamespaceViewerPolicyRuleFor(proj.Name)}, + }, + // Project space editor. + { + ObjectMeta: meta.ObjectMeta{Name: getProjectSpaceEditorClusterRoleName(proj.Name)}, + Rules: []rbac.PolicyRule{getNamespaceEditorPolicyRuleFor(proj.Name)}, + }, + } + + for i := range crs { + systemmeta.NoteResource(crs[i], "roles", map[string]string{"project": proj.Name}) + kubemeta.ControlOnWithoutBlock(crs[i], proj, walrus.SchemeGroupVersionKind("Project")) + + // Create. + _, err := kubeclientset.CreateWithCtrlClient(ctx, cli, crs[i]) + if err != nil { + return fmt.Errorf("create project cluster role: %s: %w", crs[i].Name, err) + } + } + + // Bind project subject role. + err := BindProjectSubjectRole(ctx, cli, proj, walrus.ProjectSubjectRoleOwner) + if err != nil { + return fmt.Errorf("bind project subject role: %w", err) + } + + return nil +} + +// BindProjectSubjectRoleFor binds the given subject role of the given project for the given user info. +func BindProjectSubjectRoleFor( + ctx context.Context, + cli ctrlcli.Client, + proj *walrus.Project, + role walrus.ProjectSubjectRole, + uInfo authnuser.Info, +) error { + spaceRoleName := getProjectSpaceEditorClusterRoleName(proj.Name) + if role != walrus.ProjectSubjectRoleOwner { + spaceRoleName = getProjectSpaceViewerClusterRoleName(proj.Name) + } + resourceRoleName := role.String() + + id := stringx.SumByFNV64a(uInfo.GetName()) + crbs := []*rbac.ClusterRoleBinding{ + // Project resource role binding. + { + ObjectMeta: meta.ObjectMeta{ + Name: fmt.Sprintf("%s-%s", resourceRoleName, id), + }, + Subjects: []rbac.Subject{ + { + APIGroup: rbac.GroupName, + Kind: "User", + Name: uInfo.GetName(), + }, + }, + RoleRef: rbac.RoleRef{ + APIGroup: rbac.GroupName, + Kind: "ClusterRole", + Name: resourceRoleName, + }, + }, + // Project space role binding. + { + ObjectMeta: meta.ObjectMeta{ + Name: fmt.Sprintf("%s-%s-space", resourceRoleName, id), + }, + Subjects: []rbac.Subject{ + { + APIGroup: rbac.GroupName, + Kind: "User", + Name: uInfo.GetName(), + }, + }, + RoleRef: rbac.RoleRef{ + APIGroup: rbac.GroupName, + Kind: "ClusterRole", + Name: spaceRoleName, + }, + }, + } + + for i := range crbs { + systemmeta.NoteResource(crbs[i], "rolebindings", map[string]string{"project": proj.Name}) + kubemeta.ControlOnWithoutBlock(crbs[i], proj, walrus.SchemeGroupVersionKind("Project")) + + // Create. + _, err := kubeclientset.CreateWithCtrlClient(ctx, cli, crbs[i]) + if err != nil { + return fmt.Errorf("create project cluster role binding: %s: %w", crbs[i].Name, err) + } + } + + return nil +} + +// BindProjectSubjectRole is similar to BindProjectSubjectRoleFor, +// but it can retrieve user information from context automatically. +func BindProjectSubjectRole(ctx context.Context, cli ctrlcli.Client, proj *walrus.Project, role walrus.ProjectSubjectRole) error { + ui, ok := genericapirequest.UserFrom(ctx) + if !ok { + return errors.New("cannot retrieve kubernetes request user information from context") + } + return BindProjectSubjectRoleFor(ctx, cli, proj, role, ui) +} + +// UnbindProjectSubjectRoleFor unbinds the given subject role of the given project from the given user info. +func UnbindProjectSubjectRoleFor( + ctx context.Context, + cli ctrlcli.Client, + role walrus.ProjectSubjectRole, + uInfo authnuser.Info, +) error { + resourceRoleName := role.String() + + id := stringx.SumByFNV64a(uInfo.GetName()) + crbs := []*rbac.ClusterRoleBinding{ + // Project resource role binding. + { + ObjectMeta: meta.ObjectMeta{ + Name: fmt.Sprintf("%s-%s", resourceRoleName, id), + }, + }, + // Project space role binding. + { + ObjectMeta: meta.ObjectMeta{ + Name: fmt.Sprintf("%s-%s-space", resourceRoleName, id), + }, + }, + } + + for i := range crbs { + // Delete. + err := kubeclientset.DeleteWithCtrlClient(ctx, cli, crbs[i], + kubeclientset.WithDeleteMetaOptions(meta.DeleteOptions{ + PropagationPolicy: ptr.To(meta.DeletePropagationForeground), + })) + if err != nil { + return err + } + } + + return nil +} + +// UnbindProjectSubjectRole is similar to UnbindProjectSubjectRoleFor, +// but it can retrieve user information from context automatically. +func UnbindProjectSubjectRole(ctx context.Context, cli ctrlcli.Client, role walrus.ProjectSubjectRole) error { + ui, ok := genericapirequest.UserFrom(ctx) + if !ok { + return errors.New("cannot retrieve kubernetes request user information from context") + } + return UnbindProjectSubjectRoleFor(ctx, cli, role, ui) +} diff --git a/pkg/systemdeployer/kuberes.go b/pkg/systemdeployer/kuberes.go new file mode 100644 index 000000000..97559b56d --- /dev/null +++ b/pkg/systemdeployer/kuberes.go @@ -0,0 +1,81 @@ +package systemdeployer + +import ( + "context" + "fmt" + "reflect" + "slices" + + batch "k8s.io/api/batch/v1" + core "k8s.io/api/core/v1" + rbac "k8s.io/api/rbac/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" +) + +// ClusterRoleName is the Kubernetes ClusterRole name for running deployer. +const ClusterRoleName = "walrus-deployer" + +// Initialize initializes Kubernetes resources for deployer. +// +// Initialize creates a Kubernetes ClusterRole for running deployer. +func Initialize(ctx context.Context, cli clientset.Interface) error { + err := review.CanDoCreate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: rbac.SchemeGroupVersion.Group, + Version: rbac.SchemeGroupVersion.Version, + Resource: "clusterroles", + }, + }, + review.WithUpdateIfExisted(), + ) + if err != nil { + return err + } + + crCli := cli.RbacV1().ClusterRoles() + eCr := &rbac.ClusterRole{ + ObjectMeta: meta.ObjectMeta{ + Name: ClusterRoleName, + }, + Rules: []rbac.PolicyRule{ + // The below rules are used for kaniko to build images. + { + APIGroups: []string{batch.GroupName}, + Resources: []string{"jobs"}, + Verbs: []string{rbac.VerbAll}, + }, + { + APIGroups: []string{core.GroupName}, + Resources: []string{"secrets", "pods", "pods/log"}, + Verbs: []string{rbac.VerbAll}, + }, + }, + } + alignFn := func(aCr *rbac.ClusterRole) (*rbac.ClusterRole, bool, error) { + included := slices.ContainsFunc(eCr.Rules, func(er rbac.PolicyRule) bool { + return slices.ContainsFunc(aCr.Rules, func(ar rbac.PolicyRule) bool { + return reflect.DeepEqual(er, ar) + }) + }) + if included { + return nil, true, nil + } + // Append the existing rules. + aCr.Rules = append(aCr.Rules, eCr.Rules...) + return aCr, false, nil + } + + _, err = kubeclientset.Create(ctx, crCli, eCr, + kubeclientset.WithUpdateIfExisted(alignFn)) + if err != nil { + return fmt.Errorf("install deployer cluster role %q: %w", eCr.GetName(), err) + } + + return nil +} diff --git a/pkg/systemkuberes/environment.go b/pkg/systemkuberes/environment.go new file mode 100644 index 000000000..429b3b893 --- /dev/null +++ b/pkg/systemkuberes/environment.go @@ -0,0 +1,60 @@ +package systemkuberes + +import ( + "context" + "fmt" + + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" + "github.com/seal-io/walrus/pkg/system" +) + +// DefaultEnvironmentName is the Kubernetes Namespace name for the default environment. +const DefaultEnvironmentName = DefaultProjectName + "-local" + +// InstallDefaultEnvironment creates the default environment, alias to Kubernetes Namespace default-local. +func InstallDefaultEnvironment(ctx context.Context, cli clientset.Interface) error { + err := review.CanDoUpdate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: walrus.SchemeGroupVersion.Group, + Version: walrus.SchemeGroupVersion.Version, + Resource: "environments", + }, + }, + review.WithCreateIfNotExisted(), + ) + if err != nil { + return err + } + + envCli := cli.WalrusV1().Environments(DefaultProjectName) + env := &walrus.Environment{ + ObjectMeta: meta.ObjectMeta{ + Namespace: DefaultProjectName, + Name: DefaultEnvironmentName, + }, + Spec: walrus.EnvironmentSpec{ + Type: func() walrus.EnvironmentType { + if system.LoopbackKubeInside.Get() { + return walrus.EnvironmentTypeProduction + } + return walrus.EnvironmentTypeDevelopment + }(), + DisplayName: "Default Environment", + Description: "The default environment created by Walrus.", + }, + } + + _, err = kubeclientset.Create(ctx, envCli, env) + if err != nil { + return fmt.Errorf("install default environment: %w", err) + } + + return nil +} diff --git a/pkg/systemkuberes/project.go b/pkg/systemkuberes/project.go new file mode 100644 index 000000000..015a6e2c1 --- /dev/null +++ b/pkg/systemkuberes/project.go @@ -0,0 +1,54 @@ +package systemkuberes + +import ( + "context" + "fmt" + + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + + walrus "github.com/seal-io/walrus/pkg/apis/walrus/v1" + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" +) + +// DefaultProjectName is the Kubernetes Namespace name for the default project. +const DefaultProjectName = core.NamespaceDefault + +// InstallDefaultProject creates the default project, alias of the Kubernetes Namespace default. +func InstallDefaultProject(ctx context.Context, cli clientset.Interface) error { + err := review.CanDoUpdate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: walrus.SchemeGroupVersion.Group, + Version: walrus.SchemeGroupVersion.Version, + Resource: "projects", + }, + }, + review.WithCreateIfNotExisted(), + ) + if err != nil { + return err + } + + projCli := cli.WalrusV1().Projects(SystemNamespaceName) + proj := &walrus.Project{ + ObjectMeta: meta.ObjectMeta{ + Namespace: SystemNamespaceName, + Name: DefaultProjectName, + }, + Spec: walrus.ProjectSpec{ + DisplayName: "Default Project", + Description: "The default project created by Walrus.", + }, + } + + _, err = kubeclientset.Create(ctx, projCli, proj) + if err != nil { + return fmt.Errorf("install default project: %w", err) + } + + return nil +} diff --git a/pkg/systemkuberes/system.go b/pkg/systemkuberes/system.go new file mode 100644 index 000000000..bf6dd9b2e --- /dev/null +++ b/pkg/systemkuberes/system.go @@ -0,0 +1,177 @@ +package systemkuberes + +import ( + "context" + "fmt" + "slices" + + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" + "github.com/seal-io/walrus/pkg/system" +) + +// SystemNamespaceName is the name indicates which Kubernetes Namespace storing system resources. +const SystemNamespaceName = "walrus-system" + +// InstallSystemNamespace creates the system namespace. +func InstallSystemNamespace(ctx context.Context, cli clientset.Interface) error { + err := review.CanDoCreate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: core.SchemeGroupVersion.Group, + Version: core.SchemeGroupVersion.Version, + Resource: "namespaces", + }, + }, + ) + if err != nil { + return err + } + + nsCli := cli.CoreV1().Namespaces() + ns := &core.Namespace{ + ObjectMeta: meta.ObjectMeta{ + Name: SystemNamespaceName, + }, + } + + _, err = kubeclientset.Create(ctx, nsCli, ns) + if err != nil { + return fmt.Errorf("install namespace %q: %w", ns.GetName(), err) + } + + return nil +} + +// SystemRoutingServiceName is the name indicates which Kubernetes Service routing system access. +const SystemRoutingServiceName = "walrus" + +// InstallFakeSystemRoutingService creates the fake routing service/endpoint for system. +// +// The service points to the PrimaryIP of the system. +func InstallFakeSystemRoutingService(ctx context.Context, cli clientset.Interface, port int) error { + err := InstallSystemNamespace(ctx, cli) + if err != nil { + return err + } + + err = review.CanDoCreate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: core.SchemeGroupVersion.Group, + Version: core.SchemeGroupVersion.Version, + Resource: "services", + }, + { + Group: core.SchemeGroupVersion.Group, + Version: core.SchemeGroupVersion.Version, + Resource: "endpoints", + }, + }, + review.WithRecreateIfDuplicated(), + review.WithUpdateIfExisted(), + ) + if err != nil { + return err + } + + svcCli := cli.CoreV1().Services(SystemNamespaceName) + eSvc := &core.Service{ + ObjectMeta: meta.ObjectMeta{ + Name: SystemRoutingServiceName, + Labels: map[string]string{ + "walrus.seal.io/fake-routing": "true", + }, + }, + Spec: core.ServiceSpec{ + Type: core.ServiceTypeClusterIP, + ClusterIP: core.ClusterIPNone, + Ports: []core.ServicePort{ + { + Port: int32(port), + }, + }, + }, + } + svcCompareFn := func(aSvc *core.Service) bool { + return aSvc.Spec.Type == eSvc.Spec.Type && + aSvc.Spec.ClusterIP == eSvc.Spec.ClusterIP && + slices.ContainsFunc(aSvc.Spec.Ports, func(ap core.ServicePort) bool { + return ap.Port == eSvc.Spec.Ports[0].Port + }) + } + + _, err = kubeclientset.Create(ctx, svcCli, eSvc, + kubeclientset.WithRecreateIfDuplicated(svcCompareFn)) + if err != nil { + return fmt.Errorf("install fake rounting service %q: %w", eSvc.GetName(), err) + } + + epCli := cli.CoreV1().Endpoints(SystemNamespaceName) + eEp := &core.Endpoints{ + ObjectMeta: meta.ObjectMeta{ + Name: eSvc.GetName(), + Labels: map[string]string{ + "walrus.seal.io/fake-routing": "true", + }, + }, + Subsets: []core.EndpointSubset{ + { + Addresses: []core.EndpointAddress{ + { + IP: system.PrimaryIP.Get(), + }, + }, + Ports: []core.EndpointPort{ + { + Port: int32(port), + }, + }, + }, + }, + } + epAlignFn := func(aEp *core.Endpoints) (*core.Endpoints, bool, error) { + var found bool + for i := range aEp.Subsets { + for j := range aEp.Subsets[i].Addresses { + if aEp.Subsets[i].Addresses[j].IP == eEp.Subsets[0].Addresses[0].IP { + found = true + break + } + } + if found { + found = false + for j := range aEp.Subsets[i].Ports { + if aEp.Subsets[i].Ports[j].Port == eEp.Subsets[0].Ports[0].Port { + found = true + break + } + } + } + if found { + break + } + } + if found { + return nil, true, nil + } + + // Append the existing subsets. + aEp.Subsets = append(aEp.Subsets, eEp.Subsets...) + return eEp, false, nil + } + + _, err = kubeclientset.Create(ctx, epCli, eEp, + kubeclientset.WithUpdateIfExisted(epAlignFn)) + if err != nil { + return fmt.Errorf("install fake routing service %q: %w", eEp.GetName(), err) + } + + return nil +} diff --git a/pkg/systemkuberes/variable.go b/pkg/systemkuberes/variable.go new file mode 100644 index 000000000..20f87adbc --- /dev/null +++ b/pkg/systemkuberes/variable.go @@ -0,0 +1,4 @@ +package systemkuberes + +// VariablesDelegatedSecretName is the delegated Kubernetes Secret name for the variables. +const VariablesDelegatedSecretName = "walrus-variables" diff --git a/pkg/systemmeta/alias.go b/pkg/systemmeta/alias.go new file mode 100644 index 000000000..b3c9fd248 --- /dev/null +++ b/pkg/systemmeta/alias.go @@ -0,0 +1,12 @@ +package systemmeta + +import ( + ctrlcli "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ( + // MetaObject is the interface for the object with metadata. + MetaObject = ctrlcli.Object + // MetaObjectList is the interface for the list of objects with metadata. + MetaObjectList = ctrlcli.ObjectList +) diff --git a/pkg/systemmeta/lock.go b/pkg/systemmeta/lock.go new file mode 100644 index 000000000..ea171ac37 --- /dev/null +++ b/pkg/systemmeta/lock.go @@ -0,0 +1,49 @@ +package systemmeta + +import ( + "slices" +) + +const ( + // LockedResourceFinalizer is the finalizer to indicate the resource is locked by system. + LockedResourceFinalizer = "walrus.seal.io/controlled" +) + +// Lock adds a finalizer to the given resource. +// +// If the resource has been controlled, returns true, +// otherwise, returns false. +func Lock(obj MetaObject) (locked bool) { + if obj == nil { + panic("object is nil") + } + + fs := obj.GetFinalizers() + if slices.Contains(fs, LockedResourceFinalizer) { + return true + } + + fs = append(fs, LockedResourceFinalizer) + obj.SetFinalizers(fs) + return false +} + +// Unlock removes a finalizer from the given resource. +// +// If the resource is not be controlled, returns true, +// otherwise, returns false. +func Unlock(obj MetaObject) (unlocked bool) { + if obj == nil { + panic("object is nil") + } + + fs := obj.GetFinalizers() + fs2 := slices.DeleteFunc(fs, func(s string) bool { + return s == LockedResourceFinalizer + }) + if len(fs) == len(fs2) { + return true + } + obj.SetFinalizers(fs2) + return false +} diff --git a/pkg/systemmeta/resource.go b/pkg/systemmeta/resource.go new file mode 100644 index 000000000..90a29a451 --- /dev/null +++ b/pkg/systemmeta/resource.go @@ -0,0 +1,294 @@ +package systemmeta + +import ( + "fmt" + "strings" + + kmeta "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/sets" +) + +const ( + // ResourceTypeLabel is the label key to indicate the system type of delegated resource. + ResourceTypeLabel = "resource.walrus.seal.io/type" + + // ResourceNoteAnnoPrefix is the annotation prefix to indicate the note of resource. + ResourceNoteAnnoPrefix = "note.walrus.seal.io/" +) + +// NoteResource armors the resource. +func NoteResource(obj MetaObject, resType string, notes map[string]string) { + if obj == nil { + panic("object is nil") + } + + ls := obj.GetLabels() + if ls == nil { + ls = make(map[string]string) + } + ls[ResourceTypeLabel] = resType + obj.SetLabels(ls) + + if len(notes) > 0 { + as := obj.GetAnnotations() + if as == nil { + as = make(map[string]string) + } + + for k, v := range notes { + as[ResourceNoteAnnoPrefix+k] = v + } + + obj.SetAnnotations(as) + } +} + +// DescribeResource explains the details of resource. +func DescribeResource(obj MetaObject) (resType string, notes map[string]string) { + if obj == nil { + panic("object is nil") + } + + ls := obj.GetLabels() + if ls != nil { + resType = ls[ResourceTypeLabel] + } + + notes = make(map[string]string) + as := obj.GetAnnotations() + for k, v := range as { + if strings.HasPrefix(k, ResourceNoteAnnoPrefix) { + notes[k[len(ResourceNoteAnnoPrefix):]] = v + } + } + return +} + +// DescribeResourceType explains the resource type of resource. +func DescribeResourceType(obj MetaObject) string { + if obj == nil { + panic("object is nil") + } + + ls := obj.GetLabels() + if ls != nil { + return ls[ResourceTypeLabel] + } + + return "" +} + +// DescribeResourceNote explains the note of a resource with the given key. +func DescribeResourceNote(obj MetaObject, noteKey string) string { + if obj == nil { + panic("object is nil") + } + + as := obj.GetAnnotations() + for k, v := range as { + if !strings.HasPrefix(k, ResourceNoteAnnoPrefix) { + continue + } + if k[len(ResourceNoteAnnoPrefix):] == noteKey { + return v + } + } + return "" +} + +// DescribeResourceNotes explains the notes of a resource with the given keys. +func DescribeResourceNotes(obj MetaObject, noteKeys []string) map[string]string { + if obj == nil { + panic("object is nil") + } + + nks := sets.New(noteKeys...) + r := make(map[string]string, len(noteKeys)) + + as := obj.GetAnnotations() + for k, v := range as { + if !strings.HasPrefix(k, ResourceNoteAnnoPrefix) { + continue + } + if nks.Has(k[len(ResourceNoteAnnoPrefix):]) { + r[k[len(ResourceNoteAnnoPrefix):]] = v + } + } + + return r +} + +// UnnoteResource is similar to DescribeResource, +// but it removes the resource labels and annotations. +func UnnoteResource(obj MetaObject) (resType string, notes map[string]string) { + if obj == nil { + panic("object is nil") + } + + ls := obj.GetLabels() + if ls != nil { + resType = ls[ResourceTypeLabel] + delete(ls, ResourceTypeLabel) + obj.SetLabels(ls) + } + + notes = make(map[string]string) + as := obj.GetAnnotations() + if as != nil { + for k := range as { + if !strings.HasPrefix(k, ResourceNoteAnnoPrefix) { + continue + } + notes[k[len(ResourceNoteAnnoPrefix):]] = as[k] + delete(as, k) + } + obj.SetAnnotations(as) + } + + return +} + +// PopResourceNote is similar to DescribeResourceNote, +// but it removes the resource annotation with the given key. +func PopResourceNote(obj MetaObject, noteKey string) string { + if obj == nil { + panic("object is nil") + } + + as := obj.GetAnnotations() + for k := range as { + if k == ResourceNoteAnnoPrefix+noteKey { + v := as[k] + delete(as, k) + obj.SetAnnotations(as) + return v + } + } + return "" +} + +// PopResourceNotes is similar to DescribeResourceNotes, +// but it removes the resource annotations with the given keys. +func PopResourceNotes(obj MetaObject, noteKeys []string) map[string]string { + if obj == nil { + panic("object is nil") + } + + nks := sets.New(noteKeys...) + r := make(map[string]string, len(noteKeys)) + + as := obj.GetAnnotations() + for k := range as { + if !strings.HasPrefix(k, ResourceNoteAnnoPrefix) { + continue + } + if nks.Has(k[len(ResourceNoteAnnoPrefix):]) { + r[k[len(ResourceNoteAnnoPrefix):]] = as[k] + delete(as, k) + } + } + + obj.SetAnnotations(as) + return r +} + +// GetResourcesLabelSelectorOfType returns a label selector for the resources of the specified type. +func GetResourcesLabelSelectorOfType(resType string) labels.Selector { + return labels.SelectorFromSet(labels.Set{ + ResourceTypeLabel: resType, + }) +} + +// FilterResourceListByNotes returns a list of resources that matched by notes. +func FilterResourceListByNotes[T MetaObjectList](objList T, noteKey, noteValue string, noteKeyAndValues ...string) T { + items, err := kmeta.ExtractList(objList) + if err != nil { + panic(fmt.Errorf("failed to extract list: %w", err)) + } + + newItems := make([]runtime.Object, 0, len(items)) + for i := range items { + m := MatchResourceByNotes(items[i].(MetaObject), noteKey, noteValue, noteKeyAndValues...) + if !m { + continue + } + newItems = append(newItems, items[i]) + } + + err = kmeta.SetList(objList, newItems) + if err != nil { + panic(fmt.Errorf("failed to set list: %w", err)) + } + + return objList +} + +// MatchResourceByNotes returns true if the given resource matched by notes. +func MatchResourceByNotes(obj MetaObject, noteKey, noteValue string, noteKeyAndValues ...string) bool { + if obj == nil { + panic("object is nil") + } + + if noteValue != DescribeResourceNote(obj, noteKey) { + return false + } + for i := 0; i < len(noteKeyAndValues); i += 2 { + k := noteKeyAndValues[i] + v := "" + if i+1 < len(noteKeyAndValues) { + v = noteKeyAndValues[i+1] + } + if v != DescribeResourceNote(obj, k) { + return false + } + } + return true +} + +// FilterResourceList returns a list of resources that matched by resource type and notes. +func FilterResourceList[T MetaObjectList](objList T, resType string, noteKeyAndValues ...string) T { + items, err := kmeta.ExtractList(objList) + if err != nil { + panic(fmt.Errorf("failed to extract list: %w", err)) + } + + newItems := make([]runtime.Object, 0, len(items)) + for i := range items { + m := MatchResource(items[i].(MetaObject), resType, noteKeyAndValues...) + if !m { + continue + } + newItems = append(newItems, items[i]) + } + + err = kmeta.SetList(objList, newItems) + if err != nil { + panic(fmt.Errorf("failed to set list: %w", err)) + } + + return objList +} + +// MatchResource returns true if the given resource matched by resource type and notes. +func MatchResource(obj MetaObject, resType string, noteKeyAndValues ...string) bool { + if obj == nil { + panic("object is nil") + } + + if DescribeResourceType(obj) != resType { + return false + } + for i := 0; i < len(noteKeyAndValues); i += 2 { + k := noteKeyAndValues[i] + v := "" + if i+1 < len(noteKeyAndValues) { + v = noteKeyAndValues[i+1] + } + if v != DescribeResourceNote(obj, k) { + return false + } + } + return true +} diff --git a/pkg/systemsetting/helper.go b/pkg/systemsetting/helper.go new file mode 100644 index 000000000..e375e4a85 --- /dev/null +++ b/pkg/systemsetting/helper.go @@ -0,0 +1,263 @@ +package systemsetting + +import ( + "context" + "errors" + "fmt" + "net/url" + "slices" + "strconv" + "strings" + "time" + + conregname "github.com/google/go-containerregistry/pkg/name" + "github.com/robfig/cron/v3" + "github.com/seal-io/utils/osx" + "github.com/seal-io/utils/stringx" +) + +// Initializer defines the stereotype for initializing the default value. +type Initializer func(name string) (value string) + +// InitializeFromSpecifiedEnv searches the variable of the given environment name, +// returns the default value if not found the specified environment. +func InitializeFromSpecifiedEnv(envName string, defValue ...string) Initializer { + return func(_ string) string { + return osx.ExpandEnv(envName, defValue...) + } +} + +// InitializeFromEnv searches the variable of the `WALRUS_SETTING_${UpperSnakeCase_of_SettingName}`, +// returns the default value if not found the environment. +func InitializeFromEnv(defValue ...string) Initializer { + return func(name string) string { + envName := "WALRUS_SETTING_" + stringx.UnderscoreUpper(name) + return osx.ExpandEnv(envName, defValue...) + } +} + +// InitializeFrom initializes with the given value. +func InitializeFrom(value string) Initializer { + return func(_ string) string { + return value + } +} + +// Admission defines the stereotype for validating writing. +type Admission func(ctx context.Context, oldVal, newVal string) (err error) + +// ErrAdmissionSkipped is the error returned by Admission to indicate the validation is skipped. +var ErrAdmissionSkipped = errors.New("admission skipped") + +// AdmitWith combines multiple Admission into one, +// if no Admission given, it will be Allow. +// +// If one Admission of the given Admissions returns an error, +// the error will be returned immediately. +// +// If one Admission of the given Admissions returns an ErrAdmissionSkipped, +// the function will return true immediately. +func AdmitWith(admits ...Admission) Admission { + if len(admits) == 0 { + admits = []Admission{Allow} + } + return func(ctx context.Context, oldValue, newValue string) error { + var err error + for i := range admits { + err = admits[i](ctx, oldValue, newValue) + if err != nil { + break + } + } + if errors.Is(err, ErrAdmissionSkipped) { + return nil + } + return err + } +} + +// Allow implements the Admission stereotype, +// which means the value can be modified. +func Allow(ctx context.Context, oldVal, newVal string) error { + return nil +} + +// Disallow implements the Admission stereotype, +// which means the value can not be modified. +func Disallow(ctx context.Context, oldVal, newVal string) error { + return errors.New("cannot modify") +} + +// AllowBlank implements the Admission stereotype, +// which means the value can be modified if blank. +// +// AllowBlank always combines with other Admission, +// if allow input anything, please use Allow instead. +func AllowBlank(ctx context.Context, oldVal, newVal string) error { + if !isBlank(newVal) { + return nil + } + return ErrAdmissionSkipped +} + +// DisallowBlank implements the Admission stereotype, +// which means the value can be modified if not blank. +// +// DisallowBlank always combines with other Admission, +// if disallow input anything, please use Disallow instead. +func DisallowBlank(ctx context.Context, oldVal, newVal string) error { + if !isBlank(newVal) { + return nil + } + return errors.New("blank value") +} + +// AllowOnceConfigure implements the Admission stereotype, +// which means the value can be modified if blank. +func AllowOnceConfigure(ctx context.Context, oldVal, newVal string) error { + if isBlank(oldVal) { + return nil + } + return errors.New("already configured") +} + +// AllowBoolean implements the Admission stereotype, +// which means the value can be modified if it's boolean. +func AllowBoolean(ctx context.Context, oldVal, newVal string) error { + _, err := strconv.ParseBool(newVal) + return err +} + +// AllowInt64 implements the Admission stereotype, +// which means the value can be modified if it's int64. +func AllowInt64(ctx context.Context, oldVal, newVal string) error { + _, err := strconv.ParseInt(newVal, 10, 64) + return err +} + +// AllowUint64 implements the Admission stereotype, +// which means the value can be modified if it's uint64. +func AllowUint64(ctx context.Context, oldVal, newVal string) error { + _, err := strconv.ParseUint(newVal, 10, 64) + return err +} + +// AllowFloat64 implements the Admission stereotype, +// which means the value can be modified if it's float64. +func AllowFloat64(ctx context.Context, oldVal, newVal string) error { + _, err := strconv.ParseFloat(newVal, 64) + return err +} + +// AllowHttpUrl implements the Admission stereotype, +// which means the value can be modified if it is an HTTP URL. +// This Admission allows blank new value, +// if not allowed, combine with DisallowBlank. +func AllowHttpUrl(ctx context.Context, oldVal, newVal string) error { + return checkUrl(newVal, httpSchemeUrlOnly) +} + +// AllowSockUrl implements the Admission stereotype, +// which means the value can be modified if it is a Socket URL. +// This Admission allows blank new value, +// if not allowed, combine with DisallowBlank. +func AllowSockUrl(ctx context.Context, oldVal, newVal string) error { + return checkUrl(newVal, sockSchemeUrlOnly) +} + +// AllowUrl implements the Admission stereotype, +// which means the value can be modified if it is a URL. +// This Admission allows blank new value, +// if not allowed, combine with DisallowBlank. +func AllowUrl(ctx context.Context, oldVal, newVal string) error { + return checkUrl(newVal, anySchemeUrl) +} + +// AllowCronExpression implements the Admission stereotype, +// which means the value can be modified if it's cron expression. +// This Admission allows blank new value, +// if not allowed, combine with DisallowBlank. +func AllowCronExpression(ctx context.Context, oldVal, newVal string) error { + _, err := cron.ParseStandard(newVal) + return err +} + +// AllowCronExpressionAtLeast implements the Admission stereotype, +// which means the value can be modified if it's cron expression and at least the given duration. +// This Admission allows blank new value, +// if not allowed, combine with DisallowBlank. +func AllowCronExpressionAtLeast(d time.Duration) Admission { + return func(ctx context.Context, oldVal, newVal string) error { + expr, err := cron.ParseStandard(newVal) + if err != nil { + return err + } + next := expr.Next(time.Now()) + duration := expr.Next(next).Sub(next) + if duration < d { + return fmt.Errorf("cron expression %q is too short, at least %v", newVal, d) + } + return nil + } +} + +// AllowContainerRegistry implements the Admission stereotype, +// which means the value can be modified if it's container registry. +func AllowContainerRegistry(ctx context.Context, oldVal, newVal string) error { + _, err := conregname.NewRepository(newVal) + return err +} + +// AllowContainerImageReference implements the Admission stereotype, +// which means the value can be modified if it's container image reference. +func AllowContainerImageReference(ctx context.Context, oldVal, newVal string) error { + _, err := conregname.ParseReference(newVal) + return err +} + +func isBlank(s string) bool { + return slices.Contains([]string{"", "{}", "[]"}, strings.TrimSpace(s)) +} + +type urlChecker func(url.URL) error + +func anySchemeUrl(_ url.URL) error { + return nil +} + +func httpSchemeUrlOnly(u url.URL) error { + switch strings.ToLower(u.Scheme) { + case "http", "https": + return nil + } + return fmt.Errorf("invalid schema: %q, allowed: http, https", u.Scheme) +} + +func sockSchemeUrlOnly(u url.URL) error { + switch strings.ToLower(u.Scheme) { + case "socks4", "socks5": + return nil + } + return fmt.Errorf("invalid schema: %q, allowed socks4, socks5", u.Scheme) +} + +func checkUrl(str string, check urlChecker) error { + v, err := url.Parse(str) + if err != nil { + return fmt.Errorf("%s is illegal URL format: %w", str, err) + } + + port := v.Port() + if port != "" { + p, err := strconv.ParseUint(port, 10, 32) + if err != nil { + return fmt.Errorf("parsing given port: %w", err) + } + + if p > 65535 { + return fmt.Errorf("given port %d: exceeded upper limit", p) + } + } + + return check(*v) +} diff --git a/pkg/systemsetting/kuberes.go b/pkg/systemsetting/kuberes.go new file mode 100644 index 000000000..2648df5b6 --- /dev/null +++ b/pkg/systemsetting/kuberes.go @@ -0,0 +1,93 @@ +package systemsetting + +import ( + "context" + + "github.com/google/uuid" + "golang.org/x/exp/maps" + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" + "github.com/seal-io/walrus/pkg/systemkuberes" + "github.com/seal-io/walrus/pkg/systemmeta" +) + +const ( + // DelegatedSecretNamespace is the delegated Kubernetes Secret namespace for the settings. + DelegatedSecretNamespace = systemkuberes.SystemNamespaceName + + // DelegatedSecretName is the delegated Kubernetes Secret name for the settings. + DelegatedSecretName = "walrus-settings" +) + +// Initialize initializes Kubernetes resources for settings. +// +// Initialize creates the delegated Kubernetes Secret for settings. +func Initialize(ctx context.Context, cli clientset.Interface) error { + err := systemkuberes.InstallSystemNamespace(ctx, cli) + if err != nil { + return err + } + + err = review.CanDoUpdate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: core.SchemeGroupVersion.Group, + Version: core.SchemeGroupVersion.Version, + Resource: "secrets", + }, + }, + review.WithCreateIfNotExisted(), + ) + if err != nil { + return err + } + + secCli := cli.CoreV1().Secrets(systemkuberes.SystemNamespaceName) + + eSec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Name: DelegatedSecretName, + }, + Data: map[string][]byte{}, + } + eResType := "settings" + eNotes := map[string]string{} + for name, defVal := range Initials() { + eSec.Data[name] = []byte(defVal) + eNotes[name+"-uid"] = uuid.NewString() + } + systemmeta.NoteResource(eSec, eResType, eNotes) + alignFn := func(aSec *core.Secret) (_ *core.Secret, skip bool, err error) { + // Align delegated info. + aResType, aNotes := systemmeta.DescribeResource(aSec) + if aResType != eResType || !sets.KeySet(aNotes).HasAll(maps.Keys(eNotes)...) { + eNotes := maps.Clone(eNotes) + maps.Copy(eNotes, aNotes) + systemmeta.NoteResource(aSec, eResType, eNotes) + skip = false + } + // Align data. + for k := range eSec.Data { + if _, ok := aSec.Data[k]; !ok { + aSec.Data[k] = eSec.Data[k] + skip = false + } + } + return aSec, skip, nil + } + + _, err = kubeclientset.Update(ctx, secCli, eSec, + kubeclientset.WithUpdateAlign(alignFn), + kubeclientset.WithCreateIfNotExisted[*core.Secret]()) + if err != nil { + return err + } + + return nil +} diff --git a/pkg/systemsetting/setting.go b/pkg/systemsetting/setting.go new file mode 100644 index 000000000..71fe1a1dd --- /dev/null +++ b/pkg/systemsetting/setting.go @@ -0,0 +1,373 @@ +package systemsetting + +import ( + "context" + "fmt" + "net/url" + "strconv" + "time" + + "github.com/seal-io/utils/stringx" + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/system" + "github.com/seal-io/walrus/pkg/systemkuberes" +) + +type _SettingProp uint8 + +const ( + _SettingPropPrivate _SettingProp = 1 << (iota) + _SettingPropHidden + _SettingPropEditable + _SettingPropSensitive +) + +type Setting struct { + name string + description string + defVal string + admit Admission + props _SettingProp +} + +// Name returns the name of the setting. +func (s Setting) Name() string { + return s.name +} + +// Description returns the description of the setting. +func (s Setting) Description() string { + return s.description +} + +// Private returns true if the setting is private. +func (s Setting) Private() bool { + return s.props == _SettingPropPrivate +} + +// Hidden returns true if the setting is hidden. +func (s Setting) Hidden() bool { + return s.props&_SettingPropHidden == _SettingPropHidden +} + +// Editable returns true if the setting is editable. +func (s Setting) Editable() bool { + return s.props&_SettingPropEditable == _SettingPropEditable +} + +// Sensitive returns true if the setting is sensitive. +func (s Setting) Sensitive() bool { + return s.props&_SettingPropSensitive == _SettingPropSensitive +} + +// Configure configures the value of the setting. +func (s Setting) Configure(ctx context.Context, newVal string) error { + loopbackKubeCli := system.LoopbackKubeClient.Get() + + // Update. + secCli := loopbackKubeCli.CoreV1().Secrets(systemkuberes.SystemNamespaceName) + eSec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + Name: DelegatedSecretName, + }, + } + alignFn := func(aSec *core.Secret) (*core.Secret, bool, error) { + var oldVal string + if aSec.Data != nil { + oldVal = string(aSec.Data[s.name]) + } + if admitErr := s.admit(ctx, oldVal, newVal); admitErr != nil { + // NB(thxCode): Skip update if the new value is invalid. + return nil, false, admitErr + } + if oldVal == newVal { + // Skip update if the new value is the same as the old value. + return nil, true, nil + } + // Update the value of the setting. + aSec.Data[s.name] = []byte(newVal) + return aSec, false, nil + } + + _, err := kubeclientset.Update(ctx, secCli, eSec, + kubeclientset.WithUpdateAlign(alignFn)) + if err != nil { + return fmt.Errorf("configure setting %s: %w", s.name, err) + } + + return nil +} + +// Value returns the value of the setting. +func (s Setting) Value(ctx context.Context) (string, error) { + loopbackKubeCli := system.LoopbackKubeClient.Get() + + sec, err := loopbackKubeCli.CoreV1(). + Secrets(systemkuberes.SystemNamespaceName). + Get(ctx, DelegatedSecretName, meta.GetOptions{ResourceVersion: "0"}) + if err != nil { + return "", fmt.Errorf("get value of setting %s: %w", s.name, err) + } + + if sec.Data == nil || sec.Data[s.name] == nil { + return "", fmt.Errorf("get value of setting %s: not found", s.name) + } + + return string(sec.Data[s.name]), nil +} + +// ValueBool returns the bool value of the setting. +func (s Setting) ValueBool(ctx context.Context) (bool, error) { + v, err := s.Value(ctx) + if err != nil { + return false, err + } + return strconv.ParseBool(v) +} + +// ValueInt64 returns the int64 value of the setting. +func (s Setting) ValueInt64(ctx context.Context) (int64, error) { + v, err := s.Value(ctx) + if err != nil { + return 0, err + } + return strconv.ParseInt(v, 10, 64) +} + +// ValueUint64 returns the uint64 value of the setting. +func (s Setting) ValueUint64(ctx context.Context) (uint64, error) { + v, err := s.Value(ctx) + if err != nil { + return 0, err + } + return strconv.ParseUint(v, 10, 64) +} + +// ValueFloat64 returns the float64 value of the setting. +func (s Setting) ValueFloat64(ctx context.Context) (float64, error) { + v, err := s.Value(ctx) + if err != nil { + return 0, err + } + return strconv.ParseFloat(v, 64) +} + +// ValueURL returns the *url.URL value of the setting. +func (s Setting) ValueURL(ctx context.Context) (*url.URL, error) { + v, err := s.Value(ctx) + if err != nil { + return nil, err + } + return url.Parse(v) +} + +var settings = map[string]Setting{} + +func newSetting( + name, description string, props _SettingProp, + init Initializer, admit Admission, +) Setting { + settings[name] = Setting{ + name: name, + defVal: init(name), + admit: admit, + description: description, + props: props, + } + return settings[name] +} + +// Index returns the setting with the given name. +func Index(name string) (Setting, bool) { + s, ok := settings[name] + return s, ok +} + +// Initials returns a map with all settings and their default values. +func Initials() map[string]string { + m := map[string]string{} + for k, v := range settings { + m[k] = v.defVal + } + return m +} + +// the built-in settings for deployer. +var ( + DeployerHttpProxy = newSetting( + "deployer-http-proxy", + "Indicates an address for proxying none SSL http outbound traffic used by deployer, "+ + "it's in form of http(s)://[user:password@]address[:port].", + _SettingPropEditable, + InitializeFromSpecifiedEnv("HTTP_PROXY"), + AdmitWith(AllowBlank, AllowHttpUrl), + ) + DeployerHttpsProxy = newSetting( + "deployer-https-proxy", + "Indicates an address for proxying SSL http outbound traffic used by deployer, "+ + "it's in form of http(s)://[user:password@]address[:port].", + _SettingPropEditable, + InitializeFromSpecifiedEnv("HTTPS_PROXY"), + AdmitWith(AllowBlank, AllowHttpUrl), + ) + DeployerAllProxy = newSetting( + "deployer-all-proxy", + "Indicates an address for proxying all outbound traffic used by deployer, "+ + "it's in form of scheme://[user:password@]address[:port].", + _SettingPropEditable, + InitializeFromSpecifiedEnv("ALL_PROXY"), + AdmitWith(AllowBlank, AllowSockUrl), + ) + DeployerNoProxy = newSetting( + "deployer-no-proxy", + "Indicates addresses that should not to proxy, "+ + "it's in form of comma separated list of IPs or DNS names.", + _SettingPropEditable, + InitializeFromSpecifiedEnv("NO_PROXY"), + Allow, + ) + DeployerImage = newSetting( + "deployer-image", + "Indicates the image used by deployer.", + _SettingPropEditable, + InitializeFromEnv("sealio/terraform-deployer:v1.5.7-seal.1"), + AdmitWith(DisallowBlank, AllowContainerImageReference), + ) + DeployerNetworkMirrorUrl = newSetting( + "deployer-network-mirror-url", + "Indicates the URL to configure the network mirror for deployer.", + _SettingPropEditable, + InitializeFromEnv(), + AdmitWith(AllowBlank, AllowHttpUrl), + ) +) + +// the built-in settings for server. +var ( + ServeIdentify = newSetting( + "serve-identify", + "Indicates the UUID after server installation, "+ + "it's used for telemetry.", + _SettingPropPrivate, + InitializeFrom(stringx.Hex(16)), + Disallow, + ) + ServeUiUrl = newSetting( + "serve-ui-url", + "Indicates a URL to provide the server UI, "+ + "it's in form of scheme://address[:port]/path.", + _SettingPropPrivate, + InitializeFromEnv("https://walrus-ui-1303613262.cos.ap-guangzhou.myqcloud.com/latest/index.html"), // nolint: lll + AdmitWith(DisallowBlank, AllowUrl), + ) + ServeWalrusFilesUrl = newSetting( + "serve-walrus-files-url", + "Indicates a URL to provide the WalrusFiles.", + _SettingPropEditable, + InitializeFromEnv("https://github.com/seal-io/walrus-file-hub"), + AdmitWith(DisallowBlank, AllowUrl), + ) + ServeUrl = newSetting( + "serve-url", + "Indicates the URL to access server, "+ + "it's in form of https://address[:port].", + _SettingPropEditable, + InitializeFromEnv(), + AdmitWith(DisallowBlank, AllowHttpUrl), + ) + EnableTelemetry = newSetting( + "enable-telemetry", + "Indicates whether to enable telemetry.", + _SettingPropEditable, + InitializeFromEnv("true"), + AllowBoolean, + ) + EnableSyncCatalog = newSetting( + "enable-sync-catalog", + "Indicates whether to enable the catalog synchronization, "+ + "If enabled, the server will synchronize all versioned templates under the catalog.", + _SettingPropEditable, + InitializeFromEnv("true"), + AllowBoolean, + ) + EnableBuiltInCatalog = newSetting( + "enable-builtin-catalog", + "Indicates whether to enable the builtin catalog.", + _SettingPropEditable, + InitializeFromEnv("true"), + AllowBoolean, + ) + EnableRemoteTlsVerify = newSetting( + "enable-remote-tls-verify", + "Indicates whether to enable the remote TLS verification.", + _SettingPropEditable, + InitializeFromEnv("true"), + AllowBoolean, + ) + ImageRegistry = newSetting( + "image-registry", + "Indicates the registry used by the server to pull images.", + _SettingPropEditable, + InitializeFromEnv("docker.io"), + AdmitWith(AllowBlank, AllowContainerRegistry), + ) + DefaultEnvironmentMode = newSetting( + "default-environment-mode", + "Indicates the default environment mode.", + _SettingPropPrivate, + InitializeFromEnv("kubernetes"), + Disallow, + ) +) + +// the built-in settings for server cron jobs. +var ( + ConnectorStatusSyncCron = newSetting( + "connector-status-sync-cron", + "Indicates the Cron Expression of sync connector status, "+ + "default Cron Expression means executing check every 5 minutes. "+ + "The Cron Expression to sync is at least 1 minute.", + _SettingPropEditable, + InitializeFromEnv("0 */5 * ? * *" /* every 5 minutes */), + AllowCronExpressionAtLeast(1*time.Minute), + ) + CatalogSyncCron = newSetting( + "catalog-sync-cron", + "Indicates the Cron Expression of sync catalog, "+ + "default Cron Expression means executing check every day at 1 o'clock. "+ + "The Cron Expression to sync is at least 30 minutes.", + _SettingPropEditable, + InitializeFromEnv("0 0 1 * * *" /* every day at 1 o'clock */), + AllowCronExpressionAtLeast(30*time.Minute), + ) + ResourceRelationshipCheckCron = newSetting( + "resource-relationship-check-cron", + "Indicates the Cron Expression of check resource relationship, "+ + "default Cron Expression means executing check every 30 minutes. "+ + "The Cron Expression to sync is at least 1 minute.", + _SettingPropEditable, + InitializeFromEnv("*/30 * * ? * *" /* every 30 minutes */), + AllowCronExpressionAtLeast(1*time.Minute), + ) + ResourceComponentStatusSyncCron = newSetting( + "resource-component-status-sync-cron", + "Indicates the Cron Expression of sync resource component status, "+ + "default Cron Expression means executing check every 1 minutes. "+ + "The Cron Expression to sync is at least 30 seconds", + _SettingPropEditable, + InitializeFromEnv("0 */1 * ? * *" /* every 1 minutes */), + AllowCronExpressionAtLeast(30*time.Second), + ) + TelemetryReportCron = newSetting( + "telemetry-report-cron", + "Indicates the Cron Expression of report telemetry, "+ + "default Cron Expression means executing check every day at 2 o'clock. "+ + "The Cron Expression to sync is at least 1 hour.", + _SettingPropEditable, + InitializeFromEnv("0 0 2 * * *" /* every day at 2 o'clock */), + AllowCronExpressionAtLeast(1*time.Hour), + ) +) diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go new file mode 100644 index 000000000..258e4f8d0 --- /dev/null +++ b/pkg/vcs/git.go @@ -0,0 +1,178 @@ +package vcs + +import ( + "bytes" + "context" + "encoding/hex" + "errors" + "fmt" + "net/url" + "regexp" + "strings" + + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/storer" + "github.com/go-git/go-git/v5/plumbing/transport" + "github.com/seal-io/utils/osx" +) + +type GitCloneOptions struct { + URL string + Auth transport.AuthMethod + Proxy transport.ProxyOptions + InsecureSkipTLS bool + ForceNewRepo bool +} + +var regGitHashRef = regexp.MustCompile(`[0-9a-fA-F]{7,40}`) + +// GitClone executes Git clone with the options and returns the cloned filesystem. +// +// If the given directory is empty, a temporary directory will be created. +func GitClone(ctx context.Context, dir string, o GitCloneOptions) (*ClonedFilesystem, error) { + opts := git.CloneOptions{ + URL: o.URL, + Auth: o.Auth, + ProxyOptions: o.Proxy, + InsecureSkipTLS: o.InsecureSkipTLS, + Mirror: false, + ReferenceName: plumbing.HEAD, + RemoteName: git.DefaultRemoteName, + Tags: git.AllTags, + RecurseSubmodules: git.DefaultSubmoduleRecursionDepth, + } + + var subpath, ref string + { + if opts.URL == "" { + return nil, git.ErrEmptyUrls + } + + u, err := url.Parse(opts.URL) + if err != nil { + return nil, fmt.Errorf("parse given URL: %w", err) + } + u.Path, subpath, _ = strings.Cut(u.Path, "//") + if q := u.Query(); q != nil { + ref = q.Get("ref") + q.Del("ref") + u.RawQuery = q.Encode() + } + + opts.URL = u.String() + } + + optsSlice := []git.CloneOptions{opts} + // If the reference is given, try to clone with the reference name. + if ref != "" && !regGitHashRef.MatchString(ref) { + opts.SingleBranch = true + opts.Depth = 1 + optsSlice = make([]git.CloneOptions, 0, 2) + o1 := opts + o1.ReferenceName = plumbing.NewBranchReferenceName(ref) + optsSlice = append(optsSlice, o1) + o2 := opts + o2.ReferenceName = plumbing.NewTagReferenceName(ref) + optsSlice = append(optsSlice, o2) + } + + if dir == "" { + dir = osx.TempDir("git-clone-*") + } + + var ( + repo *git.Repository + err error + ) + for i := range optsSlice { + repo, err = git.PlainCloneContext(ctx, dir, false, &optsSlice[i]) + if err != nil && !errors.As(err, &git.NoMatchingRefSpecError{}) { + break + } + } + if err != nil { + if o.ForceNewRepo || !errors.Is(err, git.ErrRepositoryAlreadyExists) { + return nil, fmt.Errorf("git clone: %w", err) + } + + repo, err = git.PlainOpen(dir) + if err != nil { + return nil, fmt.Errorf("git clone: found existing repo but failed to open: %w", err) + } + } + + wt, err := repo.Worktree() + if err != nil { + return nil, fmt.Errorf("prepare git worktree: %w", err) + } + + if ref != "" && regGitHashRef.MatchString(ref) { + var h plumbing.Hash + if len(ref) == 40 { + h = plumbing.NewHash(ref) + } else { + // Try slow path. + hp, err := hex.DecodeString(ref[:len(ref)&^1]) + if err != nil { + return nil, fmt.Errorf("decode given ref: %w", err) + } + hs := retrieveHashesWithPrefix(repo.Storer, hp) + switch { + case len(hs) == 0: + return nil, fmt.Errorf("no matching hash for the given ref: %s", ref) + case len(hs) > 1: + return nil, fmt.Errorf("ambiguous hash for the given ref: %s", ref) + } + h = hs[0] + } + err = wt.Checkout(&git.CheckoutOptions{ + Hash: h, + }) + if err != nil { + return nil, fmt.Errorf("git checkout: %w", err) + } + } + + fs := wt.Filesystem + if subpath != "" { + // If the subpath is given, chroot the filesystem. + fs, err = fs.Chroot(subpath) + if err != nil { + return nil, fmt.Errorf("chroot git worktree's subpath: %w", err) + } + } + + return &ClonedFilesystem{Filesystem: fs}, nil +} + +// retrieveHashesWithPrefix is borrowed from the method expandPartialHash of github.com/go-git/go-git/v5/repository.go, +// which is used to expand the partial hash to the full hash. +func retrieveHashesWithPrefix(s storer.EncodedObjectStorer, hp []byte) []plumbing.Hash { + // Fast path. + type fastIter interface { + HashesWithPrefix(prefix []byte) ([]plumbing.Hash, error) + } + if fi, ok := s.(fastIter); ok { + h, err := fi.HashesWithPrefix(hp) + if err != nil { + return nil + } + return h + } + + // Slow path. + var hashes []plumbing.Hash + si, err := s.IterEncodedObjects(plumbing.AnyObject) + if err != nil { + return nil + } + _ = si.ForEach(func(obj plumbing.EncodedObject) error { + h := obj.Hash() + if bytes.HasPrefix(h[:], hp) { + hashes = append(hashes, h) + } + return nil + }) + return hashes +} diff --git a/pkg/vcs/helper.go b/pkg/vcs/helper.go new file mode 100644 index 000000000..27f3193c5 --- /dev/null +++ b/pkg/vcs/helper.go @@ -0,0 +1,63 @@ +package vcs + +import ( + "io" + "io/fs" + + "github.com/go-git/go-billy/v5" + "github.com/seal-io/utils/osx" + "github.com/seal-io/utils/pools/bytespool" +) + +var _ fs.ReadFileFS = (*ClonedFilesystem)(nil) + +// ClonedFilesystem ports the fs.FS interface to the billy.Filesystem interface. +type ClonedFilesystem struct { + billy.Filesystem +} + +func (d ClonedFilesystem) Open(name string) (fs.File, error) { + f, err := d.Filesystem.Open(name) + if err != nil { + return nil, err + } + + return ClonedFile{File: f, dir: d.Filesystem}, nil +} + +func (d ClonedFilesystem) ReadDir(name string) ([]fs.DirEntry, error) { + ds, err := d.Filesystem.ReadDir(name) + if err != nil { + return nil, err + } + + r := make([]fs.DirEntry, len(ds)) + for i := range ds { + r[i] = fs.FileInfoToDirEntry(ds[i]) + } + return r, nil +} + +func (d ClonedFilesystem) ReadFile(name string) ([]byte, error) { + f, err := d.Filesystem.Open(name) + if err != nil { + return nil, err + } + defer osx.Close(f) + + buf := bytespool.GetBuffer() + _, err = io.Copy(buf, f) + return buf.Bytes(), err +} + +var _ fs.File = (*ClonedFile)(nil) + +type ClonedFile struct { + billy.File + + dir billy.Filesystem +} + +func (f ClonedFile) Stat() (fs.FileInfo, error) { + return f.dir.Stat(f.Name()) +} diff --git a/pkg/webhook/types.go b/pkg/webhook/types.go new file mode 100644 index 000000000..233b24081 --- /dev/null +++ b/pkg/webhook/types.go @@ -0,0 +1,46 @@ +package webhook + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + ctrladmission "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +type ( + // SetupOptions is the options for setting up a webhook. + SetupOptions struct { + // Manager is the controller-runtime manager. + Manager ctrl.Manager + } + + // Setup is the interface for the webhook setup. + Setup interface { + // SetupWebhook returns the webhook affected object if successful. + // + // SetupWebhook is called before the Cache is started, + // you should not do anything that requires the Cache to be started. + // Instead, you can configure the Cache, like IndexField or something else. + SetupWebhook(context.Context, SetupOptions) (runtime.Object, error) + } +) + +// DefaultCustomValidator implements webhook.CustomValidator, +// which is used to combine and override the required methods. +type DefaultCustomValidator struct{} + +var _ ctrlwebhook.CustomValidator = (*DefaultCustomValidator)(nil) + +func (DefaultCustomValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (ctrladmission.Warnings, error) { + return nil, nil +} + +func (DefaultCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (ctrladmission.Warnings, error) { + return nil, nil +} + +func (DefaultCustomValidator) ValidateDelete(ctx context.Context, obj runtime.Object) (ctrladmission.Warnings, error) { + return nil, nil +} diff --git a/pkg/webhooks/setup.go b/pkg/webhooks/setup.go new file mode 100644 index 000000000..e0f44ee1c --- /dev/null +++ b/pkg/webhooks/setup.go @@ -0,0 +1,182 @@ +package webhooks + +import ( + "context" + "fmt" + "net/http" + + "github.com/davecgh/go-spew/spew" + admreg "k8s.io/api/admissionregistration/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + ctrl "sigs.k8s.io/controller-runtime" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + ctrladmission "sigs.k8s.io/controller-runtime/pkg/webhook/admission" + + "github.com/seal-io/walrus/pkg/clients/clientset" + "github.com/seal-io/walrus/pkg/kubeclientset" + "github.com/seal-io/walrus/pkg/kubeclientset/review" + "github.com/seal-io/walrus/pkg/webhook" + "github.com/seal-io/walrus/pkg/webhooks/walruscore" +) + +// NB(thxCode): Register webhooks below. +var ( + setupers = []webhook.Setup{ + new(walruscore.CatalogWebhook), + new(walruscore.ConnectorWebhook), + new(walruscore.ResourceDefinitionWebhook), + new(walruscore.TemplateWebhook), + } + cfgGetters = []_WebhookConfigurationsGetter{ + walruscore.GetWebhookConfigurations, + } +) + +type ( + _DefaultWebhookHandler interface { + ctrlwebhook.CustomDefaulter + DefaultPath() string + } + _ValidatorWebhookHandler interface { + ctrlwebhook.CustomValidator + ValidatePath() string + } + _WebhookConfigurationsGetter func(string, admreg.WebhookClientConfig) ( + *admreg.ValidatingWebhookConfiguration, + *admreg.MutatingWebhookConfiguration, + ) + HTTPServeMux interface { + Handle(string, http.Handler) + } +) + +func Setup(ctx context.Context, mgr ctrl.Manager, mux HTTPServeMux) error { + scheme := mgr.GetScheme() + for i := range setupers { + switch setupers[i].(type) { + default: + continue + case _DefaultWebhookHandler: + case _ValidatorWebhookHandler: + } + + opts := webhook.SetupOptions{Manager: mgr} + obj, err := setupers[i].SetupWebhook(ctx, opts) + if err != nil { + return fmt.Errorf("webhook setup: %s: %w", spew.Sdump(setupers[i]), err) + } + + if d, ok := setupers[i].(_DefaultWebhookHandler); ok { + dh := ctrladmission.WithCustomDefaulter(scheme, obj, d).WithRecoverPanic(true) + mux.Handle(d.DefaultPath(), dh) + } + if v, ok := setupers[i].(_ValidatorWebhookHandler); ok { + vh := ctrladmission.WithCustomValidator(scheme, obj, v).WithRecoverPanic(true) + mux.Handle(v.ValidatePath(), vh) + } + } + + return nil +} + +// GetWebhookConfigurations returns the registered webhook configuration. +func GetWebhookConfigurations(cc admreg.WebhookClientConfig) (*admreg.ValidatingWebhookConfiguration, *admreg.MutatingWebhookConfiguration) { + // NB(thxCode): add more webhook configurations getters here. + // Merge all the webhook configurations from the getters. + var ( + vret = make([]*admreg.ValidatingWebhookConfiguration, len(cfgGetters)) + vwsc int + mret = make([]*admreg.MutatingWebhookConfiguration, len(cfgGetters)) + mwsc int + ) + for i := range cfgGetters { + vwc, mwc := cfgGetters[i]("walrus-webhook", cc) + if vwc != nil { + vret[i] = vwc + vwsc += len(vwc.Webhooks) + } + if mwc != nil { + mret[i] = mwc + mwsc += len(mwc.Webhooks) + } + } + + var ( + vwc *admreg.ValidatingWebhookConfiguration + mwc *admreg.MutatingWebhookConfiguration + ) + if vwsc != 0 { + vwc = &admreg.ValidatingWebhookConfiguration{ + ObjectMeta: meta.ObjectMeta{ + Name: "walrus-webhook-validation", + }, + } + for i := range vret { + if vret[i] == nil { + continue + } + vwc.Webhooks = append(vwc.Webhooks, vret[i].Webhooks...) + } + } + if mwsc != 0 { + mwc = &admreg.MutatingWebhookConfiguration{ + ObjectMeta: meta.ObjectMeta{ + Name: "walrus-webhook-mutation", + }, + } + for i := range mret { + if mret[i] == nil { + continue + } + mwc.Webhooks = append(mwc.Webhooks, mret[i].Webhooks...) + } + } + + return vwc, mwc +} + +// InstallWebhookConfigurations installs the webhook configurations. +func InstallWebhookConfigurations(ctx context.Context, cli clientset.Interface, cc admreg.WebhookClientConfig) error { + err := review.CanDoUpdate(ctx, + cli.AuthorizationV1().SelfSubjectAccessReviews(), + review.Simples{ + { + Group: admreg.SchemeGroupVersion.Group, + Version: admreg.SchemeGroupVersion.Version, + Resource: "validatingwebhookconfigurations", + }, + { + Group: admreg.SchemeGroupVersion.Group, + Version: admreg.SchemeGroupVersion.Version, + Resource: "mutatingwebhookconfigurations", + }, + }, + review.WithCreateIfNotExisted(), + ) + if err != nil { + return err + } + + vwCli := cli.AdmissionregistrationV1().ValidatingWebhookConfigurations() + mwCli := cli.AdmissionregistrationV1().MutatingWebhookConfigurations() + + vwc, mwc := GetWebhookConfigurations(cc) + if vwc != nil { + _, err := kubeclientset.Update(ctx, vwCli, vwc, + kubeclientset.WithCreateIfNotExisted[*admreg.ValidatingWebhookConfiguration]()) + if err != nil { + return fmt.Errorf("install validating webhook configuration %q: %w", + vwc.GetName(), err) + } + } + if mwc != nil { + _, err := kubeclientset.Update(ctx, mwCli, mwc, + kubeclientset.WithCreateIfNotExisted[*admreg.MutatingWebhookConfiguration]()) + if err != nil { + return fmt.Errorf("install mutating webhook configuration %q: %w", + mwc.GetName(), err) + } + } + + return nil +} diff --git a/pkg/webhooks/walruscore/catalog.go b/pkg/webhooks/walruscore/catalog.go new file mode 100644 index 000000000..0544348c6 --- /dev/null +++ b/pkg/webhooks/walruscore/catalog.go @@ -0,0 +1,38 @@ +package walruscore + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + ctrladmission "sigs.k8s.io/controller-runtime/pkg/webhook/admission" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/webhook" +) + +// CatalogWebhook hooks a v1.Catalog object. +// +// +k8s:webhook-gen:validating:group="walruscore.seal.io",version="v1",resource="catalogs",scope="Namespaced" +// +k8s:webhook-gen:validating:operations=["UPDATE","DELETE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10 +type CatalogWebhook struct { + webhook.DefaultCustomValidator +} + +func (r *CatalogWebhook) SetupWebhook(_ context.Context, opts webhook.SetupOptions) (runtime.Object, error) { + return &walruscore.Catalog{}, nil +} + +var _ ctrlwebhook.CustomValidator = (*CatalogWebhook)(nil) + +func (r *CatalogWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} + +func (r *CatalogWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} diff --git a/pkg/webhooks/walruscore/connector.go b/pkg/webhooks/walruscore/connector.go new file mode 100644 index 000000000..9d761236c --- /dev/null +++ b/pkg/webhooks/walruscore/connector.go @@ -0,0 +1,43 @@ +package walruscore + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + ctrladmission "sigs.k8s.io/controller-runtime/pkg/webhook/admission" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/webhook" +) + +// ConnectorWebhook hooks a v1.Connector object. +// +// nolint: lll +// +k8s:webhook-gen:validating:group="walruscore.seal.io",version="v1",resource="connectors",scope="Namespaced" +// +k8s:webhook-gen:validating:operations=["CREATE","UPDATE","DELETE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10 +type ConnectorWebhook struct{} + +func (r *ConnectorWebhook) SetupWebhook(_ context.Context, opts webhook.SetupOptions) (runtime.Object, error) { + return &walruscore.Connector{}, nil +} + +var _ ctrlwebhook.CustomValidator = (*ConnectorWebhook)(nil) + +func (r *ConnectorWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} + +func (r *ConnectorWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} + +func (r *ConnectorWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} diff --git a/pkg/webhooks/walruscore/resource_definition.go b/pkg/webhooks/walruscore/resource_definition.go new file mode 100644 index 000000000..08100071a --- /dev/null +++ b/pkg/webhooks/walruscore/resource_definition.go @@ -0,0 +1,29 @@ +package walruscore + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/webhook" +) + +// ResourceDefinitionWebhook hooks a v1.ResourceDefinition object. +// +// +k8s:webhook-gen:mutating:group="walruscore.seal.io",version="v1",resource="resourcedefinitions",scope="Namespaced" +// +k8s:webhook-gen:mutating:operations=["CREATE","UPDATE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10 +type ResourceDefinitionWebhook struct{} + +func (r *ResourceDefinitionWebhook) SetupWebhook(_ context.Context, opts webhook.SetupOptions) (runtime.Object, error) { + return &walruscore.ResourceDefinition{}, nil +} + +var _ ctrlwebhook.CustomDefaulter = (*ResourceDefinitionWebhook)(nil) + +func (r *ResourceDefinitionWebhook) Default(ctx context.Context, obj runtime.Object) error { + // TODO: your logic here + + return nil +} diff --git a/pkg/webhooks/walruscore/template.go b/pkg/webhooks/walruscore/template.go new file mode 100644 index 000000000..471ced9cc --- /dev/null +++ b/pkg/webhooks/walruscore/template.go @@ -0,0 +1,38 @@ +package walruscore + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + ctrlwebhook "sigs.k8s.io/controller-runtime/pkg/webhook" + ctrladmission "sigs.k8s.io/controller-runtime/pkg/webhook/admission" + + walruscore "github.com/seal-io/walrus/pkg/apis/walruscore/v1" + "github.com/seal-io/walrus/pkg/webhook" +) + +// TemplateWebhook hooks a v1.Template object. +// +// +k8s:webhook-gen:validating:group="walruscore.seal.io",version="v1",resource="templates",scope="Namespaced" +// +k8s:webhook-gen:validating:operations=["UPDATE","DELETE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10 +type TemplateWebhook struct { + webhook.DefaultCustomValidator +} + +func (r *TemplateWebhook) SetupWebhook(_ context.Context, opts webhook.SetupOptions) (runtime.Object, error) { + return &walruscore.Template{}, nil +} + +var _ ctrlwebhook.CustomValidator = (*TemplateWebhook)(nil) + +func (r *TemplateWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} + +func (r *TemplateWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (ctrladmission.Warnings, error) { + // TODO: your logic here + + return nil, nil +} diff --git a/pkg/webhooks/walruscore/zz_generated.webhooks.go b/pkg/webhooks/walruscore/zz_generated.webhooks.go new file mode 100644 index 000000000..51a60ade4 --- /dev/null +++ b/pkg/webhooks/walruscore/zz_generated.webhooks.go @@ -0,0 +1,242 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package walruscore + +import ( + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" +) + +func GetWebhookConfigurations(np string, c v1.WebhookClientConfig) (*v1.ValidatingWebhookConfiguration, *v1.MutatingWebhookConfiguration) { + vwc := GetValidatingWebhookConfiguration(np+"-validation", c) + mwc := GetMutatingWebhookConfiguration(np+"-mutation", c) + return vwc, mwc +} + +func GetValidatingWebhookConfiguration(n string, c v1.WebhookClientConfig) *v1.ValidatingWebhookConfiguration { + return &v1.ValidatingWebhookConfiguration{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "admissionregistration.k8s.io/v1", + Kind: "ValidatingWebhookConfiguration", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: n, + }, + Webhooks: []v1.ValidatingWebhook{ + vwh_walrus_pkg_webhooks_walruscore_CatalogWebhook(c), + vwh_walrus_pkg_webhooks_walruscore_ConnectorWebhook(c), + vwh_walrus_pkg_webhooks_walruscore_TemplateWebhook(c), + }, + } +} + +func GetMutatingWebhookConfiguration(n string, c v1.WebhookClientConfig) *v1.MutatingWebhookConfiguration { + return &v1.MutatingWebhookConfiguration{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "admissionregistration.k8s.io/v1", + Kind: "MutatingWebhookConfiguration", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: n, + }, + Webhooks: []v1.MutatingWebhook{ + mwh_walrus_pkg_webhooks_walruscore_ResourceDefinitionWebhook(c), + }, + } +} + +func (*CatalogWebhook) ValidatePath() string { + return "/validate-walruscore-seal-io-v1-catalog" +} + +func vwh_walrus_pkg_webhooks_walruscore_CatalogWebhook(c v1.WebhookClientConfig) v1.ValidatingWebhook { + path := "/validate-walruscore-seal-io-v1-catalog" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.ValidatingWebhook{ + Name: "validate.walruscore.seal.io.v1.catalog", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "walruscore.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "catalogs", + }, + Scope: ptr.To[v1.ScopeType]("Namespaced"), + }, + Operations: []v1.OperationType{ + "UPDATE", + "DELETE", + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + } +} + +func (*ConnectorWebhook) ValidatePath() string { + return "/validate-walruscore-seal-io-v1-connector" +} + +func vwh_walrus_pkg_webhooks_walruscore_ConnectorWebhook(c v1.WebhookClientConfig) v1.ValidatingWebhook { + path := "/validate-walruscore-seal-io-v1-connector" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.ValidatingWebhook{ + Name: "validate.walruscore.seal.io.v1.connector", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "walruscore.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "connectors", + }, + Scope: ptr.To[v1.ScopeType]("Namespaced"), + }, + Operations: []v1.OperationType{ + "CREATE", + "UPDATE", + "DELETE", + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + } +} + +func (*ResourceDefinitionWebhook) DefaultPath() string { + return "/mutate-walruscore-seal-io-v1-resourcedefinition" +} + +func mwh_walrus_pkg_webhooks_walruscore_ResourceDefinitionWebhook(c v1.WebhookClientConfig) v1.MutatingWebhook { + path := "/mutate-walruscore-seal-io-v1-resourcedefinition" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.MutatingWebhook{ + Name: "mutate.walruscore.seal.io.v1.resourcedefinition", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "walruscore.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "resourcedefinitions", + }, + Scope: ptr.To[v1.ScopeType]("Namespaced"), + }, + Operations: []v1.OperationType{ + "CREATE", + "UPDATE", + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + } +} + +func (*TemplateWebhook) ValidatePath() string { + return "/validate-walruscore-seal-io-v1-template" +} + +func vwh_walrus_pkg_webhooks_walruscore_TemplateWebhook(c v1.WebhookClientConfig) v1.ValidatingWebhook { + path := "/validate-walruscore-seal-io-v1-template" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.ValidatingWebhook{ + Name: "validate.walruscore.seal.io.v1.template", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "walruscore.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "templates", + }, + Scope: ptr.To[v1.ScopeType]("Namespaced"), + }, + Operations: []v1.OperationType{ + "UPDATE", + "DELETE", + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + } +} diff --git a/staging/github.com/seal-io/code-generator/LICENSE b/staging/github.com/seal-io/code-generator/LICENSE new file mode 100644 index 000000000..aedc3770a --- /dev/null +++ b/staging/github.com/seal-io/code-generator/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2023 Seal, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/staging/github.com/seal-io/code-generator/README.md b/staging/github.com/seal-io/code-generator/README.md new file mode 100644 index 000000000..6980d6140 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/README.md @@ -0,0 +1,23 @@ +# code-generator + +Golang code-generators used to implement [Kubernetes-style API types](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md). + +## Purpose + +Extend [k8s.io/code-generator](https://github.com/kubernetes/code-generator) to support the following: + +- [CRD Gen](./cmd/crd-gen): Code generators for the CRD (Custom Resource Definition) API. + +# License + +Copyright (c) 2024 [Seal, Inc.](https://seal.io) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [LICENSE](../../LICENSE) file for details. + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/README.md b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/README.md new file mode 100644 index 000000000..d2670b9cf --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/README.md @@ -0,0 +1,34 @@ +# APIRegistration Gen + +This directory contains the code generators for the APIService API. + +# Marker Usage + +- Package Markers + - `+groupName=example.domain.io`: Specify the group name. + - `+versionName=v1`: Specify the version. + - `+k8s:apireg-gen:service:insecureSkipTLSVerify=,groupPriorityMinimum=,versionPriority=`: Specify the configuration + of the APIService. + - `insecureSkipTLSVerify`: Select from `true` or `false`, default is `false`. + - `groupPriorityMinimum`: Specify the minimum priority of the group, must between 0 and 2000, default is `100`. + - `versionPriority`: Specify the priority of the version, must not be negative, default is `100`. +- Type Markers + - `+k8s:apireg-gen:resource:scope="Namespaced",categories=["..."],shortName=["..."],plural="...",subResources=["status","scale"]`: + Specify the resource. + - `scope`: Select from `Namespaced` or `Cluster`. + - `categories`, `shortName` and `subResources`: Specify in the JSON array format. + - `subResources` only supports `status` and `scale`. + +# License + +Copyright (c) 2024 [Seal, Inc.](https://seal.io) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [LICENSE](../../LICENSE) file for details. + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/args/args.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/args/args.go new file mode 100644 index 000000000..9b57aff04 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/args/args.go @@ -0,0 +1,36 @@ +package args + +import ( + "fmt" + + "github.com/spf13/pflag" + "k8s.io/gengo/args" +) + +// CustomArgs is used by the gengo framework to pass args specific to this generator. +type CustomArgs struct{} + +// NewDefaults returns default arguments for the generator. +func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { + genericArgs := args.Default().WithoutDefaultFlagParsing() + + customArgs := &CustomArgs{} + genericArgs.CustomArgs = customArgs + + genericArgs.OutputFileBaseName = "apireg_generated" + + return genericArgs, customArgs +} + +// AddFlags add the generator flags to the flag set. +func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { +} + +// Validate checks the given arguments. +func Validate(genericArgs *args.GeneratorArgs) error { + if _, ok := genericArgs.CustomArgs.(*CustomArgs); !ok { + return fmt.Errorf("expected CustomArgs to be of type %T", &CustomArgs{}) + } + + return nil +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/apireg.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/apireg.go new file mode 100644 index 000000000..bd7678a4f --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/apireg.go @@ -0,0 +1,283 @@ +package generators + +import ( + "io" + "slices" + "strings" + + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" + apireg "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +func NewAPIRegGen(sanitizedName, outputPackage string) generator.Generator { + return &apiRegGen{ + DefaultGen: generator.DefaultGen{ + OptionalName: sanitizedName, + }, + outputPackage: outputPackage, + imports: generator.NewImportTrackerForPackage(outputPackage), + } +} + +type ( + APIServiceDefinition = apireg.APIService + APIResourceDefinition struct { + Scope string + Categories []string + ShortNames []string + Kind string + Singular string + Plural string + SubResources []string + } +) + +type apiRegGen struct { + generator.DefaultGen + + outputPackage string + imports namer.ImportTracker + + pkgDef *APIServiceDefinition + types []*types.Type + typeDefs map[types.Name]*APIResourceDefinition +} + +func (g *apiRegGen) Filter(c *generator.Context, t *types.Type) bool { + if t.Kind == types.Struct && t.Name.Package == g.outputPackage { + g.pkgDef = reflectPackage(c.Universe[g.outputPackage]) + if g.pkgDef == nil { + return false + } + + if td := reflectType(t); td != nil { + if g.typeDefs == nil { + g.typeDefs = map[types.Name]*APIResourceDefinition{} + } + + g.types = append(g.types, t) + g.typeDefs[t.Name] = td + } + return true + } + return false +} + +func (g *apiRegGen) Namers(c *generator.Context) namer.NameSystems { + return namer.NameSystems{ + // Have the raw namer for this file track what it imports. + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "private": &namer.NameStrategy{ + Join: func(pre string, in []string, post string) string { + return strings.Join(in, "_") + }, + PrependPackageNames: 4, + }, + } +} + +func (g *apiRegGen) isOtherPackage(pkg string) bool { + switch { + default: + return true + case pkg == g.outputPackage: + case strings.HasSuffix(pkg, `"`+g.outputPackage+`"`): + } + return false +} + +func (g *apiRegGen) Imports(c *generator.Context) []string { + var pkgs []string + for _, pkg := range g.imports.ImportLines() { + if g.isOtherPackage(pkg) { + pkgs = append(pkgs, pkg) + } + } + return pkgs +} + +func (g *apiRegGen) Init(c *generator.Context, w io.Writer) error { + args := getAPIServiceTypedArgs() + sw := generator.NewSnippetWriter(w, c, "$", "$") + + // START: Interfaces + sw.Do("type (\n", nil) + { + sw.Do("WithStatusSubResource interface {\n", nil) + sw.Do("$.ObjectMetaAccessor|raw$\n", args) + sw.Do("$.Object|raw$\n", args) + sw.Do("CopyStatusTo($.Object|raw$)\n", args) + sw.Do("}\n\n", nil) + } + { + sw.Do("WithScaleSubResource interface {\n", nil) + sw.Do("$.ObjectMetaAccessor|raw$\n", args) + sw.Do("$.Object|raw$\n", args) + sw.Do("GetScale() *$.Scale|raw$ // TODO: Main struct needs to implement this. \n", args) + sw.Do("SetScale(*$.Scale|raw$) // TODO: Main struct needs to implement this. \n", args) + sw.Do("}\n\n", nil) + } + sw.Do(")\n\n", nil) + // END: Interfaces + + // START: GetAPIService + sw.Do("func GetAPIService(svc $.ServiceReference|raw$, ca []byte) *$.APIService|raw$ {\n", args) + sw.Do("return &$.APIService|raw${\n", args) + args = args.With("APISERVICE", g.pkgDef) + // START: TypeMeta. + sw.Do("TypeMeta: $.TypeMeta|raw${\n", args) + sw.Do("APIVersion: \"$.APISERVICE.TypeMeta.APIVersion$\",\n", args) + sw.Do("Kind: \"$.APISERVICE.TypeMeta.Kind$\",\n", args) + sw.Do("},\n", nil) + // END: TypeMeta. + // START: ObjectMeta. + sw.Do("ObjectMeta: $.ObjectMeta|raw${\n", args) + sw.Do("Name: \"$.APISERVICE.ObjectMeta.Name$\",\n", args) + sw.Do("},\n", nil) + // END: ObjectMeta. + spec := g.pkgDef.Spec + args = args.With("SPEC", spec) + // START: Spec. + sw.Do("Spec: $.APIServiceSpec|raw${\n", args) + sw.Do("Service: svc.DeepCopy(),\n", args) + sw.Do("Group: \"$.SPEC.Group$\",\n", args) + sw.Do("Version: \"$.SPEC.Version$\",\n", args) + sw.Do("InsecureSkipTLSVerify: $.SPEC.InsecureSkipTLSVerify$,\n", args) + sw.Do("CABundle: $.BytesClone$(ca),\n", args) + sw.Do("GroupPriorityMinimum: $.SPEC.GroupPriorityMinimum$,\n", args) + sw.Do("VersionPriority: $.SPEC.VersionPriority$,\n", args) + sw.Do("},\n", nil) + // END: Spec. + sw.Do("}\n", nil) + sw.Do("}\n\n", nil) + // END: GetAPIService + + return sw.Error() +} + +func (g *apiRegGen) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + res := g.typeDefs[t.Name] + if res == nil { + return nil + } + + args := getAPIResourceTypedArgs().With("TYPE", t) + sw := generator.NewSnippetWriter(w, c, "$", "$") + + // START: rest.Scoper + sw.Do("var _ $.Scoper|raw$ = (*$.TYPE|raw$)(nil)\n", args) + sw.Do("func (*$.TYPE|raw$) NamespaceScoped() bool{\n", args) + sw.Do("return $.$\n", res.Scope == string(apiext.NamespaceScoped)) + sw.Do("}\n\n", nil) + // END: rest.Scoper + + // START: rest.KindProvider + sw.Do("var _ $.KindProvider|raw$ = (*$.TYPE|raw$)(nil)\n", args) + sw.Do("func (*$.TYPE|raw$) Kind() string{\n", args) + sw.Do("return \"$.$\"", res.Kind) + sw.Do("}\n\n", nil) + // END: rest.KindProvider + + // START: rest.SingularNameProvider + sw.Do("var _ $.SingularNameProvider|raw$ = (*$.TYPE|raw$)(nil)\n", args) + sw.Do("func (*$.TYPE|raw$) GetSingularName() string{\n", args) + sw.Do("return \"$.$\"\n", res.Singular) + sw.Do("}\n\n", nil) + // END: rest.SingularNameProvider + + // START: rest.ShortNamesProvider + sw.Do("var _ $.ShortNamesProvider|raw$ = (*$.TYPE|raw$)(nil)\n", args) + sw.Do("func (*$.TYPE|raw$) ShortNames() []string{\n", args) + if len(res.ShortNames) != 0 { + sw.Do("return []string{\n\"$.$\",\n}\n", strings.Join(res.ShortNames, "\",\n \"")) + } else { + sw.Do("return []string{}\n", nil) + } + sw.Do("}\n\n", nil) + // END: rest.ShortNamesProvider + + // START: rest.CategoriesProvider + sw.Do("var _ $.CategoriesProvider|raw$ = (*$.TYPE|raw$)(nil)\n", args) + sw.Do("func (*$.TYPE|raw$) Categories() []string{\n", args) + if len(res.Categories) != 0 { + sw.Do("return []string{\n\"$.$\",\n}\n", strings.Join(res.Categories, "\",\n \"")) + } else { + sw.Do("return []string{}\n", nil) + } + sw.Do("}\n\n", nil) + // END: rest.CategoriesProvider + + // START: subresources + for _, v := range slices.Compact(res.SubResources) { + switch v { + case "status": + sw.Do("var _ WithStatusSubResource = (*$.TYPE|raw$)(nil)\n", args) + if t.Methods == nil || t.Methods["CopyStatusTo"] == nil { + sw.Do("func (in *$.TYPE|raw$) CopyStatusTo(out $.Object|raw$) {\n", args) + sw.Do("out.(*$.TYPE|raw$).Status=in.Status\n", args) + sw.Do("}\n\n", nil) + } + case "scale": + sw.Do("var _ WithScaleSubResource = (*$.TYPE|raw$)(nil)\n", args) + if t.Methods == nil || t.Methods["GetScale"] == nil { + sw.Do("func (in *$.TYPE|raw$) GetScale() *$.Scale|raw$ {\n", args) + sw.Do("// TODO: Move me to definition file\n", nil) + sw.Do("return &$.Scale|raw${}\n", args) + sw.Do("}\n\n", nil) + } + if t.Methods == nil || t.Methods["SetScale"] == nil { + sw.Do("func (in *$.TYPE|raw$) SetScale(s *$.Scale|raw$) {\n", args) + sw.Do("// TODO: Move me to definition file \n", nil) + sw.Do("}\n\n", nil) + } + } + } + // END: subresources + + return sw.Error() +} + +const ( + pkgUtilPtr = "k8s.io/utils/ptr" + pkgUtilBytes = "bytes" + pkgAPIMachineryMetadata = "k8s.io/apimachinery/pkg/apis/meta/v1" + pkgAPIMachineryRuntimeSchema = "k8s.io/apimachinery/pkg/runtime/schema" + pkgAPIMachineryRuntime = "k8s.io/apimachinery/pkg/runtime" + pkgTypeAPIRegistration = "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + pkgTypeAutoscaling = "k8s.io/api/autoscaling/v1" + pkgAPIServerRest = "k8s.io/apiserver/pkg/registry/rest" +) + +func getAPIServiceTypedArgs() generator.Args { + return generator.Args{ + "BytesClone": types.Ref(pkgUtilBytes, "Clone"), + "TypeMeta": types.Ref(pkgAPIMachineryMetadata, "TypeMeta"), + "ObjectMeta": types.Ref(pkgAPIMachineryMetadata, "ObjectMeta"), + "ObjectMetaAccessor": types.Ref(pkgAPIMachineryMetadata, "ObjectMetaAccessor"), + "Object": types.Ref(pkgAPIMachineryRuntime, "Object"), + "APIService": types.Ref(pkgTypeAPIRegistration, "APIService"), + "APIServiceSpec": types.Ref(pkgTypeAPIRegistration, "APIServiceSpec"), + "ServiceReference": types.Ref(pkgTypeAPIRegistration, "ServiceReference"), + "Scale": types.Ref(pkgTypeAutoscaling, "Scale"), + } +} + +func getAPIResourceTypedArgs() generator.Args { + return generator.Args{ + "PtrTo": types.Ref(pkgUtilPtr, "To"), + "TypeMeta": types.Ref(pkgAPIMachineryMetadata, "TypeMeta"), + "ObjectMeta": types.Ref(pkgAPIMachineryMetadata, "ObjectMeta"), + "ObjectMetaAccessor": types.Ref(pkgAPIMachineryMetadata, "ObjectMetaAccessor"), + "GroupVersionResource": types.Ref(pkgAPIMachineryRuntimeSchema, "GroupVersionResource"), + "Object": types.Ref(pkgAPIMachineryRuntime, "Object"), + "Scale": types.Ref(pkgTypeAutoscaling, "Scale"), + "Scoper": types.Ref(pkgAPIServerRest, "Scoper"), + "KindProvider": types.Ref(pkgAPIServerRest, "KindProvider"), + "SingularNameProvider": types.Ref(pkgAPIServerRest, "SingularNameProvider"), + "ShortNamesProvider": types.Ref(pkgAPIServerRest, "ShortNamesProvider"), + "CategoriesProvider": types.Ref(pkgAPIServerRest, "CategoriesProvider"), + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/apireg_test.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/apireg_test.go new file mode 100644 index 000000000..f8ae2e3bf --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/apireg_test.go @@ -0,0 +1,64 @@ +package generators + +import ( + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/gengo/args" + "k8s.io/gengo/generator" + + apireggenargs "github.com/seal-io/code-generator/cmd/apireg-gen/args" +) + +func Test_apiregGen(t *testing.T) { + var ( + dir = filepath.Join("testdata", "apireg_gen") + pkg = "github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen" + ) + + g := args.GeneratorArgs{ + InputDirs: []string{pkg}, + OutputBase: filepath.Join("testdata", "apireg_gen"), + OutputFileBaseName: "zz_generated.apiservice", + GoHeaderFilePath: filepath.Join(dir, "go.txt"), + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &apireggenargs.CustomArgs{}, + } + + err := g.Execute( + NameSystems(), + DefaultNameSystem(), + func(ctx *generator.Context, args *args.GeneratorArgs) generator.Packages { + packages := Packages(ctx, args) + + for i := range packages { + p, ok := packages[i].(*generator.DefaultPackage) + if !ok { + continue + } + + p.PackagePath = strings.TrimPrefix(p.PackagePath, pkg) + packages[i] = p + } + + return packages + }) + if err != nil { + t.Fatalf("failed to execute apireg-gen: %v", err) + } + + actualBytes, err := os.ReadFile(filepath.Join(dir, "zz_generated.apiservice.go")) + if err != nil { + t.Fatalf("failed to read actual file: %v", err) + } + + expectedBytes, err := os.ReadFile(filepath.Join(dir, "zz_generated.apiservice.go.expected")) + if err != nil { + t.Fatalf("failed to read expected file: %v", err) + } + + assert.Equal(t, string(expectedBytes), string(actualBytes)) +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/helper.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/helper.go new file mode 100644 index 000000000..f1c09bcb8 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/helper.go @@ -0,0 +1,218 @@ +package generators + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/seal-io/utils/stringx" + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/gengo/types" + "k8s.io/klog/v2" + apireg "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + + "github.com/seal-io/code-generator/utils" +) + +// reflectPackage reflects the given package into a APIServiceDefinition, +// according to the given package. +func reflectPackage(p *types.Package) *APIServiceDefinition { + if p == nil { + return nil + } + + logger := klog.Background(). + WithName("$"). + WithValues("gen", "apireg-gen", "package", p.Path) + + // Collect package markers. + // + // +groupName= + // +versionName= + // +k8s:apireg-gen:service:insecureSkipTLSVerify=,groupPriorityMinimum=,versionPriority= + pm := map[string][]string{} + collectMarkers(p.Comments, pm) + + if len(pm) == 0 || len(pm["group"]) == 0 || len(pm["version"]) == 0 { + return nil + } + + var ( + group = pm["group"][len(pm["group"])-1] + version = pm["version"][len(pm["version"])-1] + ) + + apisvc := apireg.APIService{ + TypeMeta: meta.TypeMeta{ + APIVersion: apireg.SchemeGroupVersion.String(), + Kind: "APIService", + }, + ObjectMeta: meta.ObjectMeta{ + Name: fmt.Sprintf("%s.%s", version, group), + }, + Spec: apireg.APIServiceSpec{ + Group: group, + Version: version, + InsecureSkipTLSVerify: false, + GroupPriorityMinimum: 100, + VersionPriority: 100, + }, + } + + for _, svc := range pm["service"] { + logger := logger.WithValues("markers", "service") + + for mk, mv := range utils.ParseMarker(svc) { + switch mk { + case "insecureSkipTLSVerify": + if err := json.Unmarshal([]byte(mv), &apisvc.Spec.InsecureSkipTLSVerify); err != nil { + logger.Error(nil, "unmarshal insecureSkipTLSVerify", "value", mv) + } + case "groupPriorityMinimum": + var v int32 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(nil, "unmarshal groupPriorityMinimum", "value", mv) + case v <= 0 || v >= 2000: + logger.Error(nil, "invalid groupPriorityMinimum range, must between 0 and 2000", "value", mv) + default: + apisvc.Spec.GroupPriorityMinimum = v + } + case "versionPriority": + var v int32 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(nil, "unmarshal versionPriority", "value", mv) + case v < 0: + logger.Error(nil, "invalid versionPriority, must not be negative", "value", mv) + default: + apisvc.Spec.VersionPriority = v + } + } + } + } + + return &apisvc +} + +var knownScopes = sets.New(string(apiext.NamespaceScoped), string(apiext.ClusterScoped)) + +// reflectType reflects the given type into a APIResourceDefinition, +// according to the given type. +func reflectType(t *types.Type) *APIResourceDefinition { + if t == nil { + return nil + } + + logger := klog.Background(). + WithName("$"). + WithValues("gen", "apireg-gen", "type", t.String()) + + var ( + kind = t.Name.Name + singular = strings.ToLower(kind) + plural = strings.ToLower(stringx.Pluralize(kind)) + ) + + apires := APIResourceDefinition{ + Kind: kind, + Singular: singular, + } + + // Collect type markers. + // + // +k8s:apireg-gen:resource:scope=,categories=,shortName=,plural=,subResources= + tm := map[string][]string{} + collectMarkers(t.SecondClosestCommentLines, tm) + collectMarkers(t.CommentLines, tm) + + if len(tm) == 0 || len(tm["resource"]) == 0 { + return nil + } + + for _, res := range tm["resource"] { + logger := logger.WithValues("markers", "resource") + + for mk, mv := range utils.ParseMarker(res) { + switch mk { + case "scope": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal scope", "value", mv) + case !knownScopes.Has(v): + logger.Error(nil, "invalid scope, select from known scopes", "value", mv) + default: + apires.Scope = v + } + case "categories": + if err := json.Unmarshal([]byte(mv), &apires.Categories); err != nil { + logger.Error(nil, "unmarshal categories", "value", mv) + } + case "shortName": + if err := json.Unmarshal([]byte(mv), &apires.ShortNames); err != nil { + logger.Error(nil, "unmarshal shortName", "value", mv) + } + case "plural": + if err := json.Unmarshal([]byte(mv), &apires.Plural); err != nil { + logger.Error(nil, "unmarshal plural", "value", mv) + } + case "subResources": + if err := json.Unmarshal([]byte(mv), &apires.SubResources); err != nil { + logger.Error(nil, "unmarshal subResources", "value", mv) + } + } + } + } + if apires.Scope == "" { + apires.Scope = string(apiext.NamespaceScoped) + } + if apires.Plural == "" { + apires.Plural = plural + } + + return &apires +} + +const ( + groupMarker = "+groupName=" + versionMarker = "+versionName=" + apiregGenMarker = "+k8s:apireg-gen:" +) + +// collectMarkers collects markers from the given comments into a map. +func collectMarkers(comments []string, into map[string][]string) { + for _, line := range comments { + line = strings.TrimSpace(line) + if len(line) == 0 { + continue + } + + switch { + default: + if !strings.HasPrefix(line, "+") { + into["comment"] = append(into["comment"], line) + } + case strings.HasPrefix(line, groupMarker): + if v := line[len(groupMarker):]; v != "" { + into["group"] = append(into["group"], v) + } + case strings.HasPrefix(line, versionMarker): + if v := line[len(versionMarker):]; v != "" { + into["version"] = append(into["version"], v) + } + case strings.HasPrefix(line, apiregGenMarker): + kv := strings.SplitN(line[len(apiregGenMarker):], ":", 2) + if len(kv) == 2 { + into[kv[0]] = append(into[kv[0]], kv[1]) + } else if len(kv) == 1 { + into[kv[0]] = append(into[kv[0]], "") + } + } + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/helper_test.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/helper_test.go new file mode 100644 index 000000000..7ad832f6b --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/helper_test.go @@ -0,0 +1,42 @@ +package generators + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/gengo/parser" + "sigs.k8s.io/yaml" +) + +func Test_reflectPackage(t *testing.T) { + var ( + dir = filepath.Join("testdata", "reflect_package") + pkg = "github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package" + ) + + b := parser.New() + if err := b.AddDir(pkg); err != nil { + t.Fatalf("failed to parse package %q: %v", pkg, err) + } + + u, err := b.FindTypes() + if err != nil { + t.Fatalf("failed to find types: %v", err) + } + + td := reflectPackage(u.Package(pkg)) + + actualBytes, err := yaml.Marshal(td) + if err != nil { + t.Fatalf("failed to marshal type definition: %v", err) + } + + expectedBytes, err := os.ReadFile(filepath.Join(dir, "expected.yaml")) + if err != nil { + t.Fatalf("failed to read expected file: %v", err) + } + + assert.Equal(t, string(expectedBytes), string(actualBytes)) +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/packages.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/packages.go new file mode 100644 index 000000000..fc53fcb8b --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/packages.go @@ -0,0 +1,70 @@ +package generators + +import ( + "fmt" + "strings" + + "k8s.io/gengo/args" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/klog/v2" +) + +// NameSystems returns the name system used by the generators in this package. +func NameSystems() namer.NameSystems { + return namer.NameSystems{ + "public": namer.NewPublicNamer(0), + } +} + +// DefaultNameSystem returns the default name system for ordering the types to be +// processed by the generators in this package. +func DefaultNameSystem() string { + return "public" +} + +func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { + boilerplate, err := arguments.LoadGoBoilerplate() + if err != nil { + klog.Fatalf("Failed loading boilerplate: %v", err) + } + + packages := generator.Packages{} + header := append([]byte(fmt.Sprintf("//go:build !%s\n// +build !%s\n\n", arguments.GeneratedBuildTag, arguments.GeneratedBuildTag)), boilerplate...) + + for i := range context.Inputs { + klog.V(5).Infof("considering pkg %q", context.Inputs[i]) + pkg := context.Universe[context.Inputs[i]] + if pkg == nil { + // If the input had no Go files, for example. + continue + } + + path := pkg.Path + // If the source path is within a /vendor/ directory (for example, + // k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow + // generation to output to the proper relative path (under vendor). + // Otherwise, the generator will create the file in the wrong location + // in the output directory. + if strings.HasPrefix(pkg.SourcePath, arguments.OutputBase) { + expandedPath := strings.TrimPrefix(pkg.SourcePath, arguments.OutputBase) + if strings.HasPrefix(expandedPath, "/vendor/") { + path = expandedPath + } + } + + packages = append(packages, + &generator.DefaultPackage{ + PackageName: pkg.Name, + PackagePath: path, + HeaderText: header, + GeneratorFunc: func(c *generator.Context) []generator.Generator { + return []generator.Generator{ + NewAPIRegGen(arguments.OutputFileBaseName, path), + } + }, + }) + } + + return packages +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/doc.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/doc.go new file mode 100644 index 000000000..6b944655c --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/doc.go @@ -0,0 +1,6 @@ +// Package apireg_gen is the group of the API. +// +// +groupName=server.walrus.seal.io +// +versionName=v1 +// +k8s:apireg-gen:service:insecureSkipTLSVerify=true,groupPriorityMinimum=1000,versionPriority=100 +package apireg_gen diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/dummy.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/dummy.go new file mode 100644 index 000000000..5efa8967d --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/dummy.go @@ -0,0 +1,37 @@ +package apireg_gen + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// Dummy is the schema for the projects API. +// +// +k8s:apireg-gen:resource:categories=["all","walrus"],scope="Cluster",shortName=["proj"],plural="projects",subResources=["status","scale","others"] +type Dummy struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec DummySpec `json:"spec,omitempty"` + Status DummyStatus `json:"status,omitempty"` +} + +// DummySpec defines the desired state of Dummy. +type DummySpec struct { +} + +// DummyStatus defines the observed state of Dummy. +type DummyStatus struct { +} + +var _ runtime.Object = (*DummyList)(nil) + +// DummyList holds the list of Dummy. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DummyList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + + Items []Dummy `json:"items"` +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/dummy_others.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/dummy_others.go new file mode 100644 index 000000000..263024b32 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/dummy_others.go @@ -0,0 +1,12 @@ +package apireg_gen + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// DummyOthers is the schema for the dummy sub resources API. +// +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type DummyOthers struct { + meta.TypeMeta `json:",inline"` +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/go.txt b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/go.txt new file mode 100644 index 000000000..e9f9a7eec --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/go.txt @@ -0,0 +1,4 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.apiservice.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.apiservice.go new file mode 100644 index 000000000..55f6faab4 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.apiservice.go @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. +package apireg_gen + +import ( + "bytes" + + autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + rest "k8s.io/apiserver/pkg/registry/rest" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +type ( + WithStatusSubResource interface { + v1.ObjectMetaAccessor + runtime.Object + CopyStatusTo(runtime.Object) + } + + WithScaleSubResource interface { + v1.ObjectMetaAccessor + runtime.Object + GetScale() *autoscalingv1.Scale // TODO: Main struct needs to implement this. + SetScale(*autoscalingv1.Scale) // TODO: Main struct needs to implement this. + } +) + +func GetAPIService(svc apiregistrationv1.ServiceReference, ca []byte) *apiregistrationv1.APIService { + return &apiregistrationv1.APIService{ + TypeMeta: v1.TypeMeta{ + APIVersion: "apiregistration.k8s.io/v1", + Kind: "APIService", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "v1.server.walrus.seal.io", + }, + Spec: apiregistrationv1.APIServiceSpec{ + Service: svc.DeepCopy(), + Group: "server.walrus.seal.io", + Version: "v1", + InsecureSkipTLSVerify: true, + CABundle: bytes.Clone(ca), + GroupPriorityMinimum: 1000, + VersionPriority: 100, + }, + } +} + +var _ rest.Scoper = (*Dummy)(nil) + +func (*Dummy) NamespaceScoped() bool { + return false +} + +var _ rest.KindProvider = (*Dummy)(nil) + +func (*Dummy) Kind() string { + return "Dummy" +} + +var _ rest.SingularNameProvider = (*Dummy)(nil) + +func (*Dummy) GetSingularName() string { + return "dummy" +} + +var _ rest.ShortNamesProvider = (*Dummy)(nil) + +func (*Dummy) ShortNames() []string { + return []string{ + "proj", + } +} + +var _ rest.CategoriesProvider = (*Dummy)(nil) + +func (*Dummy) Categories() []string { + return []string{ + "all", + "walrus", + } +} + +var _ WithStatusSubResource = (*Dummy)(nil) + +func (in *Dummy) CopyStatusTo(out runtime.Object) { + out.(*Dummy).Status = in.Status +} + +var _ WithScaleSubResource = (*Dummy)(nil) + +func (in *Dummy) GetScale() *autoscalingv1.Scale { + // TODO: Move me to definition file + return &autoscalingv1.Scale{} +} + +func (in *Dummy) SetScale(s *autoscalingv1.Scale) { + // TODO: Move me to definition file +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.apiservice.go.expected b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.apiservice.go.expected new file mode 100644 index 000000000..55f6faab4 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.apiservice.go.expected @@ -0,0 +1,106 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. +package apireg_gen + +import ( + "bytes" + + autoscalingv1 "k8s.io/api/autoscaling/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + rest "k8s.io/apiserver/pkg/registry/rest" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" +) + +type ( + WithStatusSubResource interface { + v1.ObjectMetaAccessor + runtime.Object + CopyStatusTo(runtime.Object) + } + + WithScaleSubResource interface { + v1.ObjectMetaAccessor + runtime.Object + GetScale() *autoscalingv1.Scale // TODO: Main struct needs to implement this. + SetScale(*autoscalingv1.Scale) // TODO: Main struct needs to implement this. + } +) + +func GetAPIService(svc apiregistrationv1.ServiceReference, ca []byte) *apiregistrationv1.APIService { + return &apiregistrationv1.APIService{ + TypeMeta: v1.TypeMeta{ + APIVersion: "apiregistration.k8s.io/v1", + Kind: "APIService", + }, + ObjectMeta: v1.ObjectMeta{ + Name: "v1.server.walrus.seal.io", + }, + Spec: apiregistrationv1.APIServiceSpec{ + Service: svc.DeepCopy(), + Group: "server.walrus.seal.io", + Version: "v1", + InsecureSkipTLSVerify: true, + CABundle: bytes.Clone(ca), + GroupPriorityMinimum: 1000, + VersionPriority: 100, + }, + } +} + +var _ rest.Scoper = (*Dummy)(nil) + +func (*Dummy) NamespaceScoped() bool { + return false +} + +var _ rest.KindProvider = (*Dummy)(nil) + +func (*Dummy) Kind() string { + return "Dummy" +} + +var _ rest.SingularNameProvider = (*Dummy)(nil) + +func (*Dummy) GetSingularName() string { + return "dummy" +} + +var _ rest.ShortNamesProvider = (*Dummy)(nil) + +func (*Dummy) ShortNames() []string { + return []string{ + "proj", + } +} + +var _ rest.CategoriesProvider = (*Dummy)(nil) + +func (*Dummy) Categories() []string { + return []string{ + "all", + "walrus", + } +} + +var _ WithStatusSubResource = (*Dummy)(nil) + +func (in *Dummy) CopyStatusTo(out runtime.Object) { + out.(*Dummy).Status = in.Status +} + +var _ WithScaleSubResource = (*Dummy)(nil) + +func (in *Dummy) GetScale() *autoscalingv1.Scale { + // TODO: Move me to definition file + return &autoscalingv1.Scale{} +} + +func (in *Dummy) SetScale(s *autoscalingv1.Scale) { + // TODO: Move me to definition file +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.deepcopy.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.deepcopy.go new file mode 100644 index 000000000..04b10c25c --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.deepcopy.go @@ -0,0 +1,131 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package apireg_gen + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Dummy) DeepCopyInto(out *Dummy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dummy. +func (in *Dummy) DeepCopy() *Dummy { + if in == nil { + return nil + } + out := new(Dummy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Dummy) 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 *DummyList) DeepCopyInto(out *DummyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Dummy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DummyList. +func (in *DummyList) DeepCopy() *DummyList { + if in == nil { + return nil + } + out := new(DummyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DummyList) 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 *DummySpec) DeepCopyInto(out *DummySpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DummySpec. +func (in *DummySpec) DeepCopy() *DummySpec { + if in == nil { + return nil + } + out := new(DummySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DummyStatus) DeepCopyInto(out *DummyStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DummyStatus. +func (in *DummyStatus) DeepCopy() *DummyStatus { + if in == nil { + return nil + } + out := new(DummyStatus) + in.DeepCopyInto(out) + return out +} + + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DummyOthers) DeepCopyInto(out *DummyOthers) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DummyOthers. +func (in *DummyOthers) DeepCopy() *DummyOthers { + if in == nil { + return nil + } + out := new(DummyOthers) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DummyOthers) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} \ No newline at end of file diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.register.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.register.go new file mode 100644 index 000000000..7d8683537 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/apireg_gen/zz_generated.register.go @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus", DO NOT EDIT. + +package apireg_gen + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "manager.walrus.seal.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1"} + +// SchemeGroupVersion is group version used to register these objects. +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// SchemeResource takes an unqualified resource and returns a Group qualified GroupResource. +func SchemeResource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Dummy{}, + &DummyList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package/doc.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package/doc.go new file mode 100644 index 000000000..2fcca3dc3 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package/doc.go @@ -0,0 +1,6 @@ +// Package reflect_package is the group of the API. +// +// +groupName=server.walrus.seal.io +// +versionName=v1 +// +k8s:apireg-gen:service:insecureSkipTLSVerify=true +package reflect_package diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package/expected.yaml b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package/expected.yaml new file mode 100644 index 000000000..760f8587c --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/generators/testdata/reflect_package/expected.yaml @@ -0,0 +1,12 @@ +apiVersion: apiregistration.k8s.io/v1 +kind: APIService +metadata: + creationTimestamp: null + name: v1.server.walrus.seal.io +spec: + group: server.walrus.seal.io + groupPriorityMinimum: 100 + insecureSkipTLSVerify: true + version: v1 + versionPriority: 100 +status: {} diff --git a/staging/github.com/seal-io/code-generator/cmd/apireg-gen/main.go b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/main.go new file mode 100644 index 000000000..b50bd8973 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/apireg-gen/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "flag" + + "github.com/spf13/pflag" + "k8s.io/klog/v2" + + generatorargs "github.com/seal-io/code-generator/cmd/apireg-gen/args" + "github.com/seal-io/code-generator/cmd/apireg-gen/generators" +) + +func main() { + klog.InitFlags(nil) + genericArgs, customArgs := generatorargs.NewDefaults() + + genericArgs.AddFlags(pflag.CommandLine) + customArgs.AddFlags(pflag.CommandLine) + _ = flag.Set("logtostderr", "true") + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) + pflag.Parse() + + if err := generatorargs.Validate(genericArgs); err != nil { + klog.Fatalf("Error: %v", err) + } + + if err := genericArgs.Execute( + generators.NameSystems(), + generators.DefaultNameSystem(), + generators.Packages, + ); err != nil { + klog.Fatalf("Error: %v", err) + } + + klog.V(2).Info("Completed successfully.") +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/README.md b/staging/github.com/seal-io/code-generator/cmd/crd-gen/README.md new file mode 100644 index 000000000..50766451a --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/README.md @@ -0,0 +1,80 @@ +# CRD Gen + +This directory contains the code generators for the CRD (Custom Resource Definition) API. + +# Marker Usage + +- Package Markers + - `+groupName=example.domain.io`: Specify the group name. + - `+versionName=v1`: Specify the version. +- Type Markers + - `+k8s:crd-gen:resource:scope="Namespaced",categories=["..."],shortName=["..."],plural="...",subResources=["status","scale"]`: + Specify the resource. + - `scope`: Select from `Namespaced` or `Cluster`. + - `categories`, `shortName` and `subResources`: Specify in the JSON array format. + - `subResources` only supports `status` and `scale`. + - `+k8s:crd-gen:printcolumn:name="Name",type="string",jsonPath=".metadata.name",format="string",priority=0`: + Specify the print column, `name`, `type`, `jsonPath` are required. + - `jsonPath`: Specify the JSON path. + - `priority`: Specify in the integer format. +- Field Markers + - `+k8s:validation:default={"name":"abc","age":10}`: Specify the default value of the field, in JSON format. + - do not compatible with `openapi-gen`, please use `+default=` replacing `+k8s:validation:default=` on top of the Field for `openapi-gen`. + - `+k8s:validation:example={"name":"abc","age":10}`: Specify the example value of the field, in JSON format. + - `+k8s:validation:enum=["a","b","c"]`: Specify the enum value of the field, in JSON array format. + - do not compatible with `openapi-gen`, please use `+enum` on top of the enumeration Type for `openapi-gen`. + - `+k8s:validation:maximum=10`: Specify the maximum value of the number field. + - `+k8s:validation:minimum=1`: Specify the minimum value of the number field. + - `+k8s:validation:exclusiveMaximum`: Specify whether be exclusive the minimum value of the number field. + - `+k8s:validation:exclusiveMinimum`: Specify whether be exclusive the minimum value of the number field. + - `+k8s:validation:multipleOf=5`: Specify the basic multiple of the number field. + - `+k8s:validation:maxItems=10`: Specify the maximum items of the array field. + - `+k8s:validation:minItems=1`: Specify the minimum items of the array field. + - `+k8s:validation:uniqueItems=true`: Specify the items of the array field are unique or not. + - `+k8s:validation:maxProperties=true`: Specify the maximum items of the struct/map field. + - `+k8s:validation:minProperties=true`: Specify the minimum items of the struct/map field. + - `+k8s:validation:maxLength=10`: Specify the maximum length of the string field. + - `+k8s:validation:minLength=1`: Specify the minimum length of the string field. + - `+k8s:validation:format="date"`: Specify the format of the string field. + - `+k8s:validation:pattern="^a.*$"`: Specify the pattern of the field, in Go Regexp format. + - `+k8s:validation:preserveUnknownFields"`: Specify whether to preserve the unknown (sub) fields. + - `+k8s:validation:embeddedResource`: Specify whether to embed the resource to the field, the resource that has + apiVersion, kind and metadata fields. + - `+k8s:validation:cel[?]:rule=""`, `+k8s:validation:cel[?]:rule> [block]\n`: Specify the CEL (Common Expression + Language) rule of the field, it is required to have at least one rule. + - `+k8s:validation:cel[?]:message=""`, `+k8s:validation:cel[?]:message> [block]\n`: Specify the message if the given + data violates the CEL rule. + - `+k8s:validation:cel[?]:messageExpression=""`, `+k8s:validation:cel[?]:messageExpression> [block]\n`: Specify the + evaluative message if the given data violates the CEL rule. + - `+k8s:validation:cel[?]:reason="FieldValueInvalid"`: Specify the violation reason, select + from `FieldValueInvalid`, `FieldValueForbidden`, `FieldValueRequired` or `FieldValueDuplicate`. + - `+k8s:validation:cel[?]:fieldPath=""`: Specify the field path for violation. + - `+k8s:validation:cel[?]:optionalOldSelf=""`: Inject `oldSelf` to avoid not validating when creating or introducing + new value updates. + - `+nullable`, `+nullable=false`: Specify whether the field is nullable or not. + - `+optional`: Specify whether the field is optional, by default all fields are required. + - `+listType="atomic"`: Specify the list type of the field, select from `map`, `set` or `atomic`. + - `atomic`: Default, all the fields are treated as one unit, any changes have to replace the entire list. + - `map`: It needs to have a key field (`+listMapKey=`), which will be used to build an associative list. + - `set`: Fields need to be "scalar", and there can be only one occurrence of each. + - `+listMapKey="name"`: Specify the (sub) field of the list type to be the map key, it is required when the list + type + is `map`. + - `+mapType="granular"`: Specify the map type of the field, select from `granular` or `atomic`. + - `atomic`: All fields are treated as one unit, any changes have to replace the entire map. + - `granular`: Default, items in the map are independent of each other, and can be manipulated by different + actors. + +# License + +Copyright (c) 2024 [Seal, Inc.](https://seal.io) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [LICENSE](../../LICENSE) file for details. + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/args/args.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/args/args.go new file mode 100644 index 000000000..d0d843cd7 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/args/args.go @@ -0,0 +1,36 @@ +package args + +import ( + "fmt" + + "github.com/spf13/pflag" + "k8s.io/gengo/args" +) + +// CustomArgs is used by the gengo framework to pass args specific to this generator. +type CustomArgs struct{} + +// NewDefaults returns default arguments for the generator. +func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { + genericArgs := args.Default().WithoutDefaultFlagParsing() + + customArgs := &CustomArgs{} + genericArgs.CustomArgs = customArgs + + genericArgs.OutputFileBaseName = "crds_generated" + + return genericArgs, customArgs +} + +// AddFlags add the generator flags to the flag set. +func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { +} + +// Validate checks the given arguments. +func Validate(genericArgs *args.GeneratorArgs) error { + if _, ok := genericArgs.CustomArgs.(*CustomArgs); !ok { + return fmt.Errorf("expected CustomArgs to be of type %T", &CustomArgs{}) + } + + return nil +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/crd.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/crd.go new file mode 100644 index 000000000..586ec6a73 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/crd.go @@ -0,0 +1,507 @@ +package generators + +import ( + "fmt" + "io" + "strings" + + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" + "k8s.io/utils/ptr" +) + +func NewCRDGen(sanitizedName, outputPackage string) generator.Generator { + return &crdGen{ + DefaultGen: generator.DefaultGen{ + OptionalName: sanitizedName, + }, + outputPackage: outputPackage, + imports: generator.NewImportTrackerForPackage(outputPackage), + } +} + +type CRDTypeDefinition = apiext.CustomResourceDefinition + +type crdGen struct { + generator.DefaultGen + + outputPackage string + imports namer.ImportTracker + + types []*types.Type + typeDefs map[types.Name]*CRDTypeDefinition +} + +func (g *crdGen) Filter(c *generator.Context, t *types.Type) bool { + if t.Kind == types.Struct && t.Name.Package == g.outputPackage { + if td := reflectType(c.Universe[g.outputPackage], t); td != nil { + if g.typeDefs == nil { + g.typeDefs = map[types.Name]*CRDTypeDefinition{} + } + + g.types = append(g.types, t) + g.typeDefs[t.Name] = td + } + return true + } + return false +} + +func (g *crdGen) Namers(c *generator.Context) namer.NameSystems { + return namer.NameSystems{ + // Have the raw namer for this file track what it imports. + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "private": &namer.NameStrategy{ + Join: func(pre string, in []string, post string) string { + return strings.Join(in, "_") + }, + PrependPackageNames: 4, + }, + } +} + +func (g *crdGen) isOtherPackage(pkg string) bool { + switch { + default: + return true + case pkg == g.outputPackage: + case strings.HasSuffix(pkg, `"`+g.outputPackage+`"`): + } + return false +} + +func (g *crdGen) Imports(c *generator.Context) []string { + var pkgs []string + for _, pkg := range g.imports.ImportLines() { + if g.isOtherPackage(pkg) { + pkgs = append(pkgs, pkg) + } + } + return pkgs +} + +func (g *crdGen) Init(c *generator.Context, w io.Writer) error { + args := getCustomResourceDefinitionTypedArgs() + sw := generator.NewSnippetWriter(w, c, "$", "$") + + // START: GetCustomResourceDefinitions + sw.Do("func GetCustomResourceDefinitions() map[string]*$.CustomResourceDefinition|raw$ {\n", args) + sw.Do("return map[string]*$.CustomResourceDefinition|raw$ {\n", args) + + for _, t := range g.types { + if g.typeDefs[t.Name] == nil { + continue + } + typedArgs := generator.Args{"TYPE": t} + sw.Do("\"$.TYPE.Name.Name$\": crd_$.TYPE|private$(),\n", typedArgs) + } + + sw.Do("}\n", nil) + sw.Do("}\n\n", nil) + // END: GetCustomResourceDefinitions + + return sw.Error() +} + +func (g *crdGen) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + crd := g.typeDefs[t.Name] + if crd == nil { + return nil + } + + args := getCustomResourceDefinitionTypedArgs().With("TYPE", t) + sw := generator.NewSnippetWriter(w, c, "$", "$") + sw.Do("func crd_$.TYPE|private$() *$.CustomResourceDefinition|raw$ {\n", args) + sw.Do("return &$.CustomResourceDefinition|raw$ {\n", args) + + args = args.With("CRD", crd) + // START: TypeMeta. + sw.Do("TypeMeta: $.TypeMeta|raw${\n", args) + sw.Do("APIVersion: \"apiextensions.k8s.io/v1\",\n", nil) + sw.Do("Kind: \"CustomResourceDefinition\",\n", nil) + sw.Do("},\n", nil) + // END: TypeMeta. + // START: ObjectMeta. + sw.Do("ObjectMeta: $.ObjectMeta|raw${\n", args) + sw.Do("Name: \"$.$\",\n", crd.Name) + sw.Do("},\n", nil) + // END: ObjectMeta. + + spec := crd.Spec + args = args.With("SPEC", spec) + // START: Spec. + sw.Do("Spec: $.CustomResourceDefinitionSpec|raw${\n", args) + sw.Do("Group: \"$.SPEC.Group$\",\n", args) + sw.Do("Names: $.CustomResourceDefinitionNames|raw${\n", args) + { + sw.Do("Plural: \"$.SPEC.Names.Plural$\",\n", args) + if spec.Names.Singular != "" { + sw.Do("Singular: \"$.SPEC.Names.Singular$\",\n", args) + } + if len(spec.Names.ShortNames) > 0 { + sw.Do("ShortNames: []string{\n\"$.$\",\n},\n", strings.Join(spec.Names.ShortNames, "\",\n \"")) + } + sw.Do("Kind: \"$.SPEC.Names.Kind$\",\n", args) + if spec.Names.ListKind != "" { + sw.Do("ListKind: \"$.SPEC.Names.ListKind$\",\n", args) + } + if len(spec.Names.Categories) > 0 { + sw.Do("Categories: []string{\n\"$.$\",\n},\n", strings.Join(spec.Names.Categories, "\",\n \"")) + } + } + sw.Do("},\n", nil) + sw.Do("Scope: \"$.SPEC.Scope$\",\n", args) + + ver := spec.Versions[0] + args = args.With("VERSION", ver) + // START: Spec/Versions/0. + sw.Do("Versions: []$.CustomResourceDefinitionVersion|raw${\n", args) + sw.Do("{\n", nil) + sw.Do("Name: \"$.VERSION.Name$\",\n", args) + sw.Do("Served: $.VERSION.Served$,\n", args) + sw.Do("Storage: $.VERSION.Storage$,\n", args) + + // START: Spec/Versions/0/Schema. + sw.Do("Schema: &$.CustomResourceValidation|raw${\n", args) + sw.Do("OpenAPIV3Schema: &$.JSONSchemaProps|raw${\n", args) + writeSchema(sw, ver.Schema.OpenAPIV3Schema) + sw.Do("},\n", nil) + sw.Do("},\n", nil) + // END: Spec/Versions/0/Schema. + + // START: Spec/Versions/0/SubResources. + if subResources := ver.Subresources; subResources != nil { + sw.Do("Subresources: &$.CustomResourceSubresources|raw${\n", args) + if subResources.Status != nil { + sw.Do("Status: &$.CustomResourceSubresourceStatus|raw${},\n", args) + } + if subResources.Scale != nil { + sw.Do("Scale: &$.CustomResourceSubresourceScale|raw${},\n", args) + } + sw.Do("},\n", nil) + } + // END: Spec/Versions/0/SubResources. + + // START: Spec/Versions/0/AdditionalPrinterColumns. + if printerColumns := ver.AdditionalPrinterColumns; len(printerColumns) > 0 { + sw.Do("AdditionalPrinterColumns: []$.CustomResourceColumnDefinition|raw${\n", args) + for _, printerColumn := range printerColumns { + colArgs := args.With("COLUMN", printerColumn) + sw.Do("{\n", nil) + sw.Do("Name: \"$.COLUMN.Name$\",\n", colArgs) + sw.Do("Type: \"$.COLUMN.Type$\",\n", colArgs) + sw.Do("Format: \"$.COLUMN.Format$\",\n", colArgs) + sw.Do("Description: $.$,\n", fmt.Sprintf("%#v", printerColumn.Description)) + sw.Do("Priority: \"$.COLUMN.Priority$\",\n", colArgs) + sw.Do("JSONPath: \"$.COLUMN.JSONPath$\",\n", colArgs) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + // END: Spec/Versions/0/AdditionalPrinterColumns. + + sw.Do("},\n", nil) + sw.Do("},\n", nil) + // END: Spec/Versions/0. + + sw.Do("},\n", nil) + // END: Spec. + + sw.Do("}\n", nil) + sw.Do("}\n\n", nil) + + return sw.Error() +} + +func writeSchema(sw *generator.SnippetWriter, schema *apiext.JSONSchemaProps) { + if sw == nil || schema == nil { + return + } + + args := getJSONSchemaTypedArgs().With("SCHEMA", schema) + + if schema.Ref != nil { + sw.Do("Ref: $.PtrTo|raw$(\"$.SCHEMA.Ref$\"),\n", args) + } + if schema.Description != "" { + sw.Do("Description: $.$,\n", fmt.Sprintf("%#v", schema.Description)) + } + if schema.Type != "" { + sw.Do("Type: \"$.SCHEMA.Type$\",\n", args) + } + if schema.Format != "" { + sw.Do("Format: \"$.SCHEMA.Format$\",\n", args) + } + if schema.Title != "" { + sw.Do("Title: \"$.SCHEMA.Title$\",\n", args) + } + if def := schema.Default; def != nil { + sw.Do("Default: &$.JSON|raw${\n", args) + sw.Do("Raw: []byte(`$.$`),\n", string(def.Raw)) + sw.Do("},\n", nil) + } + if schema.Maximum != nil { + sw.Do("Maximum: $.PtrTo|raw$[float64]($.SCHEMA.Maximum$),\n", args) + } + if schema.ExclusiveMaximum { + sw.Do("ExclusiveMaximum: true,\n", nil) + } + if schema.Minimum != nil { + sw.Do("Minimum: $.PtrTo|raw$[float64]($.SCHEMA.Minimum$),\n", args) + } + if schema.ExclusiveMinimum { + sw.Do("ExclusiveMinimum: true,\n", nil) + } + if schema.MaxLength != nil { + sw.Do("MaxLength: $.PtrTo|raw$[int64]($.SCHEMA.MaxLength$),\n", args) + } + if schema.MinLength != nil { + sw.Do("MinLength: $.PtrTo|raw$[int64]($.SCHEMA.MinLength$),\n", args) + } + if schema.Pattern != "" { + sw.Do("Pattern: \"$.SCHEMA.Pattern$\",\n", args) + } + if schema.MaxItems != nil { + sw.Do("MaxItems: $.PtrTo|raw$[int64]($.SCHEMA.MaxItems$),\n", args) + } + if schema.MinItems != nil { + sw.Do("MinItems: $.PtrTo|raw$[int64]($.SCHEMA.MinItems$),\n", args) + } + if schema.UniqueItems { + sw.Do("UniqueItems: true,\n", nil) + } + if schema.MultipleOf != nil { + sw.Do("MultipleOf: $.PtrTo|raw$[float64]($.SCHEMA.MultipleOf$),\n", args) + } + if len(schema.Enum) != 0 { + sw.Do("Enum: []$.JSON|raw${\n", args) + for _, e := range schema.Enum { + sw.Do("{\n", nil) + sw.Do("Raw: []byte(`$.$`),\n", string(e.Raw)) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if schema.MaxProperties != nil { + sw.Do("MaxProperties: $.PtrTo|raw$[int64]($.SCHEMA.MaxProperties$),\n", args) + } + if schema.MinProperties != nil { + sw.Do("MinProperties: $.PtrTo|raw$[int64]($.SCHEMA.MinProperties$),\n", args) + } + if len(schema.Required) != 0 { + sw.Do("Required: []string{\n\"$.$\",\n},\n", strings.Join(schema.Required, "\",\n \"")) + } + if items := schema.Items; items != nil { + sw.Do("Items: &$.JSONSchemaPropsOrArray|raw${\n", args) + if items.Schema != nil { + sw.Do("Schema: &$.JSONSchemaProps|raw${\n", args) + writeSchema(sw, items.Schema) + sw.Do("},\n", nil) + } else { + sw.Do("JSONSchemas: []$.JSONSchemaProps|raw${\n", args) + for i := range items.JSONSchemas { + sw.Do("{\n", nil) + writeSchema(sw, ptr.To(items.JSONSchemas[i])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if len(schema.AllOf) != 0 { + sw.Do("AllOf: []$.JSONSchemaProps|raw${\n", args) + for i := range schema.AllOf { + sw.Do("{\n", nil) + writeSchema(sw, ptr.To(schema.AllOf[i])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if len(schema.OneOf) != 0 { + sw.Do("OneOf: []$.JSONSchemaProps|raw${\n", args) + for i := range schema.OneOf { + sw.Do("{\n", nil) + writeSchema(sw, ptr.To(schema.OneOf[i])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if len(schema.AnyOf) != 0 { + sw.Do("AnyOf: []$.JSONSchemaProps|raw${\n", args) + for i := range schema.AnyOf { + sw.Do("{\n", nil) + writeSchema(sw, ptr.To(schema.AnyOf[i])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if schema.Not != nil { + sw.Do("Not: &$.JSONSchemaProps|raw${\n", args) + writeSchema(sw, schema.Not) + sw.Do("},\n", nil) + } + if len(schema.Properties) != 0 { + sw.Do("Properties: map[string]$.JSONSchemaProps|raw${\n", args) + for _, name := range sets.List(sets.KeySet(schema.Properties)) { + sw.Do("\"$.$\": {\n", name) + writeSchema(sw, ptr.To(schema.Properties[name])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if addProps := schema.AdditionalProperties; addProps != nil { + sw.Do("AdditionalProperties: &$.JSONSchemaPropsOrBool|raw${\n", args) + sw.Do("Allows: $.$,\n", addProps.Allows) + if addProps.Schema != nil { + sw.Do("Schema: &$.JSONSchemaProps|raw${\n", args) + writeSchema(sw, addProps.Schema) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if len(schema.PatternProperties) != 0 { + sw.Do("PatternProperties: map[string]$.JSONSchemaProps|raw${\n", args) + for _, name := range sets.List(sets.KeySet(schema.PatternProperties)) { + sw.Do("\"$.$\": {\n", name) + writeSchema(sw, ptr.To(schema.PatternProperties[name])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if len(schema.Dependencies) != 0 { + sw.Do("Dependencies: map[string]$.JSONSchemaPropsOrStringArray|raw${\n", args) + for _, name := range sets.List(sets.KeySet(schema.Dependencies)) { + dep := schema.Dependencies[name] + sw.Do("\"$.$\": {\n", name) + if dep.Schema != nil { + sw.Do("Schema: &$.JSONSchemaProps|raw${\n", args) + writeSchema(sw, dep.Schema) + sw.Do("},\n", nil) + } else { + sw.Do("Property: []string{\n\"$.$\",\n},\n", strings.Join(dep.Property, "\",\n \"")) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if addItems := schema.AdditionalItems; addItems != nil { + sw.Do("AdditionalItems: &$.JSONSchemaPropsOrBool|raw${\n", args) + sw.Do("Allows: $.$,\n", addItems.Allows) + if addItems.Schema != nil { + sw.Do("Schema: &$.JSONSchemaProps|raw${\n", args) + writeSchema(sw, addItems.Schema) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if len(schema.Definitions) != 0 { + sw.Do("Definitions: map[string]$.JSONSchemaProps|raw${\n", args) + for _, name := range sets.List(sets.KeySet(schema.Definitions)) { + sw.Do("\"$.$\": {\n", name) + writeSchema(sw, ptr.To(schema.Definitions[name])) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + if extDocs := schema.ExternalDocs; extDocs != nil { + sw.Do("ExternalDocs: &$.ExternalDocumentation|raw${\n", args) + sw.Do("Description: $.$,\n", fmt.Sprintf("%#v", extDocs.Description)) + sw.Do("URL: \"$.SCHEMA.ExternalDocs.URL$\",\n", args) + sw.Do("},\n", nil) + } + if exp := schema.Example; exp != nil { + sw.Do("Example: &$.JSON|raw${\n", args) + sw.Do("Raw: []byte(`$.$`),\n", string(exp.Raw)) + sw.Do("},\n", nil) + } + if schema.Nullable { + sw.Do("Nullable: true,\n", nil) + } + if schema.XPreserveUnknownFields != nil { + sw.Do("XPreserveUnknownFields: $.PtrTo|raw$[bool]($.SCHEMA.XPreserveUnknownFields$),\n", args) + } + if schema.XEmbeddedResource { + sw.Do("XEmbeddedResource: true,\n", nil) + } + if schema.XIntOrString { + sw.Do("XIntOrString: true,\n", nil) + } + if len(schema.XListMapKeys) != 0 { + sw.Do("XListMapKeys: []string{\n\"$.$\",\n},\n", strings.Join(schema.XListMapKeys, "\",\n \"")) + } + if schema.XListType != nil { + sw.Do("XListType: $.PtrTo|raw$[string](\"$.SCHEMA.XListType$\"),\n", args) + } + if schema.XMapType != nil { + sw.Do("XMapType: $.PtrTo|raw$[string](\"$.SCHEMA.XMapType$\"),\n", args) + } + if len(schema.XValidations) != 0 { + sw.Do("XValidations: []$.ValidationRule|raw${\n", args) + for _, val := range schema.XValidations { + valArgs := args.With("VALIDATION", val) + sw.Do("{\n", nil) + sw.Do("Rule: $.$,\n", fmt.Sprintf("%#v", val.Rule)) + if val.Message != "" { + sw.Do("Message: $.$,\n", fmt.Sprintf("%#v", val.Message)) + } + if val.MessageExpression != "" { + sw.Do("MessageExpression: $.$,\n", fmt.Sprintf("%#v", val.MessageExpression)) + } + if val.Reason != nil { + sw.Do("Reason: $.PtrTo|raw$[$.FieldValueErrorReason|raw$](\"$.VALIDATION.Reason$\"),\n", valArgs) + } + if val.FieldPath != "" { + sw.Do("FieldPath: $.$,\n", fmt.Sprintf("%#v", val.FieldPath)) + } + if val.OptionalOldSelf != nil { + sw.Do("OptionalOldSelf: $.PtrTo|raw$[bool]($.VALIDATION.OptionalOldSelf$),\n", valArgs) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } +} + +const ( + pkgUtilPtr = "k8s.io/utils/ptr" + pkgAPIMachineryMetadata = "k8s.io/apimachinery/pkg/apis/meta/v1" + pkgTypeAPIExtensions = "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +func getCustomResourceDefinitionTypedArgs() generator.Args { + return generator.Args{ + "TypeMeta": types.Ref(pkgAPIMachineryMetadata, "TypeMeta"), + "ObjectMeta": types.Ref(pkgAPIMachineryMetadata, "ObjectMeta"), + "SchemeGroupVersion": types.Ref(pkgTypeAPIExtensions, "SchemeGroupVersion"), + "CustomResourceDefinition": types.Ref(pkgTypeAPIExtensions, "CustomResourceDefinition"), + "CustomResourceDefinitionSpec": types.Ref(pkgTypeAPIExtensions, "CustomResourceDefinitionSpec"), + "CustomResourceDefinitionNames": types.Ref(pkgTypeAPIExtensions, "CustomResourceDefinitionNames"), + "CustomResourceDefinitionVersion": types.Ref(pkgTypeAPIExtensions, "CustomResourceDefinitionVersion"), + "CustomResourceValidation": types.Ref(pkgTypeAPIExtensions, "CustomResourceValidation"), + "CustomResourceSubresources": types.Ref(pkgTypeAPIExtensions, "CustomResourceSubresources"), + "CustomResourceSubresourceStatus": types.Ref(pkgTypeAPIExtensions, "CustomResourceSubresourceStatus"), + "CustomResourceSubresourceScale": types.Ref(pkgTypeAPIExtensions, "CustomResourceSubresourceScale"), + "CustomResourceColumnDefinition": types.Ref(pkgTypeAPIExtensions, "CustomResourceColumnDefinition"), + "JSONSchemaProps": types.Ref(pkgTypeAPIExtensions, "JSONSchemaProps"), + } +} + +func getJSONSchemaTypedArgs() generator.Args { + return generator.Args{ + "PtrTo": types.Ref(pkgUtilPtr, "To"), + "JSONSchemaProps": types.Ref(pkgTypeAPIExtensions, "JSONSchemaProps"), + "JSON": types.Ref(pkgTypeAPIExtensions, "JSON"), + "JSONSchemaPropsOrArray": types.Ref(pkgTypeAPIExtensions, "JSONSchemaPropsOrArray"), + "JSONSchemaPropsOrBool": types.Ref(pkgTypeAPIExtensions, "JSONSchemaPropsOrBool"), + "JSONSchemaDependencies": types.Ref(pkgTypeAPIExtensions, "JSONSchemaDependencies"), + "JSONSchemaPropsOrStringArray": types.Ref(pkgTypeAPIExtensions, "JSONSchemaPropsOrStringArray"), + "JSONSchemaDefinitions": types.Ref(pkgTypeAPIExtensions, "JSONSchemaDefinitions"), + "ExternalDocumentation": types.Ref(pkgTypeAPIExtensions, "ExternalDocumentation"), + "ValidationRules": types.Ref(pkgTypeAPIExtensions, "ValidationRules"), + "ValidationRule": types.Ref(pkgTypeAPIExtensions, "ValidationRule"), + "FieldValueErrorReason": types.Ref(pkgTypeAPIExtensions, "FieldValueErrorReason"), + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/crd_test.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/crd_test.go new file mode 100644 index 000000000..a2af9053e --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/crd_test.go @@ -0,0 +1,64 @@ +package generators + +import ( + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/gengo/args" + "k8s.io/gengo/generator" + + crdgenargs "github.com/seal-io/code-generator/cmd/crd-gen/args" +) + +func Test_crdGen(t *testing.T) { + var ( + dir = filepath.Join("testdata", "crd_gen") + pkg = "github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen" + ) + + g := args.GeneratorArgs{ + InputDirs: []string{pkg}, + OutputBase: filepath.Join("testdata", "crd_gen"), + OutputFileBaseName: "zz_generated.crds", + GoHeaderFilePath: filepath.Join(dir, "go.txt"), + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &crdgenargs.CustomArgs{}, + } + + err := g.Execute( + NameSystems(), + DefaultNameSystem(), + func(ctx *generator.Context, args *args.GeneratorArgs) generator.Packages { + packages := Packages(ctx, args) + + for i := range packages { + p, ok := packages[i].(*generator.DefaultPackage) + if !ok { + continue + } + + p.PackagePath = strings.TrimPrefix(p.PackagePath, pkg) + packages[i] = p + } + + return packages + }) + if err != nil { + t.Fatalf("failed to execute crd-gen: %v", err) + } + + actualBytes, err := os.ReadFile(filepath.Join(dir, "zz_generated.crds.go")) + if err != nil { + t.Fatalf("failed to read actual file: %v", err) + } + + expectedBytes, err := os.ReadFile(filepath.Join(dir, "zz_generated.crds.go.expected")) + if err != nil { + t.Fatalf("failed to read expected file: %v", err) + } + + assert.Equal(t, string(expectedBytes), string(actualBytes)) +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go new file mode 100644 index 000000000..9c5344cdb --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper.go @@ -0,0 +1,1141 @@ +package generators + +import ( + "encoding/json" + "fmt" + "regexp" + "slices" + "strconv" + "strings" + + "github.com/seal-io/utils/stringx" + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/code-generator/third_party/forked/golang/reflect" + "k8s.io/gengo/types" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + + "github.com/seal-io/code-generator/utils" +) + +var ( + knownScopes = sets.New(apiext.NamespaceScoped, apiext.ClusterScoped) + knownDataTypes = sets.New("integer", "number", "string", "boolean") + knownDataFormats = sets.New("int32", "int64", "float", "double", "byte", "binary", "date", "date-time", "password") +) + +// reflectType reflects the given package and type into a CRDTypeDefinition, +// according to the given package. +func reflectType(p *types.Package, t *types.Type) *CRDTypeDefinition { + if p == nil || t == nil { + return nil + } + + logger := klog.Background(). + WithName("$"). + WithValues("gen", "crd-gen", "type", t.String()) + + // Collect package markers. + // + // +groupName= + // +versionName= + pm := map[string][]string{} + collectMarkers(p.Comments, pm) + + if len(pm) == 0 || len(pm["group"]) == 0 || len(pm["version"]) == 0 { + return nil + } + + var ( + group = pm["group"][len(pm["group"])-1] + version = pm["version"][len(pm["version"])-1] + kind = t.Name.Name + singular = strings.ToLower(kind) + plural = strings.ToLower(stringx.Pluralize(kind)) + ) + + crd := apiext.CustomResourceDefinition{ + TypeMeta: meta.TypeMeta{ + APIVersion: apiext.SchemeGroupVersion.String(), + Kind: "CustomResourceDefinition", + }, + ObjectMeta: meta.ObjectMeta{ + Name: fmt.Sprintf("%s.%s", plural, group), + }, + Spec: apiext.CustomResourceDefinitionSpec{ + Group: group, + Names: apiext.CustomResourceDefinitionNames{ + Kind: kind, + ListKind: fmt.Sprintf("%sList", kind), + Plural: plural, + Singular: singular, + }, + Scope: apiext.NamespaceScoped, + Versions: []apiext.CustomResourceDefinitionVersion{ + { + Name: version, + Served: true, + Storage: true, + Schema: &apiext.CustomResourceValidation{}, + }, + }, + }, + } + + // Collect type markers. + // + // +k8s:crd-gen:resource:scope=,categories=,shortName=,plural=,subResources= + // +k8s:crd-gen:printcolumn:name=,type=,jsonPath=,description=,format=,priority= + tm := map[string][]string{} + collectMarkers(t.SecondClosestCommentLines, tm) + collectMarkers(t.CommentLines, tm) + + if len(tm) == 0 || len(tm["resource"]) == 0 { + return nil + } + + for _, res := range tm["resource"] { + logger := logger.WithValues("markers", "resource") + + for mk, mv := range utils.ParseMarker(res) { + switch mk { + case "scope": + var v apiext.ResourceScope + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal scope", "value", mv) + case !knownScopes.Has(v): + logger.Error(nil, "invalid scope, select from known scopes", "value", mv) + default: + crd.Spec.Scope = v + } + case "categories": + if err := json.Unmarshal([]byte(mv), &crd.Spec.Names.Categories); err != nil { + logger.Error(nil, "unmarshal categories", "value", mv) + } + case "shortName": + if err := json.Unmarshal([]byte(mv), &crd.Spec.Names.ShortNames); err != nil { + logger.Error(nil, "unmarshal shortName", "value", mv) + } + case "plural": + if err := json.Unmarshal([]byte(mv), &crd.Spec.Names.Plural); err != nil { + logger.Error(nil, "unmarshal plural", "value", mv) + } + case "subResources": + var subResources []string + if err := json.Unmarshal([]byte(mv), &subResources); err != nil { + logger.Error(nil, "unmarshal subResources", "value", mv) + continue + } + + if len(subResources) != 0 { + crd.Spec.Versions[0].Subresources = &apiext.CustomResourceSubresources{} + } + + for _, subres := range subResources { + switch subres { + case "status": + crd.Spec.Versions[0].Subresources.Status = &apiext.CustomResourceSubresourceStatus{} + case "scale": + crd.Spec.Versions[0].Subresources.Scale = &apiext.CustomResourceSubresourceScale{} + } + } + } + } + } + if crd.Spec.Scope == "" { + crd.Spec.Scope = apiext.NamespaceScoped + } + if crd.Spec.Names.Plural == "" { + crd.Spec.Names.Plural = plural + } + + for _, pc := range tm["printcolumn"] { + logger := logger.WithValues("markers", "printcolumn") + + var pcd apiext.CustomResourceColumnDefinition + + for mk, mv := range utils.ParseMarker(pc) { + switch mk { + case "name": + if err := json.Unmarshal([]byte(mv), &pcd.Name); err != nil { + logger.Error(err, "unmarshal name", "value", mv) + } + case "type": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal type", "value", mv) + case !knownDataTypes.Has(v): + logger.Error(nil, "invalid type, select from known data types", "value", mv) + default: + pcd.Type = v + } + case "format": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal format", "value", mv) + case !knownDataFormats.Has(v): + logger.Error(nil, "invalid format, select from known formats", "value", mv) + default: + pcd.Format = v + } + case "jsonPath": + if err := json.Unmarshal([]byte(mv), &pcd.JSONPath); err != nil { + logger.Error(err, "unmarshal jsonPath", "value", mv) + } + case "priority": + if err := json.Unmarshal([]byte(mv), &pcd.Priority); err != nil { + logger.Error(err, "unmarshal priority", "value", mv) + } + } + } + + if pcd.Name == "" || pcd.Type == "" || pcd.JSONPath == "" { + logger.Error(nil, "invalid print column", "line", crdGenMarker+":printcolumn:"+pc) + continue + } + + crd.Spec.Versions[0].AdditionalPrinterColumns = append(crd.Spec.Versions[0].AdditionalPrinterColumns, pcd) + } + + if props := schemeType(logger, nil, t); props != nil { + props.Description = strings.Join(tm["comment"], "\n") + crd.Spec.Versions[0].Schema.OpenAPIV3Schema = props + } + + return &crd +} + +var ( + bytesProps = apiext.JSONSchemaProps{ + Type: "string", + Format: "byte", + } + + knownTypedProps = map[string]apiext.JSONSchemaProps{ + "k8s.io/apimachinery/pkg/runtime.RawExtension": { + Type: "object", + XPreserveUnknownFields: ptr.To(true), + }, + "k8s.io/api/core/v1.Protocol": { + Type: "string", + Default: &apiext.JSON{Raw: []byte(`"TCP"`)}, + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": { + Type: "object", + Properties: map[string]apiext.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + }, + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": { + Type: "object", + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.Fields": { + Type: "object", + AdditionalProperties: &apiext.JSONSchemaPropsOrBool{Allows: true}, + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": { + Type: "object", + AdditionalProperties: &apiext.JSONSchemaPropsOrBool{Allows: true}, + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": { + Type: "string", + Format: "date-time", + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": { + Type: "string", + Format: "date-time", + }, + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": { + Type: "string", + Format: "duration", + }, + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured.Unstructured": { + Type: "object", + }, + "k8s.io/apimachinery/pkg/api/resource.Quantity": { + XIntOrString: true, + AnyOf: []apiext.JSONSchemaProps{ + {Type: "integer"}, + {Type: "string"}, + }, + Pattern: "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + }, + "k8s.io/apimachinery/pkg/types.UID": { + Type: "string", + Format: "uuid", + }, + "k8s.io/apimachinery/pkg/util/intstr.IntOrString": { + XIntOrString: true, + AnyOf: []apiext.JSONSchemaProps{ + {Type: "integer"}, + {Type: "string"}, + }, + }, + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1.JSON": { + XPreserveUnknownFields: ptr.To(true), + }, + "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON": { + XPreserveUnknownFields: ptr.To(true), + }, + "encoding/json.RawMessage": bytesProps, + } + knownEmbeddedResourceTypedProps = map[string]apiext.JSONSchemaProps{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": { + Type: "object", + Properties: map[string]apiext.JSONSchemaProps{ + "name": { + Type: "string", + }, + "namespace": { + Type: "string", + }, + "annotations": { + Type: "object", + AdditionalProperties: &apiext.JSONSchemaPropsOrBool{ + Schema: &apiext.JSONSchemaProps{ + Type: "string", + }, + }, + }, + "labels": { + Type: "object", + AdditionalProperties: &apiext.JSONSchemaPropsOrBool{ + Schema: &apiext.JSONSchemaProps{ + Type: "string", + }, + }, + }, + "finalizers": { + Type: "array", + Items: &apiext.JSONSchemaPropsOrArray{ + Schema: &apiext.JSONSchemaProps{ + Type: "string", + }, + }, + }, + }, + }, + } + + knownListTypes = sets.New("atomic", "map", "set") + knownMapTypes = sets.New("atomic", "granular") + knownFormats = sets.New("bsonobjectid", "uri", "email", "hostname", "ipv4", "ipv6", + "cidr", "mac", "uuid", "uuid3", "uuid4", "uuid5", "isbn", "isbn10", "isbn13", "creditcard", + "ssn", "hexcolor", "rgbcolor", "byte", "password", "date", "duration", "datetime") + knownCelErrorReasons = sets.New( + apiext.FieldValueRequired, + apiext.FieldValueDuplicate, + apiext.FieldValueInvalid, + apiext.FieldValueForbidden) +) + +// schemeType reflects the given type into a JSONSchemaProps . +func schemeType(logger klog.Logger, visited map[*types.Type]struct{}, t *types.Type) (props *apiext.JSONSchemaProps) { + if t == nil { + return nil + } + + if visited == nil { + visited = map[*types.Type]struct{}{} + } + + if _, found := visited[t]; found { + return &apiext.JSONSchemaProps{ + Ref: ptr.To(refer(t)), + } + } + + switch t.Kind { + case types.Pointer: + props = schemeType(logger, visited, t.Elem) + if props != nil { + props.Nullable = true + } + case types.Alias: + if r, found := knownTypedProps[t.String()]; found { + props = &r + } else { + props = schemeType(logger, visited, t.Underlying) + } + case types.Map: + if t.Key != types.String { + // Fallback to byte slices if map key is not string. + props = ptr.To(bytesProps) + logger.Error(nil, "invalid map key type, must be string, fallback to byte slice", + "type", t.Key.String()) + } else if r := schemeType(logger, visited, t.Elem); r != nil { + props = &apiext.JSONSchemaProps{ + Type: "object", + AdditionalProperties: &apiext.JSONSchemaPropsOrBool{ + Allows: true, + Schema: r, + }, + } + } + + if props != nil { + props.Nullable = true + } + case types.Interface: + props = &apiext.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: ptr.To(true), + } + case types.Array: + props = schemeType(logger, visited, t.Elem) + + if props != nil { + props.MinItems = ptr.To(t.Len) + props.MaxItems = ptr.To(t.Len) + } + case types.Slice: + if t.Elem == types.Byte && t.Len == 0 { + props = ptr.To(bytesProps) + } else if r := schemeType(logger, visited, t.Elem); r != nil { + props = &apiext.JSONSchemaProps{ + Type: "array", + Items: &apiext.JSONSchemaPropsOrArray{ + Schema: r, + }, + } + } + + if props != nil { + props.Nullable = true + + if t.Len > 0 { + props.MinItems = ptr.To(t.Len) + props.MaxItems = ptr.To(t.Len) + } + } + case types.Struct: + if r, found := knownTypedProps[t.String()]; found { + props = &r + } else { + props = &apiext.JSONSchemaProps{ + Type: "object", + Properties: map[string]apiext.JSONSchemaProps{}, + } + + for _, mem := range t.Members { + var ( + name = stringx.CamelizeDownFirst(mem.Name) + inline bool + hidden bool + ) + if tg := parseStructTags(mem.Tags).Get("json"); tg.Available() { + c, tg, s := tg.Next() + if c != "" { + name = c + } + + for ; !s; c, tg, s = tg.Next() { + switch c { + case "inline": + inline = true + case "-": + hidden = true + } + } + } + + if hidden { + continue + } + + if t.Name.Package != "" && !t.IsAnonymousStruct() { + visited[t] = struct{}{} + } + + logger := logger.WithName(name) + + subProps := schemeType(logger, visited, mem.Type) + if subProps == nil { + continue + } + + if inline { + for k := range subProps.Properties { + props.Properties[k] = subProps.Properties[k] + } + continue + } + + if name != "status" { + props.Required = append(props.Required, name) + } + + // Collect member markers. + // + // +k8s:validation:default= + // +k8s:validation:example= + // +k8s:validation:enum= + // +k8s:validation:maximum= + // +k8s:validation:minimum= + // +k8s:validation:exclusiveMaximum + // +k8s:validation:exclusiveMinimum + // +k8s:validation:multipleOf= + // +k8s:validation:maxItems= + // +k8s:validation:minItems= + // +k8s:validation:uniqueItems + // +k8s:validation:maxProperties= + // +k8s:validation:minProperties= + // +k8s:validation:maxLength= + // +k8s:validation:minLength= + // +k8s:validation:format= + // +k8s:validation:pattern= + // +k8s:validation:preserveUnknownFields + // +k8s:validation:embeddedResource + // +k8s:validation:cel[?]:rule= + // +k8s:validation:cel[?]:rule> + // +k8s:validation:cel[?]:message= + // +k8s:validation:cel[?]:message> + // +k8s:validation:cel[?]:messageExpression= + // +k8s:validation:cel[?]:messageExpression> + // +k8s:validation:cel[?]:reason= + // +k8s:validation:cel[?]:fieldPath= + // +k8s:validation:cel[?]:optionalOldSelf= + // + // +nullable= + // +optional + // +listType= + // +listMapKey= + // +mapType= + // +default= + mm := map[string][]string{} + collectMarkers(mem.CommentLines, mm) + + for _, val := range mm["validation"] { + for mk, mv := range utils.ParseMarker(val) { + switch mk { + case "default": + if err := json.Unmarshal([]byte(mv), &subProps.Default); err != nil { + logger.Error(err, "unmarshal default", "value", mv) + } + case "example": + if err := json.Unmarshal([]byte(mv), &subProps.Example); err != nil { + logger.Error(err, "unmarshal example", "value", mv) + } + case "enum": + if err := json.Unmarshal([]byte(mv), &subProps.Enum); err != nil { + logger.Error(err, "unmarshal enum", "value", mv) + } + case "maximum": + var v float64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal maximum", "value", mv) + case !isNumber(mem.Type): + logger.Error(nil, "unsupported maximum, must type with number") + default: + subProps.Maximum = ptr.To(v) + } + case "minimum": + var v float64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal minimum", "value", mv) + case !isNumber(mem.Type): + logger.Error(nil, "unsupported minimum, must type with number") + default: + subProps.Minimum = ptr.To(v) + } + case "exclusiveMaximum": + if !isNumber(mem.Type) { + logger.Error(nil, "unsupported exclusiveMaximum, must type with number") + } else { + subProps.ExclusiveMaximum = true + } + case "exclusiveMinimum": + if !isNumber(mem.Type) { + logger.Error(nil, "unsupported exclusiveMinimum, must type with number") + } else { + subProps.ExclusiveMinimum = true + } + case "multipleOf": + var v float64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal multipleOf", "value", mv) + case v <= 0: + logger.Error(nil, "invalid multipleOf, must be greater than 0", + "value", mv) + case !isNumber(mem.Type): + logger.Error(nil, "unsupported multipleOf, must type with number") + default: + subProps.MultipleOf = ptr.To(v) + } + case "maxItems": + var v int64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal maxItems", "value", mv) + case v <= 0: + logger.Error(nil, "invalid maxItems, must be greater than 0", + "value", mv) + case !isSlice(mem.Type): + logger.Error(nil, "unsupported maxItems, must type with slice") + default: + subProps.MaxItems = ptr.To(v) + } + case "minItems": + var v int64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal minItems", "value", mv) + case v < 0: + logger.Error(nil, "invalid minItems, must not be negative", + "value", mv) + case !isSlice(mem.Type): + logger.Error(nil, "unsupported minItems, must type with slice") + default: + subProps.MinItems = ptr.To(v) + } + case "uniqueItems": + if !isSlice(mem.Type) { + logger.Error(nil, "unsupported uniqueItems, must type with slice") + } else { + subProps.UniqueItems = true + } + case "maxProperties": + var v int64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal maxProperties", "value", mv) + case v <= 0: + logger.Error(nil, "invalid maxProperties, must be greater than 0", + "value", mv) + case !isMap(mem.Type): + logger.Error(nil, "unsupported maxProperties, must type with map") + default: + subProps.MaxProperties = ptr.To(v) + } + case "minProperties": + var v int64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal minProperties", "value", mv) + case v < 0: + logger.Error(nil, "invalid minProperties, must not be negative", + "value", mv) + case !isMap(mem.Type): + logger.Error(nil, "unsupported maxProperties, must type with map") + default: + subProps.MinProperties = ptr.To(v) + } + case "maxLength": + var v int64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal maxLength", "value", mv) + case v <= 0: + logger.Error(nil, "invalid maxLength, must be greater than 0", + "value", mv) + case !isString(mem.Type): + logger.Error(nil, "unsupported maxLength, must type with string") + default: + subProps.MaxLength = ptr.To(v) + } + case "minLength": + var v int64 + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal minLength", "value", mv) + case v < 0: + logger.Error(nil, "invalid minLength, must not be negative", + "value", mv) + case !isString(mem.Type): + logger.Error(nil, "unsupported minLength, must type with string") + default: + subProps.MinLength = ptr.To(v) + } + case "format": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal format", "value", mv) + case !knownFormats.Has(v): + logger.Error(nil, "invalid format, select from known formats", + "value", mv) + case !isString(mem.Type): + logger.Error(nil, "unsupported format, must type with string") + default: + subProps.Format = v + } + case "pattern": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal pattern", "value", mv) + } else if _, err = regexp.Compile(v); err != nil { + logger.Error(err, "invalid pattern", "value", mv) + } else { + subProps.Pattern = v + } + case "preserveUnknownFields": + if !isStruct(mem.Type) { + logger.Error(nil, "unsupported preserveUnknownFields, must type with struct") + } else { + subProps.XPreserveUnknownFields = ptr.To(true) + } + case "embeddedResource": + if !isStruct(mem.Type) { + logger.Error(nil, "unsupported embeddedResource, must type with struct") + } else { + subProps.XEmbeddedResource = true + if r, found := knownEmbeddedResourceTypedProps[mem.Type.String()]; found { + subProps.Properties = r.Properties + } + } + case "nullable": + if err := json.Unmarshal([]byte(mv), &subProps.Nullable); err != nil { + logger.Error(err, "unmarshal nullable", "value", mv) + } + case "optional": + props.Required = slices.DeleteFunc(props.Required, + func(n string) bool { + return n == name + }) + if len(props.Required) == 0 { + props.Required = nil + } + case "listType": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal listType", "value", mv) + case !knownListTypes.Has(v): + logger.Error(nil, "invalid listType, select from 'atomic', 'map' or 'set'", + "value", mv) + case !isSlice(mem.Type): + logger.Error(nil, "unsupported listType, must type with slice") + default: + subProps.XListType = ptr.To(v) + } + case "listMapKey": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal listMapKey", "value", mv) + case v == "": + logger.Error(nil, "invalid listMapKey, must not be blank") + case ptr.Deref(subProps.XListType, "") != "map": + logger.Error(nil, "invalid listMapKey, as listType is not 'map'") + default: + subProps.XListMapKeys = append(subProps.XListMapKeys, v) + } + case "mapType": + var v string + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal mapType", "value", mv) + case !knownMapTypes.Has(v): + logger.Error(nil, "invalid mapType, select from 'map' atomic 'granular'") + case !isMap(mem.Type): + logger.Error(nil, "unsupported mapType, must type with map") + default: + subProps.XMapType = ptr.To(v) + } + } + } + } + + for _, cel := range mm["cel"] { + kv := strings.SplitN(strings.TrimSpace(cel), ":", 2) + if len(kv) != 2 || !strings.HasPrefix(kv[0], "cel[") { + continue + } + + idx, err := strconv.ParseInt(kv[0][4:len(kv[0])-1], 10, 64) + if err != nil { + logger.Error(err, "invalid cel index", "value", cel) + continue + } + + if idx < 0 { + logger.Error(nil, "invalid cel index, must be non-negative", "value", cel) + continue + } + + switch length := int64(len(subProps.XValidations)); { + case subProps.XValidations == nil && idx == 0: + // Initialize. + subProps.XValidations = apiext.ValidationRules{{}} + case subProps.XValidations != nil && idx == length-1: + // Update. + case subProps.XValidations != nil && idx == length: + // Increase. + subProps.XValidations = append(subProps.XValidations, apiext.ValidationRule{}) + default: + // Clean. + subProps.XValidations = apiext.ValidationRules{} + logger.Error(nil, "invalid cel index, must be incremental", "value", cel) + continue + } + + switch { + case strings.HasPrefix(kv[1], "rule="): + var v string + if err := json.Unmarshal([]byte(kv[1][5:]), &v); err != nil { + logger.Error(err, "unmarshal CEL rule", "value", cel) + } else { + subProps.XValidations[idx].Rule = v + } + case strings.HasPrefix(kv[1], "rule>"): + v := strings.TrimSpace(kv[1][5:]) + if subProps.XValidations[idx].Rule == "" { + subProps.XValidations[idx].Rule = v + } else { + subProps.XValidations[idx].Rule += "\n" + v + } + case strings.HasPrefix(kv[1], "message="): + var v string + if err := json.Unmarshal([]byte(kv[1][8:]), &v); err != nil { + logger.Error(err, "unmarshal CEL message", "value", cel) + } else { + subProps.XValidations[idx].Message = v + } + case strings.HasPrefix(kv[1], "message>"): + v := strings.TrimSpace(kv[1][8:]) + if subProps.XValidations[idx].Message == "" { + subProps.XValidations[idx].Message = v + } else { + subProps.XValidations[idx].Message += "\n" + v + } + case strings.HasPrefix(kv[1], "messageExpression="): + var v string + if err := json.Unmarshal([]byte(kv[1][18:]), &v); err != nil { + logger.Error(err, "unmarshal CEL messageExpression", "value", cel) + } else { + subProps.XValidations[idx].MessageExpression = v + } + case strings.HasPrefix(kv[1], "messageExpression>"): + v := strings.TrimSpace(kv[1][18:]) + if subProps.XValidations[idx].MessageExpression == "" { + subProps.XValidations[idx].MessageExpression = v + } else { + subProps.XValidations[idx].MessageExpression += "\n" + v + } + case strings.HasPrefix(kv[1], "reason="): + var v string + err := json.Unmarshal([]byte(kv[1][7:]), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal CEL reason", "value", cel) + case !knownCelErrorReasons.Has(apiext.FieldValueErrorReason(v)): + logger.Error(nil, "invalid CEL reason, select from known reasons", "value", cel) + default: + subProps.XValidations[idx].Reason = ptr.To(apiext.FieldValueErrorReason(v)) + } + case strings.HasPrefix(kv[1], "fieldPath="): + var v string + if err := json.Unmarshal([]byte(kv[1][10:]), &v); err != nil { + logger.Error(err, "unmarshal CEL fieldPath", "value", cel) + } else { + subProps.XValidations[idx].FieldPath = v + } + case strings.HasPrefix(kv[1], "optionalOldSelf="): + var v bool + if err := json.Unmarshal([]byte(kv[1][16:]), &v); err != nil { + logger.Error(err, "unmarshal CEL optionalOldSelf", "value", cel) + } else { + subProps.XValidations[idx].OptionalOldSelf = ptr.To(v) + } + } + } + + subProps.Description = strings.Join(mm["comment"], "\n") + props.Properties[name] = *subProps + } + } + } + + if t.IsPrimitive() { + if r, found := knownTypedProps[t.String()]; found { + props = &r + } else { + switch { + case t == types.Bool: + props = &apiext.JSONSchemaProps{ + Type: "boolean", + } + case t == types.String: + props = &apiext.JSONSchemaProps{ + Type: "string", + } + case types.IsInteger(t): + props = &apiext.JSONSchemaProps{ + Type: "integer", + } + + switch t { + case types.Int32, types.Uint16: + props.Format = "int32" + case types.Int64, types.Uint32: + props.Format = "int64" + } + default: + props = &apiext.JSONSchemaProps{ + Type: "number", + } + + switch t { + case types.Float32: + props.Format = "float" + case types.Float64: + props.Format = "double" + } + } + } + } + + if props == nil { + // Fallback to byte slices if type is not supported. + props = ptr.To(bytesProps) + logger.Info("unsupported type, fallback to byte slice", "type", t.String()) + } + + return props +} + +// isNumber returns true if the given type is a number. +func isNumber(t *types.Type) bool { + if t != nil { + switch t.Kind { + case types.Builtin: + return types.IsInteger(t) || t == types.Float32 || t == types.Float64 + case types.Alias: + return isNumber(t.Underlying) + case types.Pointer: + return isNumber(t.Elem) + } + } + + return false +} + +// isString returns true if the given type is a string. +func isString(t *types.Type) bool { + if t != nil { + switch t.Kind { + case types.Builtin: + return t == types.String + case types.Alias: + return isString(t.Underlying) + case types.Pointer: + return isString(t.Elem) + } + } + + return false +} + +// isSlice returns true if the given type is a slice. +func isSlice(t *types.Type) bool { + if t != nil { + switch t.Kind { + case types.Slice: + return true + case types.Alias: + return isSlice(t.Underlying) + case types.Pointer: + return isSlice(t.Elem) + } + } + + return false +} + +// isMap returns true if the given type is a map. +func isMap(t *types.Type) bool { + if t != nil { + switch t.Kind { + case types.Map: + return true + case types.Alias: + return isMap(t.Underlying) + case types.Pointer: + return isMap(t.Elem) + } + } + + return false +} + +// isStruct returns true if the given type is a struct. +func isStruct(t *types.Type) bool { + if t != nil { + switch t.Kind { + case types.Struct: + return true + case types.Alias: + return isStruct(t.Underlying) + case types.Pointer: + return isStruct(t.Elem) + } + } + + return false +} + +// refer creates a definition link for the given package and type. +func refer(t *types.Type) string { + r := t.Name.Name + if t.Name.Package != "" { + // Replace `/` with `~1` and `~` with `~0` according to JSONPointer escapes. + r = strings.ReplaceAll(t.Name.Package, "/", "~1") + "~0" + t.Name.Name + } + return "#/definitions/" + r +} + +const ( + groupMarker = "+groupName=" + versionMarker = "+versionName=" + nullableMarker = "+nullable" // By default, this is nullable. + defaultMarker = "+default=" + optionalMarker = "+optional" + listTypeMarker = "+listType=" + listMapKeyMarker = "+listMapKey=" + mapTypeMarker = "+mapType=" + crdGenMarker = "+k8s:crd-gen:" + validationMarker = "+k8s:validation:" // Compatibility with openapi-gen. +) + +// collectMarkers collects markers from the given comments into a map. +func collectMarkers(comments []string, into map[string][]string) { + for _, line := range comments { + line = strings.TrimSpace(line) + if len(line) == 0 { + continue + } + + switch { + default: + if !strings.HasPrefix(line, "+") { + into["comment"] = append(into["comment"], line) + } + case strings.HasPrefix(line, groupMarker): + if v := line[len(groupMarker):]; v != "" { + into["group"] = append(into["group"], v) + } + case strings.HasPrefix(line, versionMarker): + if v := line[len(versionMarker):]; v != "" { + into["version"] = append(into["version"], v) + } + case strings.HasPrefix(line, crdGenMarker): + kv := strings.SplitN(line[len(crdGenMarker):], ":", 2) + if len(kv) == 2 { + into[kv[0]] = append(into[kv[0]], kv[1]) + } else if len(kv) == 1 { + into[kv[0]] = append(into[kv[0]], "") + } + case strings.HasPrefix(line, nullableMarker): + if v := line[len(nullableMarker):]; v != "" { + into["validation"] = append(into["validation"], "nullable"+v) + } else { + into["validation"] = append(into["validation"], "nullable=true") + } + case strings.HasPrefix(line, defaultMarker): + if v := line[len(defaultMarker):]; v != "" { + into["validation"] = append(into["validation"], "default="+v) + } + case line == optionalMarker: + into["validation"] = append(into["validation"], "optional") + case strings.HasPrefix(line, listTypeMarker): + if v := line[len(listTypeMarker):]; v != "" { + into["validation"] = append(into["validation"], "listType="+v) + } + case strings.HasPrefix(line, listMapKeyMarker): + if v := line[len(listMapKeyMarker):]; v != "" { + into["validation"] = append(into["validation"], "listMapKey="+v) + } + case strings.HasPrefix(line, mapTypeMarker): + if v := line[len(mapTypeMarker):]; v != "" { + into["validation"] = append(into["validation"], "mapType="+v) + } + case strings.HasPrefix(line, validationMarker): + if v := line[len(validationMarker):]; v != "" { + if strings.HasPrefix(v, "cel[") { + into["cel"] = append(into["cel"], v) + continue + } + into["validation"] = append(into["validation"], v) + } + } + } +} + +// parseStructTags returns the struct tags of the given type. +func parseStructTags(st string) StructTags { + p, _ := reflect.ParseStructTags(st) + return StructTags(p) +} + +type ( + StructTags reflect.StructTags + Tag string +) + +func (tags StructTags) String() string { + if len(tags) == 0 { + return "" + } + + return reflect.StructTags(tags).String() +} + +func (tags StructTags) Has(name string) bool { + if len(tags) == 0 { + return false + } + + return reflect.StructTags(tags).Has(name) +} + +func (tags StructTags) Get(name string) Tag { + for _, tag := range tags { + if tag.Name == name { + return Tag(tag.Value) + } + } + + return "" +} + +func (t Tag) String() string { + return string(t) +} + +func (t Tag) Available() bool { + return string(t) != "" +} + +func (t Tag) Next() (current string, remain Tag, stop bool) { + b, a, _ := strings.Cut(string(t), ",") + return b, Tag(a), b == "" && a == "" +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper_test.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper_test.go new file mode 100644 index 000000000..504219a55 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/helper_test.go @@ -0,0 +1,48 @@ +package generators + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/gengo/parser" + "sigs.k8s.io/yaml" +) + +func Test_reflectType(t *testing.T) { + var ( + dir = filepath.Join("testdata", "reflect_type") + pkg = "github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type" + typ = "Dummy" + ) + + b := parser.New() + if err := b.AddDir(pkg); err != nil { + t.Fatalf("failed to parse package %q: %v", pkg, err) + } + + u, err := b.FindTypes() + if err != nil { + t.Fatalf("failed to find types: %v", err) + } + + ty := u.Package(pkg).Type(typ) + if ty == nil { + t.Fatalf("failed to find type %q in package %q", typ, pkg) + } + + td := reflectType(u.Package(pkg), ty) + + actualBytes, err := yaml.Marshal(td) + if err != nil { + t.Fatalf("failed to marshal type definition: %v", err) + } + + expectedBytes, err := os.ReadFile(filepath.Join(dir, "expected.yaml")) + if err != nil { + t.Fatalf("failed to read expected file: %v", err) + } + + assert.Equal(t, string(expectedBytes), string(actualBytes)) +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/packages.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/packages.go new file mode 100644 index 000000000..df5e5e765 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/packages.go @@ -0,0 +1,70 @@ +package generators + +import ( + "fmt" + "strings" + + "k8s.io/gengo/args" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/klog/v2" +) + +// NameSystems returns the name system used by the generators in this package. +func NameSystems() namer.NameSystems { + return namer.NameSystems{ + "public": namer.NewPublicNamer(0), + } +} + +// DefaultNameSystem returns the default name system for ordering the types to be +// processed by the generators in this package. +func DefaultNameSystem() string { + return "public" +} + +func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { + boilerplate, err := arguments.LoadGoBoilerplate() + if err != nil { + klog.Fatalf("Failed loading boilerplate: %v", err) + } + + packages := generator.Packages{} + header := append([]byte(fmt.Sprintf("//go:build !%s\n// +build !%s\n\n", arguments.GeneratedBuildTag, arguments.GeneratedBuildTag)), boilerplate...) + + for i := range context.Inputs { + klog.V(5).Infof("considering pkg %q", context.Inputs[i]) + pkg := context.Universe[context.Inputs[i]] + if pkg == nil { + // If the input had no Go files, for example. + continue + } + + path := pkg.Path + // If the source path is within a /vendor/ directory (for example, + // k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow + // generation to output to the proper relative path (under vendor). + // Otherwise, the generator will create the file in the wrong location + // in the output directory. + if strings.HasPrefix(pkg.SourcePath, arguments.OutputBase) { + expandedPath := strings.TrimPrefix(pkg.SourcePath, arguments.OutputBase) + if strings.HasPrefix(expandedPath, "/vendor/") { + path = expandedPath + } + } + + packages = append(packages, + &generator.DefaultPackage{ + PackageName: pkg.Name, + PackagePath: path, + HeaderText: header, + GeneratorFunc: func(c *generator.Context) []generator.Generator { + return []generator.Generator{ + NewCRDGen(arguments.OutputFileBaseName, path), + } + }, + }) + } + + return packages +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/doc.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/doc.go new file mode 100644 index 000000000..adc8c854c --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/doc.go @@ -0,0 +1,5 @@ +// Package crd_gen is the internal version of the API. +// +// +groupName=samplecontroller.k8s.io +// +versionName=v1 +package crd_gen diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/dummy.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/dummy.go new file mode 100644 index 000000000..0ed31a2ce --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/dummy.go @@ -0,0 +1,121 @@ +package crd_gen + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// Dummy is the schema for the projects API. +// +// +k8s:crd-gen:resource:categories=["all","walrus"],scope="Namespaced",shortName=["proj"],plural="projects",subResources=["status"] +type Dummy struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec DummySpec `json:"spec,omitempty"` + Status DummyStatus `json:"status,omitempty"` +} + +// DummySpec defines the desired state of Dummy. +type DummySpec struct { + // Primitive. + + // +optional + // +k8s:validation:minimum=1 + Integer int `json:"integer,omitempty"` + // +optional + Float float64 `json:"float,omitempty"` + // +optional + // +k8s:validation:enum=["x","y","z"] + String string `json:"string,omitempty"` + // +optional + Bool bool `json:"bool,omitempty"` + // +k8s:validation:enum=[1,2,3,5,7] + // +nullable=false + IntegerPointer *int64 `json:"integerPointer,omitempty"` + // +k8s:validation:maximum=10 + FloatPointer *float32 `json:"floatPointer,omitempty"` + StringPointer *string `json:"stringPointer,omitempty"` + BoolPointer *bool `json:"boolPointer,omitempty"` + + // WellKnown Extension. + + MicroTime meta.MicroTime `json:"microTime,omitempty"` + Duration meta.Duration `json:"duration,omitempty"` + Time meta.Time `json:"time,omitempty"` + IntOrString intstr.IntOrString `json:"intOrString,omitempty"` + RawExtension runtime.RawExtension `json:"rawExtension,omitempty"` + MicroTimePointer *meta.MicroTime `json:"microTimePointer,omitempty"` + DurationPointer *meta.Duration `json:"durationPointer,omitempty"` + TimePointer *meta.Time `json:"timePointer,omitempty"` + IntOrStringPointer *intstr.IntOrString `json:"intOrStringPointer,omitempty"` + RawExtensionPointer *runtime.RawExtension `json:"rawExtensionPointer,omitempty"` + + // Map. + + // +mapType="atomic" + // +k8s:validation:maxProperties=3 + MapString map[string]string `json:"mapString,omitempty"` + MapPointString map[string]*string `json:"mapPointString,omitempty"` + MapObject map[string]struct { + A string `json:"a,omitempty"` + B int `json:"b,omitempty"` + C bool `json:"c,omitempty"` + D float64 `json:"d,omitempty"` + E map[string]struct{} `json:"e,omitempty"` + F []struct{} `json:"f,omitempty"` + } `json:"mapObject,omitempty"` + // +mapType="atomic" + MapInOrString map[string]intstr.IntOrString `json:"mapInOrString,omitempty"` + MapStringPointer *map[string]string `json:"mapStringPointer,omitempty"` + MapInterface map[string]any `json:"mapInterface,omitempty"` + + // Slice. + + // +k8s:validation:maxItems=3 + // +k8s:validation:minItems=1 + SliceString []string `json:"sliceString,omitempty"` + SlicePointString []*string `json:"slicePointString,omitempty"` + // +k8s:validation:cel[0]:rule="self.b > 0" + // +k8s:validation:cel[0]:message="b must be greater than 0" + SliceObject []struct { + A string `json:"a,omitempty"` + B int `json:"b,omitempty"` + C bool `json:"c,omitempty"` + D float64 `json:"d,omitempty"` + E map[string]struct{} `json:"e,omitempty"` + F []struct{} `json:"f,omitempty"` + } `json:"sliceObject,omitempty"` + SliceBytes []byte `json:"sliceBytes,omitempty"` + SliceBytesPointer *[]byte `json:"sliceBytesPointer,omitempty"` + SliceInterface []any `json:"sliceInterface,omitempty"` + + // Array. + + ArrayString [3]string `json:"arrayString,omitempty"` + ArrayPointString [3]*string `json:"arrayPointString,omitempty"` + // +k8s:validation:cel[0]:rule> self.b > 0 + // +k8s:validation:cel[0]:message> b must be greater than 0, + // +k8s:validation:cel[1]:rule> self.e.length() % 2 == 0 + // +k8s:validation:cel[1]:rule> ? self.a == self.a + ' is even' + // +k8s:validation:cel[1]:rule> : self.a == self.a + ' is odd' + // +k8s:validation:cel[1]:message> mutate a + // +k8s:validation:cel[1]:reason="FieldValueRequired" + ArrayObject [3]struct { + A string `json:"a,omitempty"` + B int `json:"b,omitempty"` + C bool `json:"c,omitempty"` + D float64 `json:"d,omitempty"` + E map[string]struct{} `json:"e,omitempty"` + } + + // Reference. + + SubDummySpecPointer *DummySpec `json:"subDummySpecPointer,omitempty"` + SliceSubDummySpec []DummySpec `json:"sliceSubDummySpec,omitempty"` +} + +// DummyStatus defines the observed state of Dummy. +type DummyStatus struct { +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/go.txt b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/go.txt new file mode 100644 index 000000000..e9f9a7eec --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/go.txt @@ -0,0 +1,4 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go new file mode 100644 index 000000000..58201cafa --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go @@ -0,0 +1,529 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. +package crd_gen + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + ptr "k8s.io/utils/ptr" +) + +func GetCustomResourceDefinitions() map[string]*v1.CustomResourceDefinition { + return map[string]*v1.CustomResourceDefinition{ + "Dummy": crd_crd_gen_generators_testdata_crd_gen_Dummy(), + } +} + +func crd_crd_gen_generators_testdata_crd_gen_Dummy() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "dummies.samplecontroller.k8s.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "samplecontroller.k8s.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "projects", + Singular: "dummy", + ShortNames: []string{ + "proj", + }, + Kind: "Dummy", + ListKind: "DummyList", + Categories: []string{ + "all", + "walrus", + }, + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "Dummy is the schema for the projects API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + Required: []string{ + "integer", + "float", + "string", + "bool", + "integerPointer", + "floatPointer", + "stringPointer", + "boolPointer", + "microTime", + "duration", + "time", + "intOrString", + "rawExtension", + "microTimePointer", + "durationPointer", + "timePointer", + "intOrStringPointer", + "rawExtensionPointer", + "mapString", + "mapPointString", + "mapObject", + "mapInOrString", + "mapStringPointer", + "mapInterface", + "sliceString", + "slicePointString", + "sliceObject", + "sliceBytes", + "sliceBytesPointer", + "sliceInterface", + "arrayString", + "arrayPointString", + "arrayObject", + "subDummySpecPointer", + "sliceSubDummySpec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "arrayObject": { + Type: "object", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](3), + Required: []string{ + "a", + "b", + "c", + "d", + "e", + }, + Properties: map[string]v1.JSONSchemaProps{ + "a": { + Type: "string", + }, + "b": { + Type: "integer", + }, + "c": { + Type: "boolean", + }, + "d": { + Type: "number", + Format: "double", + }, + "e": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + }, + XValidations: []v1.ValidationRule{ + { + Rule: "self.b > 0", + Message: "b must be greater than 0,", + }, + { + Rule: "self.e.length() % 2 == 0\n? self.a == self.a + ' is even'\n: self.a == self.a + ' is odd'", + Message: "mutate a", + Reason: ptr.To[v1.FieldValueErrorReason]("FieldValueRequired"), + }, + }, + }, + "arrayPointString": { + Type: "string", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](3), + Nullable: true, + }, + "arrayString": { + Type: "string", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](3), + }, + "bool": { + Type: "boolean", + }, + "boolPointer": { + Type: "boolean", + Nullable: true, + }, + "duration": { + Type: "string", + Format: "duration", + }, + "durationPointer": { + Type: "string", + Format: "duration", + Nullable: true, + }, + "float": { + Type: "number", + Format: "double", + }, + "floatPointer": { + Type: "number", + Format: "float", + Maximum: ptr.To[float64](10), + Nullable: true, + }, + "intOrString": { + AnyOf: []v1.JSONSchemaProps{ + { + Type: "integer", + }, + { + Type: "string", + }, + }, + XIntOrString: true, + }, + "intOrStringPointer": { + AnyOf: []v1.JSONSchemaProps{ + { + Type: "integer", + }, + { + Type: "string", + }, + }, + Nullable: true, + XIntOrString: true, + }, + "integer": { + Type: "integer", + Minimum: ptr.To[float64](1), + }, + "integerPointer": { + Type: "integer", + Format: "int64", + Enum: []v1.JSON{ + { + Raw: []byte(`1`), + }, + { + Raw: []byte(`2`), + }, + { + Raw: []byte(`3`), + }, + { + Raw: []byte(`5`), + }, + { + Raw: []byte(`7`), + }, + }, + }, + "mapInOrString": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + AnyOf: []v1.JSONSchemaProps{ + { + Type: "integer", + }, + { + Type: "string", + }, + }, + XIntOrString: true, + }, + }, + Nullable: true, + XMapType: ptr.To[string]("atomic"), + }, + "mapInterface": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: ptr.To[bool](true), + }, + }, + Nullable: true, + }, + "mapObject": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + Required: []string{ + "a", + "b", + "c", + "d", + "e", + "f", + }, + Properties: map[string]v1.JSONSchemaProps{ + "a": { + Type: "string", + }, + "b": { + Type: "integer", + }, + "c": { + Type: "boolean", + }, + "d": { + Type: "number", + Format: "double", + }, + "e": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + "f": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + }, + }, + }, + Nullable: true, + }, + "mapPointString": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "string", + Nullable: true, + }, + }, + Nullable: true, + }, + "mapString": { + Type: "object", + MaxProperties: ptr.To[int64](3), + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "string", + }, + }, + Nullable: true, + XMapType: ptr.To[string]("atomic"), + }, + "mapStringPointer": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "string", + }, + }, + Nullable: true, + }, + "microTime": { + Type: "string", + Format: "date-time", + }, + "microTimePointer": { + Type: "string", + Format: "date-time", + Nullable: true, + }, + "rawExtension": { + Type: "object", + XPreserveUnknownFields: ptr.To[bool](true), + }, + "rawExtensionPointer": { + Type: "object", + Nullable: true, + XPreserveUnknownFields: ptr.To[bool](true), + }, + "sliceBytes": { + Type: "string", + Format: "byte", + Nullable: true, + }, + "sliceBytesPointer": { + Type: "string", + Format: "byte", + Nullable: true, + }, + "sliceInterface": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: ptr.To[bool](true), + }, + }, + Nullable: true, + }, + "sliceObject": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + Required: []string{ + "a", + "b", + "c", + "d", + "e", + "f", + }, + Properties: map[string]v1.JSONSchemaProps{ + "a": { + Type: "string", + }, + "b": { + Type: "integer", + }, + "c": { + Type: "boolean", + }, + "d": { + Type: "number", + Format: "double", + }, + "e": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + "f": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + }, + }, + }, + Nullable: true, + XValidations: []v1.ValidationRule{ + { + Rule: "self.b > 0", + Message: "b must be greater than 0", + }, + }, + }, + "slicePointString": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "string", + Nullable: true, + }, + }, + Nullable: true, + }, + "sliceString": { + Type: "array", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](1), + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "string", + }, + }, + Nullable: true, + }, + "sliceSubDummySpec": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Ref: ptr.To("#/definitions/github.com~1seal-io~1code-generator~1cmd~1crd-gen~1generators~1testdata~1crd_gen~0DummySpec"), + }, + }, + Nullable: true, + }, + "string": { + Type: "string", + Enum: []v1.JSON{ + { + Raw: []byte(`"x"`), + }, + { + Raw: []byte(`"y"`), + }, + { + Raw: []byte(`"z"`), + }, + }, + }, + "stringPointer": { + Type: "string", + Nullable: true, + }, + "subDummySpecPointer": { + Ref: ptr.To("#/definitions/github.com~1seal-io~1code-generator~1cmd~1crd-gen~1generators~1testdata~1crd_gen~0DummySpec"), + Nullable: true, + }, + "time": { + Type: "string", + Format: "date-time", + }, + "timePointer": { + Type: "string", + Format: "date-time", + Nullable: true, + }, + }, + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected new file mode 100644 index 000000000..58201cafa --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/crd_gen/zz_generated.crds.go.expected @@ -0,0 +1,529 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. +package crd_gen + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + ptr "k8s.io/utils/ptr" +) + +func GetCustomResourceDefinitions() map[string]*v1.CustomResourceDefinition { + return map[string]*v1.CustomResourceDefinition{ + "Dummy": crd_crd_gen_generators_testdata_crd_gen_Dummy(), + } +} + +func crd_crd_gen_generators_testdata_crd_gen_Dummy() *v1.CustomResourceDefinition { + return &v1.CustomResourceDefinition{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apiextensions.k8s.io/v1", + Kind: "CustomResourceDefinition", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "dummies.samplecontroller.k8s.io", + }, + Spec: v1.CustomResourceDefinitionSpec{ + Group: "samplecontroller.k8s.io", + Names: v1.CustomResourceDefinitionNames{ + Plural: "projects", + Singular: "dummy", + ShortNames: []string{ + "proj", + }, + Kind: "Dummy", + ListKind: "DummyList", + Categories: []string{ + "all", + "walrus", + }, + }, + Scope: "Namespaced", + Versions: []v1.CustomResourceDefinitionVersion{ + { + Name: "v1", + Served: true, + Storage: true, + Schema: &v1.CustomResourceValidation{ + OpenAPIV3Schema: &v1.JSONSchemaProps{ + Description: "Dummy is the schema for the projects API.", + Type: "object", + Required: []string{ + "metadata", + "spec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "apiVersion": { + Type: "string", + }, + "kind": { + Type: "string", + }, + "metadata": { + Type: "object", + }, + "spec": { + Type: "object", + Required: []string{ + "integer", + "float", + "string", + "bool", + "integerPointer", + "floatPointer", + "stringPointer", + "boolPointer", + "microTime", + "duration", + "time", + "intOrString", + "rawExtension", + "microTimePointer", + "durationPointer", + "timePointer", + "intOrStringPointer", + "rawExtensionPointer", + "mapString", + "mapPointString", + "mapObject", + "mapInOrString", + "mapStringPointer", + "mapInterface", + "sliceString", + "slicePointString", + "sliceObject", + "sliceBytes", + "sliceBytesPointer", + "sliceInterface", + "arrayString", + "arrayPointString", + "arrayObject", + "subDummySpecPointer", + "sliceSubDummySpec", + }, + Properties: map[string]v1.JSONSchemaProps{ + "arrayObject": { + Type: "object", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](3), + Required: []string{ + "a", + "b", + "c", + "d", + "e", + }, + Properties: map[string]v1.JSONSchemaProps{ + "a": { + Type: "string", + }, + "b": { + Type: "integer", + }, + "c": { + Type: "boolean", + }, + "d": { + Type: "number", + Format: "double", + }, + "e": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + }, + XValidations: []v1.ValidationRule{ + { + Rule: "self.b > 0", + Message: "b must be greater than 0,", + }, + { + Rule: "self.e.length() % 2 == 0\n? self.a == self.a + ' is even'\n: self.a == self.a + ' is odd'", + Message: "mutate a", + Reason: ptr.To[v1.FieldValueErrorReason]("FieldValueRequired"), + }, + }, + }, + "arrayPointString": { + Type: "string", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](3), + Nullable: true, + }, + "arrayString": { + Type: "string", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](3), + }, + "bool": { + Type: "boolean", + }, + "boolPointer": { + Type: "boolean", + Nullable: true, + }, + "duration": { + Type: "string", + Format: "duration", + }, + "durationPointer": { + Type: "string", + Format: "duration", + Nullable: true, + }, + "float": { + Type: "number", + Format: "double", + }, + "floatPointer": { + Type: "number", + Format: "float", + Maximum: ptr.To[float64](10), + Nullable: true, + }, + "intOrString": { + AnyOf: []v1.JSONSchemaProps{ + { + Type: "integer", + }, + { + Type: "string", + }, + }, + XIntOrString: true, + }, + "intOrStringPointer": { + AnyOf: []v1.JSONSchemaProps{ + { + Type: "integer", + }, + { + Type: "string", + }, + }, + Nullable: true, + XIntOrString: true, + }, + "integer": { + Type: "integer", + Minimum: ptr.To[float64](1), + }, + "integerPointer": { + Type: "integer", + Format: "int64", + Enum: []v1.JSON{ + { + Raw: []byte(`1`), + }, + { + Raw: []byte(`2`), + }, + { + Raw: []byte(`3`), + }, + { + Raw: []byte(`5`), + }, + { + Raw: []byte(`7`), + }, + }, + }, + "mapInOrString": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + AnyOf: []v1.JSONSchemaProps{ + { + Type: "integer", + }, + { + Type: "string", + }, + }, + XIntOrString: true, + }, + }, + Nullable: true, + XMapType: ptr.To[string]("atomic"), + }, + "mapInterface": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: ptr.To[bool](true), + }, + }, + Nullable: true, + }, + "mapObject": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + Required: []string{ + "a", + "b", + "c", + "d", + "e", + "f", + }, + Properties: map[string]v1.JSONSchemaProps{ + "a": { + Type: "string", + }, + "b": { + Type: "integer", + }, + "c": { + Type: "boolean", + }, + "d": { + Type: "number", + Format: "double", + }, + "e": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + "f": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + }, + }, + }, + Nullable: true, + }, + "mapPointString": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "string", + Nullable: true, + }, + }, + Nullable: true, + }, + "mapString": { + Type: "object", + MaxProperties: ptr.To[int64](3), + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "string", + }, + }, + Nullable: true, + XMapType: ptr.To[string]("atomic"), + }, + "mapStringPointer": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "string", + }, + }, + Nullable: true, + }, + "microTime": { + Type: "string", + Format: "date-time", + }, + "microTimePointer": { + Type: "string", + Format: "date-time", + Nullable: true, + }, + "rawExtension": { + Type: "object", + XPreserveUnknownFields: ptr.To[bool](true), + }, + "rawExtensionPointer": { + Type: "object", + Nullable: true, + XPreserveUnknownFields: ptr.To[bool](true), + }, + "sliceBytes": { + Type: "string", + Format: "byte", + Nullable: true, + }, + "sliceBytesPointer": { + Type: "string", + Format: "byte", + Nullable: true, + }, + "sliceInterface": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: ptr.To[bool](true), + }, + }, + Nullable: true, + }, + "sliceObject": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + Required: []string{ + "a", + "b", + "c", + "d", + "e", + "f", + }, + Properties: map[string]v1.JSONSchemaProps{ + "a": { + Type: "string", + }, + "b": { + Type: "integer", + }, + "c": { + Type: "boolean", + }, + "d": { + Type: "number", + Format: "double", + }, + "e": { + Type: "object", + AdditionalProperties: &v1.JSONSchemaPropsOrBool{ + Allows: true, + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + "f": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "object", + }, + }, + Nullable: true, + }, + }, + }, + }, + Nullable: true, + XValidations: []v1.ValidationRule{ + { + Rule: "self.b > 0", + Message: "b must be greater than 0", + }, + }, + }, + "slicePointString": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "string", + Nullable: true, + }, + }, + Nullable: true, + }, + "sliceString": { + Type: "array", + MaxItems: ptr.To[int64](3), + MinItems: ptr.To[int64](1), + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Type: "string", + }, + }, + Nullable: true, + }, + "sliceSubDummySpec": { + Type: "array", + Items: &v1.JSONSchemaPropsOrArray{ + Schema: &v1.JSONSchemaProps{ + Ref: ptr.To("#/definitions/github.com~1seal-io~1code-generator~1cmd~1crd-gen~1generators~1testdata~1crd_gen~0DummySpec"), + }, + }, + Nullable: true, + }, + "string": { + Type: "string", + Enum: []v1.JSON{ + { + Raw: []byte(`"x"`), + }, + { + Raw: []byte(`"y"`), + }, + { + Raw: []byte(`"z"`), + }, + }, + }, + "stringPointer": { + Type: "string", + Nullable: true, + }, + "subDummySpecPointer": { + Ref: ptr.To("#/definitions/github.com~1seal-io~1code-generator~1cmd~1crd-gen~1generators~1testdata~1crd_gen~0DummySpec"), + Nullable: true, + }, + "time": { + Type: "string", + Format: "date-time", + }, + "timePointer": { + Type: "string", + Format: "date-time", + Nullable: true, + }, + }, + }, + "status": { + Type: "object", + }, + }, + }, + }, + Subresources: &v1.CustomResourceSubresources{ + Status: &v1.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/doc.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/doc.go new file mode 100644 index 000000000..0fc68ba5f --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/doc.go @@ -0,0 +1,5 @@ +// Package reflect_type is the internal version of the API. +// +// +groupName=samplecontroller.k8s.io +// +versionName=v1 +package reflect_type diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/dummy.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/dummy.go new file mode 100644 index 000000000..5d0526530 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/dummy.go @@ -0,0 +1,123 @@ +package reflect_type + +import ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// Dummy is the schema for the projects API. +// +// +k8s:crd-gen:resource:categories=["all","walrus"],scope="Namespaced",shortName=["proj"],plural="projects",subResources=["status"] +type Dummy struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + + Spec DummySpec `json:"spec,omitempty"` + Status DummyStatus `json:"status,omitempty"` +} + +// DummySpec defines the desired state of Dummy. +type DummySpec struct { + // Primitive. + + // +optional + // +k8s:validation:minimum=1 + Integer int `json:"integer,omitempty"` + // +optional + Float float64 `json:"float,omitempty"` + // +optional + // +k8s:validation:enum=["x","y","z"] + String string `json:"string,omitempty"` + // +optional + Bool bool `json:"bool,omitempty"` + // +k8s:validation:enum=[1,2,3,5,7] + // +nullable=false + IntegerPointer *int64 `json:"integerPointer,omitempty"` + // +k8s:validation:maximum=10 + FloatPointer *float32 `json:"floatPointer,omitempty"` + // +k8s:validation:default="x" + StringPointer *string `json:"stringPointer,omitempty"` + // +default=true + BoolPointer *bool `json:"boolPointer,omitempty"` + + // WellKnown Extension. + + MicroTime meta.MicroTime `json:"microTime,omitempty"` + Duration meta.Duration `json:"duration,omitempty"` + Time meta.Time `json:"time,omitempty"` + IntOrString intstr.IntOrString `json:"intOrString,omitempty"` + RawExtension runtime.RawExtension `json:"rawExtension,omitempty"` + MicroTimePointer *meta.MicroTime `json:"microTimePointer,omitempty"` + DurationPointer *meta.Duration `json:"durationPointer,omitempty"` + TimePointer *meta.Time `json:"timePointer,omitempty"` + IntOrStringPointer *intstr.IntOrString `json:"intOrStringPointer,omitempty"` + RawExtensionPointer *runtime.RawExtension `json:"rawExtensionPointer,omitempty"` + + // Map. + + // +mapType="atomic" + // +k8s:validation:maxProperties=3 + MapString map[string]string `json:"mapString,omitempty"` + MapPointString map[string]*string `json:"mapPointString,omitempty"` + MapObject map[string]struct { + A string `json:"a,omitempty"` + B int `json:"b,omitempty"` + C bool `json:"c,omitempty"` + D float64 `json:"d,omitempty"` + E map[string]struct{} `json:"e,omitempty"` + F []struct{} `json:"f,omitempty"` + } `json:"mapObject,omitempty"` + // +mapType="atomic" + MapInOrString map[string]intstr.IntOrString `json:"mapInOrString,omitempty"` + MapStringPointer *map[string]string `json:"mapStringPointer,omitempty"` + MapInterface map[string]any `json:"mapInterface,omitempty"` + + // Slice. + + // +k8s:validation:maxItems=3 + // +k8s:validation:minItems=1 + SliceString []string `json:"sliceString,omitempty"` + SlicePointString []*string `json:"slicePointString,omitempty"` + // +k8s:validation:cel[0]:rule="self.b > 0" + // +k8s:validation:cel[0]:message="b must be greater than 0" + SliceObject []struct { + A string `json:"a,omitempty"` + B int `json:"b,omitempty"` + C bool `json:"c,omitempty"` + D float64 `json:"d,omitempty"` + E map[string]struct{} `json:"e,omitempty"` + F []struct{} `json:"f,omitempty"` + } `json:"sliceObject,omitempty"` + SliceBytes []byte `json:"sliceBytes,omitempty"` + SliceBytesPointer *[]byte `json:"sliceBytesPointer,omitempty"` + SliceInterface []any `json:"sliceInterface,omitempty"` + + // Array. + + ArrayString [3]string `json:"arrayString,omitempty"` + ArrayPointString [3]*string `json:"arrayPointString,omitempty"` + // +k8s:validation:cel[0]:rule> self.b > 0 + // +k8s:validation:cel[0]:message> b must be greater than 0, + // +k8s:validation:cel[1]:rule> self.e.length() % 2 == 0 + // +k8s:validation:cel[1]:rule> ? self.a == self.a + ' is even' + // +k8s:validation:cel[1]:rule> : self.a == self.a + ' is odd' + // +k8s:validation:cel[1]:message> mutate a + // +k8s:validation:cel[1]:reason="FieldValueRequired" + ArrayObject [3]struct { + A string `json:"a,omitempty"` + B int `json:"b,omitempty"` + C bool `json:"c,omitempty"` + D float64 `json:"d,omitempty"` + E map[string]struct{} `json:"e,omitempty"` + } + + // Reference. + + SubDummySpecPointer *DummySpec `json:"subDummySpecPointer,omitempty"` + SliceSubDummySpec []DummySpec `json:"sliceSubDummySpec,omitempty"` +} + +// DummyStatus defines the observed state of Dummy. +type DummyStatus struct { +} diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml new file mode 100644 index 000000000..0d426eac7 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/generators/testdata/reflect_type/expected.yaml @@ -0,0 +1,338 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + name: dummies.samplecontroller.k8s.io +spec: + group: samplecontroller.k8s.io + names: + categories: + - all + - walrus + kind: Dummy + listKind: DummyList + plural: projects + shortNames: + - proj + singular: dummy + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + description: Dummy is the schema for the projects API. + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + arrayObject: + maxItems: 3 + minItems: 3 + properties: + a: + type: string + b: + type: integer + c: + type: boolean + d: + format: double + type: number + e: + additionalProperties: + type: object + nullable: true + type: object + required: + - a + - b + - c + - d + - e + type: object + x-kubernetes-validations: + - message: b must be greater than 0, + rule: self.b > 0 + - message: mutate a + reason: FieldValueRequired + rule: |- + self.e.length() % 2 == 0 + ? self.a == self.a + ' is even' + : self.a == self.a + ' is odd' + arrayPointString: + maxItems: 3 + minItems: 3 + nullable: true + type: string + arrayString: + maxItems: 3 + minItems: 3 + type: string + bool: + type: boolean + boolPointer: + default: true + nullable: true + type: boolean + duration: + format: duration + type: string + durationPointer: + format: duration + nullable: true + type: string + float: + format: double + type: number + floatPointer: + format: float + maximum: 10 + nullable: true + type: number + intOrString: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + intOrStringPointer: + anyOf: + - type: integer + - type: string + nullable: true + x-kubernetes-int-or-string: true + integer: + minimum: 1 + type: integer + integerPointer: + enum: + - 1 + - 2 + - 3 + - 5 + - 7 + format: int64 + type: integer + mapInOrString: + additionalProperties: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + nullable: true + type: object + x-kubernetes-map-type: atomic + mapInterface: + additionalProperties: + type: object + x-kubernetes-preserve-unknown-fields: true + nullable: true + type: object + mapObject: + additionalProperties: + properties: + a: + type: string + b: + type: integer + c: + type: boolean + d: + format: double + type: number + e: + additionalProperties: + type: object + nullable: true + type: object + f: + items: + type: object + nullable: true + type: array + required: + - a + - b + - c + - d + - e + - f + type: object + nullable: true + type: object + mapPointString: + additionalProperties: + nullable: true + type: string + nullable: true + type: object + mapString: + additionalProperties: + type: string + maxProperties: 3 + nullable: true + type: object + x-kubernetes-map-type: atomic + mapStringPointer: + additionalProperties: + type: string + nullable: true + type: object + microTime: + format: date-time + type: string + microTimePointer: + format: date-time + nullable: true + type: string + rawExtension: + type: object + x-kubernetes-preserve-unknown-fields: true + rawExtensionPointer: + nullable: true + type: object + x-kubernetes-preserve-unknown-fields: true + sliceBytes: + format: byte + nullable: true + type: string + sliceBytesPointer: + format: byte + nullable: true + type: string + sliceInterface: + items: + type: object + x-kubernetes-preserve-unknown-fields: true + nullable: true + type: array + sliceObject: + items: + properties: + a: + type: string + b: + type: integer + c: + type: boolean + d: + format: double + type: number + e: + additionalProperties: + type: object + nullable: true + type: object + f: + items: + type: object + nullable: true + type: array + required: + - a + - b + - c + - d + - e + - f + type: object + nullable: true + type: array + x-kubernetes-validations: + - message: b must be greater than 0 + rule: self.b > 0 + slicePointString: + items: + nullable: true + type: string + nullable: true + type: array + sliceString: + items: + type: string + maxItems: 3 + minItems: 1 + nullable: true + type: array + sliceSubDummySpec: + items: + $ref: '#/definitions/github.com~1seal-io~1code-generator~1cmd~1crd-gen~1generators~1testdata~1reflect_type~0DummySpec' + nullable: true + type: array + string: + enum: + - x + - "y" + - z + type: string + stringPointer: + default: x + nullable: true + type: string + subDummySpecPointer: + $ref: '#/definitions/github.com~1seal-io~1code-generator~1cmd~1crd-gen~1generators~1testdata~1reflect_type~0DummySpec' + nullable: true + time: + format: date-time + type: string + timePointer: + format: date-time + nullable: true + type: string + required: + - integer + - float + - string + - bool + - integerPointer + - floatPointer + - stringPointer + - boolPointer + - microTime + - duration + - time + - intOrString + - rawExtension + - microTimePointer + - durationPointer + - timePointer + - intOrStringPointer + - rawExtensionPointer + - mapString + - mapPointString + - mapObject + - mapInOrString + - mapStringPointer + - mapInterface + - sliceString + - slicePointString + - sliceObject + - sliceBytes + - sliceBytesPointer + - sliceInterface + - arrayString + - arrayPointString + - arrayObject + - subDummySpecPointer + - sliceSubDummySpec + type: object + status: + type: object + required: + - metadata + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/staging/github.com/seal-io/code-generator/cmd/crd-gen/main.go b/staging/github.com/seal-io/code-generator/cmd/crd-gen/main.go new file mode 100644 index 000000000..49fa24c77 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/crd-gen/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "flag" + + "github.com/spf13/pflag" + "k8s.io/klog/v2" + + generatorargs "github.com/seal-io/code-generator/cmd/crd-gen/args" + "github.com/seal-io/code-generator/cmd/crd-gen/generators" +) + +func main() { + klog.InitFlags(nil) + genericArgs, customArgs := generatorargs.NewDefaults() + + genericArgs.AddFlags(pflag.CommandLine) + customArgs.AddFlags(pflag.CommandLine) + _ = flag.Set("logtostderr", "true") + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) + pflag.Parse() + + if err := generatorargs.Validate(genericArgs); err != nil { + klog.Fatalf("Error: %v", err) + } + + if err := genericArgs.Execute( + generators.NameSystems(), + generators.DefaultNameSystem(), + generators.Packages, + ); err != nil { + klog.Fatalf("Error: %v", err) + } + + klog.V(2).Info("Completed successfully.") +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/README.md b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/README.md new file mode 100644 index 000000000..cfb7e82fc --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/README.md @@ -0,0 +1,37 @@ +# Webhook(Configuration) Gen + +This directory contains the code generators for the Webhook Configuration API. + +# Marker Usage + +- Type Markers: + - `+k8s:webhook-gen:validating:*`: Specify to generate ValidatingWebhookConfiguration. + - `+k8s:webhook-gen:mutating:*`: Specify to generate MutatingWebhookConfiguration. + - `+k8s:webhook-gen:*:group="example.domain.io",version="v1",resource="dummies",scope="Namespaced"`: Specify the + group, version and resource name, which is used for generate the webhook configuration's path. + - `scope`: Select from `Namespaced`, `Cluster` or `*`. + - `+k8s:webhook-gen:*:operations=["..."],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10,reinvocationPolicy="Never"`: + Specify the configuration of the webhook. + - `operations`: Specify in the JSON array format. Combine by `CREATE`, `UPDATE`, `DELETE`, `CONNECT`, or `*`. + - `failurePolicy`: Select from `Fail` or `Ignore`. + - `sideEffects`: Select from `Unknown`, `None`, `Some` or `NoneOnDryRun`. + - `matchPolicy`: Select from `Exact` or `Equivalent`. + - `timeoutSeconds`: Specify the timeout seconds. + - `reinvocationPolicy`: Select from `Never` or `IfNeeded`, works on MutatingWebhookConfiguration only. + - `+k8s:webhook-gen:*:namespaceSelector={}`: Specify the namespace selector for the webhook configuration. + - `+k8s:webhook-gen:*:objectSelector={}`: Specify the object selector for the webhook configuration. + - `+k8s:webhook-gen:*:matchConditions=[{}]`: Specify the match conditions for the webhook configuration. + +# License + +Copyright (c) 2024 [Seal, Inc.](https://seal.io) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [LICENSE](../../LICENSE) file for details. + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/args/args.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/args/args.go new file mode 100644 index 000000000..fba7b9f60 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/args/args.go @@ -0,0 +1,36 @@ +package args + +import ( + "fmt" + + "github.com/spf13/pflag" + "k8s.io/gengo/args" +) + +// CustomArgs is used by the gengo framework to pass args specific to this generator. +type CustomArgs struct{} + +// NewDefaults returns default arguments for the generator. +func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { + genericArgs := args.Default().WithoutDefaultFlagParsing() + + customArgs := &CustomArgs{} + genericArgs.CustomArgs = customArgs + + genericArgs.OutputFileBaseName = "webhook_generated" + + return genericArgs, customArgs +} + +// AddFlags add the generator flags to the flag set. +func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { +} + +// Validate checks the given arguments. +func Validate(genericArgs *args.GeneratorArgs) error { + if _, ok := genericArgs.CustomArgs.(*CustomArgs); !ok { + return fmt.Errorf("expected CustomArgs to be of type %T", &CustomArgs{}) + } + + return nil +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/helper.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/helper.go new file mode 100644 index 000000000..89641ef65 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/helper.go @@ -0,0 +1,425 @@ +package generators + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/seal-io/utils/stringx" + admreg "k8s.io/api/admissionregistration/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/gengo/types" + "k8s.io/klog/v2" + + "github.com/seal-io/code-generator/utils" +) + +var ( + knownOperations = sets.New( + admreg.OperationAll, + admreg.Create, + admreg.Delete, + admreg.Update, + admreg.Connect) + knownScopes = sets.New( + admreg.NamespacedScope, + admreg.ClusterScope, + admreg.AllScopes) + knownFailurePolicies = sets.New( + admreg.Fail, + admreg.Ignore) + knownMatchPolicies = sets.New( + admreg.Exact, + admreg.Equivalent) + knownSideEffects = sets.New( + admreg.SideEffectClassUnknown, + admreg.SideEffectClassSome, + admreg.SideEffectClassNone, + admreg.SideEffectClassNoneOnDryRun) + knownReinvocationPolicies = sets.New( + admreg.NeverReinvocationPolicy, + admreg.IfNeededReinvocationPolicy) +) + +// reflectType reflects the type into a WebhookTypeDefinition, +// according to the given package. +func reflectType(t *types.Type) *WebhookTypeDefinition { + if t == nil { + return nil + } + + logger := klog.Background(). + WithName("$"). + WithValues("gen", "webhook-gen", "type", t.String()) + + // Collect type markers. + // + // +k8s:webhook-gen:validating:group=,version=,resource=,scope=,failurePolicy=,sideEffects=,matchPolicy=,timeoutSeconds= + // +k8s:webhook-gen:validating:operations= + // +k8s:webhook-gen:validating:namespaceSelector= + // +k8s:webhook-gen:validating:objectSelector= + // +k8s:webhook-gen:validating:matchConditions= + // +k8s:webhook-gen:mutating:group=,version=,resource=,scope=,failurePolicy=,sideEffects=,matchPolicy=,reinvocationPolicy=,timeoutSeconds= + // +k8s:webhook-gen:mutating:operations= + // +k8s:webhook-gen:mutating:namespaceSelector= + // +k8s:webhook-gen:mutating:objectSelector= + // +k8s:webhook-gen:mutating:matchConditions= + tm := map[string][]string{} + collectMarkers(t.SecondClosestCommentLines, tm) + collectMarkers(t.CommentLines, tm) + + if len(tm) == 0 || (len(tm["validating"]) == 0 && len(tm["mutating"]) == 0) { + return nil + } + + var td WebhookTypeDefinition + + if len(tm["validating"]) != 0 { + logger := logger.WithValues("markers", "validating") + + wh := &admreg.ValidatingWebhook{ + AdmissionReviewVersions: []string{"v1"}, + } + + for _, webhook := range tm["validating"] { + for mk, mv := range utils.ParseMarker(webhook) { + switch mk { + case "group": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal group", "value", mv) + } else { + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].APIGroups = []string{strings.ToLower(v)} + } + case "version": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal version", "value", mv) + } else { + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].APIVersions = []string{strings.ToLower(v)} + } + case "resource": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal resource", "value", mv) + } else { + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].Resources = []string{strings.ToLower(v)} + } + case "scope": + var v admreg.ScopeType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal scope", "value", mv) + case !knownScopes.Has(v): + logger.Error(nil, "invalid scope, select from known scopes", "value", mv) + default: + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].Scope = &v + } + case "operations": + var v []admreg.OperationType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal operations", "value", mv) + case !knownOperations.HasAll(v...): + logger.Error(nil, "invalid operations, select from known operations", "value", mv) + default: + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].Operations = v + } + case "failurePolicy": + var v admreg.FailurePolicyType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal failure policy", "value", mv) + case !knownFailurePolicies.Has(v): + logger.Error(nil, "invalid failure policy, select from known failure policies", "value", mv) + default: + wh.FailurePolicy = &v + } + case "sideEffects": + var v admreg.SideEffectClass + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal side effects", "value", mv) + case !knownSideEffects.Has(v): + logger.Error(nil, "invalid side effects, select from known side effect classes", "value", mv) + default: + wh.SideEffects = &v + } + case "matchPolicy": + var v admreg.MatchPolicyType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal match policy", "value", mv) + case !knownMatchPolicies.Has(v): + logger.Error(nil, "invalid match policy, select from known match policies", "value", mv) + default: + wh.MatchPolicy = &v + } + case "timeoutSeconds": + var v int32 + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal timeout seconds", "value", mv) + } else { + wh.TimeoutSeconds = &v + } + case "namespaceSelector": + var selector meta.LabelSelector + if err := json.Unmarshal([]byte(mv), &selector); err != nil { + logger.Error(err, "unmarshal namespace selector", "value", mv) + } else { + wh.NamespaceSelector = &selector + } + case "objectSelector": + var selector meta.LabelSelector + if err := json.Unmarshal([]byte(mv), &selector); err != nil { + logger.Error(err, "unmarshal object selector", "value", mv) + } else { + wh.ObjectSelector = &selector + } + case "matchConditions": + var conditions []admreg.MatchCondition + err := json.Unmarshal([]byte(mv), &conditions) + switch { + case err != nil: + logger.Error(err, "unmarshal match conditions", "value", mv) + case len(conditions) > 64: + logger.Error(nil, "too many match conditions, maximum 64", "value", mv) + case len(conditions) > 0: + wh.MatchConditions = conditions + } + } + } + } + + if len(wh.Rules) == 0 || len(wh.Rules[0].Resources) == 0 { + logger.Error(nil, "invalid rules specified, must include one resource") + } else { + var pre, grp, ver, klow string + pre = "validate" + if len(wh.Rules[0].APIGroups) != 0 { + grp = wh.Rules[0].APIGroups[0] + } + if len(wh.Rules[0].APIVersions) != 0 { + ver = wh.Rules[0].APIVersions[0] + } + klow = strings.ToLower(stringx.Singularize(wh.Rules[0].Resources[0])) + wh.Name = fmt.Sprintf("%s.%s.%s.%s", pre, grp, ver, klow) + td.Validating = wh + } + } + + if len(tm["mutating"]) != 0 { + logger := logger.WithValues("markers", "mutating") + + wh := &admreg.MutatingWebhook{ + AdmissionReviewVersions: []string{"v1"}, + } + + for _, webhook := range tm["mutating"] { + for mk, mv := range utils.ParseMarker(webhook) { + switch mk { + case "group": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal group", "value", mv) + } else { + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].APIGroups = []string{strings.ToLower(v)} + } + case "version": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal version", "value", mv) + } else { + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].APIVersions = []string{strings.ToLower(v)} + } + case "resource": + var v string + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal resource", "value", mv) + } else { + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].Resources = []string{strings.ToLower(v)} + } + case "scope": + var v admreg.ScopeType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal scope", "value", mv) + case !knownScopes.Has(v): + logger.Error(nil, "invalid scope, select from known scopes", "value", mv) + default: + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].Scope = &v + } + case "operations": + var v []admreg.OperationType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal operations", "value", mv) + case !knownOperations.HasAll(v...): + logger.Error(nil, "invalid operations, select from known operations", "value", mv) + default: + if len(wh.Rules) == 0 { + wh.Rules = append(wh.Rules, admreg.RuleWithOperations{}) + } + wh.Rules[0].Operations = v + } + case "failurePolicy": + var v admreg.FailurePolicyType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal failure policy", "value", mv) + case !knownFailurePolicies.Has(v): + logger.Error(nil, "invalid failure policy, select from known failure policies", "value", mv) + default: + wh.FailurePolicy = &v + } + case "sideEffects": + var v admreg.SideEffectClass + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal side effects", "value", mv) + case !knownSideEffects.Has(v): + logger.Error(nil, "invalid side effects, select from known side effect classes", "value", mv) + default: + wh.SideEffects = &v + } + case "matchPolicy": + var v admreg.MatchPolicyType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal match policy", "value", mv) + case !knownMatchPolicies.Has(v): + logger.Error(nil, "invalid match policy, select from known match policies", "value", mv) + default: + wh.MatchPolicy = &v + } + case "timeoutSeconds": + var v int32 + if err := json.Unmarshal([]byte(mv), &v); err != nil { + logger.Error(err, "unmarshal timeout seconds", "value", mv) + } else { + wh.TimeoutSeconds = &v + } + case "namespaceSelector": + var selector meta.LabelSelector + if err := json.Unmarshal([]byte(mv), &selector); err != nil { + logger.Error(err, "unmarshal namespace selector", "value", mv) + } else { + wh.NamespaceSelector = &selector + } + case "objectSelector": + var selector meta.LabelSelector + if err := json.Unmarshal([]byte(mv), &selector); err != nil { + logger.Error(err, "unmarshal object selector", "value", mv) + } else { + wh.ObjectSelector = &selector + } + case "reinvocationPolicy": + var v admreg.ReinvocationPolicyType + err := json.Unmarshal([]byte(mv), &v) + switch { + case err != nil: + logger.Error(err, "unmarshal reinvocation policy", "value", mv) + case !knownReinvocationPolicies.Has(v): + logger.Error(nil, "invalid reinvocation policy, select from known reinvocation policies", "value", mv) + default: + wh.ReinvocationPolicy = &v + } + case "matchConditions": + var conditions []admreg.MatchCondition + err := json.Unmarshal([]byte(mv), &conditions) + switch { + case err != nil: + logger.Error(err, "unmarshal match conditions", "value", mv) + case len(conditions) > 64: + logger.Error(nil, "too many match conditions, maximum 64", "value", mv) + case len(conditions) > 0: + wh.MatchConditions = conditions + } + } + } + } + + if len(wh.Rules) == 0 || len(wh.Rules[0].Resources) == 0 { + logger.Error(nil, "invalid rules specified, must include one resource") + } else { + var pre, grp, ver, klow string + pre = "mutate" + if len(wh.Rules[0].APIGroups) != 0 { + grp = wh.Rules[0].APIGroups[0] + } + if len(wh.Rules[0].APIVersions) != 0 { + ver = wh.Rules[0].APIVersions[0] + } + klow = strings.ToLower(stringx.Singularize(wh.Rules[0].Resources[0])) + wh.Name = fmt.Sprintf("%s.%s.%s.%s", pre, grp, ver, klow) + td.Mutating = wh + } + } + + if td.Validating == nil && td.Mutating == nil { + return nil + } + + return &td +} + +const ( + webhookGenMarker = "+k8s:webhook-gen:" +) + +// collectMarkers collects markers from the given comment lines. +func collectMarkers(comments []string, into map[string][]string) { + for _, line := range comments { + line = strings.TrimSpace(line) + if len(line) == 0 { + continue + } + + if strings.HasPrefix(line, webhookGenMarker) { + kv := strings.SplitN(line[len(webhookGenMarker):], ":", 2) + if len(kv) == 2 { + into[kv[0]] = append(into[kv[0]], kv[1]) + } else if len(kv) == 1 { + into[kv[0]] = append(into[kv[0]], "") + } + } + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/helper_test.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/helper_test.go new file mode 100644 index 000000000..adda4f1d6 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/helper_test.go @@ -0,0 +1,48 @@ +package generators + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/gengo/parser" + "sigs.k8s.io/yaml" +) + +func Test_reflectType(t *testing.T) { + var ( + dir = filepath.Join("testdata", "reflect_type") + pkg = "github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type" + typ = "DummyReconciler" + ) + + b := parser.New() + if err := b.AddDir(pkg); err != nil { + t.Fatalf("failed to parse package %q: %v", pkg, err) + } + + u, err := b.FindTypes() + if err != nil { + t.Fatalf("failed to find types: %v", err) + } + + ty := u.Package(pkg).Type(typ) + if ty == nil { + t.Fatalf("failed to find type %q in package %q", typ, pkg) + } + + td := reflectType(ty) + + actualBytes, err := yaml.Marshal(td) + if err != nil { + t.Fatalf("failed to marshal typed definition: %v", err) + } + + expectedBytes, err := os.ReadFile(filepath.Join(dir, "expected.yaml")) + if err != nil { + t.Fatalf("failed to read expected file: %v", err) + } + + assert.Equal(t, string(expectedBytes), string(actualBytes)) +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/packages.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/packages.go new file mode 100644 index 000000000..d81389745 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/packages.go @@ -0,0 +1,70 @@ +package generators + +import ( + "fmt" + "strings" + + "k8s.io/gengo/args" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/klog/v2" +) + +// NameSystems returns the name system used by the generators in this package. +func NameSystems() namer.NameSystems { + return namer.NameSystems{ + "public": namer.NewPublicNamer(0), + } +} + +// DefaultNameSystem returns the default name system for ordering the types to be +// processed by the generators in this package. +func DefaultNameSystem() string { + return "public" +} + +func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { + boilerplate, err := arguments.LoadGoBoilerplate() + if err != nil { + klog.Fatalf("Failed loading boilerplate: %v", err) + } + + packages := generator.Packages{} + header := append([]byte(fmt.Sprintf("//go:build !%s\n// +build !%s\n\n", arguments.GeneratedBuildTag, arguments.GeneratedBuildTag)), boilerplate...) + + for i := range context.Inputs { + klog.V(5).Infof("considering pkg %q", context.Inputs[i]) + pkg := context.Universe[context.Inputs[i]] + if pkg == nil { + // If the input had no Go files, for example. + continue + } + + path := pkg.Path + // If the source path is within a /vendor/ directory (for example, + // k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow + // generation to output to the proper relative path (under vendor). + // Otherwise, the generator will create the file in the wrong location + // in the output directory. + if strings.HasPrefix(pkg.SourcePath, arguments.OutputBase) { + expandedPath := strings.TrimPrefix(pkg.SourcePath, arguments.OutputBase) + if strings.HasPrefix(expandedPath, "/vendor/") { + path = expandedPath + } + } + + packages = append(packages, + &generator.DefaultPackage{ + PackageName: pkg.Name, + PackagePath: path, + HeaderText: header, + GeneratorFunc: func(c *generator.Context) []generator.Generator { + return []generator.Generator{ + NewWebhookGen(arguments.OutputFileBaseName, path), + } + }, + }) + } + + return packages +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type/dummy.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type/dummy.go new file mode 100644 index 000000000..858cbc170 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type/dummy.go @@ -0,0 +1,9 @@ +package reflect_type + +// DummyReconciler reconciles a Dummy object. +// +// nolint:lll +// +k8s:webhook-gen:validating:group="samplecontroller.seal.io",version="v1",resource="dummies",scope="*",operations=["CREATE","UPDATE","DELETE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10,namespaceSelector={"matchExpressions":[{"key":"walrus.seal.io/operate","operator":"Exists"}]},objectSelector={"matchLabels":{"label":"value"}},matchConditions=[{"name":"test","expression":"self.b > 0"}] +// +k8s:webhook-gen:mutating:group="samplecontroller.seal.io",version="v1",resource="dummies",scope="*",failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",reinvocationPolicy="Never",timeoutSeconds=10,namespaceSelector={"matchExpressions":[{"key":"walrus.seal.io/operate","operator":"Exists"}]},objectSelector={"matchLabels":{"label":"value"}} +type DummyReconciler struct { +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type/expected.yaml b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type/expected.yaml new file mode 100644 index 000000000..1f44c45a8 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/reflect_type/expected.yaml @@ -0,0 +1,56 @@ +mutating: + admissionReviewVersions: + - v1 + clientConfig: {} + failurePolicy: Fail + matchPolicy: Equivalent + name: mutate.samplecontroller.seal.io.v1.dummy + namespaceSelector: + matchExpressions: + - key: walrus.seal.io/operate + operator: Exists + objectSelector: + matchLabels: + label: value + reinvocationPolicy: Never + rules: + - apiGroups: + - samplecontroller.seal.io + apiVersions: + - v1 + resources: + - dummies + scope: '*' + sideEffects: None + timeoutSeconds: 10 +validating: + admissionReviewVersions: + - v1 + clientConfig: {} + failurePolicy: Fail + matchConditions: + - expression: self.b > 0 + name: test + matchPolicy: Equivalent + name: validate.samplecontroller.seal.io.v1.dummy + namespaceSelector: + matchExpressions: + - key: walrus.seal.io/operate + operator: Exists + objectSelector: + matchLabels: + label: value + rules: + - apiGroups: + - samplecontroller.seal.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + - DELETE + resources: + - dummies + scope: '*' + sideEffects: None + timeoutSeconds: 10 diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/dummy.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/dummy.go new file mode 100644 index 000000000..64613794f --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/dummy.go @@ -0,0 +1,9 @@ +package webhook_gen + +// DummyReconciler reconciles a Dummy object. +// +// nolint:lll +// +k8s:webhook-gen:validating:group="samplecontroller.seal.io",version="v1",resource="dummies",scope="*",operations=["CREATE","UPDATE","DELETE"],failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",timeoutSeconds=10,namespaceSelector={"matchExpressions":[{"key":"walrus.seal.io/operate","operator":"Exists"}]},objectSelector={"matchLabels":{"label":"value"}},matchConditions=[{"name":"test","expression":"self.b > 0"}] +// +k8s:webhook-gen:mutating:group="samplecontroller.seal.io",version="v1",resource="dummies",scope="*",failurePolicy="Fail",sideEffects="None",matchPolicy="Equivalent",reinvocationPolicy="Never",timeoutSeconds=10,namespaceSelector={"matchExpressions":[{"key":"walrus.seal.io/operate","operator":"Exists"}]},objectSelector={"matchLabels":{"label":"value"}} +type DummyReconciler struct { +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/go.txt b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/go.txt new file mode 100644 index 000000000..e9f9a7eec --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/go.txt @@ -0,0 +1,4 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/zz_generated.webhooks.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/zz_generated.webhooks.go new file mode 100644 index 000000000..0f5fe49cc --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/zz_generated.webhooks.go @@ -0,0 +1,174 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. +package webhook_gen + +import ( + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" +) + +func GetWebhookConfigurations(np string, c v1.WebhookClientConfig) (*v1.ValidatingWebhookConfiguration, *v1.MutatingWebhookConfiguration) { + vwc := GetValidatingWebhookConfiguration(np+"-validation", c) + mwc := GetMutatingWebhookConfiguration(np+"-mutation", c) + return vwc, mwc +} + +func GetValidatingWebhookConfiguration(n string, c v1.WebhookClientConfig) *v1.ValidatingWebhookConfiguration { + return &v1.ValidatingWebhookConfiguration{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "admissionregistration.k8s.io/v1", + Kind: "ValidatingWebhookConfiguration", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: n, + }, + Webhooks: []v1.ValidatingWebhook{ + vwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c), + }, + } +} + +func GetMutatingWebhookConfiguration(n string, c v1.WebhookClientConfig) *v1.MutatingWebhookConfiguration { + return &v1.MutatingWebhookConfiguration{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "admissionregistration.k8s.io/v1", + Kind: "MutatingWebhookConfiguration", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: n, + }, + Webhooks: []v1.MutatingWebhook{ + mwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c), + }, + } +} + +func (*DummyReconciler) ValidatePath() string { + return "/validate-samplecontroller-seal-io-v1-dummy" +} + +func vwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c v1.WebhookClientConfig) v1.ValidatingWebhook { + path := "/validate-samplecontroller-seal-io-v1-dummy" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.ValidatingWebhook{ + Name: "validate.samplecontroller.seal.io.v1.dummy", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "samplecontroller.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "dummies", + }, + Scope: ptr.To[v1.ScopeType]("*"), + }, + Operations: []v1.OperationType{ + "CREATE", + "UPDATE", + "DELETE", + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + NamespaceSelector: ptr.To(metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{ + { + Key: "walrus.seal.io/operate", + Operator: metav1.LabelSelectorOperator("Exists"), + }, + }, + }), + ObjectSelector: ptr.To(metav1.LabelSelector{ + MatchLabels: map[string]string{ + "label": "value", + }, + }), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + MatchConditions: []v1.MatchCondition{ + { + Name: "test", + Expression: "self.b > 0", + }, + }, + } +} + +func (*DummyReconciler) DefaultPath() string { + return "/mutate-samplecontroller-seal-io-v1-dummy" +} + +func mwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c v1.WebhookClientConfig) v1.MutatingWebhook { + path := "/mutate-samplecontroller-seal-io-v1-dummy" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.MutatingWebhook{ + Name: "mutate.samplecontroller.seal.io.v1.dummy", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "samplecontroller.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "dummies", + }, + Scope: ptr.To[v1.ScopeType]("*"), + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + NamespaceSelector: ptr.To(metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{ + { + Key: "walrus.seal.io/operate", + Operator: metav1.LabelSelectorOperator("Exists"), + }, + }, + }), + ObjectSelector: ptr.To(metav1.LabelSelector{ + MatchLabels: map[string]string{ + "label": "value", + }, + }), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + ReinvocationPolicy: ptr.To[v1.ReinvocationPolicyType]("Never"), + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/zz_generated.webhooks.go.expected b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/zz_generated.webhooks.go.expected new file mode 100644 index 000000000..0f5fe49cc --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen/zz_generated.webhooks.go.expected @@ -0,0 +1,174 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by "walrus". DO NOT EDIT. +package webhook_gen + +import ( + v1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" +) + +func GetWebhookConfigurations(np string, c v1.WebhookClientConfig) (*v1.ValidatingWebhookConfiguration, *v1.MutatingWebhookConfiguration) { + vwc := GetValidatingWebhookConfiguration(np+"-validation", c) + mwc := GetMutatingWebhookConfiguration(np+"-mutation", c) + return vwc, mwc +} + +func GetValidatingWebhookConfiguration(n string, c v1.WebhookClientConfig) *v1.ValidatingWebhookConfiguration { + return &v1.ValidatingWebhookConfiguration{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "admissionregistration.k8s.io/v1", + Kind: "ValidatingWebhookConfiguration", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: n, + }, + Webhooks: []v1.ValidatingWebhook{ + vwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c), + }, + } +} + +func GetMutatingWebhookConfiguration(n string, c v1.WebhookClientConfig) *v1.MutatingWebhookConfiguration { + return &v1.MutatingWebhookConfiguration{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "admissionregistration.k8s.io/v1", + Kind: "MutatingWebhookConfiguration", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: n, + }, + Webhooks: []v1.MutatingWebhook{ + mwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c), + }, + } +} + +func (*DummyReconciler) ValidatePath() string { + return "/validate-samplecontroller-seal-io-v1-dummy" +} + +func vwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c v1.WebhookClientConfig) v1.ValidatingWebhook { + path := "/validate-samplecontroller-seal-io-v1-dummy" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.ValidatingWebhook{ + Name: "validate.samplecontroller.seal.io.v1.dummy", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "samplecontroller.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "dummies", + }, + Scope: ptr.To[v1.ScopeType]("*"), + }, + Operations: []v1.OperationType{ + "CREATE", + "UPDATE", + "DELETE", + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + NamespaceSelector: ptr.To(metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{ + { + Key: "walrus.seal.io/operate", + Operator: metav1.LabelSelectorOperator("Exists"), + }, + }, + }), + ObjectSelector: ptr.To(metav1.LabelSelector{ + MatchLabels: map[string]string{ + "label": "value", + }, + }), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + MatchConditions: []v1.MatchCondition{ + { + Name: "test", + Expression: "self.b > 0", + }, + }, + } +} + +func (*DummyReconciler) DefaultPath() string { + return "/mutate-samplecontroller-seal-io-v1-dummy" +} + +func mwh_webhook_gen_generators_testdata_webhook_gen_DummyReconciler(c v1.WebhookClientConfig) v1.MutatingWebhook { + path := "/mutate-samplecontroller-seal-io-v1-dummy" + + cc := c.DeepCopy() + if cc.Service != nil { + cc.Service.Path = &path + } else if c.URL != nil { + cc.URL = ptr.To(*c.URL + path) + } + + return v1.MutatingWebhook{ + Name: "mutate.samplecontroller.seal.io.v1.dummy", + ClientConfig: *cc, + Rules: []v1.RuleWithOperations{ + { + Rule: v1.Rule{ + APIGroups: []string{ + "samplecontroller.seal.io", + }, + APIVersions: []string{ + "v1", + }, + Resources: []string{ + "dummies", + }, + Scope: ptr.To[v1.ScopeType]("*"), + }, + }, + }, + FailurePolicy: ptr.To[v1.FailurePolicyType]("Fail"), + MatchPolicy: ptr.To[v1.MatchPolicyType]("Equivalent"), + NamespaceSelector: ptr.To(metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{ + { + Key: "walrus.seal.io/operate", + Operator: metav1.LabelSelectorOperator("Exists"), + }, + }, + }), + ObjectSelector: ptr.To(metav1.LabelSelector{ + MatchLabels: map[string]string{ + "label": "value", + }, + }), + SideEffects: ptr.To[v1.SideEffectClass]("None"), + TimeoutSeconds: ptr.To[int32](10), + AdmissionReviewVersions: []string{ + "v1", + }, + ReinvocationPolicy: ptr.To[v1.ReinvocationPolicyType]("Never"), + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/webhook.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/webhook.go new file mode 100644 index 000000000..79420d9cc --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/webhook.go @@ -0,0 +1,496 @@ +package generators + +import ( + "fmt" + "io" + "strings" + + "github.com/seal-io/utils/stringx" + admreg "k8s.io/api/admissionregistration/v1" + "k8s.io/gengo/generator" + "k8s.io/gengo/namer" + "k8s.io/gengo/types" +) + +func NewWebhookGen(sanitizedName, outputPackage string) generator.Generator { + return &webhookGen{ + DefaultGen: generator.DefaultGen{ + OptionalName: sanitizedName, + }, + outputPackage: outputPackage, + imports: generator.NewImportTrackerForPackage(outputPackage), + } +} + +type WebhookTypeDefinition struct { + Validating *admreg.ValidatingWebhook `json:"validating,omitempty"` + Mutating *admreg.MutatingWebhook `json:"mutating,omitempty"` +} + +type webhookGen struct { + generator.DefaultGen + + outputPackage string + imports namer.ImportTracker + + types []*types.Type + typeDefs map[types.Name]*WebhookTypeDefinition +} + +func (g *webhookGen) Filter(c *generator.Context, t *types.Type) bool { + if t.Kind == types.Struct && t.Name.Package == g.outputPackage { + if td := reflectType(t); td != nil { + if g.typeDefs == nil { + g.typeDefs = map[types.Name]*WebhookTypeDefinition{} + } + + g.types = append(g.types, t) + g.typeDefs[t.Name] = td + } + return true + } + return false +} + +func (g *webhookGen) Namers(c *generator.Context) namer.NameSystems { + return namer.NameSystems{ + // Have the raw namer for this file track what it imports. + "raw": namer.NewRawNamer(g.outputPackage, g.imports), + "private": &namer.NameStrategy{ + Join: func(pre string, in []string, post string) string { + return strings.Join(in, "_") + }, + PrependPackageNames: 4, + }, + } +} + +func (g *webhookGen) isOtherPackage(pkg string) bool { + switch { + default: + return true + case pkg == g.outputPackage: + case strings.HasSuffix(pkg, `"`+g.outputPackage+`"`): + } + return false +} + +func (g *webhookGen) Imports(c *generator.Context) []string { + var pkgs []string + for _, pkg := range g.imports.ImportLines() { + if g.isOtherPackage(pkg) { + pkgs = append(pkgs, pkg) + } + } + return pkgs +} + +func (g *webhookGen) Init(c *generator.Context, w io.Writer) error { + var validateTypes []*types.Type + var mutateTypes []*types.Type + for _, t := range g.types { + td := g.typeDefs[t.Name] + if td == nil { + continue + } + + if td.Validating != nil { + validateTypes = append(validateTypes, t) + } + + if td.Mutating != nil { + mutateTypes = append(mutateTypes, t) + } + } + + args := getAdmissionRegistrationTypedArgs() + sw := generator.NewSnippetWriter(w, c, "$", "$") + + sw.Do("func GetWebhookConfigurations(np string, c $.WebhookClientConfig|raw$) "+ + "(*$.ValidatingWebhookConfiguration|raw$, *$.MutatingWebhookConfiguration|raw$) {\n", args) + sw.Do("vwc := GetValidatingWebhookConfiguration(np+\"-validation\", c)\n", nil) + sw.Do("mwc := GetMutatingWebhookConfiguration(np+\"-mutation\", c)\n", nil) + sw.Do("return vwc, mwc\n", nil) + sw.Do("}\n\n", nil) + + // START: ValidatingWebhookConfiguration. + sw.Do("func GetValidatingWebhookConfiguration(n string, c $.WebhookClientConfig|raw$) *$.ValidatingWebhookConfiguration|raw$ {\n", args) + + if len(validateTypes) == 0 { + sw.Do("return nil\n", nil) + } else { + sw.Do("return &$.ValidatingWebhookConfiguration|raw${\n", args) + sw.Do("TypeMeta: $.TypeMeta|raw${\n", args) + sw.Do("APIVersion: \"admissionregistration.k8s.io/v1\",\n", nil) + sw.Do("Kind: \"ValidatingWebhookConfiguration\",\n", nil) + sw.Do("},\n", nil) + sw.Do("ObjectMeta: $.ObjectMeta|raw${\n", args) + sw.Do("Name: n,\n", nil) + sw.Do("},\n", nil) + sw.Do("Webhooks: []$.ValidatingWebhook|raw${\n", args) + for _, t := range validateTypes { + typedArgs := generator.Args{"TYPE": t} + sw.Do("vwh_$.TYPE|private$(c),\n", typedArgs) + } + sw.Do("},\n", nil) + sw.Do("}\n", nil) + } + + sw.Do("}\n\n", nil) + // END: ValidatingWebhookConfiguration. + + // START: MutatingWebhookConfiguration. + sw.Do("func GetMutatingWebhookConfiguration(n string, c $.WebhookClientConfig|raw$) *$.MutatingWebhookConfiguration|raw$ {\n", args) + + if len(mutateTypes) == 0 { + sw.Do("return nil\n", nil) + } else { + sw.Do("return &$.MutatingWebhookConfiguration|raw${\n", args) + sw.Do("TypeMeta: $.TypeMeta|raw${\n", args) + sw.Do("APIVersion: \"admissionregistration.k8s.io/v1\",\n", nil) + sw.Do("Kind: \"MutatingWebhookConfiguration\",\n", nil) + sw.Do("},\n", nil) + sw.Do("ObjectMeta: $.ObjectMeta|raw${\n", args) + sw.Do("Name: n,\n", nil) + sw.Do("},\n", nil) + sw.Do("Webhooks: []$.MutatingWebhook|raw${\n", args) + for _, t := range mutateTypes { + typedArgs := generator.Args{"TYPE": t} + sw.Do("mwh_$.TYPE|private$(c),\n", typedArgs) + } + sw.Do("},\n", nil) + sw.Do("}\n", nil) + } + + sw.Do("}\n\n", nil) + // END: MutatingWebhookConfiguration. + + return sw.Error() +} + +func (g *webhookGen) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + td := g.typeDefs[t.Name] + if td == nil { + return nil + } + + if td.Validating != nil { + err := g.generateValidating(c, t, w, td.Validating) + if err != nil { + return err + } + } + + if td.Mutating != nil { + err := g.generateMutating(c, t, w, td.Mutating) + if err != nil { + return err + } + } + + return nil +} + +func (g *webhookGen) generateValidating(c *generator.Context, t *types.Type, w io.Writer, spec *admreg.ValidatingWebhook) error { + path := fmt.Sprintf("/%s", strings.ReplaceAll(spec.Name, ".", "-")) + + args := getAdmissionRegistrationTypedArgs().With("TYPE", t) + sw := generator.NewSnippetWriter(w, c, "$", "$") + + // ValidatePath + sw.Do("func (*$.TYPE|raw$) ValidatePath() string {\n", args) + sw.Do("return \"$.$\"\n", path) + sw.Do("}\n\n", nil) + + // vwh_*** + sw.Do("func vwh_$.TYPE|private$(c $.WebhookClientConfig|raw$) $.ValidatingWebhook|raw$ {\n", args) + + sw.Do("path := \"$.$\"\n\n", path) + sw.Do("cc := c.DeepCopy()\n", nil) + sw.Do("if cc.Service != nil {\n", nil) + sw.Do("cc.Service.Path = &path\n", nil) + sw.Do("} else if c.URL != nil {\n", nil) + sw.Do("cc.URL = ptr.To(*c.URL + path)\n", nil) + sw.Do("}\n\n", nil) + sw.Do("return $.ValidatingWebhook|raw${\n", args) + + args = args.With("SPEC", spec) + // START: Webhook. + sw.Do("Name: \"$.$\",\n", spec.Name) + sw.Do("ClientConfig: *cc,\n", nil) + + rule := spec.Rules[0] + args = args.With("RULE", rule) + // START: Webhook/Rules/0. + sw.Do("Rules: []$.RuleWithOperations|raw${\n", args) + sw.Do("{\n", nil) + sw.Do("Rule: $.Rule|raw${\n", args) + if len(rule.APIGroups) != 0 { + sw.Do("APIGroups: []string{\n\"$.$\",\n},\n", strings.Join(rule.APIGroups, "\",\n \"")) + } + if len(rule.APIVersions) != 0 { + sw.Do("APIVersions: []string{\n\"$.$\",\n},\n", strings.Join(rule.APIVersions, "\",\n \"")) + } + sw.Do("Resources: []string{\n\"$.$\",\n},\n", strings.Join(rule.Resources, "\",\n \"")) + if rule.Scope != nil { + sw.Do("Scope: ptr.To[$.ScopeType|raw$](\"$.RULE.Scope$\"),\n", args) + } + sw.Do("},\n", nil) + if len(rule.Operations) != 0 { + sw.Do("Operations: []$.OperationType|raw${\n\"$.OPERS$\",\n},\n", + args.With("OPERS", stringx.Join("\",\n \"", rule.Operations...))) + } + sw.Do("},\n", nil) + sw.Do("},\n", nil) + // END: Webhook/Rules/0. + + if spec.FailurePolicy != nil { + sw.Do("FailurePolicy: ptr.To[$.FailurePolicyType|raw$](\"$.SPEC.FailurePolicy$\"),\n", args) + } + if spec.MatchPolicy != nil { + sw.Do("MatchPolicy: ptr.To[$.MatchPolicyType|raw$](\"$.SPEC.MatchPolicy$\"),\n", args) + } + if selector := spec.NamespaceSelector; selector != nil { + sw.Do("NamespaceSelector: ptr.To($.LabelSelector|raw${\n", args) + if len(selector.MatchLabels) != 0 { + sw.Do("MatchLabels: map[string]string{\n", nil) + for k, v := range selector.MatchLabels { + sw.Do("\"$.KEY$\": \"$.VAL$\",\n", generator.Args{"KEY": k, "VAL": v}) + } + sw.Do("},\n", nil) + } + if len(selector.MatchExpressions) != 0 { + sw.Do("MatchExpressions: []$.LabelSelectorRequirement|raw${\n", args) + for _, expr := range selector.MatchExpressions { + sw.Do("{\n", nil) + sw.Do("Key: \"$.KEY$\",\n", generator.Args{"KEY": expr.Key}) + sw.Do("Operator: $.LabelSelectorOperator|raw$(\"$.OPER$\"),\n", args.With("OPER", expr.Operator)) + if expr.Values != nil { + sw.Do("Values: []string{\n\"$.$\",\n},\n", strings.Join(expr.Values, "\",\n \"")) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + sw.Do("}),\n", nil) + } + if selector := spec.ObjectSelector; selector != nil { + sw.Do("ObjectSelector: ptr.To($.LabelSelector|raw${\n", args) + if len(selector.MatchLabels) != 0 { + sw.Do("MatchLabels: map[string]string{\n", nil) + for k, v := range selector.MatchLabels { + sw.Do("\"$.KEY$\": \"$.VAL$\",\n", generator.Args{"KEY": k, "VAL": v}) + } + sw.Do("},\n", nil) + } + if len(selector.MatchExpressions) != 0 { + sw.Do("MatchExpressions: []$.LabelSelectorRequirement|raw${\n", args) + for _, expr := range selector.MatchExpressions { + sw.Do("{\n", nil) + sw.Do("Key: \"$.KEY$\",\n", generator.Args{"KEY": expr.Key}) + sw.Do("Operator: $.LabelSelectorOperator|raw$(\"$.OPER$\"),\n", args.With("OPER", expr.Operator)) + if expr.Values != nil { + sw.Do("Values: []string{\n\"$.$\",\n},\n", strings.Join(expr.Values, "\",\n \"")) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + sw.Do("}),\n", nil) + } + if spec.SideEffects != nil { + sw.Do("SideEffects: ptr.To[$.SideEffectClass|raw$](\"$.SPEC.SideEffects$\"),\n", args) + } + if spec.TimeoutSeconds != nil { + sw.Do("TimeoutSeconds: ptr.To[int32]($.SPEC.TimeoutSeconds$),\n", args) + } + if len(spec.AdmissionReviewVersions) != 0 { + sw.Do("AdmissionReviewVersions: []string{\n\"$.$\",\n},\n", strings.Join(spec.AdmissionReviewVersions, "\",\n \"")) + } + if len(spec.MatchConditions) != 0 { + sw.Do("MatchConditions: []$.MatchCondition|raw${\n", args) + for _, cond := range spec.MatchConditions { + sw.Do("{\n", nil) + sw.Do("Name: \"$.$\",\n", cond.Name) + sw.Do("Expression: $.$,\n", fmt.Sprintf("%#v", cond.Expression)) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + + sw.Do("}\n", nil) + // END: Webhook. + + sw.Do("}\n\n", nil) + + return sw.Error() +} + +func (g *webhookGen) generateMutating(c *generator.Context, t *types.Type, w io.Writer, spec *admreg.MutatingWebhook) error { + path := fmt.Sprintf("/%s", strings.ReplaceAll(spec.Name, ".", "-")) + + args := getAdmissionRegistrationTypedArgs().With("TYPE", t) + sw := generator.NewSnippetWriter(w, c, "$", "$") + + // DefaultPath + sw.Do("func (*$.TYPE|raw$) DefaultPath() string {\n", args) + sw.Do("return \"$.$\"\n", path) + sw.Do("}\n\n", nil) + + // mwh_*** + sw.Do("func mwh_$.TYPE|private$(c $.WebhookClientConfig|raw$) $.MutatingWebhook|raw$ {\n", args) + + sw.Do("path := \"$.$\"\n\n", path) + sw.Do("cc := c.DeepCopy()\n", nil) + sw.Do("if cc.Service != nil {\n", nil) + sw.Do("cc.Service.Path = &path\n", nil) + sw.Do("} else if c.URL != nil {\n", nil) + sw.Do("cc.URL = ptr.To(*c.URL + path)\n", nil) + sw.Do("}\n\n", nil) + sw.Do("return $.MutatingWebhook|raw${\n", args) + + args = args.With("SPEC", spec) + // START: Webhook. + sw.Do("Name: \"$.$\",\n", spec.Name) + sw.Do("ClientConfig: *cc,\n", nil) + + rule := spec.Rules[0] + args = args.With("RULE", rule) + // START: Webhook/Rules/0. + sw.Do("Rules: []$.RuleWithOperations|raw${\n", args) + sw.Do("{\n", nil) + sw.Do("Rule: $.Rule|raw${\n", args) + if len(rule.APIGroups) != 0 { + sw.Do("APIGroups: []string{\n\"$.$\",\n},\n", strings.Join(rule.APIGroups, "\",\n \"")) + } + if len(rule.APIVersions) != 0 { + sw.Do("APIVersions: []string{\n\"$.$\",\n},\n", strings.Join(rule.APIVersions, "\",\n \"")) + } + sw.Do("Resources: []string{\n\"$.$\",\n},\n", strings.Join(rule.Resources, "\",\n \"")) + if rule.Scope != nil { + sw.Do("Scope: ptr.To[$.ScopeType|raw$](\"$.RULE.Scope$\"),\n", args) + } + sw.Do("},\n", nil) + if len(rule.Operations) != 0 { + sw.Do("Operations: []$.OperationType|raw${\n\"$.OPERS$\",\n},\n", + args.With("OPERS", stringx.Join("\",\n \"", rule.Operations...))) + } + sw.Do("},\n", nil) + sw.Do("},\n", nil) + // END: Webhook/Rules/0. + + if spec.FailurePolicy != nil { + sw.Do("FailurePolicy: ptr.To[$.FailurePolicyType|raw$](\"$.SPEC.FailurePolicy$\"),\n", args) + } + if spec.MatchPolicy != nil { + sw.Do("MatchPolicy: ptr.To[$.MatchPolicyType|raw$](\"$.SPEC.MatchPolicy$\"),\n", args) + } + if selector := spec.NamespaceSelector; selector != nil { + sw.Do("NamespaceSelector: ptr.To($.LabelSelector|raw${\n", args) + if len(selector.MatchLabels) != 0 { + sw.Do("MatchLabels: map[string]string{\n", nil) + for k, v := range selector.MatchLabels { + sw.Do("\"$.KEY$\": \"$.VAL$\",\n", generator.Args{"KEY": k, "VAL": v}) + } + sw.Do("},\n", nil) + } + if len(selector.MatchExpressions) != 0 { + sw.Do("MatchExpressions: []$.LabelSelectorRequirement|raw${\n", args) + for _, expr := range selector.MatchExpressions { + sw.Do("{\n", nil) + sw.Do("Key: \"$.KEY$\",\n", generator.Args{"KEY": expr.Key}) + sw.Do("Operator: $.LabelSelectorOperator|raw$(\"$.OPER$\"),\n", args.With("OPER", expr.Operator)) + if expr.Values != nil { + sw.Do("Values: []string{\n\"$.$\",\n},\n", strings.Join(expr.Values, "\",\n \"")) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + sw.Do("}),\n", nil) + } + if selector := spec.ObjectSelector; selector != nil { + sw.Do("ObjectSelector: ptr.To($.LabelSelector|raw${\n", args) + if len(selector.MatchLabels) != 0 { + sw.Do("MatchLabels: map[string]string{\n", nil) + for k, v := range selector.MatchLabels { + sw.Do("\"$.KEY$\": \"$.VAL$\",\n", generator.Args{"KEY": k, "VAL": v}) + } + sw.Do("},\n", nil) + } + if len(selector.MatchExpressions) != 0 { + sw.Do("MatchExpressions: []$.LabelSelectorRequirement|raw${\n", nil) + for _, expr := range selector.MatchExpressions { + sw.Do("{\n", nil) + sw.Do("Key: \"$.KEY$\",\n", generator.Args{"KEY": expr.Key}) + sw.Do("Operator: $.LabelSelectorOperator|raw$(\"$.OPER$\"),\n", args.With("OPER", expr.Operator)) + if expr.Values != nil { + sw.Do("Values: []string{\n\"$.$\",\n},\n", strings.Join(expr.Values, "\",\n \"")) + } + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + sw.Do("}),\n", nil) + } + if spec.SideEffects != nil { + sw.Do("SideEffects: ptr.To[$.SideEffectClass|raw$](\"$.SPEC.SideEffects$\"),\n", args) + } + if spec.TimeoutSeconds != nil { + sw.Do("TimeoutSeconds: ptr.To[int32]($.SPEC.TimeoutSeconds$),\n", args) + } + if len(spec.AdmissionReviewVersions) != 0 { + sw.Do("AdmissionReviewVersions: []string{\n\"$.$\",\n},\n", strings.Join(spec.AdmissionReviewVersions, "\",\n \"")) + } + if spec.ReinvocationPolicy != nil { + sw.Do("ReinvocationPolicy: ptr.To[$.ReinvocationPolicyType|raw$](\"$.SPEC.ReinvocationPolicy$\"),\n", args) + } + if len(spec.MatchConditions) != 0 { + sw.Do("MatchConditions: []$.MatchCondition|raw${\n", args) + for _, cond := range spec.MatchConditions { + sw.Do("{\n", nil) + sw.Do("Name: \"$.$\",\n", cond.Name) + sw.Do("Expression: $.$,\n", fmt.Sprintf("%#v", cond.Expression)) + sw.Do("},\n", nil) + } + sw.Do("},\n", nil) + } + + sw.Do("}\n", nil) + // END: Webhook. + + sw.Do("}\n\n", nil) + + return sw.Error() +} + +const ( + pkgUtilPtr = "k8s.io/utils/ptr" + pkgAPIMachineryMetadata = "k8s.io/apimachinery/pkg/apis/meta/v1" + pkgTypeAdmissionRegistration = "k8s.io/api/admissionregistration/v1" +) + +func getAdmissionRegistrationTypedArgs() generator.Args { + return generator.Args{ + "PtrTo": types.Ref(pkgUtilPtr, "To"), + "TypeMeta": types.Ref(pkgAPIMachineryMetadata, "TypeMeta"), + "ObjectMeta": types.Ref(pkgAPIMachineryMetadata, "ObjectMeta"), + "LabelSelector": types.Ref(pkgAPIMachineryMetadata, "LabelSelector"), + "LabelSelectorRequirement": types.Ref(pkgAPIMachineryMetadata, "LabelSelectorRequirement"), + "LabelSelectorOperator": types.Ref(pkgAPIMachineryMetadata, "LabelSelectorOperator"), + "ValidatingWebhookConfiguration": types.Ref(pkgTypeAdmissionRegistration, "ValidatingWebhookConfiguration"), + "ValidatingWebhook": types.Ref(pkgTypeAdmissionRegistration, "ValidatingWebhook"), + "MutatingWebhookConfiguration": types.Ref(pkgTypeAdmissionRegistration, "MutatingWebhookConfiguration"), + "MutatingWebhook": types.Ref(pkgTypeAdmissionRegistration, "MutatingWebhook"), + "RuleWithOperations": types.Ref(pkgTypeAdmissionRegistration, "RuleWithOperations"), + "WebhookClientConfig": types.Ref(pkgTypeAdmissionRegistration, "WebhookClientConfig"), + "Rule": types.Ref(pkgTypeAdmissionRegistration, "Rule"), + "ScopeType": types.Ref(pkgTypeAdmissionRegistration, "ScopeType"), + "OperationType": types.Ref(pkgTypeAdmissionRegistration, "OperationType"), + "FailurePolicyType": types.Ref(pkgTypeAdmissionRegistration, "FailurePolicyType"), + "MatchPolicyType": types.Ref(pkgTypeAdmissionRegistration, "MatchPolicyType"), + "SideEffectClass": types.Ref(pkgTypeAdmissionRegistration, "SideEffectClass"), + "ReinvocationPolicyType": types.Ref(pkgTypeAdmissionRegistration, "ReinvocationPolicyType"), + "MatchCondition": types.Ref(pkgTypeAdmissionRegistration, "MatchCondition"), + } +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/webhook_test.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/webhook_test.go new file mode 100644 index 000000000..d061a4178 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/generators/webhook_test.go @@ -0,0 +1,64 @@ +package generators + +import ( + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "k8s.io/gengo/args" + "k8s.io/gengo/generator" + + webhookgenargs "github.com/seal-io/code-generator/cmd/webhook-gen/args" +) + +func Test_webhookGen(t *testing.T) { + var ( + dir = filepath.Join("testdata", "webhook_gen") + pkg = "github.com/seal-io/code-generator/cmd/webhook-gen/generators/testdata/webhook_gen" + ) + + g := args.GeneratorArgs{ + InputDirs: []string{pkg}, + OutputBase: filepath.Join("testdata", "webhook_gen"), + OutputFileBaseName: "zz_generated.webhooks", + GoHeaderFilePath: filepath.Join(dir, "go.txt"), + GeneratedBuildTag: "ignore_autogenerated", + CustomArgs: &webhookgenargs.CustomArgs{}, + } + + err := g.Execute( + NameSystems(), + DefaultNameSystem(), + func(ctx *generator.Context, args *args.GeneratorArgs) generator.Packages { + packages := Packages(ctx, args) + + for i := range packages { + p, ok := packages[i].(*generator.DefaultPackage) + if !ok { + continue + } + + p.PackagePath = strings.TrimPrefix(p.PackagePath, pkg) + packages[i] = p + } + + return packages + }) + if err != nil { + t.Fatalf("failed to execute webhook-gen: %v", err) + } + + actualBytes, err := os.ReadFile(filepath.Join(dir, "zz_generated.webhooks.go")) + if err != nil { + t.Fatalf("failed to read actual file: %v", err) + } + + expectedBytes, err := os.ReadFile(filepath.Join(dir, "zz_generated.webhooks.go.expected")) + if err != nil { + t.Fatalf("failed to read expected file: %v", err) + } + + assert.Equal(t, string(expectedBytes), string(actualBytes)) +} diff --git a/staging/github.com/seal-io/code-generator/cmd/webhook-gen/main.go b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/main.go new file mode 100644 index 000000000..58d6c804f --- /dev/null +++ b/staging/github.com/seal-io/code-generator/cmd/webhook-gen/main.go @@ -0,0 +1,36 @@ +package main + +import ( + "flag" + + "github.com/spf13/pflag" + "k8s.io/klog/v2" + + generatorargs "github.com/seal-io/code-generator/cmd/webhook-gen/args" + "github.com/seal-io/code-generator/cmd/webhook-gen/generators" +) + +func main() { + klog.InitFlags(nil) + genericArgs, customArgs := generatorargs.NewDefaults() + + genericArgs.AddFlags(pflag.CommandLine) + customArgs.AddFlags(pflag.CommandLine) + _ = flag.Set("logtostderr", "true") + pflag.CommandLine.AddGoFlagSet(flag.CommandLine) + pflag.Parse() + + if err := generatorargs.Validate(genericArgs); err != nil { + klog.Fatalf("Error: %v", err) + } + + if err := genericArgs.Execute( + generators.NameSystems(), + generators.DefaultNameSystem(), + generators.Packages, + ); err != nil { + klog.Fatalf("Error: %v", err) + } + + klog.V(2).Info("Completed successfully.") +} diff --git a/staging/github.com/seal-io/code-generator/go.mod b/staging/github.com/seal-io/code-generator/go.mod new file mode 100644 index 000000000..f50ab7e21 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/go.mod @@ -0,0 +1,45 @@ +module github.com/seal-io/code-generator + +go 1.21 + +replace github.com/seal-io/utils => ../utils + +require ( + github.com/seal-io/utils v0.0.0-00010101000000-000000000000 + github.com/spf13/pflag v1.0.5 + github.com/stretchr/testify v1.8.4 + k8s.io/api v0.29.2 + k8s.io/apiextensions-apiserver v0.29.2 + k8s.io/apimachinery v0.29.2 + k8s.io/code-generator v0.29.2 + k8s.io/gengo v0.0.0-20240228010128-51d4e06bde70 + k8s.io/klog/v2 v2.120.1 + k8s.io/kube-aggregator v0.29.2 + k8s.io/utils v0.0.0-20240102154912-e7106e64919e + sigs.k8s.io/yaml v1.4.0 +) + +require ( + github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6 // indirect + github.com/akerl/timber v0.0.3 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-openapi/inflect v0.19.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + golang.org/x/mod v0.15.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.18.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect +) diff --git a/staging/github.com/seal-io/code-generator/go.sum b/staging/github.com/seal-io/code-generator/go.sum new file mode 100644 index 000000000..c8404957a --- /dev/null +++ b/staging/github.com/seal-io/code-generator/go.sum @@ -0,0 +1,150 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6 h1:NKu3y+J/UECHXXEPB+PBg1faCb+BFzt0prciWSjPzXk= +github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6/go.mod h1:c7XTNx5sTF0If/3zNvYXQe6NE2ufAfeS6V6/HorfQcA= +github.com/akerl/timber v0.0.3 h1:xTqH54vCSLjDlAsHkDL5+sZuO8xPdqsamTUk9ense/w= +github.com/akerl/timber v0.0.3/go.mod h1:LFiUpCR4BAfk6HMg6t45XIfmXcNJubA+wnw4uq2MHJg= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= +github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +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= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +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.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +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/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +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.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.2 h1:hBC7B9+MU+ptchxEqTNW2DkUosJpp1P+Wn6YncZ474A= +k8s.io/api v0.29.2/go.mod h1:sdIaaKuU7P44aoyyLlikSLayT6Vb7bvJNCX105xZXY0= +k8s.io/apiextensions-apiserver v0.29.2 h1:UK3xB5lOWSnhaCk0RFZ0LUacPZz9RY4wi/yt2Iu+btg= +k8s.io/apiextensions-apiserver v0.29.2/go.mod h1:aLfYjpA5p3OwtqNXQFkhJ56TB+spV8Gc4wfMhUA3/b8= +k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= +k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/code-generator v0.29.2 h1:c9/iw2KnNpw2IRV+wwuG/Wns2TjPSgjWzbbjTevyiHI= +k8s.io/code-generator v0.29.2/go.mod h1:FwFi3C9jCrmbPjekhaCYcYG1n07CYiW1+PAPCockaos= +k8s.io/gengo v0.0.0-20240228010128-51d4e06bde70 h1:D9H6wq7PAmub2g4XUrekNWMFVI0JIz7s0F64HBPsPOw= +k8s.io/gengo v0.0.0-20240228010128-51d4e06bde70/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-aggregator v0.29.2 h1:z9qJn5wlGmGaX6EfM7OEhr6fq6SBjDKR6tPRZ/qgxeY= +k8s.io/kube-aggregator v0.29.2/go.mod h1:QEuwzmMJJsg0eg1Gv+u4cWcYeJG2+8vN8/nTXBzopUo= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/staging/github.com/seal-io/code-generator/utils/marker.go b/staging/github.com/seal-io/code-generator/utils/marker.go new file mode 100644 index 000000000..2d9142ca9 --- /dev/null +++ b/staging/github.com/seal-io/code-generator/utils/marker.go @@ -0,0 +1,52 @@ +package utils + +import "strings" + +func ParseMarker(line string) map[string]string { + rm := map[string]string{} + + h, r, ok := strings.Cut(line, "=") + for ; ok; h, r, ok = strings.Cut(r, "=") { + h = strings.TrimSpace(h) + r = strings.TrimSpace(r) + + if r != "" { + switch r[0] { + case '[', '{': + if i := indexJSON(r); -1 < i && i < len(r)-1 { + rm[h] = r[:i+1] + r = r[i+2:] + continue + } + default: + if i := strings.Index(r, ","); -1 < i && i < len(r) { + rm[h] = r[:i] + r = r[i+1:] + continue + } + } + } + + rm[h] = r + } + + return rm +} + +func indexJSON(r string) int { + var c int + + for i := 0; i < len(r); i++ { + switch r[i] { + case '{', '[': + c++ + case '}', ']': + c-- + if c == 0 { + return i + } + } + } + + return -1 +} diff --git a/staging/github.com/seal-io/utils/certs/cache/dir.go b/staging/github.com/seal-io/utils/certs/cache/dir.go new file mode 100644 index 000000000..de9beaed1 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/cache/dir.go @@ -0,0 +1,12 @@ +package cache + +import ( + "golang.org/x/crypto/acme/autocert" + + "github.com/seal-io/utils/certs" +) + +// NewDirCache returns a new DirCache instance with the given directory. +func NewDirCache(dir string) certs.Cache { + return autocert.DirCache(dir) +} diff --git a/staging/github.com/seal-io/utils/certs/cache/kubernetes.go b/staging/github.com/seal-io/utils/certs/cache/kubernetes.go new file mode 100644 index 000000000..e895f145d --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/cache/kubernetes.go @@ -0,0 +1,273 @@ +package cache + +import ( + "context" + "errors" + "fmt" + "reflect" + "time" + + core "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + + "github.com/seal-io/utils/certs" + "github.com/seal-io/utils/pools/gopool" + "github.com/seal-io/utils/stringx" +) + +const ( + k8sManagedLabel = "certs.seal.io/managed" + k8sManagedGroupLabel = "certs.seal.io/group" + + k8sManagedNameSumAnno = "certs.seal.io/name-sum" + k8sManagedNameAnno = "certs.seal.io/name" + k8sManagedValueSumAnno = "certs.seal.io/value-sum" + k8sManagedValueKey = "value" +) + +// k8sCache implements certs.Cache using the Kubernetes Secret to store the certificate data. +type k8sCache struct { + logger klog.Logger + cli certs.SecretInterface + inf cache.SharedIndexInformer + grp string +} + +// NewK8sCache creates a new k8sCache instance with the given client. +func NewK8sCache(ctx context.Context, group string, cli certs.SecretInterface) (certs.Cache, error) { + lg := klog.Background().WithName("certs").WithName("k8s") + + lw := func() *cache.ListWatch { + labelSelector := labels.FormatLabels(map[string]string{ + k8sManagedLabel: "true", + k8sManagedGroupLabel: group, + }) + + return &cache.ListWatch{ + ListFunc: func(options meta.ListOptions) (runtime.Object, error) { + options.ResourceVersion = "0" + options.LabelSelector = labelSelector + return cli.List(ctx, options) + }, + WatchFunc: func(options meta.ListOptions) (watch.Interface, error) { + options.LabelSelector = labelSelector + return cli.Watch(ctx, options) + }, + } + }() + + inf := cache.NewSharedIndexInformer(lw, &core.Secret{}, 1*time.Hour, + map[string]cache.IndexFunc{ + "_": func(obj any) ([]string, error) { + s, ok := obj.(*core.Secret) + if !ok { + return nil, errors.New("object is not a secret") + } + + if s.DeletionTimestamp != nil || + s.Type != core.SecretTypeOpaque || + s.Annotations == nil || s.Data == nil { + return nil, nil + } + + annos, data := s.Annotations, s.Data + + if annos[k8sManagedNameAnno] == "" || annos[k8sManagedNameSumAnno] == "" || + data[k8sManagedValueKey] == nil || annos[k8sManagedValueSumAnno] == "" { + return nil, nil + } + + if sumName(annos[k8sManagedNameAnno]) != annos[k8sManagedNameSumAnno] || + sumValue(data[k8sManagedValueKey]) != annos[k8sManagedValueSumAnno] { + lg.Error(nil, "invalid key %q", annos[k8sManagedNameAnno]) + return nil, nil + } + + return []string{annos[k8sManagedNameAnno]}, nil + }, + }) + + gopool.Go(func() { + inf.Run(ctx.Done()) + }) + + // Wait for the informer to sync. + { + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + + if !cache.WaitForCacheSync(ctx.Done(), inf.HasSynced) { + return k8sCache{}, errors.New("sync informer") + } + } + + return k8sCache{ + logger: lg, + cli: cli, + inf: inf, + grp: group, + }, nil +} + +// Get reads a certificate data from the specified secret name. +func (k k8sCache) Get(ctx context.Context, name string) ([]byte, error) { + if name == "" { + return nil, certs.ErrCacheMiss + } + + // Get existed secret. + sec := k.get(ctx, name) + if sec == nil || sec.DeletionTimestamp != nil { + return nil, certs.ErrCacheMiss + } + + return sec.Data[k8sManagedValueKey], nil +} + +// Put writes the certificate data to specified secret name. +func (k k8sCache) Put(ctx context.Context, name string, data []byte) error { + if name == "" || len(data) == 0 { + return nil + } + + sec := &core.Secret{ + ObjectMeta: meta.ObjectMeta{ + GenerateName: "seal-cert-", + Annotations: map[string]string{ + k8sManagedNameAnno: name, + k8sManagedNameSumAnno: sumName(name), + k8sManagedValueSumAnno: sumValue(data), + }, + Labels: map[string]string{ + k8sManagedLabel: "true", + k8sManagedGroupLabel: k.grp, + }, + }, + Data: map[string][]byte{ + k8sManagedValueKey: data, + }, + } + + // Update existed secret if found. + if asec := k.get(ctx, name); asec != nil && asec.Name != "" && asec.DeletionTimestamp == nil { + asecCopy := asec.DeepCopy() + asecCopy.Annotations = sec.Annotations + asecCopy.Labels = sec.Labels + asecCopy.Data = sec.Data + if reflect.DeepEqual(asecCopy, asec) { + return nil + } + + var err error + asec, err = k.cli.Update(ctx, asecCopy, meta.UpdateOptions{}) + if err != nil { + if !kerrors.IsConflict(err) && !kerrors.IsNotAcceptable(err) { + return fmt.Errorf("update secret: %w", err) + } + // Retry if conflict or not acceptable. + return k.Put(ctx, name, data) + } + + k.logger.V(5).Info("updated secret", "object", klog.KObj(asec)) + + return nil + } + + // Otherwise, create new secret. + sec, err := k.cli.Create(ctx, sec, meta.CreateOptions{}) + if err != nil { + if !kerrors.IsAlreadyExists(err) { + return fmt.Errorf("create secret: %w", err) + } + // Retry if already existed. + return k.Put(ctx, name, data) + } + + k.logger.V(5).Info("created secret", "object", klog.KObj(sec)) + + return nil +} + +// Delete removes the specified secret name. +func (k k8sCache) Delete(ctx context.Context, name string) error { + if name == "" { + return nil + } + + // Get existed secret. + sec := k.get(ctx, name) + if sec == nil || sec.DeletionTimestamp != nil { + return nil + } + + return k.delete(ctx, sec) +} + +func (k k8sCache) get(ctx context.Context, name string) *core.Secret { + if name == "" { + return nil + } + + secs, err := k.inf.GetIndexer().ByIndex("_", name) + if err != nil { + k.logger.Error(err, "get indexed cached secrets") + } + + switch len(secs) { + case 0: + // Not found. + return nil + case 1: + // Found. + return secs[0].(*core.Secret) + default: + // Found multiple. + } + + // Clean up multiple secrets with the same key. + k.logger.Error(nil, "found multiple cached secrets with the same key, going to clean", + "objects", klog.KObjSlice(secs)) + + for i := range secs { + _ = k.delete(ctx, secs[i].(*core.Secret)) + } + + // Not found. + return nil +} + +func (k k8sCache) delete(ctx context.Context, sec *core.Secret) error { + if sec == nil { + return nil + } + + // Delete existed secret. + opts := meta.DeleteOptions{ + PropagationPolicy: ptr.To(meta.DeletePropagationBackground), + } + + err := k.cli.Delete(ctx, sec.Name, opts) + if err != nil && !kerrors.IsNotFound(err) { + return fmt.Errorf("delete secret: %w", err) + } + + k.logger.V(5).Info("deleted secret", + "object", klog.KObj(sec)) + + return nil +} + +func sumName(k string) string { + return "fnv64a:" + stringx.SumByFNV64a(k) +} + +func sumValue(v []byte) string { + return "sha224:" + stringx.SumBytesBySHA224(v) +} diff --git a/staging/github.com/seal-io/utils/certs/fakecert/doc.go b/staging/github.com/seal-io/utils/certs/fakecert/doc.go new file mode 100644 index 000000000..74bded662 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/fakecert/doc.go @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Package fakecert is used to handle the TLS generation in a lazy mode. +// - most of the logic is the same as golang.org/x/crypto/acme/autocert. +// - fakecert generates the host certificate for each reachable request, +// do not renew the generated certificate even the CA has changed. +// - fakecert (re)generates the host certificate if not found or the previous one has expired. +// - fakecert is not designed for production usage. +package fakecert diff --git a/staging/github.com/seal-io/utils/certs/fakecert/dynamic.go b/staging/github.com/seal-io/utils/certs/fakecert/dynamic.go new file mode 100644 index 000000000..3821072d2 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/fakecert/dynamic.go @@ -0,0 +1,230 @@ +package fakecert + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "strings" + "sync" + "time" + + "golang.org/x/net/idna" + "k8s.io/klog/v2" + + "github.com/seal-io/utils/certs" +) + +// DynamicManager manages the self-signed host certificates dynamically, +// which generates the host certificate according to the hello information. +type DynamicManager struct { + // Cache optionally stores and retrieves previously-obtained certificates + // and other state. If nil, certs will only be cached for the lifetime of + // the DynamicManager. + // + // Multiple DynamicManager instances can share the same Cache. + Cache certs.Cache + + // HostPolicy controls which domains the DynamicManager will attempt + // to retrieve new certificates for. It does not affect cached certs. + // + // If non-nil, HostPolicy is called before requesting a new getCert. + // If nil, all hosts are currently allowed. + HostPolicy certs.HostPolicy + + state sync.Map +} + +// GetCertificate implements the tls.Config.GetCertificate hook. +// It provides a TLS certificate for hello.ServerName host. +// All other fields of hello are ignored. +// +// If m.HostPolicy is non-nil, GetCertificate calls the policy before requesting +// a new getCert. A non-nil error returned from m.HostPolicy halts TLS negotiation. +// The error is propagated back to the caller of GetCertificate and is user-visible. +// This does not affect cached certs. +func (m *DynamicManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { + var ( + host = hello.ServerName + hostIP string + ) + if host != "" { + n, err := idna.Lookup.ToASCII(host) + if err != nil { + return nil, errors.New("fakecert: host contains invalid character") + } + host = strings.TrimSuffix(n, ".") + } else { + addr := hello.Conn.LocalAddr() + if addr == nil { + return nil, errors.New("fakecert: missing address") + } + tcpAddr, ok := addr.(*net.TCPAddr) + if !ok { + return nil, errors.New("fakecert: invalid address") + } + hostIP = tcpAddr.IP.String() + } + if host == "" { + host = hostIP + hostIP = "" + } + + // Timeout needs to process the worst-case scenario. + ctx, cancel := context.WithTimeout(hello.Context(), 30*time.Second) + defer cancel() + + // Get certificate by host. + ck := certKey{ + host: host, + alterIPs: hostIP, + rsa: !certs.RequestECDSA(hello), + } + + tlsCert, err := m.getCert(ctx, ck) + if err == nil { + return tlsCert, nil + } + + if !errors.Is(err, certs.ErrCacheMiss) { + return nil, fmt.Errorf("fakecert: get cert: %w", err) + } + + // Create certificate to host. + err = m.allowHost(ctx, host) + if err != nil { + return nil, fmt.Errorf("fakecert: disallowed host: %s", host) + } + + tlsCert, err = m.createCert(ctx, ck) + if err != nil { + return nil, fmt.Errorf("fakecert: create cert: %w", err) + } + + return tlsCert, nil +} + +// createCert starts the host ownership verification and returns a certificate +// for that host upon success. +// +// If the host is already being verified, it waits for the existing verification to complete. +// Either way, createCert blocks for the duration of the whole process. +func (m *DynamicManager) createCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + s := &certState{c: sync.NewCond(&sync.Mutex{})} + if v, ok := m.state.LoadOrStore(ck, s); ok { + s = v.(*certState) + } else { + caKey, caCert, err := loadOrGenCA(ctx, m.Cache) + if err != nil { + return nil, err + } + + s.Generate(ctx, caKey, caCert, ck.host, ck.alterIPs, ck.alterDNSNames, ck.rsa) + } + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + m.cachePut(ctx, ck, tlsCert) + + return tlsCert, nil +} + +// getCert returns an existing certificate either from m.state or cache, +// if a certificate is found in cache but not in m.state, the latter will be filled +// with the cached value. +func (m *DynamicManager) getCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("fakecert").WithName("dynamic") + + if v, ok := m.state.Load(ck); ok { + s := v.(*certState) + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + err = certs.VerifyX509Certificate(tlsCert.Leaf, ck.host) + if err != nil { + logger.V(5). + Error(err, "verify certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil + } + + tlsCert, err := m.cacheGet(ctx, ck) + if err != nil { + return nil, err + } + + logger.V(5). + Info("loaded certificate from cache", "host", ck.host) + m.state.Store(ck, &certState{tlsCert: tlsCert}) + + return tlsCert, nil +} + +// cacheGet loads from the cache, +// and decodes private key and certificate. +func (m *DynamicManager) cacheGet(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("fakecert").WithName("dynamic") + + if m.Cache == nil { + return nil, certs.ErrCacheMiss + } + + bs, err := m.Cache.Get(ctx, ck.String()) + if err != nil { + return nil, err + } + + tlsCert, err := certs.DecodeTLSCertificate(bs, ck.host) + if err != nil { + logger.V(5). + Error(err, "decode tls certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil +} + +// cachePut encodes private key and certificate together, +// and stores to the cache. +func (m *DynamicManager) cachePut(ctx context.Context, ck certKey, tlsCert *tls.Certificate) { + logger := klog.Background().WithName("fakecert").WithName("dynamic") + + if m.Cache == nil { + return + } + + bs, err := certs.EncodeTLSCertificate(tlsCert) + if err != nil { + logger.V(5). + Error(err, "encode tls certificate") + return + } + + err = m.Cache.Put(ctx, ck.String(), bs) + if err != nil { + logger.V(5). + Error(err, "cache tls certificate bytes") + } +} + +// allowHost returns true if the host is allowed. +func (m *DynamicManager) allowHost(ctx context.Context, hostname string) error { + if m.HostPolicy != nil { + return m.HostPolicy(ctx, hostname) + } + + return nil +} diff --git a/staging/github.com/seal-io/utils/certs/fakecert/helper.go b/staging/github.com/seal-io/utils/certs/fakecert/helper.go new file mode 100644 index 000000000..11c3a5b02 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/fakecert/helper.go @@ -0,0 +1,256 @@ +package fakecert + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "errors" + "math/big" + "net" + "strconv" + "strings" + "sync" + "time" + + "golang.org/x/crypto/acme/autocert" + "k8s.io/klog/v2" + + "github.com/seal-io/utils/certs" +) + +// certKey is the key by which certificates are tracked in state and cache. +type certKey struct { + // host indicates the host for generating. + host string + // alterIPs indicates the alternative IPs for generating, + // which is separated by comma. + alterIPs string + // alterDNSNames indicates the alternative DNS names for generating, + // which is separated by comma. + alterDNSNames string + // rsa indicates to use RSA algorithm, default is to use ECDSA. + rsa bool +} + +func (c certKey) String() string { + if c.rsa { + return strings.Join([]string{c.host, c.alterIPs, c.alterDNSNames, "rsa"}, ":") + } + + return strings.Join([]string{c.host, c.alterIPs, c.alterDNSNames}, ":") +} + +// certState is the state by which certificates are ready to read. +type certState struct { + c *sync.Cond + tlsCert *tls.Certificate + err error +} + +func (s *certState) Done() bool { + return s.tlsCert != nil || s.err != nil +} + +func (s *certState) Generate( + ctx context.Context, + caKey crypto.Signer, caCert *x509.Certificate, + host, alterIPs, alterDNSNames string, isRSA bool, +) { + if caKey == nil || caCert == nil { + s.err = errors.New("fakecert: CA is nil") + return + } + + s.c.L.Lock() + defer func() { + s.c.L.Unlock() + s.c.Broadcast() + }() + + var key crypto.Signer + if isRSA { + key, s.err = rsa.GenerateKey(rand.Reader, 2048) + } else { + key, s.err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + } + if s.err != nil { + return + } + + if host == "" { + s.err = errors.New("fakecert: missing host") + return + } + + hosts := []string{host} + if alterIPs != "" { + hosts = append(hosts, strings.Split(alterIPs, ",")...) + } + if alterDNSNames != "" { + hosts = append(hosts, strings.Split(alterDNSNames, ",")...) + } + + var srvCert *x509.Certificate + srvCert, s.err = genCert(caKey, caCert, key, hosts) + if s.err != nil { + return + } + + s.tlsCert = &tls.Certificate{ + PrivateKey: key, + Certificate: [][]byte{ + srvCert.Raw, + }, + Leaf: srvCert, + } +} + +func (s *certState) Get() (*tls.Certificate, error) { + if !s.Done() { + s.c.L.Lock() + for !s.Done() { + s.c.Wait() + } + s.c.L.Unlock() + } + + return s.tlsCert, s.err +} + +// loadOrGenCA loads or generates a CA certificate and private key. +func loadOrGenCA(ctx context.Context, c certs.Cache) (crypto.Signer, *x509.Certificate, error) { + bs, err := c.Get(ctx, "ca") + if err != nil { + if !errors.Is(err, autocert.ErrCacheMiss) { + return nil, nil, err + } + + key, x509Cert, err := genCA() + if err != nil { + return nil, nil, err + } + + bs, err = certs.EncodeTLSCertificate(&tls.Certificate{ + PrivateKey: key, + Certificate: [][]byte{ + x509Cert.Raw, + }, + }) + if err != nil { + return nil, nil, err + } + + err = c.Put(ctx, "ca", bs) + if err != nil { + return nil, nil, err + } + + return key, x509Cert, nil + } + + tlsCert, err := certs.DecodeTLSCertificate(bs, "") + if err != nil { + return nil, nil, err + } + + return tlsCert.PrivateKey.(crypto.Signer), tlsCert.Leaf, nil +} + +// genCA generates a CA certificate and private key. +func genCA() (crypto.Signer, *x509.Certificate, error) { + // Generate private key. + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return nil, nil, err + } + + // Generate certificate. + var ( + now = time.Now() + x509Cert = &x509.Certificate{ + BasicConstraintsValid: true, + IsCA: true, + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + NotBefore: now.Add(-5 * time.Minute).UTC(), + NotAfter: now.Add(time.Hour * 24 * 365 * 10).UTC(), // 10 years. + SerialNumber: new(big.Int).SetInt64(now.Unix()), + Subject: pkix.Name{ + CommonName: "fakecert-ca@" + strconv.FormatInt(now.Unix(), 10), + Organization: []string{"seal.io"}, + }, + } + ) + + certDER, err := x509.CreateCertificate(rand.Reader, x509Cert, x509Cert, key.Public(), key) + if err != nil { + return nil, nil, err + } + + x509Cert, err = x509.ParseCertificate(certDER) + if err != nil { + return nil, nil, err + } + + klog.Background().WithName("fakecert").V(5). + Info("generated", + "CA", x509Cert.Subject, + "not before", x509Cert.NotBefore, + "not after", x509Cert.NotAfter) + + return key, x509Cert, nil +} + +// genCert generates a certificate. +func genCert(caKey crypto.Signer, caX509Cert *x509.Certificate, key crypto.Signer, servers []string) (*x509.Certificate, error) { + var ( + dnsNames []string + ipAddresses []net.IP + ) + for i := range servers { + if ip := net.ParseIP(servers[i]); ip != nil { + ipAddresses = append(ipAddresses, ip) + } else { + dnsNames = append(dnsNames, servers[i]) + } + } + + now := time.Now() + x509Cert := &x509.Certificate{ + DNSNames: dnsNames, + IPAddresses: ipAddresses, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + NotAfter: time.Now().Add(time.Hour * 24 * 92).UTC(), // 3 months. + NotBefore: caX509Cert.NotBefore, + SerialNumber: new(big.Int).SetInt64(now.Unix()), + Subject: pkix.Name{ + CommonName: "fakecert@" + strconv.FormatInt(now.Unix(), 10), + Organization: []string{"seal.io"}, + }, + } + + certDER, err := x509.CreateCertificate(rand.Reader, x509Cert, caX509Cert, key.Public(), caKey) + if err != nil { + return nil, err + } + + x509Cert, err = x509.ParseCertificate(certDER) + if err != nil { + return nil, err + } + + klog.Background().WithName("fakecert").V(5). + Info("cert generated", + "servers", servers, + "certificate", x509Cert.Subject, + "not before", x509Cert.NotBefore, + "not after", x509Cert.NotAfter) + + return x509Cert, nil +} diff --git a/staging/github.com/seal-io/utils/certs/fakecert/static.go b/staging/github.com/seal-io/utils/certs/fakecert/static.go new file mode 100644 index 000000000..23b95dc8e --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/fakecert/static.go @@ -0,0 +1,265 @@ +package fakecert + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "strings" + "sync" + "time" + + "golang.org/x/net/idna" + "k8s.io/apiserver/pkg/server/dynamiccertificates" + "k8s.io/klog/v2" + + "github.com/seal-io/utils/certs" + "github.com/seal-io/utils/stringx" +) + +// StaticManager manages the self-signed host certificates, +// which generates the server certificate according to the given Host, AlternateIPs, and AlternateDNSNames names. +type StaticManager struct { + // Cache optionally stores and retrieves previously-obtained certificates + // and other state. If nil, certs will only be cached for the lifetime of + // the StaticManager. + // + // Multiple StaticManager instances can share the same Cache. + Cache certs.Cache + + // Host indicates the host for generating certificates. + // If blank, the StaticManager will not attempt to generate new certificates. + Host string + + // AlternateIPs indicates the alternate IPs for generating certificates. + AlternateIPs []net.IP + + // AlternateDNSNames indicates the alternate DNS names for generating certificates. + AlternateDNSNames []string + + state sync.Map +} + +// GetCertificate implements the tls.Config.GetCertificate hook. +// It only provides a TLS certificate for the StaticManager's Host, IPs, and DNS names. +func (m *StaticManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { + var ( + host = hello.ServerName + hostIP string + ) + if host != "" { + n, err := idna.Lookup.ToASCII(host) + if err != nil { + return nil, errors.New("fakecert: host contains invalid character") + } + host = strings.TrimSuffix(n, ".") + } else { + addr := hello.Conn.LocalAddr() + if addr == nil { + return nil, errors.New("fakecert: missing host") + } + tcpAddr, ok := addr.(*net.TCPAddr) + if !ok { + return nil, errors.New("fakecert: invalid host") + } + hostIP = tcpAddr.IP.String() + } + if host == "" { + host = hostIP + hostIP = "" + } + + if m.Host != host && m.Host != hostIP { + return nil, fmt.Errorf("fakecert: disallowed host: %s", host) + } + + if !certs.RequestECDSA(hello) { + return nil, errors.New("fakecert: disallowed ECDSA") + } + + // Timeout needs to process the worst-case scenario. + ctx, cancel := context.WithTimeout(hello.Context(), 30*time.Second) + defer cancel() + + // Get certificate by server. + ck := certKey{ + host: m.Host, + alterIPs: strings.Join(stringx.Strings(m.AlternateIPs), ","), + alterDNSNames: strings.Join(m.AlternateDNSNames, ","), + } + + tlsCert, err := m.getCert(ctx, ck) + if err == nil { + return tlsCert, nil + } + + if !errors.Is(err, certs.ErrCacheMiss) { + return nil, fmt.Errorf("fakecert: get cert: %w", err) + } + + // Create certificate to server. + tlsCert, err = m.createCert(ctx, ck) + if err != nil { + return nil, fmt.Errorf("fakecert: create cert: %w", err) + } + + return tlsCert, nil +} + +func (m *StaticManager) Name() string { + return "fakecert.static" +} + +func (m *StaticManager) AddListener(_ dynamiccertificates.Listener) {} + +func (m *StaticManager) CurrentCertKeyContent() ([]byte, []byte) { + logger := klog.Background().WithName("fakecert").WithName("static") + + // Timeout needs to process the worst-case scenario. + ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second) + defer cancel() + + ck := certKey{ + host: m.Host, + alterIPs: strings.Join(stringx.Strings(m.AlternateIPs), ","), + alterDNSNames: strings.Join(m.AlternateDNSNames, ","), + } + + tlsCert, err := m.getCert(ctx, ck) + if err != nil { + if !errors.Is(err, certs.ErrCacheMiss) { + logger.Error(err, "get cert") + return nil, nil + } + + // Create certificate to server. + tlsCert, err = m.createCert(ctx, ck) + if err != nil { + logger.Error(err, "create cert") + return nil, nil + } + } + + certPEM, keyPEM, err := certs.EncodeTLSCertificateAndKey(tlsCert) + if err != nil { + logger.Error(err, "encode tls certificate and key") + } + + return certPEM, keyPEM +} + +// createCert starts the server ownership verification and returns a certificate +// for that server upon success. +// +// If the server is already being verified, it waits for the existing verification to complete. +// Either way, createCert blocks for the duration of the whole process. +func (m *StaticManager) createCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + s := &certState{c: sync.NewCond(&sync.Mutex{})} + if v, ok := m.state.LoadOrStore(ck, s); ok { + s = v.(*certState) + } else { + caKey, caCert, err := loadOrGenCA(ctx, m.Cache) + if err != nil { + return nil, err + } + + s.Generate(ctx, caKey, caCert, ck.host, ck.alterIPs, ck.alterDNSNames, ck.rsa) + } + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + m.cachePut(ctx, ck, tlsCert) + + return tlsCert, nil +} + +// getCert returns an existing certificate either from m.state or cache, +// if a certificate is found in cache but not in m.state, the latter will be filled +// with the cached value. +func (m *StaticManager) getCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("fakecert").WithName("static") + + if v, ok := m.state.Load(ck); ok { + s := v.(*certState) + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + err = certs.VerifyX509Certificate(tlsCert.Leaf, ck.host) + if err != nil { + logger.V(5). + Error(err, "verify certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil + } + + tlsCert, err := m.cacheGet(ctx, ck) + if err != nil { + return nil, err + } + + logger.V(5). + Info("loaded certificate from cache", "host", ck.host) + m.state.Store(ck, &certState{tlsCert: tlsCert}) + + return tlsCert, nil +} + +// cacheGet loads from the cache, +// and decodes private key and certificate. +func (m *StaticManager) cacheGet(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("fakecert").WithName("static") + + if m.Cache == nil { + return nil, certs.ErrCacheMiss + } + + bs, err := m.Cache.Get(ctx, ck.String()) + if err != nil { + return nil, err + } + + tlsCert, err := certs.DecodeTLSCertificate(bs, ck.host) + if err != nil { + logger.V(5). + Error(err, "decode tls certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil +} + +// cachePut encodes private key and certificate together, +// and stores to the cache. +func (m *StaticManager) cachePut(ctx context.Context, ck certKey, tlsCert *tls.Certificate) { + logger := klog.Background().WithName("fakecert").WithName("static") + + if m.Cache == nil { + return + } + + bs, err := certs.EncodeTLSCertificate(tlsCert) + if err != nil { + logger.V(5). + Error(err, "encode tls certificate") + return + } + + err = m.Cache.Put(ctx, ck.String(), bs) + if err != nil { + logger.V(5). + Error(err, "cache tls certificate bytes") + } +} diff --git a/staging/github.com/seal-io/utils/certs/helper.go b/staging/github.com/seal-io/utils/certs/helper.go new file mode 100644 index 000000000..b8191284c --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/helper.go @@ -0,0 +1,292 @@ +package certs + +import ( + "crypto" + "crypto/ecdsa" + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" + "strings" + "time" + + "github.com/seal-io/utils/pools/bytespool" +) + +// EncodeTLSCertificate encodes a TLS certificate to PEM format, +// include private key and public key. +func EncodeTLSCertificate(cert *tls.Certificate) ([]byte, error) { + buf := bytespool.GetBuffer() + + // Encode private key. + switch k := cert.PrivateKey.(type) { + case *ecdsa.PrivateKey: + b, err := x509.MarshalECPrivateKey(k) + if err != nil { + return nil, err + } + + pb := &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} + if err = pem.Encode(buf, pb); err != nil { + return nil, err + } + case *rsa.PrivateKey: + b := x509.MarshalPKCS1PrivateKey(k) + + pb := &pem.Block{Type: "RSA PRIVATE KEY", Bytes: b} + if err := pem.Encode(buf, pb); err != nil { + return nil, err + } + default: + return nil, errors.New("unknown private key type") + } + + // Encode public key. + for _, b := range cert.Certificate { + pb := &pem.Block{Type: "CERTIFICATE", Bytes: b} + if err := pem.Encode(buf, pb); err != nil { + return nil, err + } + } + + return buf.Bytes(), nil +} + +// DecodeTLSCertificate decodes a TLS certificate from PEM format, +// include private key and public key. +func DecodeTLSCertificate(data []byte, hostname string) (*tls.Certificate, error) { + // Decode private key. + keyBlock, data := pem.Decode(data) + if keyBlock == nil || !strings.Contains(keyBlock.Type, "PRIVATE") { + return nil, errors.New("corrupt private key: invalid format") + } + + var ( + key crypto.PrivateKey + // Decode public key. + certs [][]byte + // Get leaf certificate. + n int + ) + + key, err := x509.ParseECPrivateKey(keyBlock.Bytes) + if err != nil { + // Try RSA. + k, err := x509.ParsePKCS8PrivateKey(keyBlock.Bytes) + if err != nil { + return nil, errors.New("corrupt private key: parse failed") + } + key = k.(*rsa.PrivateKey) + } + + for len(data) > 0 { + var certBlock *pem.Block + + certBlock, data = pem.Decode(data) + if certBlock == nil { + break + } + + certs = append(certs, certBlock.Bytes) + } + + if len(data) > 0 { + return nil, errors.New("corrupt certificate: invalid format") + } + + for i := range certs { + n += len(certs[i]) + } + der := make([]byte, n) + n = 0 + + for i := range certs { + n += copy(der[n:], certs[i]) + } + + x509Certs, err := x509.ParseCertificates(der) + if err != nil { + return nil, err + } + + if len(x509Certs) == 0 { + return nil, errors.New("corrupt certificate: not found") + } + leaf := x509Certs[0] + + // Validate leaf certificate. + err = VerifyX509Certificate(leaf, hostname) + if err != nil { + return nil, err + } + + switch prv := key.(type) { + case *ecdsa.PrivateKey: + pub, ok := leaf.PublicKey.(*ecdsa.PublicKey) + if !ok { + return nil, errors.New("corrupt certificate: not ECDSA type") + } + + if pub.X.Cmp(prv.X) != 0 || pub.Y.Cmp(prv.Y) != 0 { + return nil, errors.New("corrupt private key: not match ECDSA certificate") + } + case *rsa.PrivateKey: + pub, ok := leaf.PublicKey.(*rsa.PublicKey) + if !ok { + return nil, errors.New("corrupt certificate: not RSA type") + } + + if pub.N.Cmp(prv.N) != 0 { + return nil, errors.New("corrupt private key: not match RSA certificate") + } + } + + return &tls.Certificate{ + Certificate: certs, + PrivateKey: key, + Leaf: leaf, + }, nil +} + +// VerifyX509Certificate verifies the x509 certificate. +func VerifyX509Certificate(cert *x509.Certificate, hostname string) error { + now := time.Now() + if now.Before(cert.NotBefore) { + return errors.New("corrupt certificate: not valid yet") + } + + if now.After(cert.NotAfter) { + return errors.New("corrupt certificate: expired") + } + + if hostname != "" { + err := cert.VerifyHostname(hostname) + if err != nil { + return fmt.Errorf("corrupt certificate: %w", err) + } + } + + return nil +} + +// EncodeX509CertificateRequest encodes a x509 certificate request to PEM format. +func EncodeX509CertificateRequest(certReq *x509.CertificateRequest, key crypto.Signer) ([]byte, error) { + b, err := x509.CreateCertificateRequest(rand.Reader, certReq, key) + if err != nil { + return nil, err + } + + return pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE REQUEST", Bytes: b}), nil +} + +// DecodeX509Certificate decodes a x509 certificate from PEM format. +func DecodeX509Certificate(data []byte, hostname string) (*x509.Certificate, error) { + block, _ := pem.Decode(data) + if block == nil { + return nil, errors.New("corrupt certificate: invalid format") + } + + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return nil, err + } + + err = VerifyX509Certificate(cert, hostname) + if err != nil { + return nil, err + } + + return cert, nil +} + +// RequestECDSA returns true if requesting ECDSA algorithms. +func RequestECDSA(hello *tls.ClientHelloInfo) bool { + if hello.SignatureSchemes != nil { + var ecdsaOK bool + schemeLoop: + for _, scheme := range hello.SignatureSchemes { + switch scheme { + case tls.ECDSAWithSHA1, tls.ECDSAWithP256AndSHA256, + tls.ECDSAWithP384AndSHA384, tls.ECDSAWithP521AndSHA512: + ecdsaOK = true + break schemeLoop + } + } + + if !ecdsaOK { + return false + } + } + + if hello.SupportedCurves != nil { + var ecdsaOK bool + + for _, curve := range hello.SupportedCurves { + if curve == tls.CurveP256 { + ecdsaOK = true + break + } + } + + if !ecdsaOK { + return false + } + } + + for _, suite := range hello.CipherSuites { + switch suite { + case tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, + tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, + tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: + return true + } + } + + return false +} + +// EncodeTLSCertificateAndKey is similar to EncodeTLSCertificate, +// but returns private key and certificate separately. +func EncodeTLSCertificateAndKey(cert *tls.Certificate) ([]byte, []byte, error) { + // Encode private key. + priBuf := bytespool.GetBuffer() + switch k := cert.PrivateKey.(type) { + case *ecdsa.PrivateKey: + b, err := x509.MarshalECPrivateKey(k) + if err != nil { + return nil, nil, err + } + + pb := &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} + if err = pem.Encode(priBuf, pb); err != nil { + return nil, nil, err + } + case *rsa.PrivateKey: + b := x509.MarshalPKCS1PrivateKey(k) + + pb := &pem.Block{Type: "RSA PRIVATE KEY", Bytes: b} + if err := pem.Encode(priBuf, pb); err != nil { + return nil, nil, err + } + default: + return nil, nil, errors.New("unknown private key type") + } + + // Encode public key. + pubBuf := bytespool.GetBuffer() + for _, b := range cert.Certificate { + pb := &pem.Block{Type: "CERTIFICATE", Bytes: b} + if err := pem.Encode(pubBuf, pb); err != nil { + return nil, nil, err + } + } + + return pubBuf.Bytes(), priBuf.Bytes(), nil +} diff --git a/staging/github.com/seal-io/utils/certs/kubecert/doc.go b/staging/github.com/seal-io/utils/certs/kubecert/doc.go new file mode 100644 index 000000000..6a1eeefbc --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/kubecert/doc.go @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2024 Seal, Inc +// SPDX-License-Identifier: Apache-2.0 + +// Package kubecert is used to handle the TLS generation in a lazy mode. +// - most of the logic is the same as golang.org/x/crypto/acme/autocert. +// - kubecert generates the server certificate at first request arrival, +// and it relies on the Kubernetes CertificateSigningRequest. +// - kubecert (re)generates the server certificate if not found or the previous one has expired. +// - kubecert is designed for Kubernetes APIServer proxy calling, +// like Mutating/Validating Webhook, Extension APIServer. +package kubecert diff --git a/staging/github.com/seal-io/utils/certs/kubecert/dynamic.go b/staging/github.com/seal-io/utils/certs/kubecert/dynamic.go new file mode 100644 index 000000000..f086b5341 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/kubecert/dynamic.go @@ -0,0 +1,229 @@ +package kubecert + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "strings" + "sync" + "time" + + "golang.org/x/net/idna" + "k8s.io/klog/v2" + + "github.com/seal-io/utils/certs" +) + +// DynamicManager manages the Kubernetes Certificate Signing Request certificates dynamically, +// which generates the server certificate according to the hello information. +type DynamicManager struct { + // CertCli indicates the client for generating certificates. + // If nil, the DynamicManager will not attempt to generate new certificates. + CertCli certs.CertificateSigningRequestInterface + + // Cache optionally stores and retrieves previously-obtained certificates + // and other state. If nil, certs will only be cached for the lifetime of + // the DynamicManager. + // + // Multiple DynamicManager instances can share the same Cache. + Cache certs.Cache + + // HostPolicy controls which domains the DynamicManager will attempt + // to retrieve new certificates for. It does not affect cached certs. + // + // If non-nil, HostPolicy is called before requesting a new getCert. + // If nil, all hosts are currently allowed. + HostPolicy certs.HostPolicy + + state sync.Map +} + +// GetCertificate implements the tls.Config.GetCertificate hook. +// It provides a TLS certificate for hello.ServerName host. +// All other fields of hello are ignored. +// +// If m.HostPolicy is non-nil, GetCertificate calls the policy before requesting +// a new getCert. A non-nil error returned from m.HostPolicy halts TLS negotiation. +// The error is propagated back to the caller of GetCertificate and is user-visible. +// This does not affect cached certs. +func (m *DynamicManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { + var ( + host = hello.ServerName + hostIP string + ) + if host != "" { + n, err := idna.Lookup.ToASCII(host) + if err != nil { + return nil, errors.New("kubecert: host contains invalid character") + } + host = strings.TrimSuffix(n, ".") + } else { + addr := hello.Conn.LocalAddr() + if addr == nil { + return nil, errors.New("kubecert: missing host") + } + tcpAddr, ok := addr.(*net.TCPAddr) + if !ok { + return nil, errors.New("kubecert: invalid host") + } + hostIP = tcpAddr.IP.String() + } + if host == "" { + host = hostIP + hostIP = "" + } + + // Timeout needs to process the worst-case scenario. + ctx, cancel := context.WithTimeout(hello.Context(), 30*time.Second) + defer cancel() + + // Get certificate by server. + ck := certKey{ + host: host, + alterIPs: hostIP, + rsa: !certs.RequestECDSA(hello), + } + + tlsCert, err := m.getCert(ctx, ck) + if err == nil { + return tlsCert, nil + } + + if !errors.Is(err, certs.ErrCacheMiss) { + return nil, fmt.Errorf("kubecert: get cert: %w", err) + } + + // Create certificate to server. + err = m.allowHost(ctx, host) + if err != nil { + return nil, fmt.Errorf("kubecert: disallowed host: %s", host) + } + + tlsCert, err = m.createCert(ctx, ck) + if err != nil { + return nil, fmt.Errorf("kubecert: create cert: %w", err) + } + + return tlsCert, nil +} + +// createCert starts the server ownership verification and returns a certificate +// for that server upon success. +// +// If the server is already being verified, it waits for the existing verification to complete. +// Either way, createCert blocks for the duration of the whole process. +func (m *DynamicManager) createCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + s := &certState{c: sync.NewCond(&sync.Mutex{})} + if v, ok := m.state.LoadOrStore(ck, s); ok { + s = v.(*certState) + } else { + s.Generate(ctx, m.CertCli, ck.host, ck.alterIPs, ck.alterDNSNames, ck.rsa) + } + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + m.cachePut(ctx, ck, tlsCert) + + return tlsCert, nil +} + +// getCert returns an existing certificate either from m.state or cache, +// if a certificate is found in cache but not in m.state, the latter will be filled +// with the cached value. +func (m *DynamicManager) getCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("kubecert").WithName("dynamic") + + if v, ok := m.state.Load(ck); ok { + s := v.(*certState) + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + err = certs.VerifyX509Certificate(tlsCert.Leaf, ck.host) + if err != nil { + logger.V(5). + Error(err, "verify certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil + } + + tlsCert, err := m.cacheGet(ctx, ck) + if err != nil { + return nil, err + } + + logger.V(5). + Info("loaded certificate from cache", "host", ck.host) + m.state.Store(ck, &certState{tlsCert: tlsCert}) + + return tlsCert, nil +} + +// cacheGet loads from the cache, +// and decodes private key and certificate. +func (m *DynamicManager) cacheGet(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("kubecert").WithName("dynamic") + + if m.Cache == nil { + return nil, certs.ErrCacheMiss + } + + bs, err := m.Cache.Get(ctx, ck.String()) + if err != nil { + return nil, err + } + + tlsCert, err := certs.DecodeTLSCertificate(bs, ck.host) + if err != nil { + logger.V(5). + Error(err, "decode tls certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil +} + +// cachePut encodes private key and certificate together, +// and stores to the cache. +func (m *DynamicManager) cachePut(ctx context.Context, ck certKey, tlsCert *tls.Certificate) { + logger := klog.Background().WithName("kubecert").WithName("dynamic") + + if m.Cache == nil { + return + } + + bs, err := certs.EncodeTLSCertificate(tlsCert) + if err != nil { + logger.V(5). + Error(err, "encode tls certificate") + return + } + + err = m.Cache.Put(ctx, ck.String(), bs) + if err != nil { + logger.V(5). + Error(err, "cache tls certificate bytes") + } +} + +// allowHost returns true if the host is allowed. +func (m *DynamicManager) allowHost(ctx context.Context, hostname string) error { + if m.HostPolicy != nil { + return m.HostPolicy(ctx, hostname) + } + + return nil +} diff --git a/staging/github.com/seal-io/utils/certs/kubecert/helper.go b/staging/github.com/seal-io/utils/certs/kubecert/helper.go new file mode 100644 index 000000000..0dba1d836 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/kubecert/helper.go @@ -0,0 +1,288 @@ +package kubecert + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "errors" + "fmt" + "net" + "strconv" + "strings" + "sync" + "time" + + cert "k8s.io/api/certificates/v1" + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/klog/v2" + "k8s.io/utils/ptr" + + "github.com/seal-io/utils/certs" + "github.com/seal-io/utils/funcx" + "github.com/seal-io/utils/pools/gopool" +) + +// certKey is the key by which certificates are tracked in state and cache. +type certKey struct { + // host indicates the host for generating. + host string + // alterIPs indicates the alternative IPs for generating, + // which is separated by comma. + alterIPs string + // alterDNSNames indicates the alternative DNS names for generating, + // which is separated by comma. + alterDNSNames string + // rsa indicates to use RSA algorithm, default is to use ECDSA. + rsa bool +} + +func (c certKey) String() string { + if c.rsa { + return strings.Join([]string{c.host, c.alterIPs, c.alterDNSNames, "rsa"}, ":") + } + + return strings.Join([]string{c.host, c.alterIPs, c.alterDNSNames}, ":") +} + +// certState is the state by which certificates are ready to read. +type certState struct { + c *sync.Cond + tlsCert *tls.Certificate + err error +} + +func (s *certState) Done() bool { + return s.tlsCert != nil || s.err != nil +} + +func (s *certState) Generate( + ctx context.Context, + cli certs.CertificateSigningRequestInterface, + host, alterIPs, alterDNSNames string, isRSA bool, +) { + if cli == nil { + s.err = errors.New("kubecert: certificate signing request client is nil") + return + } + + s.c.L.Lock() + defer func() { + s.c.L.Unlock() + s.c.Broadcast() + }() + + var key crypto.Signer + if isRSA { + key, s.err = rsa.GenerateKey(rand.Reader, 2048) + } else { + key, s.err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + } + if s.err != nil { + return + } + + if host == "" { + s.err = errors.New("kubecert: missing host") + return + } + + hosts := []string{host} + if alterIPs != "" { + hosts = append(hosts, strings.Split(alterIPs, ",")...) + } + if alterDNSNames != "" { + hosts = append(hosts, strings.Split(alterDNSNames, ",")...) + } + + var srvCertReq *x509.CertificateRequest + srvCertReq, s.err = genCertRequest(key, hosts) + if s.err != nil { + return + } + + // Create. + csr := &cert.CertificateSigningRequest{ + ObjectMeta: meta.ObjectMeta{ + GenerateName: "kubecert-", + }, + Spec: cert.CertificateSigningRequestSpec{ + SignerName: cert.KubeletServingSignerName, + Request: funcx.MustNoError(certs.EncodeX509CertificateRequest(srvCertReq, key)), + ExpirationSeconds: ptr.To[int32](90 * 24 * 60 * 60), // 90 days + Usages: []cert.KeyUsage{ + cert.UsageKeyEncipherment, + cert.UsageDigitalSignature, + cert.UsageServerAuth, + }, + }, + } + csr, s.err = cli.Create(ctx, csr, meta.CreateOptions{}) + if s.err != nil { + return + } + + // Wait. + var ( + wc watch.Interface + cc = make(chan any) + ) + wc, s.err = cli.Watch(ctx, meta.ListOptions{ + ResourceVersion: "0", + FieldSelector: "metadata.name=" + csr.Name, + }) + if s.err != nil { + return + } + defer wc.Stop() + + gopool.Go(func() { + defer close(cc) + + for { + var ( + e watch.Event + ok bool + ) + select { + case <-ctx.Done(): + return + case e, ok = <-wc.ResultChan(): + if !ok { + return + } + } + + switch e.Type { + default: + continue + case watch.Deleted: + cc <- fmt.Errorf("kubecert: certificate signing request deleted") + return + case watch.Error: + cc <- fmt.Errorf("kubecert: watch error: %v", e.Object) + return + case watch.Modified: + } + + t, ok := e.Object.(*cert.CertificateSigningRequest) + if !ok { + continue + } + + for _, cond := range t.Status.Conditions { + switch cond.Type { + default: + continue + case cert.CertificateDenied: + cc <- fmt.Errorf("kubecert: certificate signing request denied: %s", cond.Reason) + return + case cert.CertificateFailed: + cc <- fmt.Errorf("kubecert: certificate signing request failed: %s", cond.Reason) + return + case cert.CertificateApproved: + goto Approved + } + } + + Approved: + if len(t.Status.Certificate) != 0 { + cc <- t.Status.Certificate + return + } + } + }) + + // Approve. + csr.Status.Conditions = append(csr.Status.Conditions, cert.CertificateSigningRequestCondition{ + Type: cert.CertificateApproved, + Status: core.ConditionTrue, + Reason: "ApprovedByKubecert", + Message: "This CSR was approved by kubecert", + }) + _, s.err = cli.UpdateApproval(ctx, csr.Name, csr, meta.UpdateOptions{}) + if s.err != nil { + return + } + + var srvCert *x509.Certificate + r := <-cc + switch v := r.(type) { + case error: + s.err = v + case []byte: + srvCert, s.err = certs.DecodeX509Certificate(v, host) + } + if s.err != nil { + return + } + + s.tlsCert = &tls.Certificate{ + PrivateKey: key, + Certificate: [][]byte{ + srvCert.Raw, + }, + Leaf: srvCert, + } +} + +func (s *certState) Get() (*tls.Certificate, error) { + if !s.Done() { + s.c.L.Lock() + for !s.Done() { + s.c.Wait() + } + s.c.L.Unlock() + } + + return s.tlsCert, s.err +} + +// genCertRequest generates a certificate request. +func genCertRequest(key crypto.Signer, servers []string) (*x509.CertificateRequest, error) { + var ( + dnsNames []string + ipAddresses []net.IP + ) + for i := range servers { + if ip := net.ParseIP(servers[i]); ip != nil { + ipAddresses = append(ipAddresses, ip) + } else { + dnsNames = append(dnsNames, servers[i]) + } + } + + now := time.Now() + x509CertReq := &x509.CertificateRequest{ + DNSNames: dnsNames, + IPAddresses: ipAddresses, + Subject: pkix.Name{ + CommonName: "system:node:kubecert-" + strconv.FormatInt(now.Unix(), 10), + Organization: []string{"system:nodes"}, + }, + } + + csrASN1, err := x509.CreateCertificateRequest(rand.Reader, x509CertReq, key) + if err != nil { + return nil, err + } + + x509CertReq, err = x509.ParseCertificateRequest(csrASN1) + if err != nil { + return nil, err + } + + klog.Background().WithName("kubecert").V(5). + Info("csr generated", + "servers", servers, + "certificate", x509CertReq.Subject) + + return x509CertReq, nil +} diff --git a/staging/github.com/seal-io/utils/certs/kubecert/static.go b/staging/github.com/seal-io/utils/certs/kubecert/static.go new file mode 100644 index 000000000..3941f40ee --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/kubecert/static.go @@ -0,0 +1,263 @@ +package kubecert + +import ( + "context" + "crypto/tls" + "errors" + "fmt" + "net" + "strings" + "sync" + "time" + + "golang.org/x/net/idna" + "k8s.io/apiserver/pkg/server/dynamiccertificates" + "k8s.io/klog/v2" + + "github.com/seal-io/utils/certs" + "github.com/seal-io/utils/stringx" +) + +// StaticManager manages the Kubernetes Certificate Signing Request certificates, +// which generates the server certificate according to the given Host, IPs, and DNS names. +type StaticManager struct { + // CertCli indicates the client for generating certificates. + // If nil, the StaticManager will not attempt to generate new certificates. + CertCli certs.CertificateSigningRequestInterface + + // Cache optionally stores and retrieves previously-obtained certificates + // and other state. If nil, certs will only be cached for the lifetime of + // the StaticManager. + // + // Multiple StaticManager instances can share the same Cache. + Cache certs.Cache + + // Host indicates the host for generating certificates. + // If blank, the StaticManager will not attempt to generate new certificates. + Host string + + // AlternateIPs indicates the alternate IPs for generating certificates. + AlternateIPs []net.IP + + // AlternateDNSNames indicates the alternate DNS names for generating certificates. + AlternateDNSNames []string + + state sync.Map +} + +// GetCertificate implements the tls.Config.GetCertificate hook. +// It only provides a TLS certificate for the StaticManager's Host, IPs, and DNS names. +func (m *StaticManager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { + var ( + host = hello.ServerName + hostIP string + ) + if host != "" { + n, err := idna.Lookup.ToASCII(host) + if err != nil { + return nil, errors.New("kubecert: host contains invalid character") + } + host = strings.TrimSuffix(n, ".") + } else { + addr := hello.Conn.LocalAddr() + if addr == nil { + return nil, errors.New("kubecert: missing host") + } + tcpAddr, ok := addr.(*net.TCPAddr) + if !ok { + return nil, errors.New("kubecert: invalid host") + } + hostIP = tcpAddr.IP.String() + } + if host == "" { + host = hostIP + hostIP = "" + } + + if m.Host != host && m.Host != hostIP { + return nil, fmt.Errorf("kubecert: disallowed host: %s", host) + } + if !certs.RequestECDSA(hello) { + return nil, errors.New("kubecert: disallowed ECDSA") + } + + // Timeout needs to process the worst-case scenario. + ctx, cancel := context.WithTimeout(hello.Context(), 30*time.Second) + defer cancel() + + // Get certificate by server. + ck := certKey{ + host: m.Host, + alterIPs: strings.Join(stringx.Strings(m.AlternateIPs), ","), + alterDNSNames: strings.Join(m.AlternateDNSNames, ","), + } + + tlsCert, err := m.getCert(ctx, ck) + if err == nil { + return tlsCert, nil + } + + if !errors.Is(err, certs.ErrCacheMiss) { + return nil, fmt.Errorf("kubecert: get cert: %w", err) + } + + // Create certificate to server. + tlsCert, err = m.createCert(ctx, ck) + if err != nil { + return nil, fmt.Errorf("kubecert: create cert: %w", err) + } + + return tlsCert, nil +} + +func (m *StaticManager) Name() string { + return "kubecert.static" +} + +func (m *StaticManager) AddListener(_ dynamiccertificates.Listener) {} + +func (m *StaticManager) CurrentCertKeyContent() ([]byte, []byte) { + logger := klog.Background().WithName("kubecert").WithName("static") + + // Timeout needs to process the worst-case scenario. + ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second) + defer cancel() + + ck := certKey{ + host: m.Host, + alterIPs: strings.Join(stringx.Strings(m.AlternateIPs), ","), + alterDNSNames: strings.Join(m.AlternateDNSNames, ","), + } + + tlsCert, err := m.getCert(ctx, ck) + if err != nil { + if !errors.Is(err, certs.ErrCacheMiss) { + logger.Error(err, "get cert") + return nil, nil + } + + // Create certificate to server. + tlsCert, err = m.createCert(ctx, ck) + if err != nil { + logger.Error(err, "create cert") + return nil, nil + } + } + + certPEM, keyPEM, err := certs.EncodeTLSCertificateAndKey(tlsCert) + if err != nil { + logger.Error(err, "encode tls certificate and key") + } + + return certPEM, keyPEM +} + +// createCert starts the server ownership verification and returns a certificate +// for that server upon success. +// +// If the server is already being verified, it waits for the existing verification to complete. +// Either way, createCert blocks for the duration of the whole process. +func (m *StaticManager) createCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + s := &certState{c: sync.NewCond(&sync.Mutex{})} + if v, ok := m.state.LoadOrStore(ck, s); ok { + s = v.(*certState) + } else { + s.Generate(ctx, m.CertCli, ck.host, ck.alterIPs, ck.alterDNSNames, ck.rsa) + } + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + m.cachePut(ctx, ck, tlsCert) + + return tlsCert, nil +} + +// getCert returns an existing certificate either from m.state or cache, +// if a certificate is found in cache but not in m.state, the latter will be filled +// with the cached value. +func (m *StaticManager) getCert(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("kubecert").WithName("dynamic") + + if v, ok := m.state.Load(ck); ok { + s := v.(*certState) + + tlsCert, err := s.Get() + if err != nil { + return nil, err + } + + err = certs.VerifyX509Certificate(tlsCert.Leaf, ck.host) + if err != nil { + logger.V(5). + Error(err, "verify certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil + } + + tlsCert, err := m.cacheGet(ctx, ck) + if err != nil { + return nil, err + } + + logger.V(5). + Info("loaded certificate from cache", "host", ck.host) + m.state.Store(ck, &certState{tlsCert: tlsCert}) + + return tlsCert, nil +} + +// cacheGet loads from the cache, +// and decodes private key and certificate. +func (m *StaticManager) cacheGet(ctx context.Context, ck certKey) (*tls.Certificate, error) { + logger := klog.Background().WithName("kubecert").WithName("dynamic") + + if m.Cache == nil { + return nil, certs.ErrCacheMiss + } + + bs, err := m.Cache.Get(ctx, ck.String()) + if err != nil { + return nil, err + } + + tlsCert, err := certs.DecodeTLSCertificate(bs, ck.host) + if err != nil { + logger.V(5). + Error(err, "decode tls certificate") + // Treat as miss cache, + // so the GetCertificate will regenerate. + return nil, certs.ErrCacheMiss + } + + return tlsCert, nil +} + +// cachePut encodes private key and certificate together, +// and stores to the cache. +func (m *StaticManager) cachePut(ctx context.Context, ck certKey, tlsCert *tls.Certificate) { + logger := klog.Background().WithName("kubecert").WithName("dynamic") + + if m.Cache == nil { + return + } + + bs, err := certs.EncodeTLSCertificate(tlsCert) + if err != nil { + logger.V(5). + Error(err, "encode tls certificate") + return + } + + err = m.Cache.Put(ctx, ck.String(), bs) + if err != nil { + logger.V(5). + Error(err, "cache tls certificate bytes") + } +} diff --git a/staging/github.com/seal-io/utils/certs/types.go b/staging/github.com/seal-io/utils/certs/types.go new file mode 100644 index 000000000..3caf938c2 --- /dev/null +++ b/staging/github.com/seal-io/utils/certs/types.go @@ -0,0 +1,58 @@ +package certs + +import ( + "context" + + "golang.org/x/crypto/acme/autocert" + cert "k8s.io/api/certificates/v1" + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/watch" +) + +// ErrCacheMiss is returned when a certificate is not found in cache. +var ErrCacheMiss = autocert.ErrCacheMiss + +// Cache is used by Manager to store and retrieve previously obtained certificates +// and other account data as opaque blobs. +// +// Cache implementations should not rely on the key naming pattern. Keys can +// include any printable ASCII characters, except the following: \/:*?"<>|. +type Cache = autocert.Cache + +// HostPolicy specifies which host names the Manager is allowed to respond to. +// It returns a non-nil error if the host should be rejected. +// The returned error is accessible via tls.Conn.Handshake and its callers. +type HostPolicy = autocert.HostPolicy + +// HostWhitelist returns a policy where only the specified host names are allowed. +// Only exact matches are currently supported. Subdomains, regexp or wildcard +// will not match. +// +// Note that all hosts will be converted to Punycode via idna.Lookup.ToASCII so that +// Manager.GetCertificate can handle the Unicode IDN and mixedcase hosts correctly. +// Invalid hosts will be silently ignored. +func HostWhitelist(hosts ...string) HostPolicy { + return autocert.HostWhitelist(hosts...) +} + +type SecretInterface interface { + Create(context.Context, *core.Secret, metav1.CreateOptions) (*core.Secret, error) + Update(context.Context, *core.Secret, metav1.UpdateOptions) (*core.Secret, error) + Delete(context.Context, string, metav1.DeleteOptions) error + Get(context.Context, string, metav1.GetOptions) (*core.Secret, error) + List(context.Context, metav1.ListOptions) (*core.SecretList, error) + Watch(context.Context, metav1.ListOptions) (watch.Interface, error) +} + +// CertificateSigningRequestInterface holds the operations on certificate signing requests. +type CertificateSigningRequestInterface interface { + Create(context.Context, *cert.CertificateSigningRequest, metav1.CreateOptions) (*cert.CertificateSigningRequest, error) + Update(context.Context, *cert.CertificateSigningRequest, metav1.UpdateOptions) (*cert.CertificateSigningRequest, error) + Delete(context.Context, string, metav1.DeleteOptions) error + Get(context.Context, string, metav1.GetOptions) (*cert.CertificateSigningRequest, error) + List(context.Context, metav1.ListOptions) (*cert.CertificateSigningRequestList, error) + Watch(context.Context, metav1.ListOptions) (watch.Interface, error) + UpdateApproval(context.Context, string, *cert.CertificateSigningRequest, metav1.UpdateOptions) ( + *cert.CertificateSigningRequest, error) +} diff --git a/staging/github.com/seal-io/utils/contextx/context.go b/staging/github.com/seal-io/utils/contextx/context.go new file mode 100644 index 000000000..17f75e1f8 --- /dev/null +++ b/staging/github.com/seal-io/utils/contextx/context.go @@ -0,0 +1,60 @@ +package contextx + +import ( + "context" + "time" + + "github.com/seal-io/utils/pools/gopool" +) + +func Background(stop <-chan struct{}) context.Context { + ctx, cancel := context.WithCancel(context.Background()) + gopool.Go(func() { + select { + case <-stop: + case <-ctx.Done(): + } + cancel() + }) + return ctx +} + +func TODO(stop <-chan struct{}) context.Context { + ctx, cancel := context.WithCancel(context.TODO()) + gopool.Go(func() { + select { + case <-stop: + case <-ctx.Done(): + } + cancel() + }) + return ctx +} + +func WithCancel(stop <-chan struct{}) (context.Context, context.CancelFunc) { + return context.WithCancel(Background(stop)) +} + +func WithCancelCause(stop <-chan struct{}) (context.Context, context.CancelCauseFunc) { + return context.WithCancelCause(Background(stop)) +} + +func WithDeadline(stop <-chan struct{}, d time.Time) (context.Context, context.CancelFunc) { + return context.WithDeadline(Background(stop), d) +} + +func WithDeadlineCause(stop <-chan struct{}, d time.Time, cause error) (context.Context, context.CancelFunc) { + return context.WithDeadlineCause(Background(stop), d, cause) +} + +func WithTimeout(stop <-chan struct{}, timeout time.Duration) (context.Context, context.CancelFunc) { + return context.WithTimeout(Background(stop), timeout) +} + +func WithTimeoutCause(stop <-chan struct{}, timeout time.Duration, cause error) (context.Context, context.CancelFunc) { + return context.WithTimeoutCause(Background(stop), timeout, cause) +} + +func WithValue(stop <-chan struct{}, key, val any) context.Context { + return context.WithValue(Background(stop), key, val) +} diff --git a/staging/github.com/seal-io/utils/contextx/doc.go b/staging/github.com/seal-io/utils/contextx/doc.go new file mode 100644 index 000000000..7d702af5f --- /dev/null +++ b/staging/github.com/seal-io/utils/contextx/doc.go @@ -0,0 +1,2 @@ +// Package contextx is similar to the context package, but supports to initial from a stop channel. +package contextx diff --git a/staging/github.com/seal-io/utils/errorx/error.go b/staging/github.com/seal-io/utils/errorx/error.go new file mode 100644 index 000000000..6615b9d8c --- /dev/null +++ b/staging/github.com/seal-io/utils/errorx/error.go @@ -0,0 +1,220 @@ +package errorx + +import ( + "errors" + "fmt" + "strings" +) + +// Public returns the public error message and status code. +func Public(errs []error) (int, string) { + var ( + status int + pes []PublicError + ) + + for i := range errs { + unwraps := UnwrapErrors(errs[i]) + + var pe PublicError + + for ui := range unwraps { + e := unwraps[ui] + + // Get last public error, it should include all errors under itself. + if pe == nil && errors.As(e, &pe) { + pes = append(pes, pe) + } + + // Get status while it isn't set. + var he HttpError + if status == 0 && errors.As(e, &he) { + status = he.Status + } + } + } + + return status, PublicFormat(pes) +} + +// UnwrapErrors returns all errors in the chain. +func UnwrapErrors(err error) []error { + errs := make([]error, 0) + + for err != nil { + errs = append(errs, err) + err = errors.Unwrap(err) + } + + return errs +} + +// Format returns the formatted error message. +func Format(errs []error) string { + if len(errs) == 0 { + return "" + } + + if len(errs) == 1 { + return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", errs[0].Error()) + } + + msg := make([]string, len(errs)) + for i, err := range errs { + msg[i] = fmt.Sprintf("* %s", err.Error()) + } + + return fmt.Sprintf( + "%d errors occurred:\n\t%s\n\n", + len(msg), strings.Join(msg, "\n\t")) +} + +// PublicFormat returns the formatted public error message. +func PublicFormat(errs []PublicError) string { + if len(errs) == 0 { + return "" + } + + if len(errs) == 1 { + return errs[0].Public() + } + + msg := make([]string, len(errs)) + for i, err := range errs { + msg[i] = fmt.Sprintf("* %s", err.Public()) + } + + return fmt.Sprintf( + "%d errors occurred: %s", + len(msg), strings.Join(msg, ";")) +} + +// PublicError is the public error message interface. +type PublicError interface { + Public() string +} + +// New returns an error with the supplied message. +func New(message string) ErrorX { + return ErrorX{ + Message: message, + } +} + +// Errorf returns error with the supplied format and args. +func Errorf(format string, args ...any) ErrorX { + return ErrorX{ + Message: fmt.Sprintf(format, args...), + } +} + +// Wrap returns an error with the supplied message. +func Wrap(err error, message string) ErrorX { + return ErrorX{ + Cause: err, + Message: message, + } +} + +// Wrapf returns error with the supplied format and args. +func Wrapf(err error, format string, args ...any) ErrorX { + return ErrorX{ + Cause: err, + Message: fmt.Sprintf(format, args...), + } +} + +// ErrorX is an implementation of PublicError interface. +// +// nolint:errname +type ErrorX struct { + Cause error + Message string +} + +// Error returns the error message. +func (e ErrorX) Error() string { + var sb strings.Builder + + if e.Message != "" { + sb.WriteString(e.Message) + + if e.Cause != nil { + sb.WriteString(": ") + } + } + + if e.Cause != nil { + sb.WriteString(e.Cause.Error()) + } + + return sb.String() +} + +// Unwrap returns the cause error. +func (e ErrorX) Unwrap() error { + return e.Cause +} + +// Public returns the public error message. +func (e ErrorX) Public() string { + return e.Error() +} + +// NewHttpError returns an error with the http status and supplied message. +func NewHttpError(status int, message string) HttpError { + return HttpError{ + ErrorX: ErrorX{ + Message: message, + }, + Status: status, + } +} + +// HttpErrorf returns error with the http status, format and args. +func HttpErrorf(status int, format string, args ...any) HttpError { + return HttpError{ + ErrorX: ErrorX{ + Message: fmt.Sprintf(format, args...), + }, + Status: status, + } +} + +// WrapHttpError returns an error with the http status and supplied message. +func WrapHttpError(status int, err error, message string) HttpError { + return HttpError{ + ErrorX: ErrorX{ + Cause: err, + Message: message, + }, + Status: status, + } +} + +// WrapfHttpError returns error with the http status, format and args. +func WrapfHttpError(status int, err error, format string, args ...any) HttpError { + return HttpError{ + ErrorX: ErrorX{ + Cause: err, + Message: fmt.Sprintf(format, args...), + }, + Status: status, + } +} + +// HttpError is an implementation of PublicError interface. +type HttpError struct { + Status int + ErrorX +} + +// Unwrap returns the cause error. +func (e HttpError) Unwrap() error { + return e.Cause +} + +// Public returns the public error message. +func (e HttpError) Public() string { + return e.Error() +} diff --git a/staging/github.com/seal-io/utils/events/bus/bus.go b/staging/github.com/seal-io/utils/events/bus/bus.go new file mode 100644 index 000000000..5bb286b9f --- /dev/null +++ b/staging/github.com/seal-io/utils/events/bus/bus.go @@ -0,0 +1,152 @@ +package bus + +import ( + "context" + "errors" + "fmt" + "reflect" +) + +// Bus defines the interface to decouple the logic. +type Bus interface { + // Subscribe subscribes a Handler to process. + Subscribe(string, Handler) error + // Publish publishes the Message and callback all subscribed Handler. + Publish(context.Context, Message) error +} + +// Message defines the message to be handled. +type Message any + +// Handler defines the handler to process any publishing message, +// for example, func(context.Context, T) error. +// The incoming context.Context comes from the Publish function, +// if the inside processing is background, +// do not rely on that context.Context. +type Handler any + +// bus implements the Bus interface. +type bus map[string][]namedHandler + +// handler wraps the Handler with name. +type namedHandler struct { + n string + h Handler +} + +var globalBus = New() + +// Subscribe implements the Bus interface. +func (b bus) Subscribe(n string, h Handler) error { + if b == nil { + return errors.New("nil bus") + } + + ht := reflect.TypeOf(h) + if ht.NumIn() != 2 { + return errors.New("handler must has two parameters") + } + + if ht.In(0).String() != "context.Context" { + return errors.New("handler must uses 'context.Context' as the first parameter") + } + + if ht.NumOut() != 1 { + return errors.New("handler must has one result") + } + + if ht.Out(0).String() != "error" { + return errors.New("handler must uses 'error' as the only result") + } + + switch ht.In(1).Kind() { + case reflect.Chan, reflect.Interface, reflect.UnsafePointer, reflect.Uintptr, reflect.Func, reflect.Invalid: + return errors.New("the second parameter of handler is invalid") + default: + } + + mt := getTypeSymbol(ht.In(1)) + b[mt] = append(b[mt], namedHandler{n: n, h: h}) + + return nil +} + +// Publish implements the Bus interface. +func (b bus) Publish(ctx context.Context, m Message) error { + if b == nil { + return errors.New("nil bus") + } + + mt := getTypeSymbol(reflect.TypeOf(m)) + + hs, exist := b[mt] + if !exist { + return nil + } + + in := []reflect.Value{ + reflect.ValueOf(ctx), + reflect.ValueOf(m), + } + for i := range hs { + r := reflect.ValueOf(hs[i].h).Call(in) + + err := r[0].Interface() + if err != nil { + return fmt.Errorf("call %q handler: %v", hs[i].n, err) + } + } + + return nil +} + +func getTypeSymbol(t reflect.Type) string { + var ( + p string + s = t.String() + ) + + switch t.Kind() { + default: + p = t.PkgPath() + case reflect.Interface, reflect.Pointer: + p = t.Elem().PkgPath() + } + + if p != "" { + s = p + "/" + s + } + + return s +} + +// New returns a new Bus. +func New() Bus { + return bus{} +} + +// Subscribe subscribes the handler to global Bus. +func Subscribe(n string, h Handler) error { + return globalBus.Subscribe(n, h) +} + +// MustSubscribe likes Subscribe, but panic if error found. +func MustSubscribe(n string, h Handler) { + err := Subscribe(n, h) + if err != nil { + panic(err) + } +} + +// Publish publishes the message to all subscribed Handler. +func Publish(ctx context.Context, m Message) error { + return globalBus.Publish(ctx, m) +} + +// MustPublish likes Publish, but panic if error found. +func MustPublish(ctx context.Context, m Message) { + err := Publish(ctx, m) + if err != nil { + panic(err) + } +} diff --git a/staging/github.com/seal-io/utils/events/bus/bus_test.go b/staging/github.com/seal-io/utils/events/bus/bus_test.go new file mode 100644 index 000000000..3eec2208b --- /dev/null +++ b/staging/github.com/seal-io/utils/events/bus/bus_test.go @@ -0,0 +1,102 @@ +package bus + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" +) + +type testMessage struct { + namespace string + name string +} + +func (in testMessage) String() string { + return in.namespace + "/" + in.name +} + +func TestBus_PublishStruct(t *testing.T) { + var actual testMessage + err := Subscribe("struct", func(ctx context.Context, m testMessage) error { + actual = m + return nil + }) + assert.Nil(t, err, "error subscribing") + + err = Publish(context.Background(), testMessage{namespace: "ns-abc", name: "n-efg"}) + assert.Nil(t, err, "error publishing") + + assert.Equal(t, actual, testMessage{namespace: "ns-abc", name: "n-efg"}, "unexpected") +} + +func TestBus_PublishPointer(t *testing.T) { + var actual *testMessage + err := Subscribe("pointer", func(ctx context.Context, m *testMessage) error { + actual = m + return nil + }) + assert.Nil(t, err, "error subscribing") + + err = Publish(context.Background(), &testMessage{namespace: "ns-abc", name: "n-efg"}) + assert.Nil(t, err, "error publishing") + + assert.Equal(t, actual, &testMessage{namespace: "ns-abc", name: "n-efg"}, "unexpected") +} + +func TestBus_PublishInterfaceValue(t *testing.T) { + var actual *testMessage + err := Subscribe("interface value", func(ctx context.Context, m *testMessage) error { + actual = m + return nil + }) + assert.Nil(t, err, "error subscribing") + + var v any = &testMessage{namespace: "ns-abc", name: "n-efg"} + err = Publish(context.Background(), v) + assert.Nil(t, err, "error publishing") + + assert.Equal(t, actual, &testMessage{namespace: "ns-abc", name: "n-efg"}, "unexpected") +} + +func TestBus_PublishMap(t *testing.T) { + var actual map[string]int + err := Subscribe("map", func(ctx context.Context, m map[string]int) error { + actual = m + return nil + }) + assert.Nil(t, err, "error subscribing") + + err = Publish(context.Background(), map[string]int{"a": 0, "b": 1}) + assert.Nil(t, err, "error publishing") + + assert.Equal(t, actual, map[string]int{"a": 0, "b": 1}, "unexpected") +} + +func TestBus_PublishSlice(t *testing.T) { + var actual []string + err := Subscribe("slice", func(ctx context.Context, m []string) error { + actual = m + return nil + }) + assert.Nil(t, err, "error subscribing") + + err = Publish(context.Background(), []string{"a", "b"}) + assert.Nil(t, err, "error publishing") + + assert.Equal(t, actual, []string{"a", "b"}, "unexpected") +} + +func TestBus_PublishArray(t *testing.T) { + var actual [2]int + err := Subscribe("array", func(ctx context.Context, m [2]int) error { + actual = m + return nil + }) + assert.Nil(t, err, "error subscribing") + + err = Publish(context.Background(), [2]int{0, 1}) + assert.Nil(t, err, "error publishing") + + assert.Equal(t, actual, [2]int{0, 1}, "unexpected") +} diff --git a/staging/github.com/seal-io/utils/events/topic/topic.go b/staging/github.com/seal-io/utils/events/topic/topic.go new file mode 100644 index 000000000..9fc61f2cb --- /dev/null +++ b/staging/github.com/seal-io/utils/events/topic/topic.go @@ -0,0 +1,174 @@ +package topic + +import ( + "context" + "errors" + "runtime" + "sync" + + "github.com/google/uuid" +) + +type Event struct { + Topic Topic + Data Message +} + +// Subscriber defines the interface to process the asynchronous logic. +type Subscriber interface { + // Receive receives an Event from the subscribing Topic. + Receive(context.Context) (Event, error) + // Unsubscribe quits from the subscribing Topic. + Unsubscribe() +} + +// Hub defines the interface to decouple the asynchronous logic. +type Hub interface { + // Subscribe gets a Subscriber from the Hub with the given name Topic. + Subscribe(Topic) (Subscriber, error) + // Unsubscribe quits all subscribing Subscriber from the given name Topic. + Unsubscribe(n Topic) error + // Publish publishes a Message to all Subscriber who is subscribing the given name Topic. + Publish(context.Context, Topic, Message) error +} + +// Message defines the message to be transferred. +type Message any + +// Topic defines the name of the Subscriber. +type Topic string + +type hub struct { + p *hub + t Topic + m sync.Map +} + +var globalHub = New() + +func (h *hub) Subscribe(t Topic) (Subscriber, error) { + if t == "" { + // Topic scope. + var ( + n = uuid.NewString() + c = make(chan Event, runtime.GOMAXPROCS(0)*2) + ) + + h.m.Store(n, c) + + return subscriber{p: h, n: n, c: c}, nil + } + // Hub scope. + v, _ := h.m.LoadOrStore(t, &hub{p: h, t: t}) + sh := v.(*hub) + + return sh.Subscribe("") +} + +func (h *hub) Unsubscribe(t Topic) error { + if t == "" { + // Topic scope. + h.m.Range(func(n, v any) bool { + c := v.(chan Event) + close(c) + h.m.Delete(n) + + return true + }) + + return nil + } + // Hub scope. + v, ok := h.m.Load(t) + if !ok { + return nil + } + + return v.(*hub).Unsubscribe("") +} + +func (h *hub) Publish(ctx context.Context, n Topic, m Message) error { + if n == "" { + // Topic scope. + h.m.Range(func(n, v any) bool { + c := v.(chan Event) + select { + case <-ctx.Done(): + return false + case c <- Event{Topic: h.t, Data: m}: + return true + default: + // If chan is blocking. + close(c) + h.m.Delete(n) + + return true + } + }) + + return nil + } + // Hub scope. + v, ok := h.m.Load(n) + if !ok { + return nil + } + + return v.(*hub).Publish(ctx, "", m) +} + +type subscriber struct { + p *hub + n string + c chan Event +} + +func (s subscriber) Receive(ctx context.Context) (Event, error) { + select { + case <-ctx.Done(): + return Event{}, ctx.Err() + case e, ok := <-s.c: + if !ok { + return Event{}, errors.New("topic is closed") + } + + return e, nil + } +} + +func (s subscriber) Unsubscribe() { + s.p.m.Delete(s.n) +} + +// New returns a new Hub. +func New() Hub { + return &hub{} +} + +// Subscribe gets a Subscriber from global Hub with the given topic Topic. +func Subscribe(n Topic) (Subscriber, error) { + return globalHub.Subscribe(n) +} + +// MustSubscribe likes Subscribe, but panic if error found. +func MustSubscribe(n Topic) Subscriber { + s, err := Subscribe(n) + if err != nil { + panic(err) + } + + return s +} + +// Publish publishes a Message to global Hub with the given topic Topic. +func Publish(ctx context.Context, n Topic, m Message) error { + return globalHub.Publish(ctx, n, m) +} + +// MustPublish likes Publish, but panic if error found. +func MustPublish(ctx context.Context, n Topic, m Message) { + err := Publish(ctx, n, m) + if err != nil { + panic(err) + } +} diff --git a/staging/github.com/seal-io/utils/funcx/error.go b/staging/github.com/seal-io/utils/funcx/error.go new file mode 100644 index 000000000..10235536e --- /dev/null +++ b/staging/github.com/seal-io/utils/funcx/error.go @@ -0,0 +1,65 @@ +package funcx + +// NoError ignores the given error, +// it is usually a nice helper for chain function calling. +func NoError[T any](t T, _ error) T { + return t +} + +// NoError2 ignores the given error, +// it is usually a nice helper for chain function calling. +func NoError2[T, U any](t T, u U, _ error) (T, U) { + return t, u +} + +// NoError3 ignores the given error, +// it is usually a nice helper for chain function calling. +func NoError3[T, U, V any](t T, u U, v V, _ error) (T, U, V) { + return t, u, v +} + +// NoError4 ignores the given error, +// it is usually a nice helper for chain function calling. +func NoError4[T, U, V, W any](t T, u U, v V, w W, _ error) (T, U, V, W) { + return t, u, v, w +} + +// MustNoError is similar to NoError, +// but it panics if the given error is not nil, +// it is usually a nice helper for chain function calling. +func MustNoError[T any](t T, e error) T { + if e != nil { + panic(e) + } + return t +} + +// MustNoError2 is similar to NoError2, +// but it panics if the given error is not nil, +// it is usually a nice helper for chain function calling. +func MustNoError2[T, U any](t T, u U, e error) (T, U) { + if e != nil { + panic(e) + } + return t, u +} + +// MustNoError3 is similar to NoError3, +// but it panics if the given error is not nil, +// it is usually a nice helper for chain function calling. +func MustNoError3[T, U, V any](t T, u U, v V, e error) (T, U, V) { + if e != nil { + panic(e) + } + return t, u, v +} + +// MustNoError4 is similar to NoError4, +// but it panics if the given error is not nil, +// it is usually a nice helper for chain function calling. +func MustNoError4[T, U, V, W any](t T, u U, v V, w W, e error) (T, U, V, W) { + if e != nil { + panic(e) + } + return t, u, v, w +} diff --git a/staging/github.com/seal-io/utils/go.mod b/staging/github.com/seal-io/utils/go.mod new file mode 100644 index 000000000..fd3c912e0 --- /dev/null +++ b/staging/github.com/seal-io/utils/go.mod @@ -0,0 +1,79 @@ +module github.com/seal-io/utils + +go 1.21 + +require ( + github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6 + github.com/alitto/pond v1.8.3 + github.com/allegro/bigcache/v3 v3.1.0 + github.com/dustin/go-humanize v1.0.1 + github.com/evanphx/json-patch v5.9.0+incompatible + github.com/go-openapi/inflect v0.19.0 + github.com/google/uuid v1.6.0 + github.com/henvic/httpretty v0.1.3 + github.com/json-iterator/go v1.1.12 + github.com/mattn/go-runewidth v0.0.15 + github.com/prometheus/client_golang v1.18.0 + github.com/spf13/cobra v1.8.0 + github.com/stretchr/testify v1.8.4 + github.com/tidwall/gjson v1.17.1 + github.com/tidwall/sjson v1.2.5 + go.uber.org/multierr v1.11.0 + golang.org/x/crypto v0.20.0 + golang.org/x/mod v0.15.0 + golang.org/x/net v0.21.0 + golang.org/x/text v0.14.0 + k8s.io/api v0.29.2 + k8s.io/apimachinery v0.29.2 + k8s.io/apiserver v0.29.2 + k8s.io/client-go v0.29.2 + k8s.io/klog/v2 v2.120.1 + k8s.io/utils v0.0.0-20240102154912-e7106e64919e +) + +require ( + github.com/akerl/timber v0.0.3 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful/v3 v3.11.3 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/jsonreference v0.20.4 // indirect + github.com/go-openapi/swag v0.22.9 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/common v0.47.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.1 // indirect + golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/term v0.17.0 // indirect + golang.org/x/time v0.5.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/protobuf v1.32.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) diff --git a/staging/github.com/seal-io/utils/go.sum b/staging/github.com/seal-io/utils/go.sum new file mode 100644 index 000000000..90ce456f3 --- /dev/null +++ b/staging/github.com/seal-io/utils/go.sum @@ -0,0 +1,246 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6 h1:NKu3y+J/UECHXXEPB+PBg1faCb+BFzt0prciWSjPzXk= +github.com/akerl/go-indefinite-article v0.0.2-0.20221219154354-6280c92263d6/go.mod h1:c7XTNx5sTF0If/3zNvYXQe6NE2ufAfeS6V6/HorfQcA= +github.com/akerl/timber v0.0.3 h1:xTqH54vCSLjDlAsHkDL5+sZuO8xPdqsamTUk9ense/w= +github.com/akerl/timber v0.0.3/go.mod h1:LFiUpCR4BAfk6HMg6t45XIfmXcNJubA+wnw4uq2MHJg= +github.com/alitto/pond v1.8.3 h1:ydIqygCLVPqIX/USe5EaV/aSRXTRXDEI9JwuDdu+/xs= +github.com/alitto/pond v1.8.3/go.mod h1:CmvIIGd5jKLasGI3D87qDkQxjzChdKMmnXMg3fG6M6Q= +github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk= +github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/emicklei/go-restful/v3 v3.11.3 h1:yagOQz/38xJmcNeZJtrUcKjkHRltIaIFXKWeG1SkWGE= +github.com/emicklei/go-restful/v3 v3.11.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= +github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= +github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= +github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= +github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= +github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +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/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +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.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/henvic/httpretty v0.1.3 h1:4A6vigjz6Q/+yAfTD4wqipCv+Px69C7Th/NhT0ApuU8= +github.com/henvic/httpretty v0.1.3/go.mod h1:UUEv7c2kHZ5SPQ51uS3wBpzPDibg2U3Y+IaXyHy5GBg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= +github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= +github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= +golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= +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.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +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.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.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.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +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.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.2 h1:hBC7B9+MU+ptchxEqTNW2DkUosJpp1P+Wn6YncZ474A= +k8s.io/api v0.29.2/go.mod h1:sdIaaKuU7P44aoyyLlikSLayT6Vb7bvJNCX105xZXY0= +k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= +k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/apiserver v0.29.2 h1:+Z9S0dSNr+CjnVXQePG8TcBWHr3Q7BmAr7NraHvsMiQ= +k8s.io/apiserver v0.29.2/go.mod h1:B0LieKVoyU7ykQvPFm7XSdIHaCHSzCzQWPFa5bqbeMQ= +k8s.io/client-go v0.29.2 h1:FEg85el1TeZp+/vYJM7hkDlSTFZ+c5nnK44DJ4FyoRg= +k8s.io/client-go v0.29.2/go.mod h1:knlvFZE58VpqbQpJNbCbctTVXcd35mMyAAwBdpt4jrA= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/staging/github.com/seal-io/utils/httpx/client.go b/staging/github.com/seal-io/utils/httpx/client.go new file mode 100644 index 000000000..df41a9d4a --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/client.go @@ -0,0 +1,181 @@ +package httpx + +import ( + "context" + "io" + "net/http" + + "github.com/henvic/httpretty" +) + +// DefaultClient is the default http.Client used by the package. +// +// It is used for requests pooling. +var DefaultClient = http.DefaultClient + +// Client returns a new http.Client with the given options, +// the result http.Client is used for fast-consuming requests. +// +// If you want a requests pool management, use DefaultClient instead. +func Client(opts ...*ClientOption) *http.Client { + var o *ClientOption + if len(opts) > 0 { + o = opts[0] + } else { + o = ClientOptions() + } + + root := http.DefaultTransport + if o.transport != nil { + root = o.transport + } + + if o.debug { + pretty := &httpretty.Logger{ + Time: true, + TLS: true, + RequestHeader: true, + RequestBody: true, + ResponseHeader: true, + ResponseBody: true, + Formatters: []httpretty.Formatter{&JSONFormatter{}}, + } + root = pretty.RoundTripper(root) + } + + transport := RoundTripperChain{ + Next: root, + } + for i := range o.roundTrips { + transport = RoundTripperChain{ + Do: o.roundTrips[i], + Next: transport, + } + } + + return &http.Client{ + Transport: transport, + Timeout: o.timeout, + } +} + +// NewGetRequestWithContext returns a new http.MethodGet request, +// which is saving your life from http.NewRequestWithContext. +func NewGetRequestWithContext(ctx context.Context, uri string) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodGet, uri, nil) +} + +// NewGetRequest returns a new http.MethodGet request, +// which is saving your life from http.NewRequest. +func NewGetRequest(uri string) (*http.Request, error) { + return http.NewRequest(http.MethodGet, uri, nil) +} + +// NewHeadRequestWithContext returns a new http.MethodHead request, +// which is saving your life from http.NewRequestWithContext. +func NewHeadRequestWithContext(ctx context.Context, uri string) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodHead, uri, nil) +} + +// NewHeadRequest returns a new http.MethodHead request, +// which is saving your life from http.NewRequest. +func NewHeadRequest(uri string) (*http.Request, error) { + return http.NewRequest(http.MethodHead, uri, nil) +} + +// NewPostRequestWithContext returns a new http.MethodPost request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewPostRequestWithContext(ctx context.Context, uri string, body io.Reader) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodPost, uri, body) +} + +// NewPostRequest returns a new http.MethodPost request, +// which is saving your life from http.NewRequest. +func NewPostRequest(uri string, body io.Reader) (*http.Request, error) { + return http.NewRequest(http.MethodPost, uri, body) +} + +// NewPutRequestWithContext returns a new http.MethodPut request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewPutRequestWithContext(ctx context.Context, uri string, body io.Reader) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodPut, uri, body) +} + +// NewPutRequest returns a new http.MethodPut request, +// which is saving your life from http.NewRequest. +func NewPutRequest(uri string, body io.Reader) (*http.Request, error) { + return http.NewRequest(http.MethodPut, uri, body) +} + +// NewPatchRequestWithContext returns a new http.MethodPatch request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewPatchRequestWithContext(ctx context.Context, uri string, body io.Reader) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodPatch, uri, body) +} + +// NewPatchRequest returns a new http.MethodPatch request, +// which is saving your life from http.NewRequest. +func NewPatchRequest(uri string, body io.Reader) (*http.Request, error) { + return http.NewRequest(http.MethodPatch, uri, body) +} + +// NewDeleteRequestWithContext returns a new http.MethodDelete request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewDeleteRequestWithContext(ctx context.Context, uri string) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodDelete, uri, nil) +} + +// NewDeleteRequest returns a new http.MethodDelete request, +// which is saving your life from http.NewRequest. +func NewDeleteRequest(uri string) (*http.Request, error) { + return http.NewRequest(http.MethodDelete, uri, nil) +} + +// NewConnectRequestWithContext returns a new http.MethodConnect request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewConnectRequestWithContext(ctx context.Context, uri string) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodConnect, uri, nil) +} + +// NewConnectRequest returns a new http.MethodConnect request, +// which is saving your life from http.NewRequest. +func NewConnectRequest(uri string) (*http.Request, error) { + return http.NewRequest(http.MethodConnect, uri, nil) +} + +// NewOptionsRequestWithContext returns a new http.MethodOptions request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewOptionsRequestWithContext(ctx context.Context, uri string) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodOptions, uri, nil) +} + +// NewOptionsRequest returns a new http.MethodOptions request, +// which is saving your life from http.NewRequest. +func NewOptionsRequest(uri string) (*http.Request, error) { + return http.NewRequest(http.MethodOptions, uri, nil) +} + +// NewTraceRequestWithContext returns a new http.MethodTrace request with the given context, +// which is saving your life from http.NewRequestWithContext. +func NewTraceRequestWithContext(ctx context.Context, uri string) (*http.Request, error) { + return http.NewRequestWithContext(ctx, http.MethodTrace, uri, nil) +} + +// NewTraceRequest returns a new http.MethodTrace request, +// which is saving your life from http.NewRequest. +func NewTraceRequest(uri string) (*http.Request, error) { + return http.NewRequest(http.MethodTrace, uri, nil) +} + +// Error is similar to http.Error, +// but it can get the error message by the given code. +func Error(rw http.ResponseWriter, code int) { + http.Error(rw, http.StatusText(code), code) +} + +// Close closes the http response body without error. +func Close(resp *http.Response) { + if resp != nil && resp.Body != nil { + _ = resp.Body.Close() + } +} diff --git a/staging/github.com/seal-io/utils/httpx/client_helper.go b/staging/github.com/seal-io/utils/httpx/client_helper.go new file mode 100644 index 000000000..5270e122c --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/client_helper.go @@ -0,0 +1,61 @@ +package httpx + +import ( + "bytes" + "errors" + "io" + "net/http" + "regexp" + + "github.com/henvic/httpretty" + + "github.com/seal-io/utils/json" +) + +var _ httpretty.Formatter = (*JSONFormatter)(nil) + +// JSONFormatter is copied from httpretty.JSONFormatter, +// but use our own json package. +type JSONFormatter struct{} + +var jsonTypeRE = regexp.MustCompile(`[/+]json($|;)`) + +// Match JSON media type. +func (j *JSONFormatter) Match(mediatype string) bool { + return jsonTypeRE.MatchString(mediatype) +} + +// Format JSON content. +func (j *JSONFormatter) Format(w io.Writer, src []byte) error { + if !json.Valid(src) { + // We want to get the error of json.checkValid, not unmarshal it. + // The happy path has been optimized, maybe prematurely. + if err := json.Unmarshal(src, &json.RawMessage{}); err != nil { + return err + } + } + // Avoiding allocation as we use *bytes.Buffer to store the formatted body before printing + dst, ok := w.(*bytes.Buffer) + if !ok { + // Mitigating panic to avoid upsetting anyone who uses this directly + return errors.New("underlying writer for JSONFormatter must be *bytes.Buffer") + } + return json.Indent(dst, src, "", " ") +} + +type RoundTripperChain struct { + Do func(req *http.Request) error + Next http.RoundTripper +} + +func (c RoundTripperChain) RoundTrip(req *http.Request) (*http.Response, error) { + if c.Do != nil { + if err := c.Do(req); err != nil { + return nil, err + } + } + if c.Next != nil { + return c.Next.RoundTrip(req) + } + return nil, nil +} diff --git a/staging/github.com/seal-io/utils/httpx/client_options.go b/staging/github.com/seal-io/utils/httpx/client_options.go new file mode 100644 index 000000000..16111cf52 --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/client_options.go @@ -0,0 +1,114 @@ +package httpx + +import ( + "context" + "crypto/tls" + "net" + "net/http" + "time" +) + +type ClientOption struct { + transport *http.Transport + timeout time.Duration + debug bool + roundTrips []func(req *http.Request) error +} + +func ClientOptions() *ClientOption { + transport := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + TLSClientConfig: &tls.Config{MinVersion: tls.VersionTLS12}, + DialContext: (&net.Dialer{KeepAlive: -1}).DialContext, + ForceAttemptHTTP2: true, + TLSHandshakeTimeout: 10 * time.Second, + } + + return &ClientOption{ + transport: transport, + timeout: 30 * time.Second, + } +} + +// WithTimeout sets the request timeout. +func (o *ClientOption) WithTimeout(timeout time.Duration) *ClientOption { + if timeout >= 0 { + o.timeout = timeout + } + return o +} + +// WithDebug sets the debug mode. +func (o *ClientOption) WithDebug() *ClientOption { + o.debug = true + return o +} + +// WithoutProxy disables the proxy. +func (o *ClientOption) WithoutProxy() *ClientOption { + o.transport.Proxy = nil + return o +} + +// SkipInsecureVerify skips the insecure verify. +func (o *ClientOption) SkipInsecureVerify() *ClientOption { + o.transport.TLSClientConfig.InsecureSkipVerify = true + return o +} + +// WithDial sets the dial function. +func (o *ClientOption) WithDial(dial func(context.Context, string, string) (net.Conn, error)) *ClientOption { + o.transport.DialContext = dial + return o +} + +// WithRoundTrip sets the round trip function. +func (o *ClientOption) WithRoundTrip(rt func(req *http.Request) error) *ClientOption { + if rt == nil { + return o + } + o.roundTrips = append(o.roundTrips, rt) + return o +} + +// WithUserAgent sets the user agent. +func (o *ClientOption) WithUserAgent(ua string) *ClientOption { + return o.WithRoundTrip(func(req *http.Request) error { + req.Header.Set("User-Agent", ua) + return nil + }) +} + +// WithBearerAuth sets the bearer token. +func (o *ClientOption) WithBearerAuth(token string) *ClientOption { + return o.WithRoundTrip(func(req *http.Request) error { + req.Header.Set("Authorization", "Bearer "+token) + return nil + }) +} + +// WithBasicAuth sets the basic authentication. +func (o *ClientOption) WithBasicAuth(username, password string) *ClientOption { + return o.WithRoundTrip(func(req *http.Request) error { + req.SetBasicAuth(username, password) + return nil + }) +} + +// WithHeader sets the header. +func (o *ClientOption) WithHeader(key, value string) *ClientOption { + return o.WithRoundTrip(func(req *http.Request) error { + req.Header.Set(key, value) + return nil + }) +} + +// WithHeaders sets the headers. +func (o *ClientOption) WithHeaders(headers map[string]string) *ClientOption { + return o.WithRoundTrip(func(req *http.Request) error { + for k, v := range headers { + req.Header.Set(k, v) + } + return nil + }) +} diff --git a/staging/github.com/seal-io/utils/httpx/filesystem.go b/staging/github.com/seal-io/utils/httpx/filesystem.go new file mode 100644 index 000000000..cdc9bb934 --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/filesystem.go @@ -0,0 +1,74 @@ +package httpx + +import ( + "io/fs" + "net/http" + "os" + "time" +) + +// FS converts fsys to a http.FileSystem implementation, +// for use with http.FileServer and http.NewFileTransport. +// The files provided by fsys must implement io.Seeker. +func FS(fsys fs.FS, opts ...*FSOption) http.FileSystem { + var o *FSOption + if len(opts) > 0 && opts[0] != nil { + o = opts[0] + } else { + o = FSOptions() + } + + return filesystem{ + FSOption: o, + FileSystem: http.FS(fsys), + } +} + +type filesystem struct { + *FSOption + http.FileSystem +} + +func (fs filesystem) Open(name string) (http.File, error) { + f, err := fs.FileSystem.Open(name) + if err != nil { + return nil, err + } + + return file{FSOption: fs.FSOption, File: f}, nil +} + +type file struct { + *FSOption + http.File +} + +func (f file) Readdir(count int) ([]os.FileInfo, error) { + if f.listable { + return f.File.Readdir(count) + } + + return nil, nil +} + +func (f file) Stat() (fs.FileInfo, error) { + i, err := f.File.Stat() + if err != nil { + return nil, err + } + return fileInfo{FSOption: f.FSOption, FileInfo: i}, nil +} + +type fileInfo struct { + *FSOption + fs.FileInfo +} + +var epoch = time.Now() + +func (i fileInfo) ModTime() time.Time { + if i.embedded { + return epoch + } + return i.FileInfo.ModTime() +} diff --git a/staging/github.com/seal-io/utils/httpx/filesystem_options.go b/staging/github.com/seal-io/utils/httpx/filesystem_options.go new file mode 100644 index 000000000..ec39e29a9 --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/filesystem_options.go @@ -0,0 +1,23 @@ +package httpx + +type FSOption struct { + listable bool + embedded bool +} + +func FSOptions() *FSOption { + return &FSOption{} +} + +// WithListable enables directory listing. +func (o *FSOption) WithListable() *FSOption { + o.listable = true + return o +} + +// WithEmbedded enables embedded mode, +// which provides a fixed modified time. +func (o *FSOption) WithEmbedded() *FSOption { + o.embedded = true + return o +} diff --git a/staging/github.com/seal-io/utils/httpx/handler.go b/staging/github.com/seal-io/utils/httpx/handler.go new file mode 100644 index 000000000..4317af051 --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/handler.go @@ -0,0 +1,28 @@ +package httpx + +import ( + "net" + "net/http" + "strings" +) + +type LoopbackAccessHandlerFunc func(http.ResponseWriter, *http.Request) + +func (f LoopbackAccessHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) { + isLoopBackAccessing := func(r *http.Request) bool { + host := r.Host + if host == "127.0.0.1" || host == "localhost" || host == "::1" { + ip, _, _ := net.SplitHostPort(strings.TrimSpace(r.RemoteAddr)) + return ip == "::1" || host == ip + } + + return false + } + + if !isLoopBackAccessing(r) { + w.WriteHeader(http.StatusNotFound) + return + } + + f(w, r) +} diff --git a/staging/github.com/seal-io/utils/httpx/writer.go b/staging/github.com/seal-io/utils/httpx/writer.go new file mode 100644 index 000000000..46db4e4eb --- /dev/null +++ b/staging/github.com/seal-io/utils/httpx/writer.go @@ -0,0 +1,40 @@ +package httpx + +import ( + "net/http" + + "github.com/seal-io/utils/json" + "github.com/seal-io/utils/pools/bytespool" +) + +func PureJSON(w http.ResponseWriter, code int, v any) error { + buf := bytespool.GetBuffer() + defer bytespool.Put(buf) + + err := json.NewEncoder(buf).Encode(v) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return err + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(code) + _, err = w.Write(buf.Bytes()) + return err +} + +func JSON(w http.ResponseWriter, code int, v any) error { + buf := bytespool.GetBuffer() + defer bytespool.Put(buf) + + err := json.NewEncoder(buf).Encode(v) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return err + } + + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(code) + _, err = w.Write(buf.Bytes()) + return err +} diff --git a/staging/github.com/seal-io/utils/json/common.go b/staging/github.com/seal-io/utils/json/common.go new file mode 100644 index 000000000..9b3a6ae7b --- /dev/null +++ b/staging/github.com/seal-io/utils/json/common.go @@ -0,0 +1,33 @@ +package json + +import ( + "bytes" + stdjson "encoding/json" + + "github.com/tidwall/gjson" +) + +// RawMessage is a raw encoded JSON value. +// It implements json.Marshaler and Unmarshaler and can +// be used to delay JSON decoding or precompute a JSON encoding. +type RawMessage = stdjson.RawMessage + +// Indent appends to dst an indented form of the JSON-encoded src. +// Each element in a JSON object or array begins on a new, +// indented line beginning with prefix followed by one or more +// copies of indent according to the indentation nesting. +// The data appended to dst does not begin with the prefix nor +// any indentation, to make it easier to embed inside other formatted JSON data. +// Although leading space characters (space, tab, carriage return, newline) +// at the beginning of src are dropped, trailing space characters +// at the end of src are preserved and copied to dst. +// For example, if src has no trailing spaces, neither will dst; +// if src ends in a trailing newline, so will dst. +func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error { + return stdjson.Indent(dst, src, prefix, indent) +} + +// Valid reports whether data is a valid JSON encoding. +func Valid(data []byte) bool { + return gjson.ValidBytes(data) +} diff --git a/staging/github.com/seal-io/utils/json/gjson.go b/staging/github.com/seal-io/utils/json/gjson.go new file mode 100644 index 000000000..708109f96 --- /dev/null +++ b/staging/github.com/seal-io/utils/json/gjson.go @@ -0,0 +1,23 @@ +package json + +import ( + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +// Get returns gjson.Result after searching the specified path in given JSON data, +// the path rule is documented on https://github.com/tidwall/gjson/blob/master/SYNTAX.md. +func Get(data []byte, path string) gjson.Result { + return gjson.GetBytes(data, path) +} + +// Set replaces the value after searching the specified path in given JSON data, +// or deletes the value if given nil `value`, +// the path rule is documented on https://github.com/tidwall/gjson/blob/master/SYNTAX.md. +func Set(data []byte, path string, value []byte) ([]byte, error) { + if value == nil { + return sjson.DeleteBytes(data, path) + } + + return sjson.SetRawBytes(data, path, value) +} diff --git a/staging/github.com/seal-io/utils/json/jsoniter.go b/staging/github.com/seal-io/utils/json/jsoniter.go new file mode 100644 index 000000000..a2ebb2410 --- /dev/null +++ b/staging/github.com/seal-io/utils/json/jsoniter.go @@ -0,0 +1,99 @@ +//go:build jsoniter + +package json + +import ( + stdjson "encoding/json" + "fmt" + "strconv" + "unsafe" + + jsoniter "github.com/json-iterator/go" +) + +var ( + _json = jsoniter.ConfigCompatibleWithStandardLibrary + Marshal = _json.Marshal + Unmarshal = _json.Unmarshal + MarshalIndent = _json.MarshalIndent + NewDecoder = _json.NewDecoder + NewEncoder = _json.NewEncoder +) + +func init() { + // borrowed from https://github.com/json-iterator/go/issues/145#issuecomment-323483602 + decodeNumberAsInt64IfPossible := func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + switch iter.WhatIsNext() { + case jsoniter.NumberValue: + var number stdjson.Number + + iter.ReadVal(&number) + i, err := strconv.ParseInt(string(number), 10, 64) + + if err == nil { + *(*any)(ptr) = i + return + } + + f, err := strconv.ParseFloat(string(number), 64) + if err == nil { + *(*any)(ptr) = f + return + } + default: + *(*any)(ptr) = iter.Read() + } + } + jsoniter.RegisterTypeDecoderFunc("interface {}", decodeNumberAsInt64IfPossible) +} + +// MustMarshal is similar to Marshal, +// but panics if found error. +func MustMarshal(v any) []byte { + bs, err := Marshal(v) + if err != nil { + panic(fmt.Errorf("marshal json: %w", err)) + } + + return bs +} + +// MustUnmarshal is similar to Unmarshal, +// but panics if found error. +func MustUnmarshal(data []byte, v any) { + err := Unmarshal(data, v) + if err != nil { + panic(fmt.Errorf("unmarshal json: %w", err)) + } +} + +// MustMarshalIndent is similar to MarshalIndent, +// but panics if found error. +func MustMarshalIndent(v any, prefix, indent string) []byte { + bs, err := MarshalIndent(v, prefix, indent) + if err != nil { + panic(fmt.Errorf("marshal indent json: %w", err)) + } + + return bs +} + +// ShouldMarshal is similar to Marshal, +// but never return error. +func ShouldMarshal(v any) []byte { + bs, _ := Marshal(v) + return bs +} + +// ShouldUnmarshal is similar to Unmarshal, +// but never return error. +func ShouldUnmarshal(data []byte, v any) { + _ = Unmarshal(data, v) +} + +// ShouldMarshalIndent is similar to MarshalIndent, +// but never return error. +func ShouldMarshalIndent(v any, prefix, indent string) []byte { + bs, _ := MarshalIndent(v, prefix, indent) + return bs +} diff --git a/staging/github.com/seal-io/utils/json/jsonpatch.go b/staging/github.com/seal-io/utils/json/jsonpatch.go new file mode 100644 index 000000000..24da0440b --- /dev/null +++ b/staging/github.com/seal-io/utils/json/jsonpatch.go @@ -0,0 +1,55 @@ +package json + +import ( + "reflect" + + jsonpatch "github.com/evanphx/json-patch" +) + +func PatchObject(obj, patchObject any) (any, error) { + oc := reflect.New(reflect.TypeOf(obj)).Interface() + + ob, err := Marshal(obj) + if err != nil { + return nil, err + } + + pb, err := Marshal(patchObject) + if err != nil { + return nil, err + } + + patched, err := jsonpatch.MergePatch(ob, pb) + if err != nil { + return nil, err + } + + err = Unmarshal(patched, oc) + if err != nil { + return nil, err + } + + return oc, nil +} + +func ApplyPatches(doc []byte, patches ...[]byte) ([]byte, error) { + var err error + + for i := range patches { + if len(patches[i]) == 0 { + continue + } + + if len(doc) == 0 { + doc = patches[i] + continue + } + + doc, err = jsonpatch.MergePatch(doc, patches[i]) + if err != nil { + return nil, err + } + } + + return doc, nil +} diff --git a/staging/github.com/seal-io/utils/json/std.go b/staging/github.com/seal-io/utils/json/std.go new file mode 100644 index 000000000..8175d2bac --- /dev/null +++ b/staging/github.com/seal-io/utils/json/std.go @@ -0,0 +1,67 @@ +//go:build !jsoniter + +package json + +import ( + "encoding/json" + "fmt" +) + +var ( + Marshal = json.Marshal + Unmarshal = json.Unmarshal + MarshalIndent = json.MarshalIndent + NewDecoder = json.NewDecoder + NewEncoder = json.NewEncoder +) + +// MustMarshal is similar to Marshal, +// but panics if found error. +func MustMarshal(v any) []byte { + bs, err := Marshal(v) + if err != nil { + panic(fmt.Errorf("marshal json: %w", err)) + } + + return bs +} + +// MustUnmarshal is similar to Unmarshal, +// but panics if found error. +func MustUnmarshal(data []byte, v any) { + err := Unmarshal(data, v) + if err != nil { + panic(fmt.Errorf("unmarshal json: %w", err)) + } +} + +// MustMarshalIndent is similar to MarshalIndent, +// but panics if found error. +func MustMarshalIndent(v any, prefix, indent string) []byte { + bs, err := MarshalIndent(v, prefix, indent) + if err != nil { + panic(fmt.Errorf("marshal indent json: %w", err)) + } + + return bs +} + +// ShouldMarshal is similar to Marshal, +// but never return error. +func ShouldMarshal(v any) []byte { + bs, _ := Marshal(v) + return bs +} + +// ShouldUnmarshal is similar to Unmarshal, +// but never return error. +func ShouldUnmarshal(data []byte, v any) { + _ = Unmarshal(data, v) +} + +// ShouldMarshalIndent is similar to MarshalIndent, +// but never return error. +func ShouldMarshalIndent(v any, prefix, indent string) []byte { + bs, _ := MarshalIndent(v, prefix, indent) + return bs +} diff --git a/staging/github.com/seal-io/utils/memcache/bigcache.go b/staging/github.com/seal-io/utils/memcache/bigcache.go new file mode 100644 index 000000000..bd05165e2 --- /dev/null +++ b/staging/github.com/seal-io/utils/memcache/bigcache.go @@ -0,0 +1,305 @@ +package memcache + +import ( + "context" + "errors" + "fmt" + "strings" + "time" + + "github.com/allegro/bigcache/v3" + "github.com/dustin/go-humanize" + "k8s.io/klog/v2" +) + +// Config holds the configuration of the in-memory cache, +// entry indexes by key and stores in one bucket, +// the total cache size is BucketCapacity * Buckets. +type Config struct { + // Namespace indicates the operating workspace. + Namespace string + // EntryMaxLife indicates the maximum lifetime of each entry, + // default is 15 mins. + EntryMaxLife time.Duration + // LazyEntryEviction indicates to evict an expired entry at next peeking, + // by default, a background looping tries to evict expired entries per 3 mins. + LazyEntryEviction bool + // Buckets indicates the bucket number of cache, + // value must be a power of two, + // default is 64. + Buckets int + // BucketCapacity indicates the maximum MB of each bucket, + // default is 1 MB. + BucketCapacity int + // LazyBucketScale indicates to scale when the current bucket is not enough to put a new entry, + // by default, create the bucket with the given capacity to avoid any array copying. + // It's worth noticing that the bucket capacity can not exceed even configured LazyBucketScale to true. + LazyBucketScale bool +} + +func (c *Config) Default() { + c.Namespace = strings.TrimSpace(c.Namespace) + if c.EntryMaxLife == 0 { + c.EntryMaxLife = 15 * time.Minute + } + + if c.Buckets == 0 { + c.Buckets = 64 + } + + if c.BucketCapacity == 0 { + c.BucketCapacity = 1 + } +} + +func (c *Config) Validate() error { + if c.EntryMaxLife < 0 { + return errors.New("invalid entry max age: negative") + } + + if c.Buckets < 0 { + return errors.New("invalid buckets: negative") + } + + if c.BucketCapacity < 0 { + return errors.New("invalid bucket capacity: negative") + } + + return nil +} + +// New returns an in-memory Cache implementation. +func New(ctx context.Context) (Cache, error) { + return NewWithConfig(ctx, Config{}) +} + +// MustNew likes New, but panic if error found. +func MustNew(ctx context.Context) Cache { + n, err := New(ctx) + if err != nil { + panic(fmt.Errorf("create in-memory cache: %w", err)) + } + + return n +} + +// NewWithConfig returns an in-memory Cache implementation with given configuration. +func NewWithConfig(ctx context.Context, cfg Config) (Cache, error) { + // Default, validate. + cfg.Default() + + err := cfg.Validate() + if err != nil { + return nil, err + } + + // Generate bigcache configuration with Config. + // + // For example: + // + // bigcache.Config{ + // LifeWindow: 15 * time.Minute, + // CleanWindow: 3 * time.Minute, + // Shards: 64, + // MaxEntriesInWindow: 64 * 300, // works with MaxEntrySize to determinate the cache initialization. + // MaxEntrySize: 512, + // HardMaxCacheSize: 64, + // StatsEnabled: false, + // Verbose: false, + // } + // + // Each shard initializes with `(MaxEntriesInWindows / Shards) * MaxEntrySize` = 300 * 512 = 150kb. + // Each shard limits in `(HardMaxCacheSize * 1024 * 1024) / Shards` = 64 * 1024 * 1024 / 64 = 1mb. + // Initializes with 64 * 150kb = 9mb, limits with 64 * 1mb = 64mb. + // + capacity := cfg.BucketCapacity * cfg.Buckets + logger := klog.Background().WithName("cache").WithName("memory").V(5) + + underlayCfg := bigcache.Config{ + Shards: cfg.Buckets, + LifeWindow: cfg.EntryMaxLife, + CleanWindow: 0, + MaxEntriesInWindow: cfg.Buckets << 4, + MaxEntrySize: cfg.BucketCapacity << (20 - 4), + HardMaxCacheSize: capacity, + StatsEnabled: false, + Verbose: false, + OnRemoveWithReason: func(key string, entry []byte, reason bigcache.RemoveReason) { + desc := "unknown" + switch reason { + case bigcache.Deleted: + desc = "deleted" + case bigcache.Expired: + desc = "expired" + case bigcache.NoSpace: + desc = "nospace" + } + if logger.Enabled() { + size := humanize.IBytes(uint64(len(entry))) + if len(key) > 10 { + key = key[:10] + "..." + } + logger.Info("removed", + "reason", desc, "size", size, "key", key[:10]) + } + }, + } + if !cfg.LazyEntryEviction { + // Set up a background looping to clean. + underlayCfg.CleanWindow = 3 * time.Minute + } + + if cfg.LazyBucketScale { + // Initialize the cache queue in 1/4 capacity. + underlayCfg.MaxEntrySize >>= 2 + } + + // Init. + underlay, err := bigcache.New(ctx, underlayCfg) + if err != nil { + return nil, err + } + mc := bigCache{ + underlay: underlay, + } + + if cfg.Namespace != "" { + ns := cfg.Namespace + "#" + mc.namespace = &ns + } + + return mc, nil +} + +// MustNewWithConfig likes NewWithConfig, but panic if error found. +func MustNewWithConfig(ctx context.Context, cfg Config) Cache { + n, err := NewWithConfig(ctx, cfg) + if err != nil { + panic(fmt.Errorf("create in-memory cache: %w", err)) + } + + return n +} + +// bigCache adapts Cache interface to implement an in-memory cache with bigcache.BigCache. +type bigCache struct { + namespace *string + underlay *bigcache.BigCache +} + +func (c bigCache) wrapKey(s *string) *string { + if c.namespace == nil { + return s + } + r := *c.namespace + *s + + return &r +} + +func (c bigCache) Close() error { + return c.underlay.Close() +} + +func (c bigCache) Name() string { + return "memory" +} + +func (c bigCache) Set(ctx context.Context, key string, entry []byte) (err error) { + wk := c.wrapKey(&key) + + err = c.underlay.Set(*wk, entry) + if err != nil && err.Error() == "entry is bigger than max shard size" { + err = ErrEntryTooBig + } + + return +} + +func (c bigCache) Delete(ctx context.Context, keys ...string) (err error) { + for i := range keys { + wk := c.wrapKey(&keys[i]) + + err = c.underlay.Delete(*wk) + if err != nil { + if !errors.Is(err, bigcache.ErrEntryNotFound) { + return + } + err = nil + } + } + + return +} + +func (c bigCache) Get(ctx context.Context, key string) (entry []byte, err error) { + wk := c.wrapKey(&key) + + entry, err = c.underlay.Get(*wk) + if err != nil && errors.Is(err, bigcache.ErrEntryNotFound) { + err = ErrEntryNotFound + } + + return +} + +func (c bigCache) List(ctx context.Context, keys ...string) (entries [][]byte, err error) { + entries = make([][]byte, len(keys)) + for i := range keys { + entries[i], err = c.Get(ctx, keys[i]) + if err != nil { + return + } + } + + return +} + +func (c bigCache) Iterate(ctx context.Context, m EntryKeyMatcher, a EntryAccessor) error { + if a == nil { + return nil + } + + it := c.underlay.Iterator() + for it.SetNext() { + e, err := it.Value() + if err != nil { + return err + } + + k := e.Key() + if c.namespace != nil && !strings.HasPrefix(k, *c.namespace) { + continue + } + + if m != nil && !m.Match(k) { + continue + } + + n, err := a(ctx, bigcacheEntry{i: e}) + if err != nil { + return err + } + + if !n { + break + } + } + + return nil +} + +func (c bigCache) Underlay() *bigcache.BigCache { + return c.underlay +} + +type bigcacheEntry struct { + i bigcache.EntryInfo +} + +func (e bigcacheEntry) Key() string { + return e.i.Key() +} + +func (e bigcacheEntry) Value() ([]byte, error) { + return e.i.Value(), nil +} diff --git a/staging/github.com/seal-io/utils/memcache/cache.go b/staging/github.com/seal-io/utils/memcache/cache.go new file mode 100644 index 000000000..6a7054286 --- /dev/null +++ b/staging/github.com/seal-io/utils/memcache/cache.go @@ -0,0 +1,50 @@ +package memcache + +import ( + "context" + "sync" + "time" +) + +var ( + once sync.Once + gc = MustNew(context.Background()) +) + +// Configure configures the global cache with given entry max life once, +// multiple calls will be ignored. +func Configure(entryMaxLife time.Duration) { + once.Do(func() { + _ = gc.Close() + gc = MustNewWithConfig(context.Background(), Config{ + EntryMaxLife: entryMaxLife, + }) + }) +} + +// Set sets the entry associated with the key to the global cache. +func Set(ctx context.Context, key string, entry []byte) error { + return gc.Set(ctx, key, entry) +} + +// Delete removes the keys from the global cache. +func Delete(ctx context.Context, keys ...string) error { + return gc.Delete(ctx, keys...) +} + +// Get returns the entry associated with the key from the global cache. +func Get(ctx context.Context, key string) ([]byte, error) { + return gc.Get(ctx, key) +} + +// List returns the entries associated with the keys from the global cache. +func List(ctx context.Context, keys ...string) ([][]byte, error) { + return gc.List(ctx, keys...) +} + +// Iterate iterates over the entries in the global cache. +// breaks with none nil error, +// do not do time-expensive callback during iteration. +func Iterate(ctx context.Context, m EntryKeyMatcher, a EntryAccessor) error { + return gc.Iterate(ctx, m, a) +} diff --git a/staging/github.com/seal-io/utils/memcache/interface.go b/staging/github.com/seal-io/utils/memcache/interface.go new file mode 100644 index 000000000..e937a5d6e --- /dev/null +++ b/staging/github.com/seal-io/utils/memcache/interface.go @@ -0,0 +1,87 @@ +package memcache + +import ( + "context" + "errors" + "io" + "strings" +) + +var ( + ErrEntryNotFound = errors.New("entry is not found") + ErrEntryTooBig = errors.New("entry is too big") +) + +// Entry holds the action of cache entry. +type Entry interface { + // Key returns entry key. + Key() string + + // Value returns entry value. + Value() ([]byte, error) +} + +// EntryKeyMatcher holds the predication of the iteration. +type EntryKeyMatcher interface { + // Match returns true if the given key matched. + Match(key string) bool +} + +// HasPrefix implements the EntryKeyMatcher stereotype, +// which means the key has the given prefix. +type HasPrefix string + +func (s HasPrefix) Match(key string) bool { + return strings.HasPrefix(key, string(s)) +} + +// HasSuffix implements the EntryKeyMatcher stereotype, +// which means the key has the given suffix. +type HasSuffix string + +func (s HasSuffix) Match(key string) bool { + return strings.HasSuffix(key, string(s)) +} + +// HasPartial implements the EntryKeyMatcher stereotype, +// which means the key has the given partial. +type HasPartial string + +func (s HasPartial) Match(key string) bool { + return strings.Contains(key, string(s)) +} + +// EntryAccessor accesses the entry during iterating, +// it can break the iteration with a false returning or none nil error. +type EntryAccessor func(ctx context.Context, entry Entry) (next bool, err error) + +// Cache holds the action of caching. +type Cache interface { + io.Closer + + Name() string + + // Set saves entry with the given key, + // it returns an ErrEntryTooBig when entry is too big. + Set(ctx context.Context, key string, entry []byte) error + + // Delete removes the keys. + Delete(ctx context.Context, keys ...string) error + + // Get reads entry for the key, + // it returns an ErrEntryNotFound when no entry exists for the given key. + Get(ctx context.Context, key string) ([]byte, error) + + // List reads entries for the key list. + List(ctx context.Context, keys ...string) (entries [][]byte, err error) + + // Iterate iterates all entries of the whole cache, + // breaks with none nil error, + // do not do time-expensive callback during iteration. + Iterate(ctx context.Context, m EntryKeyMatcher, a EntryAccessor) error +} + +// Underlay gets the underlay client. +type Underlay[T any] interface { + Underlay() T +} diff --git a/staging/github.com/seal-io/utils/memcache/metrics.go b/staging/github.com/seal-io/utils/memcache/metrics.go new file mode 100644 index 000000000..d506a0b98 --- /dev/null +++ b/staging/github.com/seal-io/utils/memcache/metrics.go @@ -0,0 +1,90 @@ +package memcache + +import ( + "github.com/allegro/bigcache/v3" + "github.com/prometheus/client_golang/prometheus" +) + +// NewStatsCollector returns a new prometheus.Collector for global cache. +func NewStatsCollector() prometheus.Collector { + fqName := func(name string) string { + return "memcache_" + name + } + + return &statsCollector{ + entries: prometheus.NewDesc( + fqName("entries"), + "The number of entries in the cache.", + nil, nil, + ), + capacity: prometheus.NewDesc( + fqName("capacity"), + "The store bytes amount in the cache.", + nil, nil, + ), + hitsTotal: prometheus.NewDesc( + fqName("hits_total"), + "The total number of cache hits(successfully found).", + nil, nil, + ), + missesTotal: prometheus.NewDesc( + fqName("misses_total"), + "The total number of cache misses(not found).", + nil, nil, + ), + deleteHitsTotal: prometheus.NewDesc( + fqName("delete_hits_total"), + "The total number of cache delete hits(successfully deleted).", + nil, nil, + ), + deleteMissesTotal: prometheus.NewDesc( + fqName("delete_misses_total"), + "The total number of cache delete misses(not deleted).", + nil, nil, + ), + collisionsTotal: prometheus.NewDesc( + fqName("collisions_total"), + "The total number of cache key-collisions.", + nil, nil, + ), + } +} + +type statsCollector struct { + entries *prometheus.Desc + capacity *prometheus.Desc + + hitsTotal *prometheus.Desc + missesTotal *prometheus.Desc + deleteHitsTotal *prometheus.Desc + deleteMissesTotal *prometheus.Desc + collisionsTotal *prometheus.Desc +} + +func (c *statsCollector) Describe(ch chan<- *prometheus.Desc) { + ch <- c.entries + ch <- c.capacity + ch <- c.hitsTotal + ch <- c.missesTotal + ch <- c.deleteHitsTotal + ch <- c.deleteMissesTotal + ch <- c.collisionsTotal +} + +func (c *statsCollector) Collect(ch chan<- prometheus.Metric) { + bc := gc.(Underlay[*bigcache.BigCache]).Underlay() + + var ( + entries = bc.Len() + capacity = bc.Capacity() + stats = bc.Stats() + ) + + ch <- prometheus.MustNewConstMetric(c.entries, prometheus.GaugeValue, float64(entries)) + ch <- prometheus.MustNewConstMetric(c.capacity, prometheus.GaugeValue, float64(capacity)) + ch <- prometheus.MustNewConstMetric(c.hitsTotal, prometheus.CounterValue, float64(stats.Hits)) + ch <- prometheus.MustNewConstMetric(c.missesTotal, prometheus.CounterValue, float64(stats.Misses)) + ch <- prometheus.MustNewConstMetric(c.deleteHitsTotal, prometheus.CounterValue, float64(stats.DelHits)) + ch <- prometheus.MustNewConstMetric(c.deleteMissesTotal, prometheus.CounterValue, float64(stats.DelMisses)) + ch <- prometheus.MustNewConstMetric(c.collisionsTotal, prometheus.CounterValue, float64(stats.Collisions)) +} diff --git a/staging/github.com/seal-io/utils/netx/dial.go b/staging/github.com/seal-io/utils/netx/dial.go new file mode 100644 index 000000000..3d85b0711 --- /dev/null +++ b/staging/github.com/seal-io/utils/netx/dial.go @@ -0,0 +1,42 @@ +package netx + +import ( + "context" + "crypto/tls" + "fmt" + "net" + "time" +) + +// IsConnected checks if the given address is reachable. +// +// The given network can select from tcp, udp, tls, and unix. +func IsConnected(ctx context.Context, network, address string, timeout time.Duration) error { + var ( + dialer = &net.Dialer{Timeout: timeout} + dial = dialer.DialContext + ) + + if network == "tls" { + network = "tcp" + tlsDialer := &tls.Dialer{ + NetDialer: dialer, + Config: &tls.Config{ + InsecureSkipVerify: true, // nolint:gosec + }, + } + dial = tlsDialer.DialContext + } + + c, err := dial(ctx, network, address) + if err != nil { + return fmt.Errorf("%s is unreachable", address) + } + + err = c.Close() + if err != nil { + return fmt.Errorf("%s is unreachable: closing connection: %w", address, err) + } + + return nil +} diff --git a/staging/github.com/seal-io/utils/netx/ipv4.go b/staging/github.com/seal-io/utils/netx/ipv4.go new file mode 100644 index 000000000..75e199fb1 --- /dev/null +++ b/staging/github.com/seal-io/utils/netx/ipv4.go @@ -0,0 +1,99 @@ +package netx + +import ( + "net" + "reflect" +) + +type IPv4 net.IPNet + +func MustIPv4FromCIDR(cidr string) IPv4 { + ip, err := IPv4FromCIDR(cidr) + if err != nil { + panic(err) + } + + return ip +} + +func IPv4FromCIDR(cidr string) (IPv4, error) { + _, n, err := net.ParseCIDR(cidr) + if err != nil { + return IPv4{}, err + } + + // NB(thxCode): returns result that defined in RFC 4632 and RFC 4291. + return IPv4FromIPNet(*n), nil +} + +func IPv4FromIP(ip net.IP) IPv4 { + return IPv4(net.IPNet{ + IP: ip.To4(), + Mask: ip.DefaultMask(), + }) +} + +func IPv4FromIPNet(n net.IPNet) IPv4 { + return IPv4(net.IPNet{ + IP: n.IP.To4().Mask(n.Mask), + Mask: n.Mask, + }) +} + +// Contains returns true if the given net.IP is contained in the IPv4. +func (l IPv4) Contains(ip net.IP) bool { + return (*net.IPNet)(&l).Contains(ip) +} + +// String returns the string representation of the IPv4. +func (l IPv4) String() string { + return (*net.IPNet)(&l).String() +} + +// IPNet returns the net.IPNet of the IPv4. +func (l IPv4) IPNet() net.IPNet { + return net.IPNet(l) +} + +// Equal returns true if two IPv4 are equal. +func (l IPv4) Equal(r IPv4) bool { + return reflect.DeepEqual(l.Mask, r.Mask) && (*net.IPNet)(&l).Contains(r.IP) && (*net.IPNet)(&r).Contains(l.IP) +} + +// Overlap returns true if two IPv4 overlap. +func (l IPv4) Overlap(r IPv4) bool { + return (*net.IPNet)(&l).Contains(r.IP) || (*net.IPNet)(&r).Contains(l.IP) +} + +// Next returns a IPv4 with the same mask. +// +// For example, +// returns 172.16.192.0/18 if given 172.16.128.0/18, +// returns 172.17.0.0/18 if given 172.16.192.0/18. +func (l IPv4) Next() IPv4 { + var ( + o, s = l.Mask.Size() + i, j int + ) + { + for i, j = range []int{24, 16, 8, 0} { + if o > j { + break + } + } + i = 3 - i + j = 8 + j - o + } + + r := IPv4{ + IP: []byte{l.IP[0], l.IP[1], l.IP[2], l.IP[3]}, + Mask: net.CIDRMask(o, s), + } + r.IP[i] += 1 << j + + if r.IP[i] == 0 && i > 0 { + r.IP[i-1] += 1 + } + + return r +} diff --git a/staging/github.com/seal-io/utils/netx/ipv4_test.go b/staging/github.com/seal-io/utils/netx/ipv4_test.go new file mode 100644 index 000000000..770c62248 --- /dev/null +++ b/staging/github.com/seal-io/utils/netx/ipv4_test.go @@ -0,0 +1,104 @@ +package netx + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIPv4_Overlap(t *testing.T) { + type input struct { + l, r IPv4 + } + + testCases := []struct { + given input + expected bool + }{ + { + given: input{ + l: MustIPv4FromCIDR("10.24.0.0/16"), + r: MustIPv4FromCIDR("10.24.0.0/16"), + }, + expected: true, + }, + { + given: input{ + l: MustIPv4FromCIDR("192.168.0.0/16"), + r: MustIPv4FromCIDR("192.168.0.0/24"), + }, + expected: true, + }, + { + given: input{ + l: MustIPv4FromCIDR("172.16.0.0/17"), + r: MustIPv4FromCIDR("172.16.1.0/17"), + }, + expected: true, + }, + { + given: input{ + l: MustIPv4FromCIDR("172.16.0.0/17"), + r: MustIPv4FromCIDR("172.16.128.0/17"), + }, + expected: false, + }, + { + given: input{ + l: MustIPv4FromCIDR("192.168.0.0/16"), + r: MustIPv4FromCIDR("10.24.0.0/16"), + }, + expected: false, + }, + } + for _, tc := range testCases { + t.Run(tc.given.l.String()+" "+tc.given.r.String(), func(t *testing.T) { + assert.Equal(t, tc.expected, tc.given.l.Overlap(tc.given.r)) + }) + } +} + +func TestIPv4_Next(t *testing.T) { + testCases := []struct { + given IPv4 + expected IPv4 + }{ + { + given: MustIPv4FromCIDR("192.168.0.0/16"), + expected: MustIPv4FromCIDR("192.169.0.0/16"), + }, + { + given: MustIPv4FromCIDR("192.169.0.0/16"), + expected: MustIPv4FromCIDR("192.170.0.0/16"), + }, + { + given: MustIPv4FromCIDR("192.255.0.0/16"), + expected: MustIPv4FromCIDR("193.0.0.0/16"), + }, + { + given: MustIPv4FromCIDR("172.16.0.0/17"), + expected: MustIPv4FromCIDR("172.16.128.0/17"), + }, + { + given: MustIPv4FromCIDR("172.16.0.0/18"), + expected: MustIPv4FromCIDR("172.16.64.0/18"), + }, + { + given: MustIPv4FromCIDR("172.16.64.0/18"), + expected: MustIPv4FromCIDR("172.16.128.0/18"), + }, + { + given: MustIPv4FromCIDR("172.16.128.0/18"), + expected: MustIPv4FromCIDR("172.16.192.0/18"), + }, + { + given: MustIPv4FromCIDR("172.16.192.0/18"), + expected: MustIPv4FromCIDR("172.17.0.0/18"), + }, + } + for _, tc := range testCases { + t.Run(tc.given.String(), func(t *testing.T) { + assert.Equal(t, tc.expected.String(), tc.given.Next().String()) + }) + } +} diff --git a/staging/github.com/seal-io/utils/osx/cmd.go b/staging/github.com/seal-io/utils/osx/cmd.go new file mode 100644 index 000000000..aa8ffb548 --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/cmd.go @@ -0,0 +1,113 @@ +package osx + +import ( + "os" + "path/filepath" + "strings" + + "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/sets" +) + +// RetrieveArgsFromEnvInto distinguishes the given command's argument, +// then lookup the environment's variables. +func RetrieveArgsFromEnvInto(c *cobra.Command) { + const ( + argPrefix = "--" + envKeyPrefix = "WALRUS_" + ) + + var ( + cmdName = filepath.Base(os.Args[0]) + sc *cobra.Command + ) + + for _, c := range c.Commands() { + if c.Name() == cmdName { + if len(os.Args) > 1 && !strings.HasPrefix(os.Args[1], argPrefix) { + break + } + + newArgs := make([]string, len(os.Args)+1) + newArgs[0] = os.Args[0] + newArgs[1] = cmdName + copy(newArgs[2:], os.Args[1:]) + os.Args = newArgs + + sc = c + + break + } + } + + if len(os.Args) >= 2 && sc == nil { + for _, c := range c.Commands() { + if c.Name() == os.Args[1] { + sc = c + break + } + } + } + + var ( + envPrefix = envKeyPrefix + flags = c.Flags() + ) + + if sc != nil { + envPrefix = envPrefix + strings.ToUpper(sc.Name()) + "_" + flags = sc.Flags() + } + + ignores := sets.New("help", "v", "version") + settings := sets.New[string]() + + if len(os.Args) > 2 { + for _, v := range os.Args[2:] { + if strings.HasPrefix(v, argPrefix) { + vs := strings.SplitN(v, "=", 2) + settings.Insert(vs[0]) + } + } + } + + envArgs := make([]string, 0, len(os.Environ())*2) + + for _, v := range os.Environ() { + if v2 := strings.TrimPrefix(v, envPrefix); v == v2 { + continue + } else { + v = v2 + } + + vs := strings.SplitN(v, "=", 2) + if len(vs) != 2 { + continue + } + + var ( + fn = strings.ReplaceAll(strings.ToLower(vs[0]), "_", "-") + ek = argPrefix + fn + ) + + if ignores.Has(fn) || flags.Lookup(fn) == nil || settings.Has(ek) { + continue + } + + ev := vs[1] + if ev2 := os.ExpandEnv(ev); ev2 != "" && ev != ev2 { + ev = ev2 + } + + envArgs = append(envArgs, ek, ev) + } + + if len(envArgs) == 0 { + return + } + + newArgs := make([]string, len(os.Args)+len(envArgs)) + copy(newArgs, os.Args) + copy(newArgs[len(os.Args):], envArgs) + os.Args = newArgs +} diff --git a/staging/github.com/seal-io/utils/osx/copy.go b/staging/github.com/seal-io/utils/osx/copy.go new file mode 100644 index 000000000..21abfe307 --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/copy.go @@ -0,0 +1,292 @@ +package osx + +import ( + "errors" + "fmt" + "io" + "io/fs" + "os" + "path/filepath" +) + +type CopyOptions func(*copyOptions) + +// CopyIfFound copies the src if found. +func CopyIfFound() CopyOptions { + return func(o *copyOptions) { + o.ignore = true + } +} + +// CopyInReplace deletes dst if found. +func CopyInReplace() CopyOptions { + return func(o *copyOptions) { + o.replace = true + } +} + +// CopyInShadow creates a symlink to the dst from the src. +func CopyInShadow() CopyOptions { + return func(o *copyOptions) { + o.shadow = true + } +} + +// CopyWithTimes preserves the times of all entries from src. +func CopyWithTimes() CopyOptions { + return func(o *copyOptions) { + o.preserveTimes = true + } +} + +// CopyWithOwner preserves the times of all entries from src. +func CopyWithOwner() CopyOptions { + return func(o *copyOptions) { + o.preserveOwner = true + } +} + +// CopyWithPerm specifies the perm of the dst, +// if the dst is directory, +// this only change the dst without its entries. +func CopyWithPerm(perm os.FileMode) CopyOptions { + return func(o *copyOptions) { + o.perm = &perm + } +} + +// CopyWithBuffer indicates to use buffer during copying file. +func CopyWithBuffer() CopyOptions { + return func(o *copyOptions) { + o.buffer = true + } +} + +// CopyWithModifier configures a modifier for change the content during copying file, +// it only works without buffer. +func CopyWithModifier(m func([]byte) ([]byte, error)) CopyOptions { + return func(o *copyOptions) { + o.modify = m + } +} + +type copyOptions struct { + ignore bool + replace bool + shadow bool + preserveTimes bool + preserveOwner bool + perm *os.FileMode + buffer bool + modify func([]byte) ([]byte, error) +} + +func Copy(src, dst string, opts ...CopyOptions) error { + var o copyOptions + + for i := range opts { + if opts[i] == nil { + continue + } + + opts[i](&o) + } + + srcInfo, err := os.Lstat(src) + if err != nil { + if errors.Is(err, os.ErrNotExist) && o.ignore { + return nil + } + + return err + } + + var cp func(string, string, os.FileInfo, copyOptions) error + + for { + switch m := srcInfo.Mode(); { + default: + return fmt.Errorf("unsupported src mode: %v", m) + case m&os.ModeSymlink != 0: + if src, err = os.Readlink(src); err != nil { + return fmt.Errorf("read origin of link src: %w", err) + } + + if srcInfo, err = os.Lstat(src); err != nil { + return fmt.Errorf("stat origin of link src: %w", err) + } + + continue + case m.IsDir(): + cp = copyFromDir + case m.IsRegular(): + cp = copyFromFile + } + + break + } + + dstInfo := srcInfo + + if s, err := os.Lstat(dst); err == nil { + if o.replace { + if err = os.RemoveAll(dst); err != nil { + return fmt.Errorf("cannot clean dst: %w", err) + } + } + + dstInfo = s + } + + if o.shadow { + if err = os.Symlink(src, dst); err != nil { + return fmt.Errorf("cannot shadow dst: %w", err) + } + + return nil + } + + defer func() { + m := dstInfo.Mode() + if o.perm != nil { + m = *o.perm + } + + if err = os.Chmod(dst, m); err != nil { + err = fmt.Errorf("cannot change perm: %w", err) + } + }() + + if err = cp(src, dst, srcInfo, o); err != nil { + return fmt.Errorf("cannot copy: %w", err) + } + + if o.preserveTimes { + aTime, mTime, _ := fileTimes(srcInfo) + if err = os.Chtimes(dst, aTime, mTime); err != nil { + return fmt.Errorf("cannot preserve times: %w", err) + } + } + + if o.preserveOwner { + uid, gid := fileOwner(srcInfo) + if err = os.Lchown(dst, uid, gid); err != nil { + return fmt.Errorf("cannot preserve owner: %w", err) + } + } + + return nil +} + +func copyFromDir(src, dst string, srcInfo os.FileInfo, o copyOptions) error { + // Switch directory permission for copying. + if err := os.Mkdir(dst, 0o666); err != nil { + if !os.IsExist(err) { + return err + } + + if err = os.Chmod(dst, 0o666); err != nil { + return err + } + } + + return filepath.Walk(src, func(srcSub string, srcSubInfo fs.FileInfo, err error) error { + if err != nil { + return err + } + + sub, err := filepath.Rel(src, srcSub) + if err != nil { + return err + } + dstSub := filepath.Join(dst, sub) + + switch m := srcSubInfo.Mode(); { + default: + // Unsupported src mode. + return nil + case m&os.ModeSymlink != 0: + if srcSub, err = os.Readlink(srcSub); err != nil { + return err + } + + if err = os.Symlink(srcSub, dstSub); err != nil { + return err + } + case m.IsDir(): + if err = os.Mkdir(dstSub, srcSubInfo.Mode()); err != nil && !os.IsExist(err) { + return err + } + case m.IsRegular(): + if err = copyFromFile(srcSub, dstSub, srcSubInfo, o); err != nil { + return err + } + } + + if o.preserveTimes { + aTime, mTime, _ := fileTimes(srcInfo) + if err = os.Chtimes(dstSub, aTime, mTime); err != nil { + return err + } + } + + if o.preserveOwner { + uid, gid := fileOwner(srcInfo) + if err = os.Lchown(dstSub, uid, gid); err != nil { + return err + } + } + + if srcSubInfo.Mode()&os.ModeSymlink == 0 { + if err = os.Chmod(dstSub, srcSubInfo.Mode()); err != nil { + return err + } + } + + return nil + }) +} + +func copyFromFile(src, dst string, scrInfo os.FileInfo, o copyOptions) error { + dstDir := filepath.Dir(dst) + if !Exists(dstDir) { + if err := os.MkdirAll(dstDir, 0o666); err != nil { + return err + } + } + + if o.buffer { + // Copy with buffer. + srcFile, err := os.Open(src) + if err != nil { + return err + } + + defer func() { _ = srcFile.Close() }() + + dstFile, err := os.Create(dst) + if err != nil { + return err + } + + defer func() { _ = dstFile.Close() }() + + _, err = io.Copy(srcFile, dstFile) + + return err + } + + content, err := os.ReadFile(src) + if err != nil { + return err + } + + if o.modify != nil { + content, err = o.modify(content) + if err != nil { + return err + } + } + + return os.WriteFile(dst, content, 0o600) +} diff --git a/staging/github.com/seal-io/utils/osx/env.go b/staging/github.com/seal-io/utils/osx/env.go new file mode 100644 index 000000000..390cc5b37 --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/env.go @@ -0,0 +1,32 @@ +package osx + +import ( + "os" +) + +// LookupEnv retrieves the value of the environment variable named +// by the key. If the variable is present in the environment the +// value (which may be empty) is returned and the boolean is true. +// Otherwise, the returned value will be empty and the boolean will +// be false. +func LookupEnv(key string) (string, bool) { + return os.LookupEnv(key) +} + +// Getenv retrieves the value of the environment variable named by the key. +// It returns the default, which will be empty if the variable is not present. +// To distinguish between an empty value and an unset value, use LookupEnv. +func Getenv(key string, def ...string) string { + e, ok := LookupEnv(key) + if !ok && len(def) != 0 { + return def[0] + } + + return e +} + +// ExpandEnv is similar to Getenv, +// but replaces ${var} or $var in the result. +func ExpandEnv(key string, def ...string) string { + return os.ExpandEnv(Getenv(key, def...)) +} diff --git a/staging/github.com/seal-io/utils/osx/file.go b/staging/github.com/seal-io/utils/osx/file.go new file mode 100644 index 000000000..b4b1e5456 --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/file.go @@ -0,0 +1,132 @@ +package osx + +import ( + "errors" + "fmt" + "io" + "os" + "path/filepath" +) + +// Exists checks if the given path exists. +func Exists(path string, checks ...func(os.FileInfo) bool) bool { + stat, err := os.Lstat(path) + if err != nil { + return false + } + + for i := range checks { + if checks[i] == nil { + continue + } + + if !checks[i](stat) { + return false + } + } + + return true +} + +// ExistsDir checks if the given path exists and is a directory. +func ExistsDir(path string) bool { + return Exists(path, func(stat os.FileInfo) bool { + return stat.Mode().IsDir() + }) +} + +// ExistsLink checks if the given path exists and is a symbolic link. +func ExistsLink(path string) bool { + return Exists(path, func(stat os.FileInfo) bool { + return stat.Mode()&os.ModeSymlink != 0 + }) +} + +// ExistsFile checks if the given path exists and is a regular file. +func ExistsFile(path string) bool { + return Exists(path, func(stat os.FileInfo) bool { + return stat.Mode().IsRegular() + }) +} + +// ExistsSocket checks if the given path exists and is a socket. +func ExistsSocket(path string) bool { + return Exists(path, func(stat os.FileInfo) bool { + return stat.Mode()&os.ModeSocket != 0 + }) +} + +// ExistsDevice checks if the given path exists and is a device. +func ExistsDevice(path string) bool { + return Exists(path, func(stat os.FileInfo) bool { + return stat.Mode()&os.ModeDevice != 0 + }) +} + +// TempFile creates a temporary file with the given pattern. +func TempFile(pattern string) string { + f, err := os.CreateTemp("", pattern) + if err != nil { + panic(fmt.Errorf("create temp file: %w", err)) + } + + defer func() { _ = f.Close() }() + + return f.Name() +} + +// TempDir creates a temporary directory with the given pattern. +func TempDir(pattern string) string { + n, err := os.MkdirTemp("", pattern) + if err != nil { + panic(fmt.Errorf("create temp dir: %w", err)) + } + + return n +} + +// SubTempDir is different to TempDir. +// +// TempDir creates a temporary directory randomly, +// but SubTempDir creates a subdirectory under the temporary directory with the given path. +func SubTempDir(path string) string { + n := filepath.Join(os.TempDir(), filepath.Clean(path)) + err := os.MkdirAll(n, 0o700) + if err != nil { + panic(fmt.Errorf("create temp subdir: %w", err)) + } + + return n +} + +// Close closes the given io.Closer without error. +func Close(c io.Closer) { + if c == nil { + return + } + _ = c.Close() +} + +// IsEmptyDir checks if the given directory is empty. +func IsEmptyDir(dir string) bool { + f, err := os.Open(dir) + if err != nil { + return false + } + defer Close(f) + + _, err = f.Readdir(1) + return errors.Is(err, io.EOF) +} + +// IsEmptyFile checks if the given file is empty. +func IsEmptyFile(file string) bool { + s, err := os.Lstat(file) + if err != nil { + return false + } + if !s.Mode().IsRegular() { + return false + } + return s.Size() == 0 +} diff --git a/staging/github.com/seal-io/utils/osx/file_helper_darwin.go b/staging/github.com/seal-io/utils/osx/file_helper_darwin.go new file mode 100644 index 000000000..dc011d1e1 --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/file_helper_darwin.go @@ -0,0 +1,21 @@ +package osx + +import ( + "os" + "syscall" + "time" +) + +func fileTimes(fi os.FileInfo) (aTime, mTime, cTime time.Time) { + s := fi.Sys().(*syscall.Stat_t) + aTime = time.Unix(s.Atimespec.Unix()) + mTime = fi.ModTime() + cTime = time.Unix(s.Ctimespec.Unix()) + + return +} + +func fileOwner(fi os.FileInfo) (uid, gid int) { + s := fi.Sys().(*syscall.Stat_t) + return int(s.Uid), int(s.Gid) +} diff --git a/staging/github.com/seal-io/utils/osx/file_helper_linux.go b/staging/github.com/seal-io/utils/osx/file_helper_linux.go new file mode 100644 index 000000000..a1832ebaf --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/file_helper_linux.go @@ -0,0 +1,21 @@ +package osx + +import ( + "os" + "syscall" + "time" +) + +func fileTimes(fi os.FileInfo) (aTime, mTime, cTime time.Time) { + s := fi.Sys().(*syscall.Stat_t) + aTime = time.Unix(s.Atim.Unix()) + mTime = fi.ModTime() + cTime = time.Unix(s.Ctim.Unix()) + + return +} + +func fileOwner(fi os.FileInfo) (uid, gid int) { + s := fi.Sys().(*syscall.Stat_t) + return int(s.Uid), int(s.Gid) +} diff --git a/staging/github.com/seal-io/utils/osx/file_helper_windows.go b/staging/github.com/seal-io/utils/osx/file_helper_windows.go new file mode 100644 index 000000000..ff45c3a36 --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/file_helper_windows.go @@ -0,0 +1,20 @@ +package osx + +import ( + "os" + "syscall" + "time" +) + +func fileTimes(fi os.FileInfo) (aTime, mTime, cTime time.Time) { + s := fi.Sys().(*syscall.Win32FileAttributeData) + aTime = time.Unix(0, s.LastAccessTime.Nanoseconds()) + mTime = time.Unix(0, s.LastWriteTime.Nanoseconds()) + cTime = time.Unix(0, s.CreationTime.Nanoseconds()) + + return +} + +func fileOwner(fi os.FileInfo) (uid, gid int) { + return +} diff --git a/staging/github.com/seal-io/utils/osx/link.go b/staging/github.com/seal-io/utils/osx/link.go new file mode 100644 index 000000000..62491773a --- /dev/null +++ b/staging/github.com/seal-io/utils/osx/link.go @@ -0,0 +1,160 @@ +package osx + +import ( + "errors" + "fmt" + "os" + "path/filepath" +) + +type LinkOptions func(*linkOptions) + +// LinkEvenIfNotFound links the src, +// and create the src with given perm if not found. +func LinkEvenIfNotFound(isFile bool, perm os.FileMode) LinkOptions { + return func(o *linkOptions) { + o.create = true + o.createFile = isFile + + if perm != 0 { + o.createPerm = &perm + } + } +} + +// LinkInReplace deletes dst if found. +func LinkInReplace() LinkOptions { + return func(o *linkOptions) { + o.replace = true + } +} + +// LinkInReal reads the real path from src. +func LinkInReal() LinkOptions { + return func(o *linkOptions) { + o.real = true + } +} + +// LinkWithTimes preserves the times of src. +func LinkWithTimes() LinkOptions { + return func(o *linkOptions) { + o.preserveTimes = true + } +} + +// LinkWithOwner preserves the owner of src. +func LinkWithOwner() LinkOptions { + return func(o *linkOptions) { + o.preserveOwner = true + } +} + +type linkOptions struct { + create bool + createFile bool + createPerm *os.FileMode + replace bool + real bool + preserveTimes bool + preserveOwner bool +} + +func Link(src, dst string, opts ...LinkOptions) error { + var o linkOptions + + for i := range opts { + if opts[i] == nil { + continue + } + + opts[i](&o) + } + + srcInfo, err := os.Lstat(src) + if err != nil { + if !errors.Is(err, os.ErrNotExist) || !o.create { + return err + } + m := os.FileMode(0o666) + + if o.createPerm != nil { + m = *o.createPerm + } + + if !o.createFile { + if err = os.MkdirAll(src, m); err != nil { + return fmt.Errorf("cannot create src dir: %w", err) + } + } else { + dstDir := filepath.Dir(dst) + if !Exists(dstDir) { + if err = os.MkdirAll(dstDir, 0o666); err != nil { + return fmt.Errorf("cannot create dir of dst: %w", err) + } + } + + if _, err = os.Create(src); err != nil { + return fmt.Errorf("cannot create src file: %w", err) + } + + if err = os.Chmod(src, m); err != nil { + return fmt.Errorf("cannot change src file mod: %w", err) + } + } + srcInfo, _ = os.Stat(src) + } + + if _, err := os.Lstat(dst); err == nil { + if !o.replace { + return errors.New("dst is not empty") + } + + if err = os.Remove(dst); err != nil { + return fmt.Errorf("cannot clean dst: %w", err) + } + } else { + dstDir := filepath.Dir(dst) + if !Exists(dstDir) { + if err = os.MkdirAll(dstDir, 0o666); err != nil { + return fmt.Errorf("cannot create dir of dst: %w", err) + } + } + } + + if o.real { + for { + if srcInfo.Mode()&os.ModeSymlink == 0 { + break + } + + if src, err = os.Readlink(src); err != nil { + return fmt.Errorf("read origin of link src: %w", err) + } + + if srcInfo, err = os.Lstat(src); err != nil { + return fmt.Errorf("stat origin of link src: %w", err) + } + } + } + + if err = os.Symlink(src, dst); err != nil { + return fmt.Errorf("cannot link dst: %w", err) + } + + if o.preserveTimes { + aTime, mTime, _ := fileTimes(srcInfo) + if err = os.Chtimes(dst, aTime, mTime); err != nil { + return fmt.Errorf("cannot preserve times: %w", err) + } + } + + if o.preserveOwner { + uid, gid := fileOwner(srcInfo) + if err = os.Lchown(dst, uid, gid); err != nil { + return fmt.Errorf("cannot preserve owner: %w", err) + } + } + + return nil +} diff --git a/staging/github.com/seal-io/utils/pools/bytespool/pool.go b/staging/github.com/seal-io/utils/pools/bytespool/pool.go new file mode 100644 index 000000000..f3d18237d --- /dev/null +++ b/staging/github.com/seal-io/utils/pools/bytespool/pool.go @@ -0,0 +1,59 @@ +package bytespool + +import ( + "bytes" + "sync" +) + +const defaultSize = 32 * 1024 + +type ( + Bytes = []byte + BytesBuffer = *bytes.Buffer +) + +var gp = sync.Pool{ + New: func() any { + buf := make(Bytes, defaultSize) + return &buf + }, +} + +// GetBytes gets a bytes buffer from the pool, +// which can specify with a size, +// default is 32k. +func GetBytes(size ...uint) Bytes { + buf := *(gp.Get().(*Bytes)) + + s := defaultSize + if len(size) != 0 { + s = int(size[0]) + if s == 0 { + s = defaultSize + } + } + if cap(buf) >= s { + return buf[:s] + } + + gp.Put(&buf) + return make(Bytes, s) +} + +// GetBuffer is similar to GetBytes, +// but it returns the bytes buffer wrapped by bytes.Buffer. +func GetBuffer(size ...uint) BytesBuffer { + return bytes.NewBuffer(GetBytes(size...)[:0]) +} + +// Put puts the buffer(either Bytes or BytesBuffer) back to the pool. +func Put[T Bytes | BytesBuffer](buf T) { + switch v := any(buf).(type) { + case Bytes: + gp.Put(&v) + case BytesBuffer: + bs := v.Bytes() + gp.Put(&bs) + v.Reset() + } +} diff --git a/staging/github.com/seal-io/utils/pools/gopool/metrics.go b/staging/github.com/seal-io/utils/pools/gopool/metrics.go new file mode 100644 index 000000000..edc1b82b8 --- /dev/null +++ b/staging/github.com/seal-io/utils/pools/gopool/metrics.go @@ -0,0 +1,107 @@ +package gopool + +import "github.com/prometheus/client_golang/prometheus" + +// NewStatsCollector returns a new prometheus.Collector for global gorountine pool. +func NewStatsCollector() prometheus.Collector { + fqName := func(name string) string { + return "gopool_" + name + } + + return &statsCollector{ + maxWorkers: prometheus.NewDesc( + fqName("max_workers"), + "The maximum number of pooling goroutines.", + nil, nil, + ), + inUseWorkers: prometheus.NewDesc( + fqName("in_use_workers"), + "The number of pooling goroutines in use.", + nil, nil, + ), + idleWorkers: prometheus.NewDesc( + fqName("idle_workers"), + "The number of idle pooling goroutines.", + nil, nil, + ), + maxTasks: prometheus.NewDesc( + fqName("max_tasks"), + "The maximum number of queuing tasks.", + nil, nil, + ), + submittedTasksTotal: prometheus.NewDesc( + fqName("submitted_tasks_total"), + "The total number of tasks submitted.", + nil, nil, + ), + succeededTasksTotal: prometheus.NewDesc( + fqName("succeeded_tasks_total"), + "The total number of tasks successful completed.", + nil, nil, + ), + failedTasksTotal: prometheus.NewDesc( + fqName("failed_tasks_total"), + "The total number of tasks unsuccessful completed.", + nil, nil, + ), + waitingTasks: prometheus.NewDesc( + fqName("waiting_tasks"), + "The number of tasks waiting for, which has not submitted yet.", + nil, nil, + ), + runningTasks: prometheus.NewDesc( + fqName("running_tasks"), + "The number of tasks running, which has submitted but not completed yet.", + nil, nil, + ), + } +} + +type statsCollector struct { + maxWorkers *prometheus.Desc + inUseWorkers *prometheus.Desc + idleWorkers *prometheus.Desc + + maxTasks *prometheus.Desc + submittedTasksTotal *prometheus.Desc + succeededTasksTotal *prometheus.Desc + failedTasksTotal *prometheus.Desc + waitingTasks *prometheus.Desc + runningTasks *prometheus.Desc +} + +func (c *statsCollector) Describe(ch chan<- *prometheus.Desc) { + ch <- c.maxWorkers + ch <- c.inUseWorkers + ch <- c.idleWorkers + ch <- c.maxTasks + ch <- c.submittedTasksTotal + ch <- c.waitingTasks + ch <- c.succeededTasksTotal + ch <- c.failedTasksTotal +} + +func (c *statsCollector) Collect(ch chan<- prometheus.Metric) { + var ( + maxWorkers = gp.MaxWorkers() + runningWorkers = gp.RunningWorkers() + idleWorkers = gp.IdleWorkers() + inUseWorkers = runningWorkers - idleWorkers + maxTasks = gp.MaxCapacity() + submittedTasks = gp.SubmittedTasks() + succeededTasks = gp.SuccessfulTasks() + failedTasks = gp.FailedTasks() + waitingTasks = gp.WaitingTasks() + runningTasks = submittedTasks - succeededTasks - failedTasks + ) + + ch <- prometheus.MustNewConstMetric(c.maxWorkers, prometheus.GaugeValue, float64(maxWorkers)) + ch <- prometheus.MustNewConstMetric(c.inUseWorkers, prometheus.GaugeValue, float64(inUseWorkers)) + ch <- prometheus.MustNewConstMetric(c.idleWorkers, prometheus.GaugeValue, float64(idleWorkers)) + ch <- prometheus.MustNewConstMetric(c.maxTasks, prometheus.GaugeValue, float64(maxTasks)) + ch <- prometheus.MustNewConstMetric(c.submittedTasksTotal, prometheus.CounterValue, float64(submittedTasks)) + ch <- prometheus.MustNewConstMetric(c.succeededTasksTotal, prometheus.CounterValue, float64(succeededTasks)) + ch <- prometheus.MustNewConstMetric(c.failedTasksTotal, prometheus.CounterValue, float64(failedTasks)) + ch <- prometheus.MustNewConstMetric(c.waitingTasks, prometheus.GaugeValue, float64(waitingTasks)) + ch <- prometheus.MustNewConstMetric(c.runningTasks, prometheus.GaugeValue, float64(runningTasks)) +} diff --git a/staging/github.com/seal-io/utils/pools/gopool/pool.go b/staging/github.com/seal-io/utils/pools/gopool/pool.go new file mode 100644 index 000000000..e2fc4565e --- /dev/null +++ b/staging/github.com/seal-io/utils/pools/gopool/pool.go @@ -0,0 +1,108 @@ +package gopool + +import ( + "errors" + "fmt" + "runtime" + "sync" + + "github.com/alitto/pond" + "k8s.io/klog/v2" +) + +var ( + once sync.Once + gp = NewPool(100) +) + +func NewPool(factor int) *pond.WorkerPool { + // NB(thxCode): Go allows us to create goroutines at will, but if we create too many goroutines, + // it will cause the program to crash due to insufficient memory, + // so we need to limit the number of goroutines with pooling. + // + // The advantage of pooling is that space is exchanged for time and the reuse rate is improved. + // + // - MaxWorkers is the total goroutine number should the pool creates, + // we take the number of available CPU cores as the basic value at present, + // then times the given factor to get the max workers. + // + // - MinWorkers is the goroutine number value should the pool creates at begin, + // we take the MaxWorkers as the result if it is less than 500 at present, + // otherwise, we limit the MinWorkers value to avoid the pool creates too many goroutines at begin. + // + // - MaxCapacity is the max value of submitting goroutine number should be accepted at the same time, + // we take 80% of the MaxWorkers as the result if it is greater than 100 at present. + maxWorkers := runtime.GOMAXPROCS(0) * factor + + minWorkers := maxWorkers + if minWorkers > 500 { + minWorkers = 500 + } + + maxCapacity := maxWorkers * 8 / 10 + if maxCapacity < 100 { + maxCapacity = 100 + } + + return pond.New(maxWorkers, maxCapacity, + pond.MinWorkers(minWorkers), + pond.Strategy(pond.Eager()), + pond.PanicHandler(func(i any) { + klog.Background().WithName("gopool"). + Error(fmt.Errorf("%v", i), "panic observing") + })) +} + +// Configure sets the goroutine pool with a new factor once, +// multiple calls will be ignored. +func Configure(factor int) { + once.Do(func() { + gp.Stop() + gp = NewPool(factor) + }) +} + +// Go submits a task as goroutine. +func Go(f func()) { + if !gp.TrySubmit(f) { + klog.Background().WithName("gopool"). + V(5). + Info("goroutine pool full") + gp.Submit(f) + } +} + +// TryGo tries to submit a task as goroutine. +func TryGo(f func()) bool { + r := gp.TrySubmit(f) + + return r +} + +// IsHealthy returns nil if the pool has plenty workers. +func IsHealthy(atLeast ...int) error { + watermark := 0 + if len(atLeast) > 0 { + watermark = atLeast[0] + } + + if watermark < 0 { + watermark = 0 + } + + if gp.IdleWorkers() > watermark { + return nil + } + + return errors.New("goroutine pool full") +} + +// Burst returns the maximum number of goroutines to submit at the same moment. +func Burst() int { + l, r := gp.IdleWorkers(), gp.MaxCapacity() + if l > r { + return r + } + + return l +} diff --git a/staging/github.com/seal-io/utils/pools/gopool/waitgroup.go b/staging/github.com/seal-io/utils/pools/gopool/waitgroup.go new file mode 100644 index 000000000..1444527ae --- /dev/null +++ b/staging/github.com/seal-io/utils/pools/gopool/waitgroup.go @@ -0,0 +1,156 @@ +package gopool + +import ( + "context" + "fmt" + "sync" + + "github.com/alitto/pond" + "go.uber.org/multierr" + "k8s.io/klog/v2" +) + +type IWaitGroup interface { + Wait() error + Go(func() error) +} + +type IContextWaitGroup interface { + Wait() error + Go(func(context.Context) error) +} + +// Group returns a waiting group, +// which closes at all tasks finishing and aggregates errors from tasks. +func Group() IWaitGroup { + lg := klog.Background().WithName("gopool") + return &waitGroup{lg: lg} +} + +type waitGroup struct { + lg klog.Logger + g sync.WaitGroup + m sync.Mutex + err error +} + +// Wait blocks until all tasks completed and aggregates errors from tasks. +func (g *waitGroup) Wait() error { + g.g.Wait() + return g.err +} + +// Go submits a task as goroutine. +func (g *waitGroup) Go(f func() error) { + if f == nil { + return + } + + wf := func() (err error) { + defer func() { + if v := recover(); v != nil { + switch vt := v.(type) { + case error: + err = fmt.Errorf("panic as %w", vt) + default: + err = fmt.Errorf("panic as %v", v) + } + + g.lg.Error(err, "panic observing") + } + }() + + return f() + } + + g.g.Add(1) + Go(func() { + defer g.g.Done() + + err := wf() + if err != nil { + g.m.Lock() + g.err = multierr.Append(g.err, err) + g.m.Unlock() + } + }) +} + +// GroupWithContext returns a waiting group and a context derived by the given context.Context. +// Waiting group notifies closing when any task raises error, +// any submitting task should use the returning context to receive quiting. +func GroupWithContext(ctx context.Context) (IWaitGroup, context.Context) { + g, c := gp.GroupContext(ctx) + lg := klog.Background().WithName("gopool") + + return contextWaitGroup{lg: lg, g: g}, c +} + +type contextWaitGroup struct { + lg klog.Logger + g *pond.TaskGroupWithContext +} + +// Wait blocks until either all tasks completed or +// one of them returned a non-nil error or the context associated to this group +// was canceled. +func (g contextWaitGroup) Wait() error { + return g.g.Wait() +} + +// Go submits a task as goroutine. +func (g contextWaitGroup) Go(f func() error) { + if f == nil { + return + } + + wf := func() (err error) { + defer func() { + if v := recover(); v != nil { + switch vt := v.(type) { + case error: + err = fmt.Errorf("panic as %w", vt) + default: + err = fmt.Errorf("panic as %v", v) + } + g.lg.Error(err, "panic observing") + } + }() + + return f() + } + + g.g.Submit(wf) +} + +// GroupWithContextIn is similar as GroupWithContext but doesn't return a derived context, +// all tasks can receive the derived context at submitting, a kind of more compact usage. +func GroupWithContextIn(ctx context.Context) IContextWaitGroup { + var g embeddedContextWaitGroup + g.g, g.c = GroupWithContext(ctx) + + return g +} + +type embeddedContextWaitGroup struct { + g IWaitGroup + c context.Context +} + +// Wait blocks until either all tasks completed or +// one of them returned a non-nil error or the context associated to this group +// was canceled. +func (g embeddedContextWaitGroup) Wait() error { + return g.g.Wait() +} + +// Go submits a task as goroutine. +func (g embeddedContextWaitGroup) Go(f func(context.Context) error) { + if f == nil { + return + } + + g.g.Go(func() error { + return f(g.c) + }) +} diff --git a/staging/github.com/seal-io/utils/signalx/handler_posix.go b/staging/github.com/seal-io/utils/signalx/handler_posix.go new file mode 100644 index 000000000..75bb11e9a --- /dev/null +++ b/staging/github.com/seal-io/utils/signalx/handler_posix.go @@ -0,0 +1,145 @@ +//go:build !windows + +package signalx + +import ( + "context" + "errors" + "os" + "os/signal" + "runtime" + "strconv" + "strings" + "syscall" + "time" + + "k8s.io/klog/v2" +) + +var registered = make(chan struct{}) + +// Handler registers for signals and returns a context. +func Handler() context.Context { + close(registered) // Panics when called twice. + + logger := klog.Background().WithName("signal").WithName("handler") + + sigs := []os.Signal{syscall.SIGINT, syscall.SIGTERM} + isRootProc := syscall.Getpid() == 1 + + if isRootProc { // Reap child processes. + sigs = append(sigs, syscall.SIGCHLD) + } + + sigChan := make(chan os.Signal, len(sigs)) + reapChan := make(chan os.Signal) + ctx, cancel := context.WithCancel(context.Background()) + + // Register for signals. + signal.Notify(sigChan, sigs...) + + // Process signals. + go func() { + var exited bool + + for sig := range sigChan { + logger.V(5). + Info("received", "signal", sig) + + if !exited && sig == syscall.SIGCHLD { + select { + case reapChan <- sig: + default: + // Don't block if the channel is full. + } + + continue + } + + if exited { + os.Exit(1) + } + + logger.Info("exiting") + cancel() + exited = true + + close(reapChan) + } + }() + + if !isRootProc { + return ctx + } + + // Reap child processes. + go func() { + for range reapChan { + const zombieTimeWait = 500 * time.Millisecond + + for { + runtime.Gosched() + + // Use waitid to get an exited child process, + // not like waitpid, waitid can leave the child process in waitable state. + var si Siginfo + + err := syscallWaitid(P_ALL, 0, &si, syscall.WEXITED|syscall.WNOWAIT, nil) + for errors.Is(err, syscall.EINTR) { // Try again if got interrupted. + err = syscallWaitid(P_ALL, 0, &si, syscall.WEXITED|syscall.WNOWAIT, nil) + } + + pid := int(si.Pid) + + if pid <= 0 { + if err != nil { + logger.V(5). + Error(err, "reap child process") + } + + break // Cannot catch any child process, go back to poll. + } + + if si.Exited() { + // Since EXIT_ZOMBIE is before than EXIT_DEAD, + // wait a period to avoid accidentally recycling the transitional process. + time.Sleep(zombieTimeWait) + + if !isZombieProcess(pid) { + continue // Go ahead to confirm next child process. + } + + // Wait again if the process is still a zombie process, + // so that the process can be recycled by its parent. + time.Sleep(zombieTimeWait) + } + + // Use wait4(waitpid) to reap the abnormal exited child process. + wpid, err := syscall.Wait4(pid, nil, syscall.WNOHANG, nil) + for errors.Is(err, syscall.EINTR) { // Try again if got interrupted. + wpid, err = syscall.Wait4(pid, nil, syscall.WNOHANG, nil) + } + + if wpid <= 0 { + continue // Cannot recycle the candidate, go ahead to confirm next. + } + + logger.V(5). + Info("reaped child process", "pid", wpid) + } + } + }() + + return ctx +} + +// isZombieProcess returns true if the process is a zombie process, +// which reads the /proc//stat file to check if the process is a zombie process. +func isZombieProcess(pid int) bool { + bs, err := os.ReadFile("/proc/" + strconv.Itoa(pid) + "/stat") + if err != nil { + return false + } + + return bs[strings.IndexRune(string(bs), ')')+2] == 'Z' +} diff --git a/staging/github.com/seal-io/utils/signalx/handler_windows.go b/staging/github.com/seal-io/utils/signalx/handler_windows.go new file mode 100644 index 000000000..e3c317676 --- /dev/null +++ b/staging/github.com/seal-io/utils/signalx/handler_windows.go @@ -0,0 +1,47 @@ +package signalx + +import ( + "context" + "os" + "os/signal" + "syscall" + + "k8s.io/klog/v2" +) + +var registered = make(chan struct{}) + +// Handler registers for signals and returns a context. +func Handler() context.Context { + close(registered) // Panics when called twice. + + logger := klog.Background().WithName("signal").WithName("handler") + + sigs := []os.Signal{syscall.SIGINT} + + sigChan := make(chan os.Signal, len(sigs)) + ctx, cancel := context.WithCancel(context.Background()) + + // Register for signals. + signal.Notify(sigChan, sigs...) + + // Process signals. + go func() { + var exited bool + + for sig := range sigChan { + logger.V(5). + Info("received", "signal", sig) + + if exited { + os.Exit(1) + } + + logger.Info("exiting") + cancel() + exited = true + } + }() + + return ctx +} diff --git a/staging/github.com/seal-io/utils/signalx/syscall_waitid_posix.go b/staging/github.com/seal-io/utils/signalx/syscall_waitid_posix.go new file mode 100644 index 000000000..c393b244a --- /dev/null +++ b/staging/github.com/seal-io/utils/signalx/syscall_waitid_posix.go @@ -0,0 +1,109 @@ +//go:build !windows + +package signalx + +import ( + "syscall" + "unsafe" +) + +// https://man7.org/linux/man-pages/man2/sigaction.2.html + +const ( + P_ALL = 0 + P_PID = 1 + P_PGID = 2 +) + +const ( + cExited = 1 + cKilled = 2 + cDumped = 3 + cTrapped = 4 + cStopped = 5 + cContinued = 6 +) + +type Siginfo struct { + Signo int32 /* Signal number. */ + Errno int32 /* An errno value. */ + Code int32 /* Signal code. */ + Trapno int32 + Pid int32 + Uid int32 + Status int32 /* Exit value or signal. */ + _ [100]byte +} + +func (s Siginfo) Exited() bool { + return s.Code == cExited +} + +func (s Siginfo) ExitStatus() int { + if !s.Exited() { + return -1 + } + + return int(s.Status) +} + +func (s Siginfo) Killed() bool { + return s.Code == cKilled +} + +func (s Siginfo) KillSignal() syscall.Signal { + if !s.Killed() { + return -1 + } + + return syscall.Signal(s.Errno) +} + +func (s Siginfo) Stopped() bool { + return s.Code == cStopped +} + +func (s Siginfo) StopSignal() syscall.Signal { + if !s.Stopped() { + return -1 + } + + return syscall.Signal(s.Errno) +} + +func (s Siginfo) Trapped() bool { + return s.Code == cTrapped +} + +func (s Siginfo) TrapCause() int { + if !s.Trapped() { + return -1 + } + + return int(s.Errno) +} + +func (s Siginfo) Continued() bool { + return s.Code == cContinued +} + +func (s Siginfo) Dumped() bool { + return s.Code == cDumped +} + +func syscallWaitid(idType, id int, info *Siginfo, options int, rusage *syscall.Rusage) error { + _, _, e1 := syscall.Syscall6( + syscall.SYS_WAITID, + uintptr(idType), + uintptr(id), + uintptr(unsafe.Pointer(info)), + uintptr(options), + uintptr(unsafe.Pointer(rusage)), + 0, + ) + if e1 == 0 { + return nil + } + + return e1 +} diff --git a/staging/github.com/seal-io/utils/stringx/base64.go b/staging/github.com/seal-io/utils/stringx/base64.go new file mode 100644 index 000000000..532f84c94 --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/base64.go @@ -0,0 +1,50 @@ +package stringx + +import ( + "encoding/base64" + "strings" +) + +// DecodeBase64 decodes the given string, which can +// accept padded or none padded format. +func DecodeBase64(str string) (string, error) { + // Normalizes to std encoding format. + str = strings.ReplaceAll(str, "-", "+") + str = strings.ReplaceAll(str, "_", "/") + + // Normalizes to no padding format. + str = strings.TrimRight(str, "=") + + bs, err := DecodeBase64Bytes(ToBytes(&str)) + if err != nil { + return "", err + } + + return FromBytes(&bs), nil +} + +// DecodeBase64Bytes decodes the given bytes. +func DecodeBase64Bytes(src []byte) ([]byte, error) { + enc := base64.RawStdEncoding + dst := make([]byte, enc.DecodedLen(len(src))) + n, err := enc.Decode(dst, src) + + return dst[:n], err +} + +// EncodeBase64 encodes the given string, +// and then output standard format. +func EncodeBase64(src string) string { + bs := EncodeBase64Bytes(ToBytes(&src)) + return FromBytes(&bs) +} + +// EncodeBase64Bytes is similar to DecodeBase64, +// but returns bytes. +func EncodeBase64Bytes(src []byte) []byte { + enc := base64.RawURLEncoding + dst := make([]byte, enc.EncodedLen(len(src))) + enc.Encode(dst, src) + + return dst +} diff --git a/staging/github.com/seal-io/utils/stringx/byte.go b/staging/github.com/seal-io/utils/stringx/byte.go new file mode 100644 index 000000000..2c272b1db --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/byte.go @@ -0,0 +1,16 @@ +package stringx + +import ( + "unsafe" +) + +// FromBytes converts a byte slice to a string. +func FromBytes(b *[]byte) string { + return unsafe.String(unsafe.SliceData(*b), len(*b)) +} + +// ToBytes converts a string to a byte slice, +// which is impossible to modify the item of slice. +func ToBytes(s *string) (bs []byte) { + return unsafe.Slice(unsafe.StringData(*s), len(*s)) +} diff --git a/staging/github.com/seal-io/utils/stringx/int.go b/staging/github.com/seal-io/utils/stringx/int.go new file mode 100644 index 000000000..bc3670cf8 --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/int.go @@ -0,0 +1,39 @@ +package stringx + +import ( + "strconv" +) + +// integer is a constraint that permits any integer type. +// If future releases of Go add new predeclared integer types, +// this constraint will be modified to include them. +type integer interface { + signed | unsigned +} + +// signed is a constraint that permits any signed integer type. +// If future releases of Go add new predeclared signed integer types, +// this constraint will be modified to include them. +type signed interface { + ~int | ~int8 | ~int16 | ~int32 | ~int64 +} + +// unsigned is a constraint that permits any unsigned integer type. +// If future releases of Go add new predeclared unsigned integer types, +// this constraint will be modified to include them. +type unsigned interface { + ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr +} + +// FromInt is similar to strconv.Itoa, +// but it accepts any integer type. +func FromInt[T integer](i T) string { + return strconv.FormatInt(int64(i), 10) +} + +// ToInt is similar to strconv.Atoi, +// but it returns any integer type. +func ToInt[T integer](s string) (T, error) { + i, err := strconv.ParseInt(s, 10, 64) + return T(i), err +} diff --git a/staging/github.com/seal-io/utils/stringx/random.go b/staging/github.com/seal-io/utils/stringx/random.go new file mode 100644 index 000000000..dd4137b49 --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/random.go @@ -0,0 +1,60 @@ +package stringx + +// Borrowed from github.com/thanhpk/randstr. + +import ( + "bytes" + "crypto/rand" + "encoding/binary" + "encoding/hex" +) + +// list of default letters that can be used to make a random string when calling String +// function with no letters provided. +var defLetters = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +// Bytes generates n random bytes. +func Bytes(n int) []byte { + b := make([]byte, n) + + _, err := rand.Read(b) + if err != nil { + panic(err) + } + + return b +} + +// Base64 generates a random base64 string with length of n. +func Base64(n int) string { + return String(n, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/") +} + +// Hex generates a random hex string with length of n +// e.g: 67aab2d956bd7cc621af22cfb169cba8. +func Hex(n int) string { return hex.EncodeToString(Bytes(n)) } + +// String generates a random string using only letters provided in the letters parameter +// if user omit letters parameters, this function will use defLetters instead. +func String(n int, letters ...string) string { + var ( + letterRunes []rune + bb bytes.Buffer + ) + + if len(letters) == 0 { + letterRunes = defLetters + } else { + letterRunes = []rune(letters[0]) + } + + bb.Grow(n) + + l := uint32(len(letterRunes)) + // On each loop, generate one random rune and append to output. + for i := 0; i < n; i++ { + bb.WriteRune(letterRunes[binary.BigEndian.Uint32(Bytes(4))%l]) + } + + return bb.String() +} diff --git a/staging/github.com/seal-io/utils/stringx/ruleset.go b/staging/github.com/seal-io/utils/stringx/ruleset.go new file mode 100644 index 000000000..a116eec4d --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/ruleset.go @@ -0,0 +1,165 @@ +package stringx + +import ( + "fmt" + "strings" + "unicode" + + "github.com/akerl/go-indefinite-article/indefinite" + "github.com/go-openapi/inflect" + "golang.org/x/text/cases" + "golang.org/x/text/language" + "k8s.io/apimachinery/pkg/util/sets" +) + +var ( + globalRuleset = inflect.NewDefaultRuleset() + acronymSet = sets.Set[string]{} +) + +func init() { + for _, w := range []string{ + "ACL", "API", "ACME", "ASCII", "AWS", "GPU", "CPU", "CSS", "DNS", "EOF", "GB", "GUID", + "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "KB", "LHS", "MAC", "MB", + "QPS", "RAM", "RHS", "RPC", "SLA", "SMTP", "SQL", "SSH", "SSO", "TCP", + "TLS", "TTL", "UDP", "UI", "UID", "URI", "URL", "UTF8", "UUID", "VM", "PV", + "XML", "XMPP", "XSRF", "XSS", + } { + globalRuleset.AddAcronym(w) + acronymSet.Insert(w) + } + + for s, p := range map[string]string{ + "exec": "exec", + } { + globalRuleset.AddIrregular(s, p) + } +} + +// Acronyms returns the list of acronyms. +func Acronyms() []string { + return acronymSet.UnsortedList() +} + +// Pluralize returns the plural form of a word. +func Pluralize(word string) string { + return globalRuleset.Pluralize(word) +} + +// Singularize returns the singular form of a word. +func Singularize(word string) string { + return globalRuleset.Singularize(word) +} + +// Article returns the word with article. +func Article(word string) string { + if Singularize(word) != word { + // Pluralized word. + return word + } + + return indefinite.AddArticle(word) +} + +// Camelize returns the string in camel case, "group_id" -> "GroupID". +func Camelize(word string) string { + words := strings.Split(globalRuleset.Underscore(word), "_") + + for i, w := range words { + upper := strings.ToUpper(w) + if acronymSet.Has(upper) { + words[i] = upper + } else { + words[i] = globalRuleset.Capitalize(w) + } + } + + return Join("", words...) +} + +// CamelizeDownFirst is the same as Camelize but with first lowercase char, +// "IDRef" -> "idRef. +func CamelizeDownFirst(word string) string { + words := strings.Split(globalRuleset.Underscore(word), "_") + + switch len(words) { + case 0: + return "" + case 1: + return words[0] + } + + for i, w := range words[1:] { + upper := strings.ToUpper(w) + if acronymSet.Has(upper) { + words[1:][i] = upper + } else { + words[1:][i] = globalRuleset.Capitalize(w) + } + } + + return Join("", words...) +} + +// Decamelize converts camel-case words to space-split words, "DinoParty" -> "Dino Party". +// If lowercase is true, convert the first letter of each word to lowercase, "DinoParty" -> "dino party". +func Decamelize(s string, lowercase bool) string { + var ( + b strings.Builder + splittable = false + ) + + for _, v := range s { + if splittable && unicode.IsUpper(v) { + b.WriteByte(' ') + } + + if lowercase { + b.WriteString(strings.ToLower(string(v))) + } else { + b.WriteRune(v) + } + + splittable = unicode.IsLower(v) || unicode.IsNumber(v) + } + + return b.String() +} + +// Underscore returns the string in snake case, "BigBen" -> "big_ben". +func Underscore(word string) string { + return globalRuleset.Underscore(word) +} + +// UnderscoreUpper is the same as Underscore but with all uppercase char. +func UnderscoreUpper(word string) string { + return strings.ToUpper(Underscore(word)) +} + +// Dasherize returns the string in dasherized case, "SomeText" -> "some-text". +func Dasherize(word string) string { + return globalRuleset.Dasherize(word) +} + +// Capitalize returns the string with first uppercase letter. +func Capitalize(word string) string { + return globalRuleset.Capitalize(word) +} + +// Ordinalize returns the ordination case, "1031" -> "1031st". +func Ordinalize(word string) string { + return globalRuleset.Ordinalize(word) +} + +// Title return the title case, "some-text" -> "Some Text". +func Title(word string) string { + w := strings.ReplaceAll(word, "-", " ") + w = strings.ReplaceAll(w, "_", " ") + + return cases.Title(language.English).String(w) +} + +// Question return the question case, "some-text" -> "Some Text: ". +func Question(word string) string { + return fmt.Sprintf("%s: ", Title(word)) +} diff --git a/staging/github.com/seal-io/utils/stringx/rune.go b/staging/github.com/seal-io/utils/stringx/rune.go new file mode 100644 index 000000000..56c6717c0 --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/rune.go @@ -0,0 +1,54 @@ +package stringx + +import "github.com/mattn/go-runewidth" + +func init() { + runewidth.DefaultCondition.EastAsianWidth = true + runewidth.DefaultCondition.CreateLUT() +} + +// RuneWidth returns the number of cells in r. +// See http://www.unicode.org/reports/tr11/ +func RuneWidth(r rune) int { + return runewidth.RuneWidth(r) +} + +// IsAmbiguousWidth returns whether is ambiguous width or not. +func IsAmbiguousWidth(r rune) bool { + return runewidth.IsAmbiguousWidth(r) +} + +// IsNeutralWidth returns whether is neutral width or not. +func IsNeutralWidth(r rune) bool { + return runewidth.IsNeutralWidth(r) +} + +// StringWidth return width as you can see. +func StringWidth(s string) int { + return runewidth.StringWidth(s) +} + +// Truncate return string truncated with w cells. +func Truncate(s string, w int, tail string) string { + return runewidth.Truncate(s, w, tail) +} + +// TruncateLeft cuts w cells from the beginning of the `s`. +func TruncateLeft(s string, w int, prefix string) string { + return runewidth.TruncateLeft(s, w, prefix) +} + +// Wrap return string wrapped with w cells. +func Wrap(s string, w int) string { + return runewidth.Wrap(s, w) +} + +// FillLeft return string filled in left by spaces in w cells. +func FillLeft(s string, w int) string { + return runewidth.FillLeft(s, w) +} + +// FillRight return string filled in left by spaces in w cells. +func FillRight(s string, w int) string { + return runewidth.FillRight(s, w) +} diff --git a/staging/github.com/seal-io/utils/stringx/string.go b/staging/github.com/seal-io/utils/stringx/string.go new file mode 100644 index 000000000..d8e3bf906 --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/string.go @@ -0,0 +1,104 @@ +package stringx + +import ( + "bytes" + "fmt" + "strings" +) + +func Join[T ~string](sep string, strs ...T) string { + switch len(strs) { + case 0: + return "" + case 1: + return string(strs[0]) + } + + n := len(sep) * (len(strs) - 1) + for i := 0; i < len(strs); i++ { + n += len(strs[i]) + } + + var b strings.Builder + + b.Grow(n) + b.WriteString(string(strs[0])) + + for i := range strs[1:] { + b.WriteString(sep) + b.WriteString(string(strs[i+1])) + } + + return b.String() +} + +func Strings[T fmt.Stringer](v []T) []string { + if len(v) == 0 { + return nil + } + + s := make([]string, len(v)) + for i := range v { + s[i] = v[i].String() + } + + return s +} + +// NormalizeSpecialChars replaces special characters with their normalized equivalents. +// This is useful to avoid encoding issues in PostgresSQL(Invalid byte sequence for encoding "UTF8"). +// Each byte in the input slice is examined: +// - If the byte is not a special character, it is simply copied to the output slice. +// - If the byte is a non-breaking space (0xA0), it is replaced with a space (0x20), +// but only if the last character is non-ASCII character (0xC2) +// - If the byte is a null character (0x00), it is replaced with the string "NUL" (0x4E 0x55 0x4C). +// +// The resulting byte slice is converted back to a string and returned. +func NormalizeSpecialChars(s string) string { + var ( + buf bytes.Buffer + lastChar byte + + sbs = []byte(s) + ) + + for i := 0; i < len(sbs); i++ { + switch sbs[i] { + default: + buf.WriteByte(sbs[i]) + lastChar = sbs[i] + case 0xA0: + if lastChar == 0xC2 { + buf.WriteByte(0x20) + } else { + buf.WriteByte(sbs[i]) + } + + lastChar = 0x20 + case 0x00: + buf.Write([]byte{0x4e, 0x55, 0x4c}) + + lastChar = 0x4c + } + } + + return buf.String() +} + +// LastContent retrieves the last characters of a string. +func LastContent(content string, length int) string { + if len(content) < length { + return content + } + + return content[len(content)-length:] +} + +// FirstContent retrieves the leading characters of a string. +func FirstContent(content string, length int) string { + if len(content) < length { + return content + } + + return content[:length] +} diff --git a/staging/github.com/seal-io/utils/stringx/sum.go b/staging/github.com/seal-io/utils/stringx/sum.go new file mode 100644 index 000000000..23fcc0afa --- /dev/null +++ b/staging/github.com/seal-io/utils/stringx/sum.go @@ -0,0 +1,79 @@ +package stringx + +import ( + "crypto/sha256" + "encoding/hex" + "hash/fnv" +) + +func SumByFNV64a(s string, ss ...string) string { + h := fnv.New64a() + + _, _ = h.Write(ToBytes(&s)) + for i := range ss { + _, _ = h.Write(ToBytes(&ss[i])) + } + + sum := h.Sum(nil) + return hex.EncodeToString(sum) +} + +func SumBytesByFNV64a(bs []byte, bss ...[]byte) string { + h := fnv.New64a() + + _, _ = h.Write(bs) + for i := range bss { + _, _ = h.Write(bss[i]) + } + + sum := h.Sum(nil) + return hex.EncodeToString(sum) +} + +func SumBySHA256(s string, ss ...string) string { + h := sha256.New() + + _, _ = h.Write(ToBytes(&s)) + for i := range ss { + _, _ = h.Write(ToBytes(&ss[i])) + } + + sum := h.Sum(nil) + return hex.EncodeToString(sum) +} + +func SumBytesBySHA256(bs []byte, bss ...[]byte) string { + h := sha256.New() + + _, _ = h.Write(bs) + for i := range bss { + _, _ = h.Write(bss[i]) + } + + sum := h.Sum(nil) + return hex.EncodeToString(sum) +} + +func SumBySHA224(s string, ss ...string) string { + h := sha256.New224() + + _, _ = h.Write(ToBytes(&s)) + for i := range ss { + _, _ = h.Write(ToBytes(&ss[i])) + } + + sum := h.Sum(nil) + return hex.EncodeToString(sum) +} + +func SumBytesBySHA224(bs []byte, bss ...[]byte) string { + h := sha256.New224() + + _, _ = h.Write(bs) + for i := range bss { + _, _ = h.Write(bss[i]) + } + + sum := h.Sum(nil) + return hex.EncodeToString(sum) +} diff --git a/staging/github.com/seal-io/utils/varx/var.go b/staging/github.com/seal-io/utils/varx/var.go new file mode 100644 index 000000000..37e308370 --- /dev/null +++ b/staging/github.com/seal-io/utils/varx/var.go @@ -0,0 +1,94 @@ +package varx + +import ( + "sync" +) + +// Once holds the value of the variable and ensures that the value is configured only once. +type Once[T any] struct { + o sync.Once + + v T +} + +// NewOnce returns the Once with the given value. +func NewOnce[T any](value T) *Once[T] { + return &Once[T]{ + v: value, + } +} + +// Configure sets the value, multiple calls will be ignored. +func (i *Once[T]) Configure(value T) { + i.o.Do(func() { + i.v = value + }) +} + +// Get returns the configured value, +// or returns initialized value with NewOnce if the variable is not configured yet. +func (i *Once[T]) Get() T { + return i.v +} + +// Notify holds the value of variable and ensures that the value is configured before get. +type Notify[T any] interface { + // Configure sets the value. + Configure(value T) + // IsConfigured returns true if the value is configured. + IsConfigured() bool + // Get blocks until the value is configured at the first time, + // and returns the configured result. + Get() T +} + +type notify[T any] struct { + m *sync.RWMutex + c *sync.Cond + s bool + + v T +} + +// NewNotify creates a new Notify. +func NewNotify[T any]() Notify[T] { + var m sync.RWMutex + + return ¬ify[T]{ + m: &m, + c: sync.NewCond(&m), + } +} + +func (i *notify[T]) Configure(value T) { + i.m.Lock() + i.v = value + i.s = true + i.m.Unlock() + + i.c.Broadcast() +} + +func (i *notify[T]) IsConfigured() bool { + i.m.RLock() + defer i.m.RUnlock() + + return i.s +} + +func (i *notify[T]) Get() T { + i.m.RLock() + if i.s { + i.m.RUnlock() + return i.v + } + i.m.RUnlock() + + i.m.Lock() + defer i.m.Unlock() + for !i.s { + i.c.Wait() + } + + return i.v +} diff --git a/staging/github.com/seal-io/utils/version/version.go b/staging/github.com/seal-io/utils/version/version.go new file mode 100644 index 000000000..b810ac9c0 --- /dev/null +++ b/staging/github.com/seal-io/utils/version/version.go @@ -0,0 +1,75 @@ +package version + +import ( + "fmt" + "runtime" + "strconv" + "strings" + + "golang.org/x/mod/semver" +) + +var ( + Version = "dev" + GitCommit = "HEAD" +) + +func Get() string { + return fmt.Sprintf("%s (%s)", Version, GitCommit) +} + +func GetUserAgent() string { + return GetUserAgentWith("walrus") +} + +func GetUserAgentWith(name string) string { + return "seal.io/" + name + "; version=" + Get() + "; os=" + runtime.GOOS + "; arch=" + runtime.GOARCH +} + +func Major() string { + vX := semver.Major(Version) + if vX == "" { + return Version + } + + return vX +} + +func MajorMinor() string { + vXy := semver.MajorMinor(Version) + if vXy == "" { + return Version + } + + return vXy +} + +func Previous() string { + vXy := MajorMinor() + if vXy == Version { + return Version + } + + v := strings.Split(vXy, ".") + if v[1] != "0" { + y, _ := strconv.ParseInt(v[1], 10, 64) + y-- + + if y >= 0 { + return v[0] + "." + strconv.FormatInt(y, 10) + } + } + + x, _ := strconv.ParseInt(v[0][1:], 10, 64) + x-- + + if x < 0 { + return Version + } + + return "v" + strconv.FormatInt(x, 10) +} + +func IsValid() bool { + return semver.IsValid(Version) +} diff --git a/staging/github.com/seal-io/utils/waitx/poll.go b/staging/github.com/seal-io/utils/waitx/poll.go new file mode 100644 index 000000000..2e89e80b9 --- /dev/null +++ b/staging/github.com/seal-io/utils/waitx/poll.go @@ -0,0 +1,57 @@ +package waitx + +import ( + "context" + "errors" + "time" + + "k8s.io/apimachinery/pkg/util/wait" +) + +type ConditionWithContextFunc = func(context.Context) error + +// PollUntilContextCancel is similar to wait.PollUntilContextCancel, +// but it stops until no error returned from ConditionWithContextFunc, +// or the given context is canceled. +// +// When cancellation happens, +// PollUntilContextCancel returns the last error returned from ConditionWithContextFunc. +func PollUntilContextCancel(ctx context.Context, interval time.Duration, immediate bool, condition ConditionWithContextFunc) error { + var lastErr error + + return wait.PollUntilContextCancel(ctx, interval, immediate, func(ctx context.Context) (bool, error) { + err := condition(ctx) + + switch cerr := ctx.Err(); { + case cerr != nil && err != nil: + // Cancel, return the real cause. + if errors.Is(err, cerr) && lastErr != nil { + return false, lastErr + } + return false, err + case cerr != nil: + // Since we use a background context to check the connection, + // we should return the cancellation error here to make the external behavior consistent. + return false, cerr + case err != nil: + // Record the last error. + lastErr = err + return false, nil // nolint:nilerr + } + + // No error, stop polling. + return true, nil + }) +} + +// PollUntilContextTimeout is similar to wait.PollUntilContextTimeout, +// but it stops until no error returned from ConditionWithContextFunc, +// or the given context is canceled or timeout. +// +// When cancellation happens, +// PollUntilContextTimeout returns the last error returned from ConditionWithContextFunc. +func PollUntilContextTimeout(ctx context.Context, interval, timeout time.Duration, immediate bool, condition ConditionWithContextFunc) error { + deadlineCtx, deadlineCancel := context.WithTimeout(ctx, timeout) + defer deadlineCancel() + return PollUntilContextCancel(deadlineCtx, interval, immediate, condition) +} diff --git a/staging/github.com/seal-io/walrus b/staging/github.com/seal-io/walrus new file mode 120000 index 000000000..ad9985dd7 --- /dev/null +++ b/staging/github.com/seal-io/walrus @@ -0,0 +1 @@ +./../../../ \ No newline at end of file