├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── defect.yml │ └── proposal.yml ├── dependabot.yml └── workflows │ ├── deps-release-detect.yaml │ ├── deps-release-tag.yaml │ ├── e2e.yaml │ ├── release.yaml │ └── test.yaml ├── .gitignore ├── .goreleaser.yml ├── LICENSE ├── Makefile ├── README.md ├── cicd ├── Dockerfile ├── Dockerfile_goreleaser ├── assets │ └── entrypoint.sh └── tag-deps-version.txt ├── cmd ├── jetstream-controller │ └── main.go ├── nats-boot-config │ └── main.go └── nats-server-config-reloader │ └── main.go ├── controllers └── jetstream │ ├── conn_pool.go │ ├── conn_pool_test.go │ ├── consumer.go │ ├── consumer_test.go │ ├── controller.go │ ├── controller_test.go │ ├── jsmclient.go │ ├── jsmclient_test.go │ ├── stream.go │ └── stream_test.go ├── dependencies.md ├── deploy ├── crds.yml ├── examples │ ├── consumer_pull.yml │ ├── consumer_push.yml │ ├── stream.yml │ ├── stream_mirror.yml │ ├── stream_placement.yml │ ├── stream_servers.yml │ └── stream_sources.yml └── rbac.yml ├── docker-bake.hcl ├── docs └── api.md ├── examples └── secure │ ├── client-tls.yaml │ ├── issuer.yaml │ ├── nack-a-client-tls.yaml │ ├── nack-b-client-tls.yaml │ ├── nack │ ├── account-foo.yaml │ ├── nats-account-a.yaml │ ├── nats-consumer-bar-a.yaml │ ├── nats-stream-foo-a.yaml │ └── stream-foo.yaml │ ├── nats-helm.yaml │ └── server-tls.yaml ├── go.mod ├── go.sum ├── internal └── controller │ ├── account_controller.go │ ├── account_controller_test.go │ ├── client.go │ ├── connection_pool.go │ ├── connection_pool_test.go │ ├── consumer_controller.go │ ├── consumer_controller_test.go │ ├── helpers_test.go │ ├── jetstream_controller.go │ ├── jetstream_controller_test.go │ ├── keyvalue_controller.go │ ├── keyvalue_controller_test.go │ ├── objectstore_controller.go │ ├── objectstore_controller_test.go │ ├── register.go │ ├── stream_controller.go │ ├── stream_controller_test.go │ ├── suite_test.go │ └── types.go ├── kuttl-test.yaml ├── pkg ├── bootconfig │ └── bootconfig.go ├── jetstream │ ├── apis │ │ └── jetstream │ │ │ ├── register.go │ │ │ ├── v1beta1 │ │ │ ├── consumertypes.go │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── streamtemplatetypes.go │ │ │ ├── streamtypes.go │ │ │ ├── types.go │ │ │ └── zz_generated.deepcopy.go │ │ │ └── v1beta2 │ │ │ ├── accounttypes.go │ │ │ ├── consumertypes.go │ │ │ ├── doc.go │ │ │ ├── keyvaluetypes.go │ │ │ ├── objectstoretypes.go │ │ │ ├── register.go │ │ │ ├── streamtypes.go │ │ │ ├── types.go │ │ │ └── zz_generated.deepcopy.go │ └── generated │ │ ├── applyconfiguration │ │ ├── internal │ │ │ └── internal.go │ │ ├── jetstream │ │ │ └── v1beta2 │ │ │ │ ├── account.go │ │ │ │ ├── accountspec.go │ │ │ │ ├── basestreamconfig.go │ │ │ │ ├── condition.go │ │ │ │ ├── connectionopts.go │ │ │ │ ├── consumer.go │ │ │ │ ├── consumerlimits.go │ │ │ │ ├── consumerspec.go │ │ │ │ ├── credssecret.go │ │ │ │ ├── keyvalue.go │ │ │ │ ├── keyvaluespec.go │ │ │ │ ├── objectstore.go │ │ │ │ ├── objectstorespec.go │ │ │ │ ├── republish.go │ │ │ │ ├── secretref.go │ │ │ │ ├── status.go │ │ │ │ ├── stream.go │ │ │ │ ├── streamplacement.go │ │ │ │ ├── streamsource.go │ │ │ │ ├── streamspec.go │ │ │ │ ├── subjecttransform.go │ │ │ │ ├── tls.go │ │ │ │ ├── tlssecret.go │ │ │ │ ├── tokensecret.go │ │ │ │ └── user.go │ │ └── utils.go │ │ ├── clientset │ │ └── versioned │ │ │ ├── clientset.go │ │ │ ├── fake │ │ │ ├── clientset_generated.go │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ ├── scheme │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ └── typed │ │ │ └── jetstream │ │ │ └── v1beta2 │ │ │ ├── account.go │ │ │ ├── consumer.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_account.go │ │ │ ├── fake_consumer.go │ │ │ ├── fake_jetstream_client.go │ │ │ ├── fake_keyvalue.go │ │ │ ├── fake_objectstore.go │ │ │ └── fake_stream.go │ │ │ ├── generated_expansion.go │ │ │ ├── jetstream_client.go │ │ │ ├── keyvalue.go │ │ │ ├── objectstore.go │ │ │ └── stream.go │ │ ├── informers │ │ └── externalversions │ │ │ ├── factory.go │ │ │ ├── generic.go │ │ │ ├── internalinterfaces │ │ │ └── factory_interfaces.go │ │ │ └── jetstream │ │ │ ├── interface.go │ │ │ └── v1beta2 │ │ │ ├── account.go │ │ │ ├── consumer.go │ │ │ ├── interface.go │ │ │ ├── keyvalue.go │ │ │ ├── objectstore.go │ │ │ └── stream.go │ │ └── listers │ │ └── jetstream │ │ └── v1beta2 │ │ ├── account.go │ │ ├── consumer.go │ │ ├── expansion_generated.go │ │ ├── keyvalue.go │ │ ├── objectstore.go │ │ └── stream.go ├── k8scodegen │ ├── file-header.txt │ └── k8scodegen.go └── natsreloader │ ├── natsreloader.go │ └── natsreloader_test.go └── tests ├── nack.yaml ├── nats.yaml └── stream-creation ├── 00-nack.yaml ├── 01-stream.yaml ├── 02-natscli-stream.yaml ├── asserted-natscli.yaml ├── asserted-rides-stream.yaml ├── natscli.yaml └── rides-stream.yaml /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Discussion 4 | url: https://github.com/nats-io/nack/discussions 5 | about: Ideal for ideas, feedback, or longer form questions. 6 | - name: Chat 7 | url: https://slack.nats.io 8 | about: Ideal for short, one-off questions, general conversation, and meeting other NATS users! 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/defect.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Defect 3 | description: Report a defect, such as a bug or regression. 4 | labels: 5 | - defect 6 | body: 7 | - type: textarea 8 | id: versions 9 | attributes: 10 | label: What version were you using? 11 | description: Include the server version (`nats-server --version`) and any client versions when observing the issue. 12 | validations: 13 | required: true 14 | - type: textarea 15 | id: environment 16 | attributes: 17 | label: What environment was the server running in? 18 | description: This pertains to the operating system, CPU architecture, and/or Docker image that was used. 19 | validations: 20 | required: true 21 | - type: textarea 22 | id: steps 23 | attributes: 24 | label: Is this defect reproducible? 25 | description: Provide best-effort steps to showcase the defect. 26 | validations: 27 | required: true 28 | - type: textarea 29 | id: expected 30 | attributes: 31 | label: Given the capability you are leveraging, describe your expectation? 32 | description: This may be the expected behavior or performance characteristics. 33 | validations: 34 | required: true 35 | - type: textarea 36 | id: actual 37 | attributes: 38 | label: Given the expectation, what is the defect you are observing? 39 | description: This may be an unexpected behavior or regression in performance. 40 | validations: 41 | required: true 42 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/proposal.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Proposal 3 | description: Propose an enhancement or new feature. 4 | labels: 5 | - proposal 6 | body: 7 | - type: textarea 8 | id: usecase 9 | attributes: 10 | label: What motivated this proposal? 11 | description: Describe the use case justifying this request. 12 | validations: 13 | required: true 14 | - type: textarea 15 | id: change 16 | attributes: 17 | label: What is the proposed change? 18 | description: This could be a behavior change, enhanced API, or a branch new feature. 19 | validations: 20 | required: true 21 | - type: textarea 22 | id: benefits 23 | attributes: 24 | label: Who benefits from this change? 25 | description: Describe how this not only benefits you. 26 | validations: 27 | required: false 28 | - type: textarea 29 | id: alternates 30 | attributes: 31 | label: What alternatives have you evaluated? 32 | description: This could be using existing features or relying on an external dependency. 33 | validations: 34 | required: false 35 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # version updates: enabled 4 | # security updates: enabled 5 | - package-ecosystem: "github-actions" 6 | directory: "/" 7 | schedule: 8 | interval: "weekly" 9 | - package-ecosystem: docker 10 | directory: /cicd 11 | schedule: 12 | interval: daily 13 | 14 | # version updates: disabled 15 | # security updates: enabled 16 | # https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#overriding-the-default-behavior-with-a-configuration-file 17 | - package-ecosystem: "gomod" 18 | directory: "/" 19 | schedule: 20 | interval: "daily" 21 | open-pull-requests-limit: 0 22 | -------------------------------------------------------------------------------- /.github/workflows/deps-release-detect.yaml: -------------------------------------------------------------------------------- 1 | name: Deps Release 2 | 3 | on: 'pull_request' 4 | 5 | permissions: 6 | contents: write 7 | 8 | jobs: 9 | detect: 10 | name: Detect 11 | runs-on: ubuntu-latest 12 | if: ${{ github.actor == 'dependabot[bot]' }} 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Configure Git 20 | run: | 21 | git config user.name "$GITHUB_ACTOR" 22 | git config user.email "$GITHUB_ACTOR@users.noreply.github.com" 23 | git checkout -b "$GITHUB_HEAD_REF" 24 | 25 | - name: Dependabot metadata 26 | id: dependabot-metadata 27 | uses: dependabot/fetch-metadata@v2 28 | 29 | - name: Install node 30 | uses: actions/setup-node@v4 31 | with: 32 | node-version: 18 33 | 34 | - name: Install semver 35 | run: |- 36 | npm install -g semver 37 | 38 | - name: Bump 39 | run: |- 40 | set -e 41 | push=0 42 | config='[ 43 | { 44 | "directory": "cicd", 45 | "dependencyName": "alpine" 46 | } 47 | ]' 48 | deps_file="./cicd/tag-deps-version.txt" 49 | 50 | deps='${{ steps.dependabot-metadata.outputs.updated-dependencies-json }}' 51 | 52 | for i in $(seq 0 "$(("$(echo "$config" | jq length) - 1"))"); do 53 | directory="$(echo "$config" | jq -r ".[$i].directory")" 54 | dependencyName="$(echo "$config" | jq -r ".[$i].dependencyName")" 55 | match="$(echo "$deps" | jq ".[] | select(.directory == \"/$directory\" and .dependencyName == \"$dependencyName\")")" 56 | if [ -z "$match" ]; then 57 | continue 58 | fi 59 | 60 | updateType="$(echo "$match" | jq -r ".updateType")" 61 | prevVersion="$(echo "$match" | jq -r ".prevVersion")" 62 | newVersion="$(echo "$match" | jq -r ".newVersion")" 63 | 64 | echo "directory : $directory" 65 | echo "dependencyName : $dependencyName" 66 | echo "updateType : $updateType" 67 | echo "prevVersion : $prevVersion" 68 | echo "newVersion : $newVersion" 69 | 70 | tagPrevVersion="$(git ls-remote 2>/dev/null \ 71 | | grep -oE 'refs/tags/v[0-9]+\.[0-9]+\.[0-9]+' \ 72 | | cut -d'/' -f3 \ 73 | | xargs semver \ 74 | | tail -n 1)" 75 | 76 | tagNewVersion="$(semver -i patch "$tagPrevVersion")" 77 | 78 | echo "$tagPrevVersion" > "$deps_file" 79 | echo "$tagNewVersion" >> "$deps_file" 80 | 81 | git add "$deps_file" 82 | if git commit -m "bump dependency release to $tagNewVersion"; then 83 | push=1 84 | fi 85 | done 86 | 87 | if [ "$push" = "1" ]; then 88 | git push -u origin "$GITHUB_HEAD_REF" 89 | fi 90 | -------------------------------------------------------------------------------- /.github/workflows/deps-release-tag.yaml: -------------------------------------------------------------------------------- 1 | name: Deps Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | actions: write 10 | contents: write 11 | 12 | jobs: 13 | tag: 14 | name: Tag 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Configure Git 23 | run: | 24 | git config user.name "$GITHUB_ACTOR" 25 | git config user.email "$GITHUB_ACTOR@users.noreply.github.com" 26 | 27 | - id: tag 28 | name: Determine tag 29 | run: | 30 | deps_file="./cicd/tag-deps-version.txt" 31 | old_version="$(head -n 1 "$deps_file")" 32 | old_ref_name="v$old_version" 33 | new_version="$(tail -n 1 "$deps_file")" 34 | new_ref_name="v$new_version" 35 | 36 | create=true 37 | if [ "$(git ls-remote origin "refs/tags/$new_ref_name" | wc -l)" = "1" ]; then 38 | create=false 39 | fi 40 | 41 | echo "old-version=$old_version" | tee -a "$GITHUB_OUTPUT" 42 | echo "old-ref-name=$old_ref_name" | tee -a "$GITHUB_OUTPUT" 43 | echo "new-version=$new_version" | tee -a "$GITHUB_OUTPUT" 44 | echo "new-ref-name=$new_ref_name" | tee -a "$GITHUB_OUTPUT" 45 | echo "create=$create" | tee -a "$GITHUB_OUTPUT" 46 | 47 | - if: ${{ fromJSON(steps.tag.outputs.create) }} 48 | name: Tag 49 | run: | 50 | commit="$(git rev-parse HEAD)" 51 | git fetch origin refs/tags/"${{ steps.tag.outputs.old-ref-name }}" 52 | git checkout -b deps "${{ steps.tag.outputs.old-ref-name }}" 53 | git restore --source="$commit" ./cicd ./.github/workflows/release.yaml 54 | git add ./cicd ./.github/workflows/release.yaml 55 | if git commit -m "bump dependency release to ${{ steps.tag.outputs.new-version }}"; then 56 | git tag "${{ steps.tag.outputs.new-ref-name }}" 57 | git push origin "${{ steps.tag.outputs.new-ref-name }}" 58 | fi 59 | 60 | - if: ${{ fromJSON(steps.tag.outputs.create) }} 61 | name: Trigger Release 62 | run: gh workflow run release.yaml --ref "${{ steps.tag.outputs.new-ref-name }}" 63 | env: 64 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | -------------------------------------------------------------------------------- /.github/workflows/e2e.yaml: -------------------------------------------------------------------------------- 1 | name: e2e 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | e2e: 11 | name: e2e 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: checkout 15 | uses: actions/checkout@v4 16 | 17 | - name: install kuttl 18 | run: | 19 | curl -L https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64 -o /usr/local/bin/kubectl-kuttl 20 | chmod +x /usr/local/bin/kubectl-kuttl 21 | 22 | - name: create kind cluster 23 | uses: helm/kind-action@v1.12.0 24 | 25 | - name: set up helm 26 | uses: azure/setup-helm@v4 27 | 28 | - name: run e2e test 29 | run: kubectl kuttl test 30 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | workflow_dispatch: 4 | push: 5 | tags: 6 | - v[0-9]+.[0-9]+.[0-9]+ 7 | jobs: 8 | release: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout Source 12 | uses: actions/checkout@v4 13 | with: 14 | fetch-depth: 0 15 | 16 | - name: Setup Go 17 | uses: actions/setup-go@v5 18 | with: 19 | go-version-file: go.mod 20 | 21 | - name: Setup QEMU 22 | uses: docker/setup-qemu-action@v3 23 | 24 | - name: Setup Docker Buildx 25 | id: buildx 26 | uses: docker/setup-buildx-action@v3 27 | 28 | - name: Setup Docker Hub 29 | uses: docker/login-action@v3 30 | with: 31 | username: ${{ secrets.DOCKERHUB_USERNAME }} 32 | password: ${{ secrets.DOCKERHUB_CLI_TOKEN }} 33 | 34 | - name: Get Image Tags 35 | id: tags 36 | run: | 37 | version=$(sed 's/^v//' <<< ${{ github.ref_name }}) 38 | echo tags="latest,${version}" >> $GITHUB_OUTPUT 39 | 40 | - name: Build and Push 41 | uses: docker/bake-action@v6 42 | with: 43 | source: . 44 | files: docker-bake.hcl 45 | push: true 46 | set: goreleaser.args.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} 47 | env: 48 | TAGS: "${{ steps.tags.outputs.tags }}" 49 | REGISTRY: "natsio" 50 | 51 | - name: Attach Release Files 52 | run: gh release upload ${{ github.ref_name }} deploy/crds.yml deploy/rbac.yml 53 | env: 54 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 55 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | push: 4 | paths-ignore: 5 | - '**.md' 6 | pull_request: 7 | paths-ignore: 8 | - '**.md' 9 | 10 | jobs: 11 | test: 12 | name: Test 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout Source 16 | uses: actions/checkout@v4 17 | 18 | - name: Setup Go 19 | id: setup-go 20 | uses: actions/setup-go@v5 21 | with: 22 | go-version-file: go.mod 23 | 24 | - name: Build 25 | run: make build 26 | 27 | - name: Test 28 | run: make test 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | /jetstream-controller.docker 15 | /jetstream-controller 16 | /nats-server-config-reloader 17 | /nats-server-config-reloader.docker 18 | /nats-boot-config 19 | /nats-boot-config.docker 20 | /tools 21 | /bin 22 | /.idea 23 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | project_name: nack 3 | env: 4 | - VERSION={{ if index .Env "VERSION" }}{{ .Env.VERSION }}{{ else }}{{ .Version }}{{ end }} 5 | 6 | release: 7 | name_template: 'Release {{.Tag}}' 8 | draft: true 9 | skip_upload: true 10 | github: 11 | owner: nats-io 12 | name: nack 13 | 14 | builds: 15 | - id: jetstream-controller 16 | main: ./cmd/jetstream-controller 17 | binary: jetstream-controller 18 | ldflags: 19 | - -s -w -X main.Version={{ .Env.VERSION }} -X main.GitInfo={{.ShortCommit}} -X main.BuildTime={{.Date}} 20 | tags: 21 | - timetzdata 22 | env: 23 | - CGO_ENABLED=0 24 | goos: 25 | - linux 26 | goarch: 27 | - amd64 28 | - arm64 29 | - arm 30 | goarm: 31 | - 6 32 | - 7 33 | 34 | - id: nats-boot-config 35 | main: ./cmd/nats-boot-config 36 | binary: nats-boot-config 37 | ldflags: 38 | - -s -w -X main.Version={{ .Env.VERSION }} -X main.GitInfo={{.ShortCommit}} -X main.BuildTime={{.Date}} 39 | tags: 40 | - timetzdata 41 | env: 42 | - CGO_ENABLED=0 43 | goos: 44 | - linux 45 | goarch: 46 | - amd64 47 | - arm64 48 | - arm 49 | goarm: 50 | - 6 51 | - 7 52 | 53 | - id: nats-server-config-reloader 54 | main: ./cmd/nats-server-config-reloader 55 | binary: nats-server-config-reloader 56 | ldflags: 57 | - -s -w -X main.Version={{ .Env.VERSION }} -X main.GitInfo={{.ShortCommit}} -X main.BuildTime={{.Date}} 58 | tags: 59 | - timetzdata 60 | env: 61 | - CGO_ENABLED=0 62 | goos: 63 | - linux 64 | goarch: 65 | - amd64 66 | - arm64 67 | - arm 68 | goarm: 69 | - 6 70 | - 7 71 | -------------------------------------------------------------------------------- /cicd/Dockerfile: -------------------------------------------------------------------------------- 1 | #syntax=docker/dockerfile:1.13 2 | ARG GO_APP 3 | 4 | FROM alpine:3.22.0 AS deps 5 | 6 | ARG GO_APP 7 | ARG GORELEASER_DIST_DIR=/go/src/dist 8 | 9 | ARG TARGETOS 10 | ARG TARGETARCH 11 | ARG TARGETVARIANT 12 | 13 | RUN mkdir -p /go/bin /go/src ${GORELEASER_DIST_DIR} 14 | 15 | COPY --from=build ${GORELEASER_DIST_DIR}/ ${GORELEASER_DIST_DIR} 16 | 17 | RUN < /etc/apt/sources.list.d/goreleaser.list 9 | apt-get update 10 | apt-get install -y goreleaser 11 | rm -rf /var/lib/apt/lists/* 12 | EOT 13 | 14 | FROM build 15 | 16 | ARG CI 17 | ARG PUSH 18 | ARG GITHUB_TOKEN 19 | ARG TAGS 20 | ARG VERSION 21 | 22 | COPY --from=src . /go/src 23 | 24 | RUN <"] 9 | storage: file 10 | replicas: 1 11 | account: a 12 | -------------------------------------------------------------------------------- /examples/secure/nack/stream-foo.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: jetstream.nats.io/v1beta2 3 | kind: Stream 4 | metadata: 5 | name: foo 6 | spec: 7 | name: foo 8 | subjects: ["foo", "foo.>"] 9 | storage: file 10 | replicas: 1 11 | account: a 12 | -------------------------------------------------------------------------------- /examples/secure/nats-helm.yaml: -------------------------------------------------------------------------------- 1 | tlsCA: 2 | enabled: true 3 | secretName: nats-sys-tls 4 | key: ca.crt 5 | 6 | config: 7 | cluster: 8 | enabled: true 9 | jetstream: 10 | enabled: true 11 | 12 | memoryStore: 13 | enabled: true 14 | maxSize: 2Gi 15 | 16 | fileStore: 17 | enabled: true 18 | pvc: 19 | enabled: true 20 | size: 1Gi 21 | 22 | nats: 23 | tls: 24 | enabled: true 25 | secretName: nats-server-tls 26 | cert: tls.crt 27 | key: tls.key 28 | merge: 29 | verify_and_map: true 30 | 31 | merge: 32 | system_account: SYS 33 | accounts: 34 | SYS: 35 | users: 36 | - user: CN=nats-sys-user 37 | A: 38 | jetstream: true 39 | users: 40 | - user: CN=nack-a 41 | B: 42 | jetstream: true 43 | users: 44 | - user: CN=nack-b 45 | 46 | natsBox: 47 | contexts: 48 | default: 49 | tls: 50 | secretName: nack-a-tls 51 | cert: tls.crt 52 | key: tls.key -------------------------------------------------------------------------------- /examples/secure/server-tls.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cert-manager.io/v1 3 | kind: Certificate 4 | metadata: 5 | name: nats-server-tls 6 | spec: 7 | secretName: nats-server-tls 8 | duration: 2160h # 90 days 9 | renewBefore: 240h # 10 days 10 | issuerRef: 11 | name: nats-ca 12 | kind: Issuer 13 | commonName: nats.default.svc.cluster.local 14 | dnsNames: 15 | - nats 16 | - nats.default 17 | - nats.default.svc 18 | - nats.default.svc.cluster.local 19 | - '*.nats' 20 | - '*.nats.default' 21 | - '*.nats.default.svc' 22 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/nats-io/nack 2 | 3 | go 1.24.0 4 | 5 | toolchain go1.24.2 6 | 7 | require ( 8 | github.com/fsnotify/fsnotify v1.9.0 9 | github.com/go-logr/logr v1.4.2 10 | github.com/google/go-cmp v0.7.0 11 | github.com/nats-io/jsm.go v0.2.2 12 | github.com/nats-io/nats-server/v2 v2.11.3 13 | github.com/nats-io/nats.go v1.42.0 14 | github.com/onsi/ginkgo/v2 v2.23.4 15 | github.com/onsi/gomega v1.37.0 16 | github.com/sirupsen/logrus v1.9.3 17 | github.com/stretchr/testify v1.10.0 18 | golang.org/x/sync v0.14.0 19 | k8s.io/api v0.33.0 20 | k8s.io/apimachinery v0.33.0 21 | k8s.io/client-go v0.33.0 22 | k8s.io/code-generator v0.33.0 23 | k8s.io/klog/v2 v2.130.1 24 | sigs.k8s.io/controller-runtime v0.20.4 25 | sigs.k8s.io/structured-merge-diff/v4 v4.7.0 26 | ) 27 | 28 | require ( 29 | github.com/beorn7/perks v1.0.1 // indirect 30 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 31 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect 32 | github.com/dustin/go-humanize v1.0.1 // indirect 33 | github.com/emicklei/go-restful/v3 v3.12.2 // indirect 34 | github.com/evanphx/json-patch/v5 v5.9.11 // indirect 35 | github.com/expr-lang/expr v1.17.2 // indirect 36 | github.com/fxamacker/cbor/v2 v2.8.0 // indirect 37 | github.com/go-logr/zapr v1.3.0 // indirect 38 | github.com/go-openapi/jsonpointer v0.21.1 // indirect 39 | github.com/go-openapi/jsonreference v0.21.0 // indirect 40 | github.com/go-openapi/swag v0.23.1 // indirect 41 | github.com/go-task/slim-sprig/v3 v3.0.0 // indirect 42 | github.com/gogo/protobuf v1.3.2 // indirect 43 | github.com/google/btree v1.1.3 // indirect 44 | github.com/google/gnostic-models v0.6.9 // indirect 45 | github.com/google/go-tpm v0.9.4 // indirect 46 | github.com/google/pprof v0.0.0-20250501235452-c0086092b71a // indirect 47 | github.com/google/uuid v1.6.0 // indirect 48 | github.com/josharian/intern v1.0.0 // indirect 49 | github.com/json-iterator/go v1.1.12 // indirect 50 | github.com/klauspost/compress v1.18.0 // indirect 51 | github.com/mailru/easyjson v0.9.0 // indirect 52 | github.com/minio/highwayhash v1.0.3 // indirect 53 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 54 | github.com/modern-go/reflect2 v1.0.2 // indirect 55 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 56 | github.com/nats-io/jwt/v2 v2.7.4 // indirect 57 | github.com/nats-io/nkeys v0.4.11 // indirect 58 | github.com/nats-io/nuid v1.0.1 // indirect 59 | github.com/pkg/errors v0.9.1 // indirect 60 | github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect 61 | github.com/prometheus/client_golang v1.22.0 // indirect 62 | github.com/prometheus/client_model v0.6.2 // indirect 63 | github.com/prometheus/common v0.63.0 // indirect 64 | github.com/prometheus/procfs v0.16.1 // indirect 65 | github.com/spf13/pflag v1.0.6 // indirect 66 | github.com/x448/float16 v0.8.4 // indirect 67 | go.uber.org/automaxprocs v1.6.0 // indirect 68 | go.uber.org/multierr v1.11.0 // indirect 69 | go.uber.org/zap v1.27.0 // indirect 70 | golang.org/x/crypto v0.38.0 // indirect 71 | golang.org/x/mod v0.24.0 // indirect 72 | golang.org/x/net v0.40.0 // indirect 73 | golang.org/x/oauth2 v0.30.0 // indirect 74 | golang.org/x/sys v0.33.0 // indirect 75 | golang.org/x/term v0.32.0 // indirect 76 | golang.org/x/text v0.25.0 // indirect 77 | golang.org/x/time v0.11.0 // indirect 78 | golang.org/x/tools v0.33.0 // indirect 79 | gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect 80 | google.golang.org/protobuf v1.36.6 // indirect 81 | gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect 82 | gopkg.in/inf.v0 v0.9.1 // indirect 83 | gopkg.in/yaml.v3 v3.0.1 // indirect 84 | k8s.io/apiextensions-apiserver v0.33.0 // indirect 85 | k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7 // indirect 86 | k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect 87 | k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 // indirect 88 | sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect 89 | sigs.k8s.io/randfill v1.0.0 // indirect 90 | sigs.k8s.io/yaml v1.4.0 // indirect 91 | ) 92 | -------------------------------------------------------------------------------- /internal/controller/connection_pool.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "sync" 5 | "time" 6 | 7 | "github.com/nats-io/nats.go" 8 | ) 9 | 10 | type pooledConnection struct { 11 | nc *nats.Conn 12 | pool *connectionPool 13 | hash string 14 | refCount int 15 | } 16 | 17 | func (pc *pooledConnection) Close() { 18 | if pc.pool != nil { 19 | pc.pool.release(pc.hash) 20 | } else if pc.nc != nil { 21 | pc.nc.Close() // Close directly if not pool-managed 22 | } 23 | } 24 | 25 | type connectionPool struct { 26 | connections map[string]*pooledConnection 27 | gracePeriod time.Duration 28 | mu sync.Mutex 29 | } 30 | 31 | func newConnPool(gracePeriod time.Duration) *connectionPool { 32 | return &connectionPool{ 33 | connections: make(map[string]*pooledConnection), 34 | gracePeriod: gracePeriod, 35 | } 36 | } 37 | 38 | func (p *connectionPool) Get(c *NatsConfig, pedantic bool) (*pooledConnection, error) { 39 | p.mu.Lock() 40 | defer p.mu.Unlock() 41 | 42 | hash, err := c.Hash() 43 | if err != nil { 44 | // If hash fails, create a new non-pooled connection 45 | nc, err := createNatsConn(c, pedantic) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return &pooledConnection{nc: nc}, nil 50 | } 51 | 52 | if pc, ok := p.connections[hash]; ok && !pc.nc.IsClosed() { 53 | pc.refCount++ 54 | return pc, nil 55 | } 56 | 57 | nc, err := createNatsConn(c, pedantic) 58 | if err != nil { 59 | return nil, err 60 | } 61 | 62 | pc := &pooledConnection{ 63 | nc: nc, 64 | pool: p, 65 | hash: hash, 66 | refCount: 1, 67 | } 68 | p.connections[hash] = pc 69 | 70 | return pc, nil 71 | } 72 | 73 | func (p *connectionPool) release(hash string) { 74 | p.mu.Lock() 75 | defer p.mu.Unlock() 76 | 77 | pc, ok := p.connections[hash] 78 | if !ok { 79 | return 80 | } 81 | 82 | pc.refCount-- 83 | if pc.refCount < 1 { 84 | go func() { 85 | if p.gracePeriod > 0 { 86 | time.Sleep(p.gracePeriod) 87 | } 88 | 89 | p.mu.Lock() 90 | defer p.mu.Unlock() 91 | 92 | if pc, ok := p.connections[hash]; ok && pc.refCount < 1 { 93 | pc.nc.Close() 94 | delete(p.connections, hash) 95 | } 96 | }() 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /internal/controller/connection_pool_test.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "sync" 5 | "testing" 6 | "time" 7 | 8 | natsservertest "github.com/nats-io/nats-server/v2/test" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestConnPool(t *testing.T) { 13 | t.Parallel() 14 | 15 | s := natsservertest.RunRandClientPortServer() 16 | defer s.Shutdown() 17 | 18 | c1 := &NatsConfig{ 19 | ClientName: "Client 1", 20 | ServerURL: s.ClientURL(), 21 | } 22 | 23 | c2 := &NatsConfig{ 24 | ClientName: "Client 1", 25 | ServerURL: s.ClientURL(), 26 | } 27 | 28 | c3 := &NatsConfig{ 29 | ClientName: "Client 2", 30 | ServerURL: s.ClientURL(), 31 | } 32 | 33 | pool := newConnPool(0) 34 | 35 | var conn1, conn2, conn3 *pooledConnection 36 | var err1, err2, err3 error 37 | 38 | wg := &sync.WaitGroup{} 39 | wg.Add(3) 40 | 41 | go func() { 42 | conn1, err1 = pool.Get(c1, true) 43 | wg.Done() 44 | }() 45 | go func() { 46 | conn2, err2 = pool.Get(c2, true) 47 | wg.Done() 48 | }() 49 | go func() { 50 | conn3, err3 = pool.Get(c3, true) 51 | wg.Done() 52 | }() 53 | wg.Wait() 54 | 55 | require := require.New(t) 56 | 57 | require.NoError(err1) 58 | require.NoError(err2) 59 | require.NoError(err3) 60 | 61 | require.Same(conn1, conn2) 62 | require.NotSame(conn1, conn3) 63 | require.NotSame(conn2, conn3) 64 | 65 | conn1.Close() 66 | conn3.Close() 67 | 68 | time.Sleep(time.Second) 69 | 70 | require.False(conn1.nc.IsClosed()) 71 | require.False(conn2.nc.IsClosed()) 72 | require.True(conn3.nc.IsClosed()) 73 | 74 | conn4, err4 := pool.Get(c1, true) 75 | require.NoError(err4) 76 | require.Same(conn1, conn4) 77 | require.Same(conn2, conn4) 78 | 79 | conn2.Close() 80 | conn4.Close() 81 | 82 | time.Sleep(time.Second) 83 | 84 | require.True(conn1.nc.IsClosed()) 85 | require.True(conn2.nc.IsClosed()) 86 | require.True(conn3.nc.IsClosed()) 87 | require.True(conn4.nc.IsClosed()) 88 | 89 | conn5, err5 := pool.Get(c1, true) 90 | require.NoError(err5) 91 | require.NotSame(conn1, conn5) 92 | 93 | conn5.Close() 94 | 95 | time.Sleep(time.Second) 96 | 97 | require.True(conn5.nc.IsClosed()) 98 | } 99 | -------------------------------------------------------------------------------- /internal/controller/helpers_test.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "os" 5 | "time" 6 | 7 | api "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 8 | "github.com/nats-io/nats-server/v2/server" 9 | natsserver "github.com/nats-io/nats-server/v2/test" 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | v1 "k8s.io/api/core/v1" 13 | ) 14 | 15 | func assertReadyStateMatches(condition api.Condition, status v1.ConditionStatus, reason string, message string, transitionTime time.Time) { 16 | GinkgoHelper() 17 | 18 | Expect(condition.Type).To(Equal(readyCondType)) 19 | Expect(condition.Status).To(Equal(status)) 20 | Expect(condition.Reason).To(Equal(reason)) 21 | Expect(condition.Message).To(ContainSubstring(message)) 22 | 23 | // Assert valid transition time 24 | t, err := time.Parse(time.RFC3339Nano, condition.LastTransitionTime) 25 | Expect(err).NotTo(HaveOccurred()) 26 | Expect(t).To(BeTemporally("~", transitionTime, time.Second)) 27 | } 28 | 29 | func CreateTestServer() *server.Server { 30 | opts := &natsserver.DefaultTestOptions 31 | opts.JetStream = true 32 | opts.Port = -1 33 | opts.Debug = true 34 | 35 | dir, err := os.MkdirTemp("", "nats-*") 36 | Expect(err).NotTo(HaveOccurred()) 37 | opts.StoreDir = dir 38 | 39 | ns := natsserver.RunServer(opts) 40 | Expect(err).NotTo(HaveOccurred()) 41 | 42 | return ns 43 | } 44 | -------------------------------------------------------------------------------- /internal/controller/jetstream_controller_test.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | 7 | api "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 8 | "github.com/stretchr/testify/assert" 9 | v1 "k8s.io/api/core/v1" 10 | ) 11 | 12 | func Test_updateReadyCondition(t *testing.T) { 13 | pastTransition := time.Now().UTC().Add(-time.Hour).Format(time.RFC3339Nano) 14 | updatedTransition := "now" 15 | 16 | otherCondition := api.Condition{ 17 | Type: "other", 18 | Status: v1.ConditionFalse, 19 | Reason: "Reason", 20 | Message: "Message", 21 | LastTransitionTime: pastTransition, 22 | } 23 | 24 | type args struct { 25 | conditions []api.Condition 26 | status v1.ConditionStatus 27 | reason string 28 | message string 29 | } 30 | tests := []struct { 31 | name string 32 | args args 33 | want []api.Condition 34 | }{ 35 | { 36 | name: "new ready condition", 37 | args: args{ 38 | conditions: nil, 39 | status: v1.ConditionTrue, 40 | reason: "Test", 41 | message: "Test Message", 42 | }, 43 | want: []api.Condition{ 44 | { 45 | Type: readyCondType, 46 | Status: v1.ConditionTrue, 47 | Reason: "Test", 48 | Message: "Test Message", 49 | LastTransitionTime: updatedTransition, 50 | }, 51 | }, 52 | }, 53 | { 54 | name: "update ready condition", 55 | args: args{ 56 | conditions: []api.Condition{ 57 | otherCondition, 58 | { 59 | Type: readyCondType, 60 | Status: v1.ConditionFalse, 61 | Reason: "Test", 62 | Message: "Test Message", 63 | LastTransitionTime: pastTransition, 64 | }, 65 | }, 66 | status: v1.ConditionTrue, 67 | reason: "New Reason", 68 | message: "New Message", 69 | }, 70 | want: []api.Condition{ 71 | otherCondition, 72 | { 73 | Type: readyCondType, 74 | Status: v1.ConditionTrue, 75 | Reason: "New Reason", 76 | Message: "New Message", 77 | LastTransitionTime: updatedTransition, 78 | }, 79 | }, 80 | }, 81 | { 82 | name: "should not update transition time when status is not changed", 83 | args: args{ 84 | conditions: []api.Condition{ 85 | otherCondition, 86 | { 87 | Type: readyCondType, 88 | Status: v1.ConditionTrue, 89 | Reason: "Test", 90 | Message: "Test Message", 91 | LastTransitionTime: pastTransition, 92 | }, 93 | }, 94 | status: v1.ConditionTrue, 95 | reason: "New Reason", 96 | message: "New Message", 97 | }, 98 | want: []api.Condition{ 99 | otherCondition, 100 | { 101 | Type: readyCondType, 102 | Status: v1.ConditionTrue, 103 | Reason: "New Reason", 104 | Message: "New Message", 105 | LastTransitionTime: pastTransition, 106 | }, 107 | }, 108 | }, 109 | } 110 | for _, tt := range tests { 111 | t.Run(tt.name, func(t *testing.T) { 112 | assert := assert.New(t) 113 | 114 | got := updateReadyCondition(tt.args.conditions, tt.args.status, tt.args.reason, tt.args.message) 115 | 116 | assert.Len(got, len(tt.want)) 117 | for i, want := range tt.want { 118 | actual := got[i] 119 | 120 | assert.Equal(actual.Type, want.Type) 121 | assert.Equal(actual.Status, want.Status) 122 | assert.Equal(actual.Reason, want.Reason) 123 | assert.Equal(actual.Message, want.Message) 124 | 125 | // Assert transition time was updated 126 | if want.LastTransitionTime == updatedTransition { 127 | actualTransitionTime, err := time.Parse(time.RFC3339Nano, actual.LastTransitionTime) 128 | assert.NoError(err) 129 | assert.WithinDuration(actualTransitionTime, time.Now(), 5*time.Second) 130 | } 131 | // Assert transition time was not updated 132 | if want.LastTransitionTime == pastTransition { 133 | assert.Equal(pastTransition, actual.LastTransitionTime) 134 | } 135 | } 136 | }) 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /internal/controller/register.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | 7 | ctrl "sigs.k8s.io/controller-runtime" 8 | ) 9 | 10 | // The Config contains parameters to be considered by the registered controllers. 11 | // 12 | // ReadOnly prevents controllers from actually applying changes NATS resources. 13 | // 14 | // Namespace restricts the controller to resources of the given namespace. 15 | type Config struct { 16 | ReadOnly bool 17 | Namespace string 18 | RequeueInterval time.Duration 19 | CacheDir string 20 | } 21 | 22 | // RegisterAll registers all available jetStream controllers to the manager. 23 | // natsCfg is specific to the nats server connection. 24 | // controllerCfg defines behaviour of the registered controllers. 25 | func RegisterAll(mgr ctrl.Manager, clientConfig *NatsConfig, config *Config) error { 26 | scheme := mgr.GetScheme() 27 | 28 | // Register controllers 29 | baseController, err := NewJSController(mgr.GetClient(), clientConfig, config) 30 | if err != nil { 31 | return fmt.Errorf("create base jetstream controller: %w", err) 32 | } 33 | 34 | if err := (&AccountReconciler{ 35 | Scheme: scheme, 36 | JetStreamController: baseController, 37 | }).SetupWithManager(mgr); err != nil { 38 | return fmt.Errorf("unable to create account controller: %w", err) 39 | } 40 | 41 | if err := (&ConsumerReconciler{ 42 | Scheme: scheme, 43 | JetStreamController: baseController, 44 | }).SetupWithManager(mgr); err != nil { 45 | return fmt.Errorf("unable to create consumer controller: %w", err) 46 | } 47 | 48 | if err := (&KeyValueReconciler{ 49 | Scheme: scheme, 50 | JetStreamController: baseController, 51 | }).SetupWithManager(mgr); err != nil { 52 | return fmt.Errorf("unable to create key-value controller: %w", err) 53 | } 54 | 55 | if err := (&ObjectStoreReconciler{ 56 | Scheme: scheme, 57 | JetStreamController: baseController, 58 | }).SetupWithManager(mgr); err != nil { 59 | return fmt.Errorf("unable to create object store controller: %w", err) 60 | } 61 | 62 | if err := (&StreamReconciler{ 63 | Scheme: scheme, 64 | JetStreamController: baseController, 65 | }).SetupWithManager(mgr); err != nil { 66 | return fmt.Errorf("unable to create stream controller: %w", err) 67 | } 68 | 69 | return nil 70 | } 71 | -------------------------------------------------------------------------------- /internal/controller/suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package controller 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "path/filepath" 23 | "runtime" 24 | "testing" 25 | 26 | "github.com/nats-io/nats-server/v2/server" 27 | "github.com/nats-io/nats.go/jetstream" 28 | 29 | . "github.com/onsi/ginkgo/v2" 30 | . "github.com/onsi/gomega" 31 | 32 | "k8s.io/client-go/kubernetes/scheme" 33 | "k8s.io/client-go/rest" 34 | "sigs.k8s.io/controller-runtime/pkg/client" 35 | "sigs.k8s.io/controller-runtime/pkg/envtest" 36 | logf "sigs.k8s.io/controller-runtime/pkg/log" 37 | "sigs.k8s.io/controller-runtime/pkg/log/zap" 38 | 39 | api "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 40 | ) 41 | 42 | // These tests use Ginkgo (BDD-style Go testing framework). Refer to 43 | // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. 44 | 45 | var ( 46 | cfg *rest.Config 47 | k8sClient client.Client 48 | testEnv *envtest.Environment 49 | testServer *server.Server 50 | clientUrl string 51 | jsClient jetstream.JetStream 52 | baseController JetStreamController 53 | ) 54 | 55 | func TestControllers(t *testing.T) { 56 | RegisterFailHandler(Fail) 57 | 58 | RunSpecs(t, "Controller Suite") 59 | } 60 | 61 | var _ = BeforeSuite(func() { 62 | logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) 63 | 64 | By("bootstrapping test environment") 65 | testEnv = &envtest.Environment{ 66 | CRDDirectoryPaths: []string{filepath.Join("..", "..", "deploy")}, 67 | ErrorIfCRDPathMissing: true, 68 | 69 | // The BinaryAssetsDirectory is only required if you want to run the tests directly 70 | // without call the makefile target test. If not informed it will look for the 71 | // default path defined in controller-runtime which is /usr/local/kubebuilder/. 72 | // Note that you must have the required binaries setup under the bin directory to perform 73 | // the tests directly. When we run make test it will be setup and used automatically. 74 | BinaryAssetsDirectory: filepath.Join("..", "..", "bin", "k8s", 75 | fmt.Sprintf("1.32.0-%s-%s", runtime.GOOS, runtime.GOARCH)), 76 | } 77 | 78 | var err error 79 | // cfg is defined in this file globally. 80 | cfg, err = testEnv.Start() 81 | Expect(err).NotTo(HaveOccurred()) 82 | Expect(cfg).NotTo(BeNil()) 83 | 84 | err = api.AddToScheme(scheme.Scheme) 85 | Expect(err).NotTo(HaveOccurred()) 86 | 87 | k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) 88 | Expect(err).NotTo(HaveOccurred()) 89 | Expect(k8sClient).NotTo(BeNil()) 90 | 91 | By("bootstrapping the test server") 92 | testServer = CreateTestServer() 93 | Expect(err).NotTo(HaveOccurred()) 94 | 95 | clientUrl = testServer.ClientURL() 96 | testNatsConfig := &NatsConfig{ServerURL: clientUrl} 97 | baseController, err = NewJSController(k8sClient, testNatsConfig, &Config{ 98 | Namespace: "default", 99 | }) 100 | Expect(err).NotTo(HaveOccurred()) 101 | 102 | connPool := newConnPool(0) 103 | conn, err := connPool.Get(testNatsConfig, true) 104 | Expect(err).NotTo(HaveOccurred()) 105 | domain := "" 106 | 107 | jsClient, err = CreateJetStreamClient(conn, true, domain) 108 | Expect(err).NotTo(HaveOccurred()) 109 | }) 110 | 111 | var _ = AfterSuite(func() { 112 | By("tearing down the test environment") 113 | err := testEnv.Stop() 114 | Expect(err).NotTo(HaveOccurred()) 115 | 116 | By("tearing down the test server") 117 | storeDir := testServer.StoreDir() 118 | testServer.Shutdown() 119 | err = os.RemoveAll(storeDir) 120 | Expect(err).NotTo(HaveOccurred()) 121 | }) 122 | -------------------------------------------------------------------------------- /internal/controller/types.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | const ( 4 | readyCondType = "Ready" 5 | accountFinalizer = "account.nats.io/finalizer" 6 | streamFinalizer = "stream.nats.io/finalizer" 7 | keyValueFinalizer = "kv.nats.io/finalizer" 8 | objectStoreFinalizer = "objectstore.nats.io/finalizer" 9 | consumerFinalizer = "consumer.nats.io/finalizer" 10 | 11 | stateAnnotationConsumer = "consumer.nats.io/state" 12 | stateAnnotationKV = "kv.nats.io/state" 13 | stateAnnotationObj = "objectstore.nats.io/state" 14 | stateAnnotationStream = "stream.nats.io/state" 15 | 16 | stateReady = "Ready" 17 | stateReconciling = "Reconciling" 18 | stateErrored = "Errored" 19 | stateFinalizing = "Finalizing" 20 | ) 21 | -------------------------------------------------------------------------------- /kuttl-test.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kuttl.dev/v1beta1 2 | kind: TestSuite 3 | testDirs: 4 | - tests/ 5 | commands: 6 | - command: kubectl apply -f ./deploy/crds.yml 7 | timeout: 120 8 | -------------------------------------------------------------------------------- /pkg/bootconfig/bootconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | package bootconfig 15 | 16 | import ( 17 | "context" 18 | "errors" 19 | "fmt" 20 | "os" 21 | 22 | log "github.com/sirupsen/logrus" 23 | k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 | k8sclient "k8s.io/client-go/kubernetes" 25 | k8srestapi "k8s.io/client-go/rest" 26 | k8sclientcmd "k8s.io/client-go/tools/clientcmd" 27 | ) 28 | 29 | type Options struct { 30 | // TargetTag is the tag that will be looked up to find 31 | // the public ip from the node. 32 | TargetTag string 33 | 34 | // ClientAdvertiseFileName is the name of the file where 35 | // the advertise configuration will be written into. 36 | ClientAdvertiseFileName string 37 | 38 | // GatewayAdvertiseFileName is the name of the file where 39 | // the advertise configuration will be written into for gateways. 40 | GatewayAdvertiseFileName string 41 | 42 | // NoSignals marks whether to enable the signal handler. 43 | NoSignals bool 44 | } 45 | 46 | // Controller for the boot config. 47 | type Controller struct { 48 | // Start/Stop cancellation. 49 | quit func() 50 | 51 | // Client to interact with Kubernetes resources. 52 | kc k8sclient.Interface 53 | 54 | // opts is the set of options. 55 | opts *Options 56 | } 57 | 58 | // NewController creates a new controller with the configuration. 59 | func NewController(opts *Options) *Controller { 60 | return &Controller{ 61 | opts: opts, 62 | } 63 | } 64 | 65 | // SetupClients takes the configuration and prepares the rest 66 | // clients that will be used to interact with the cluster objects. 67 | func (c *Controller) SetupClients(cfg *k8srestapi.Config) error { 68 | kc, err := k8sclient.NewForConfig(cfg) 69 | if err != nil { 70 | return err 71 | } 72 | c.kc = kc 73 | return nil 74 | } 75 | 76 | // Run starts the controller. 77 | func (c *Controller) Run(ctx context.Context) error { 78 | var err error 79 | var cfg *k8srestapi.Config 80 | if kubeconfig := os.Getenv("KUBERNETES_CONFIG_FILE"); kubeconfig != "" { 81 | cfg, err = k8sclientcmd.BuildConfigFromFlags("", kubeconfig) 82 | } else { 83 | cfg, err = k8srestapi.InClusterConfig() 84 | } 85 | if err != nil { 86 | return err 87 | } 88 | if err := c.SetupClients(cfg); err != nil { 89 | return err 90 | } 91 | 92 | nodeName := os.Getenv("KUBERNETES_NODE_NAME") 93 | if nodeName == "" { 94 | return errors.New("Target node name is missing") 95 | } 96 | log.Infof("Pod running on node %q", nodeName) 97 | 98 | node, err := c.kc.CoreV1().Nodes().Get(ctx, nodeName, k8smetav1.GetOptions{}) 99 | if err != nil { 100 | return err 101 | } 102 | 103 | var ok bool 104 | var externalAddress string 105 | for _, addr := range node.Status.Addresses { 106 | if addr.Type == "ExternalIP" { 107 | externalAddress = addr.Address 108 | ok = true 109 | break 110 | } 111 | } 112 | 113 | // Fallback to use a label to find the external address. 114 | if !ok { 115 | externalAddress, ok = node.Labels[c.opts.TargetTag] 116 | if !ok || len(externalAddress) == 0 { 117 | return errors.New("Could not find external IP address.") 118 | } 119 | } 120 | log.Infof("Pod is running on node with external IP: %s", externalAddress) 121 | 122 | clientAdvertiseConfig := fmt.Sprintf("\nclient_advertise = \"%s\"\n\n", externalAddress) 123 | 124 | err = os.WriteFile(c.opts.ClientAdvertiseFileName, []byte(clientAdvertiseConfig), 0o644) 125 | if err != nil { 126 | return fmt.Errorf("Could not write client advertise config: %s", err) 127 | } 128 | log.Infof("Successfully wrote client advertise config to %q", c.opts.ClientAdvertiseFileName) 129 | 130 | gatewayAdvertiseConfig := fmt.Sprintf("\nadvertise = \"%s\"\n\n", externalAddress) 131 | 132 | err = os.WriteFile(c.opts.GatewayAdvertiseFileName, []byte(gatewayAdvertiseConfig), 0o644) 133 | if err != nil { 134 | return fmt.Errorf("Could not write gateway advertise config: %s", err) 135 | } 136 | log.Infof("Successfully wrote gateway advertise config to %q", c.opts.GatewayAdvertiseFileName) 137 | 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/register.go: -------------------------------------------------------------------------------- 1 | package jetstream 2 | 3 | // GroupName is the group name used in this package 4 | const ( 5 | GroupName = "jetstream.nats.io" 6 | ) 7 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta1/consumertypes.go: -------------------------------------------------------------------------------- 1 | package v1beta1 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Consumer is a specification for a Consumer resource 11 | type Consumer struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec ConsumerSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (c *Consumer) GetSpec() interface{} { 20 | return c.Spec 21 | } 22 | 23 | // ConsumerSpec is the spec for a Consumer resource 24 | type ConsumerSpec struct { 25 | AckPolicy string `json:"ackPolicy"` 26 | AckWait string `json:"ackWait"` 27 | DeliverGroup string `json:"deliverGroup"` 28 | DeliverPolicy string `json:"deliverPolicy"` 29 | DeliverSubject string `json:"deliverSubject"` 30 | Description string `json:"description"` 31 | DurableName string `json:"durableName"` 32 | FilterSubject string `json:"filterSubject"` 33 | FlowControl bool `json:"flowControl"` 34 | HeartbeatInterval string `json:"heartbeatInterval"` 35 | MaxAckPending int `json:"maxAckPending"` 36 | MaxDeliver int `json:"maxDeliver"` 37 | OptStartSeq int `json:"optStartSeq"` 38 | OptStartTime string `json:"optStartTime"` 39 | RateLimitBps int `json:"rateLimitBps"` 40 | ReplayPolicy string `json:"replayPolicy"` 41 | SampleFreq string `json:"sampleFreq"` 42 | 43 | StreamName string `json:"streamName"` 44 | } 45 | 46 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 47 | 48 | // ConsumerList is a list of Consumer resources 49 | type ConsumerList struct { 50 | k8smeta.TypeMeta `json:",inline"` 51 | k8smeta.ListMeta `json:"metadata"` 52 | 53 | Items []Consumer `json:"items"` 54 | } 55 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | // +k8s:deepcopy-gen=package 2 | // +groupName=jetstream.nats.io 3 | 4 | // Package v1 is the v1 version of the API. 5 | package v1beta1 6 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta1/register.go: -------------------------------------------------------------------------------- 1 | package v1beta1 2 | 3 | import ( 4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | 8 | "github.com/nats-io/nack/pkg/jetstream/apis/jetstream" 9 | ) 10 | 11 | var ( 12 | // SchemeGroupVersion is group version used to register these objects 13 | SchemeGroupVersion = schema.GroupVersion{Group: jetstream.GroupName, Version: "v1beta1"} 14 | 15 | // SchemeBuilder initializes a scheme builder 16 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 17 | // AddToScheme is a global function that registers this API group & version to a scheme 18 | AddToScheme = SchemeBuilder.AddToScheme 19 | ) 20 | 21 | // Kind takes an unqualified kind and returns back a Group qualified GroupKind 22 | func Kind(kind string) schema.GroupKind { 23 | return SchemeGroupVersion.WithKind(kind).GroupKind() 24 | } 25 | 26 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 27 | func Resource(resource string) schema.GroupResource { 28 | return SchemeGroupVersion.WithResource(resource).GroupResource() 29 | } 30 | 31 | // Adds the list of known types to Scheme. 32 | func addKnownTypes(scheme *runtime.Scheme) error { 33 | scheme.AddKnownTypes(SchemeGroupVersion, 34 | &Stream{}, 35 | &StreamList{}, 36 | &Consumer{}, 37 | &ConsumerList{}, 38 | &StreamTemplate{}, 39 | &StreamTemplateList{}, 40 | ) 41 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion) 42 | return nil 43 | } 44 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta1/streamtemplatetypes.go: -------------------------------------------------------------------------------- 1 | package v1beta1 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // StreamTemplate is a specification for a StreamTemplate resource 11 | type StreamTemplate struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec StreamTemplateSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (s *StreamTemplate) GetSpec() interface{} { 20 | return s.Spec 21 | } 22 | 23 | // StreamTemplateSpec is the spec for a StreamTemplate resource 24 | type StreamTemplateSpec struct { 25 | StreamSpec `json:",inline"` 26 | 27 | MaxStreams int `json:"maxStreams"` 28 | } 29 | 30 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 31 | 32 | // StreamTemplateList is a list of StreamTemplate resources 33 | type StreamTemplateList struct { 34 | k8smeta.TypeMeta `json:",inline"` 35 | k8smeta.ListMeta `json:"metadata"` 36 | 37 | Items []StreamTemplate `json:"items"` 38 | } 39 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta1/streamtypes.go: -------------------------------------------------------------------------------- 1 | package v1beta1 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Stream is a specification for a Stream resource 11 | type Stream struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec StreamSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (s *Stream) GetSpec() interface{} { 20 | return s.Spec 21 | } 22 | 23 | // StreamSpec is the spec for a Stream resource 24 | type StreamSpec struct { 25 | Description string `json:"description"` 26 | Discard string `json:"discard"` 27 | DuplicateWindow string `json:"duplicateWindow"` 28 | MaxAge string `json:"maxAge"` 29 | MaxBytes int `json:"maxBytes"` 30 | MaxConsumers int `json:"maxConsumers"` 31 | MaxMsgs int `json:"maxMsgs"` 32 | MaxMsgSize int `json:"maxMsgSize"` 33 | MaxMsgsPerSubject int `json:"maxMsgsPerSubject"` 34 | Mirror *StreamSource `json:"mirror"` 35 | Name string `json:"name"` 36 | NoAck bool `json:"noAck"` 37 | Placement *StreamPlacement `json:"placement"` 38 | Replicas int `json:"replicas"` 39 | Retention string `json:"retention"` 40 | Sources []*StreamSource `json:"sources"` 41 | Storage string `json:"storage"` 42 | Subjects []string `json:"subjects"` 43 | } 44 | 45 | type StreamPlacement struct { 46 | Cluster string `json:"cluster"` 47 | Tags []string `json:"tags"` 48 | } 49 | 50 | type StreamSource struct { 51 | Name string `json:"name"` 52 | OptStartSeq int `json:"optStartSeq"` 53 | OptStartTime string `json:"optStartTime"` 54 | FilterSubject string `json:"filterSubject"` 55 | 56 | ExternalAPIPrefix string `json:"externalApiPrefix"` 57 | ExternalDeliverPrefix string `json:"externalDeliverPrefix"` 58 | } 59 | 60 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 61 | 62 | // StreamList is a list of Stream resources 63 | type StreamList struct { 64 | k8smeta.TypeMeta `json:",inline"` 65 | k8smeta.ListMeta `json:"metadata"` 66 | 67 | Items []Stream `json:"items"` 68 | } 69 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta1/types.go: -------------------------------------------------------------------------------- 1 | package v1beta1 2 | 3 | import ( 4 | k8sapi "k8s.io/api/core/v1" 5 | ) 6 | 7 | type CredentialsSecret struct { 8 | Name string `json:"name"` 9 | Key string `json:"key"` 10 | } 11 | 12 | type Status struct { 13 | ObservedGeneration int64 `json:"observedGeneration"` 14 | Conditions []Condition `json:"conditions"` 15 | } 16 | 17 | type Condition struct { 18 | Type string `json:"type"` 19 | Status k8sapi.ConditionStatus `json:"status"` 20 | Reason string `json:"reason"` 21 | Message string `json:"message"` 22 | LastTransitionTime string `json:"lastTransitionTime"` 23 | } 24 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/accounttypes.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Account is a specification for a Account resource. 11 | type Account struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec AccountSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (c *Account) GetSpec() interface{} { 20 | return c.Spec 21 | } 22 | 23 | // AccountSpec is the spec for a Account resource 24 | type AccountSpec struct { 25 | Servers []string `json:"servers"` 26 | TLS *TLSSecret `json:"tls"` 27 | Creds *CredsSecret `json:"creds"` 28 | Token *TokenSecret `json:"token"` 29 | User *User `json:"user"` 30 | } 31 | 32 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 33 | 34 | // AccountList is a list of Account resources 35 | type AccountList struct { 36 | k8smeta.TypeMeta `json:",inline"` 37 | k8smeta.ListMeta `json:"metadata"` 38 | 39 | Items []Account `json:"items"` 40 | } 41 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/consumertypes.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Consumer is a specification for a Consumer resource 11 | type Consumer struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec ConsumerSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (c *Consumer) GetSpec() interface{} { 20 | return c.Spec 21 | } 22 | 23 | // ConsumerSpec is the spec for a Consumer resource 24 | type ConsumerSpec struct { 25 | Description string `json:"description"` 26 | AckPolicy string `json:"ackPolicy"` 27 | AckWait string `json:"ackWait"` 28 | DeliverPolicy string `json:"deliverPolicy"` 29 | DeliverSubject string `json:"deliverSubject"` 30 | DeliverGroup string `json:"deliverGroup"` 31 | DurableName string `json:"durableName"` // Maps to Durable 32 | FilterSubject string `json:"filterSubject"` 33 | FilterSubjects []string `json:"filterSubjects"` 34 | FlowControl bool `json:"flowControl"` 35 | HeartbeatInterval string `json:"heartbeatInterval"` // Maps to Heartbeat 36 | MaxAckPending int `json:"maxAckPending"` 37 | MaxDeliver int `json:"maxDeliver"` 38 | BackOff []string `json:"backoff"` 39 | MaxWaiting int `json:"maxWaiting"` 40 | OptStartSeq int `json:"optStartSeq"` 41 | OptStartTime string `json:"optStartTime"` 42 | RateLimitBps int `json:"rateLimitBps"` // Maps to RateLimit 43 | ReplayPolicy string `json:"replayPolicy"` 44 | SampleFreq string `json:"sampleFreq"` // Maps to SampleFrequency 45 | HeadersOnly bool `json:"headersOnly"` 46 | MaxRequestBatch int `json:"maxRequestBatch"` 47 | MaxRequestExpires string `json:"maxRequestExpires"` 48 | MaxRequestMaxBytes int `json:"maxRequestMaxBytes"` 49 | InactiveThreshold string `json:"inactiveThreshold"` 50 | Replicas int `json:"replicas"` 51 | MemStorage bool `json:"memStorage"` // Maps to MemoryStorage 52 | Metadata map[string]string `json:"metadata"` 53 | 54 | StreamName string `json:"streamName"` 55 | BaseStreamConfig 56 | } 57 | 58 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 59 | 60 | // ConsumerList is a list of Consumer resources 61 | type ConsumerList struct { 62 | k8smeta.TypeMeta `json:",inline"` 63 | k8smeta.ListMeta `json:"metadata"` 64 | 65 | Items []Consumer `json:"items"` 66 | } 67 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | // +k8s:deepcopy-gen=package 2 | // +groupName=jetstream.nats.io 3 | 4 | // Package v1 is the v1 version of the API. 5 | package v1beta2 6 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/keyvaluetypes.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Stream is a specification for a Stream resource 11 | type KeyValue struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec KeyValueSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (s *KeyValue) GetSpec() interface{} { 20 | return s.Spec 21 | } 22 | 23 | // StreamSpec is the spec for a Stream resource 24 | type KeyValueSpec struct { 25 | Bucket string `json:"bucket"` 26 | Description string `json:"description"` 27 | MaxValueSize int `json:"maxValueSize"` 28 | History int `json:"history"` 29 | TTL string `json:"ttl"` 30 | MaxBytes int `json:"maxBytes"` 31 | Storage string `json:"storage"` 32 | Replicas int `json:"replicas"` 33 | Placement *StreamPlacement `json:"placement"` 34 | RePublish *RePublish `json:"republish"` 35 | Mirror *StreamSource `json:"mirror"` 36 | Sources []*StreamSource `json:"sources"` 37 | Compression bool `json:"compression"` 38 | BaseStreamConfig 39 | } 40 | 41 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 42 | 43 | // KeyValueList is a list of Stream resources 44 | type KeyValueList struct { 45 | k8smeta.TypeMeta `json:",inline"` 46 | k8smeta.ListMeta `json:"metadata"` 47 | 48 | Items []KeyValue `json:"items"` 49 | } 50 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/objectstoretypes.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Stream is a specification for a Stream resource 11 | type ObjectStore struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec ObjectStoreSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (s *ObjectStore) GetSpec() interface{} { 20 | return s.Spec 21 | } 22 | 23 | // StreamSpec is the spec for a Stream resource 24 | type ObjectStoreSpec struct { 25 | Bucket string `json:"bucket"` 26 | Description string `json:"description"` 27 | TTL string `json:"ttl"` 28 | MaxBytes int `json:"maxBytes"` 29 | Storage string `json:"storage"` 30 | Replicas int `json:"replicas"` 31 | Placement *StreamPlacement `json:"placement"` 32 | Compression bool `json:"compression"` 33 | Metadata map[string]string `json:"metadata"` 34 | BaseStreamConfig 35 | } 36 | 37 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 38 | 39 | // ObjectStoreList is a list of Stream resources 40 | type ObjectStoreList struct { 41 | k8smeta.TypeMeta `json:",inline"` 42 | k8smeta.ListMeta `json:"metadata"` 43 | 44 | Items []ObjectStore `json:"items"` 45 | } 46 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/register.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | 8 | "github.com/nats-io/nack/pkg/jetstream/apis/jetstream" 9 | ) 10 | 11 | var ( 12 | // SchemeGroupVersion is group version used to register these objects 13 | SchemeGroupVersion = schema.GroupVersion{Group: jetstream.GroupName, Version: "v1beta2"} 14 | 15 | // SchemeBuilder initializes a scheme builder 16 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 17 | // AddToScheme is a global function that registers this API group & version to a scheme 18 | AddToScheme = SchemeBuilder.AddToScheme 19 | ) 20 | 21 | // Kind takes an unqualified kind and returns back a Group qualified GroupKind 22 | func Kind(kind string) schema.GroupKind { 23 | return SchemeGroupVersion.WithKind(kind).GroupKind() 24 | } 25 | 26 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 27 | func Resource(resource string) schema.GroupResource { 28 | return SchemeGroupVersion.WithResource(resource).GroupResource() 29 | } 30 | 31 | // Adds the list of known types to Scheme. 32 | func addKnownTypes(scheme *runtime.Scheme) error { 33 | scheme.AddKnownTypes(SchemeGroupVersion, 34 | &Stream{}, 35 | &StreamList{}, 36 | &KeyValue{}, 37 | &KeyValueList{}, 38 | &ObjectStore{}, 39 | &ObjectStoreList{}, 40 | &Consumer{}, 41 | &ConsumerList{}, 42 | &Account{}, 43 | &AccountList{}, 44 | ) 45 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion) 46 | return nil 47 | } 48 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/streamtypes.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | k8smeta "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +genclient 8 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 9 | 10 | // Stream is a specification for a Stream resource 11 | type Stream struct { 12 | k8smeta.TypeMeta `json:",inline"` 13 | k8smeta.ObjectMeta `json:"metadata,omitempty"` 14 | 15 | Spec StreamSpec `json:"spec"` 16 | Status Status `json:"status"` 17 | } 18 | 19 | func (s *Stream) GetSpec() interface{} { 20 | return s.Spec 21 | } 22 | 23 | // StreamSpec is the spec for a Stream resource 24 | type StreamSpec struct { 25 | Name string `json:"name"` 26 | Description string `json:"description"` 27 | Subjects []string `json:"subjects"` 28 | Retention string `json:"retention"` 29 | MaxConsumers int `json:"maxConsumers"` 30 | MaxMsgsPerSubject int `json:"maxMsgsPerSubject"` 31 | MaxMsgs int `json:"maxMsgs"` 32 | MaxBytes int `json:"maxBytes"` 33 | MaxAge string `json:"maxAge"` 34 | MaxMsgSize int `json:"maxMsgSize"` 35 | Storage string `json:"storage"` 36 | Discard string `json:"discard"` 37 | Replicas int `json:"replicas"` 38 | NoAck bool `json:"noAck"` 39 | DuplicateWindow string `json:"duplicateWindow"` // Maps to Duplicates 40 | Placement *StreamPlacement `json:"placement"` 41 | Mirror *StreamSource `json:"mirror"` 42 | Sources []*StreamSource `json:"sources"` 43 | Compression string `json:"compression"` 44 | SubjectTransform *SubjectTransform `json:"subjectTransform"` 45 | RePublish *RePublish `json:"republish"` 46 | Sealed bool `json:"sealed"` 47 | DenyDelete bool `json:"denyDelete"` 48 | DenyPurge bool `json:"denyPurge"` 49 | AllowDirect bool `json:"allowDirect"` 50 | AllowRollup bool `json:"allowRollup"` // Maps to RollupAllowed 51 | MirrorDirect bool `json:"mirrorDirect"` 52 | DiscardPerSubject bool `json:"discardPerSubject"` // Maps to DiscardNewPer 53 | FirstSequence uint64 `json:"firstSequence"` // Maps to FirstSeq 54 | Metadata map[string]string `json:"metadata"` 55 | ConsumerLimits *ConsumerLimits `json:"consumerLimits"` 56 | BaseStreamConfig 57 | } 58 | 59 | type SubjectTransform struct { 60 | Source string `json:"source"` 61 | Dest string `json:"dest"` 62 | } 63 | 64 | type StreamPlacement struct { 65 | Cluster string `json:"cluster"` 66 | Tags []string `json:"tags"` 67 | } 68 | 69 | type StreamSource struct { 70 | Name string `json:"name"` 71 | OptStartSeq int `json:"optStartSeq"` 72 | OptStartTime string `json:"optStartTime"` 73 | FilterSubject string `json:"filterSubject"` 74 | 75 | ExternalAPIPrefix string `json:"externalApiPrefix"` 76 | ExternalDeliverPrefix string `json:"externalDeliverPrefix"` 77 | 78 | SubjectTransforms []*SubjectTransform `json:"subjectTransforms"` 79 | } 80 | 81 | type RePublish struct { 82 | Source string `json:"source"` 83 | Destination string `json:"destination"` 84 | HeadersOnly bool `json:"headers_only,omitempty"` 85 | } 86 | 87 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 88 | 89 | // StreamList is a list of Stream resources 90 | type StreamList struct { 91 | k8smeta.TypeMeta `json:",inline"` 92 | k8smeta.ListMeta `json:"metadata"` 93 | 94 | Items []Stream `json:"items"` 95 | } 96 | -------------------------------------------------------------------------------- /pkg/jetstream/apis/jetstream/v1beta2/types.go: -------------------------------------------------------------------------------- 1 | package v1beta2 2 | 3 | import ( 4 | k8sapi "k8s.io/api/core/v1" 5 | ) 6 | 7 | type CredentialsSecret struct { 8 | Name string `json:"name"` 9 | Key string `json:"key"` 10 | } 11 | 12 | type Status struct { 13 | ObservedGeneration int64 `json:"observedGeneration"` 14 | Conditions []Condition `json:"conditions"` 15 | } 16 | 17 | type Condition struct { 18 | Type string `json:"type"` 19 | Status k8sapi.ConditionStatus `json:"status"` 20 | Reason string `json:"reason"` 21 | Message string `json:"message"` 22 | LastTransitionTime string `json:"lastTransitionTime"` 23 | } 24 | 25 | type BaseStreamConfig struct { 26 | PreventDelete bool `json:"preventDelete"` 27 | PreventUpdate bool `json:"preventUpdate"` 28 | ConnectionOpts 29 | } 30 | 31 | type ConnectionOpts struct { 32 | Account string `json:"account"` 33 | Creds string `json:"creds"` 34 | Nkey string `json:"nkey"` 35 | Servers []string `json:"servers"` 36 | TLS TLS `json:"tls"` 37 | TLSFirst bool `json:"tlsFirst"` 38 | JsDomain string `json:"jsDomain"` 39 | } 40 | 41 | type ConsumerLimits struct { 42 | InactiveThreshold string `json:"inactiveThreshold"` 43 | MaxAckPending int `json:"maxAckPending"` 44 | } 45 | 46 | type TLS struct { 47 | ClientCert string `json:"clientCert"` 48 | ClientKey string `json:"clientKey"` 49 | RootCAs []string `json:"rootCas"` 50 | } 51 | 52 | type TLSSecret struct { 53 | ClientCert string `json:"cert"` 54 | ClientKey string `json:"key"` 55 | RootCAs string `json:"ca"` 56 | Secret *SecretRef `json:"secret"` 57 | } 58 | 59 | type CredsSecret struct { 60 | File string `json:"file"` 61 | Secret *SecretRef `json:"secret"` 62 | } 63 | 64 | type TokenSecret struct { 65 | Token string `json:"token"` 66 | Secret SecretRef `json:"secret"` 67 | } 68 | 69 | type User struct { 70 | User string `json:"user"` 71 | Password string `json:"password"` 72 | Secret SecretRef `json:"secret"` 73 | } 74 | 75 | type SecretRef struct { 76 | Name string `json:"name"` 77 | } 78 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/internal/internal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package internal 17 | 18 | import ( 19 | fmt "fmt" 20 | sync "sync" 21 | 22 | typed "sigs.k8s.io/structured-merge-diff/v4/typed" 23 | ) 24 | 25 | func Parser() *typed.Parser { 26 | parserOnce.Do(func() { 27 | var err error 28 | parser, err = typed.NewParser(schemaYAML) 29 | if err != nil { 30 | panic(fmt.Sprintf("Failed to parse schema: %v", err)) 31 | } 32 | }) 33 | return parser 34 | } 35 | 36 | var parserOnce sync.Once 37 | var parser *typed.Parser 38 | var schemaYAML = typed.YAMLObject(`types: 39 | - name: __untyped_atomic_ 40 | scalar: untyped 41 | list: 42 | elementType: 43 | namedType: __untyped_atomic_ 44 | elementRelationship: atomic 45 | map: 46 | elementType: 47 | namedType: __untyped_atomic_ 48 | elementRelationship: atomic 49 | - name: __untyped_deduced_ 50 | scalar: untyped 51 | list: 52 | elementType: 53 | namedType: __untyped_atomic_ 54 | elementRelationship: atomic 55 | map: 56 | elementType: 57 | namedType: __untyped_deduced_ 58 | elementRelationship: separable 59 | `) 60 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/accountspec.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // AccountSpecApplyConfiguration represents a declarative configuration of the AccountSpec type for use 19 | // with apply. 20 | type AccountSpecApplyConfiguration struct { 21 | Servers []string `json:"servers,omitempty"` 22 | TLS *TLSSecretApplyConfiguration `json:"tls,omitempty"` 23 | Creds *CredsSecretApplyConfiguration `json:"creds,omitempty"` 24 | Token *TokenSecretApplyConfiguration `json:"token,omitempty"` 25 | User *UserApplyConfiguration `json:"user,omitempty"` 26 | } 27 | 28 | // AccountSpecApplyConfiguration constructs a declarative configuration of the AccountSpec type for use with 29 | // apply. 30 | func AccountSpec() *AccountSpecApplyConfiguration { 31 | return &AccountSpecApplyConfiguration{} 32 | } 33 | 34 | // WithServers adds the given value to the Servers field in the declarative configuration 35 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 36 | // If called multiple times, values provided by each call will be appended to the Servers field. 37 | func (b *AccountSpecApplyConfiguration) WithServers(values ...string) *AccountSpecApplyConfiguration { 38 | for i := range values { 39 | b.Servers = append(b.Servers, values[i]) 40 | } 41 | return b 42 | } 43 | 44 | // WithTLS sets the TLS field in the declarative configuration to the given value 45 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 46 | // If called multiple times, the TLS field is set to the value of the last call. 47 | func (b *AccountSpecApplyConfiguration) WithTLS(value *TLSSecretApplyConfiguration) *AccountSpecApplyConfiguration { 48 | b.TLS = value 49 | return b 50 | } 51 | 52 | // WithCreds sets the Creds field in the declarative configuration to the given value 53 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 54 | // If called multiple times, the Creds field is set to the value of the last call. 55 | func (b *AccountSpecApplyConfiguration) WithCreds(value *CredsSecretApplyConfiguration) *AccountSpecApplyConfiguration { 56 | b.Creds = value 57 | return b 58 | } 59 | 60 | // WithToken sets the Token field in the declarative configuration to the given value 61 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 62 | // If called multiple times, the Token field is set to the value of the last call. 63 | func (b *AccountSpecApplyConfiguration) WithToken(value *TokenSecretApplyConfiguration) *AccountSpecApplyConfiguration { 64 | b.Token = value 65 | return b 66 | } 67 | 68 | // WithUser sets the User field in the declarative configuration to the given value 69 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 70 | // If called multiple times, the User field is set to the value of the last call. 71 | func (b *AccountSpecApplyConfiguration) WithUser(value *UserApplyConfiguration) *AccountSpecApplyConfiguration { 72 | b.User = value 73 | return b 74 | } 75 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/basestreamconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // BaseStreamConfigApplyConfiguration represents a declarative configuration of the BaseStreamConfig type for use 19 | // with apply. 20 | type BaseStreamConfigApplyConfiguration struct { 21 | PreventDelete *bool `json:"preventDelete,omitempty"` 22 | PreventUpdate *bool `json:"preventUpdate,omitempty"` 23 | } 24 | 25 | // BaseStreamConfigApplyConfiguration constructs a declarative configuration of the BaseStreamConfig type for use with 26 | // apply. 27 | func BaseStreamConfig() *BaseStreamConfigApplyConfiguration { 28 | return &BaseStreamConfigApplyConfiguration{} 29 | } 30 | 31 | // WithPreventDelete sets the PreventDelete field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the PreventDelete field is set to the value of the last call. 34 | func (b *BaseStreamConfigApplyConfiguration) WithPreventDelete(value bool) *BaseStreamConfigApplyConfiguration { 35 | b.PreventDelete = &value 36 | return b 37 | } 38 | 39 | // WithPreventUpdate sets the PreventUpdate field in the declarative configuration to the given value 40 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 41 | // If called multiple times, the PreventUpdate field is set to the value of the last call. 42 | func (b *BaseStreamConfigApplyConfiguration) WithPreventUpdate(value bool) *BaseStreamConfigApplyConfiguration { 43 | b.PreventUpdate = &value 44 | return b 45 | } 46 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/condition.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | v1 "k8s.io/api/core/v1" 20 | ) 21 | 22 | // ConditionApplyConfiguration represents a declarative configuration of the Condition type for use 23 | // with apply. 24 | type ConditionApplyConfiguration struct { 25 | Type *string `json:"type,omitempty"` 26 | Status *v1.ConditionStatus `json:"status,omitempty"` 27 | Reason *string `json:"reason,omitempty"` 28 | Message *string `json:"message,omitempty"` 29 | LastTransitionTime *string `json:"lastTransitionTime,omitempty"` 30 | } 31 | 32 | // ConditionApplyConfiguration constructs a declarative configuration of the Condition type for use with 33 | // apply. 34 | func Condition() *ConditionApplyConfiguration { 35 | return &ConditionApplyConfiguration{} 36 | } 37 | 38 | // WithType sets the Type field in the declarative configuration to the given value 39 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 40 | // If called multiple times, the Type field is set to the value of the last call. 41 | func (b *ConditionApplyConfiguration) WithType(value string) *ConditionApplyConfiguration { 42 | b.Type = &value 43 | return b 44 | } 45 | 46 | // WithStatus sets the Status field in the declarative configuration to the given value 47 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 48 | // If called multiple times, the Status field is set to the value of the last call. 49 | func (b *ConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *ConditionApplyConfiguration { 50 | b.Status = &value 51 | return b 52 | } 53 | 54 | // WithReason sets the Reason field in the declarative configuration to the given value 55 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 56 | // If called multiple times, the Reason field is set to the value of the last call. 57 | func (b *ConditionApplyConfiguration) WithReason(value string) *ConditionApplyConfiguration { 58 | b.Reason = &value 59 | return b 60 | } 61 | 62 | // WithMessage sets the Message field in the declarative configuration to the given value 63 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 64 | // If called multiple times, the Message field is set to the value of the last call. 65 | func (b *ConditionApplyConfiguration) WithMessage(value string) *ConditionApplyConfiguration { 66 | b.Message = &value 67 | return b 68 | } 69 | 70 | // WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value 71 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 72 | // If called multiple times, the LastTransitionTime field is set to the value of the last call. 73 | func (b *ConditionApplyConfiguration) WithLastTransitionTime(value string) *ConditionApplyConfiguration { 74 | b.LastTransitionTime = &value 75 | return b 76 | } 77 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/consumerlimits.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // ConsumerLimitsApplyConfiguration represents a declarative configuration of the ConsumerLimits type for use 19 | // with apply. 20 | type ConsumerLimitsApplyConfiguration struct { 21 | InactiveThreshold *string `json:"inactiveThreshold,omitempty"` 22 | MaxAckPending *int `json:"maxAckPending,omitempty"` 23 | } 24 | 25 | // ConsumerLimitsApplyConfiguration constructs a declarative configuration of the ConsumerLimits type for use with 26 | // apply. 27 | func ConsumerLimits() *ConsumerLimitsApplyConfiguration { 28 | return &ConsumerLimitsApplyConfiguration{} 29 | } 30 | 31 | // WithInactiveThreshold sets the InactiveThreshold field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the InactiveThreshold field is set to the value of the last call. 34 | func (b *ConsumerLimitsApplyConfiguration) WithInactiveThreshold(value string) *ConsumerLimitsApplyConfiguration { 35 | b.InactiveThreshold = &value 36 | return b 37 | } 38 | 39 | // WithMaxAckPending sets the MaxAckPending field in the declarative configuration to the given value 40 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 41 | // If called multiple times, the MaxAckPending field is set to the value of the last call. 42 | func (b *ConsumerLimitsApplyConfiguration) WithMaxAckPending(value int) *ConsumerLimitsApplyConfiguration { 43 | b.MaxAckPending = &value 44 | return b 45 | } 46 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/credssecret.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // CredsSecretApplyConfiguration represents a declarative configuration of the CredsSecret type for use 19 | // with apply. 20 | type CredsSecretApplyConfiguration struct { 21 | File *string `json:"file,omitempty"` 22 | Secret *SecretRefApplyConfiguration `json:"secret,omitempty"` 23 | } 24 | 25 | // CredsSecretApplyConfiguration constructs a declarative configuration of the CredsSecret type for use with 26 | // apply. 27 | func CredsSecret() *CredsSecretApplyConfiguration { 28 | return &CredsSecretApplyConfiguration{} 29 | } 30 | 31 | // WithFile sets the File field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the File field is set to the value of the last call. 34 | func (b *CredsSecretApplyConfiguration) WithFile(value string) *CredsSecretApplyConfiguration { 35 | b.File = &value 36 | return b 37 | } 38 | 39 | // WithSecret sets the Secret field in the declarative configuration to the given value 40 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 41 | // If called multiple times, the Secret field is set to the value of the last call. 42 | func (b *CredsSecretApplyConfiguration) WithSecret(value *SecretRefApplyConfiguration) *CredsSecretApplyConfiguration { 43 | b.Secret = value 44 | return b 45 | } 46 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/republish.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // RePublishApplyConfiguration represents a declarative configuration of the RePublish type for use 19 | // with apply. 20 | type RePublishApplyConfiguration struct { 21 | Source *string `json:"source,omitempty"` 22 | Destination *string `json:"destination,omitempty"` 23 | HeadersOnly *bool `json:"headers_only,omitempty"` 24 | } 25 | 26 | // RePublishApplyConfiguration constructs a declarative configuration of the RePublish type for use with 27 | // apply. 28 | func RePublish() *RePublishApplyConfiguration { 29 | return &RePublishApplyConfiguration{} 30 | } 31 | 32 | // WithSource sets the Source field in the declarative configuration to the given value 33 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 34 | // If called multiple times, the Source field is set to the value of the last call. 35 | func (b *RePublishApplyConfiguration) WithSource(value string) *RePublishApplyConfiguration { 36 | b.Source = &value 37 | return b 38 | } 39 | 40 | // WithDestination sets the Destination field in the declarative configuration to the given value 41 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 42 | // If called multiple times, the Destination field is set to the value of the last call. 43 | func (b *RePublishApplyConfiguration) WithDestination(value string) *RePublishApplyConfiguration { 44 | b.Destination = &value 45 | return b 46 | } 47 | 48 | // WithHeadersOnly sets the HeadersOnly field in the declarative configuration to the given value 49 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 50 | // If called multiple times, the HeadersOnly field is set to the value of the last call. 51 | func (b *RePublishApplyConfiguration) WithHeadersOnly(value bool) *RePublishApplyConfiguration { 52 | b.HeadersOnly = &value 53 | return b 54 | } 55 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/secretref.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // SecretRefApplyConfiguration represents a declarative configuration of the SecretRef type for use 19 | // with apply. 20 | type SecretRefApplyConfiguration struct { 21 | Name *string `json:"name,omitempty"` 22 | } 23 | 24 | // SecretRefApplyConfiguration constructs a declarative configuration of the SecretRef type for use with 25 | // apply. 26 | func SecretRef() *SecretRefApplyConfiguration { 27 | return &SecretRefApplyConfiguration{} 28 | } 29 | 30 | // WithName sets the Name field in the declarative configuration to the given value 31 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 32 | // If called multiple times, the Name field is set to the value of the last call. 33 | func (b *SecretRefApplyConfiguration) WithName(value string) *SecretRefApplyConfiguration { 34 | b.Name = &value 35 | return b 36 | } 37 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/status.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // StatusApplyConfiguration represents a declarative configuration of the Status type for use 19 | // with apply. 20 | type StatusApplyConfiguration struct { 21 | ObservedGeneration *int64 `json:"observedGeneration,omitempty"` 22 | Conditions []ConditionApplyConfiguration `json:"conditions,omitempty"` 23 | } 24 | 25 | // StatusApplyConfiguration constructs a declarative configuration of the Status type for use with 26 | // apply. 27 | func Status() *StatusApplyConfiguration { 28 | return &StatusApplyConfiguration{} 29 | } 30 | 31 | // WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the ObservedGeneration field is set to the value of the last call. 34 | func (b *StatusApplyConfiguration) WithObservedGeneration(value int64) *StatusApplyConfiguration { 35 | b.ObservedGeneration = &value 36 | return b 37 | } 38 | 39 | // WithConditions adds the given value to the Conditions field in the declarative configuration 40 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 41 | // If called multiple times, values provided by each call will be appended to the Conditions field. 42 | func (b *StatusApplyConfiguration) WithConditions(values ...*ConditionApplyConfiguration) *StatusApplyConfiguration { 43 | for i := range values { 44 | if values[i] == nil { 45 | panic("nil value passed to WithConditions") 46 | } 47 | b.Conditions = append(b.Conditions, *values[i]) 48 | } 49 | return b 50 | } 51 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/streamplacement.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // StreamPlacementApplyConfiguration represents a declarative configuration of the StreamPlacement type for use 19 | // with apply. 20 | type StreamPlacementApplyConfiguration struct { 21 | Cluster *string `json:"cluster,omitempty"` 22 | Tags []string `json:"tags,omitempty"` 23 | } 24 | 25 | // StreamPlacementApplyConfiguration constructs a declarative configuration of the StreamPlacement type for use with 26 | // apply. 27 | func StreamPlacement() *StreamPlacementApplyConfiguration { 28 | return &StreamPlacementApplyConfiguration{} 29 | } 30 | 31 | // WithCluster sets the Cluster field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the Cluster field is set to the value of the last call. 34 | func (b *StreamPlacementApplyConfiguration) WithCluster(value string) *StreamPlacementApplyConfiguration { 35 | b.Cluster = &value 36 | return b 37 | } 38 | 39 | // WithTags adds the given value to the Tags field in the declarative configuration 40 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 41 | // If called multiple times, values provided by each call will be appended to the Tags field. 42 | func (b *StreamPlacementApplyConfiguration) WithTags(values ...string) *StreamPlacementApplyConfiguration { 43 | for i := range values { 44 | b.Tags = append(b.Tags, values[i]) 45 | } 46 | return b 47 | } 48 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/subjecttransform.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // SubjectTransformApplyConfiguration represents a declarative configuration of the SubjectTransform type for use 19 | // with apply. 20 | type SubjectTransformApplyConfiguration struct { 21 | Source *string `json:"source,omitempty"` 22 | Dest *string `json:"dest,omitempty"` 23 | } 24 | 25 | // SubjectTransformApplyConfiguration constructs a declarative configuration of the SubjectTransform type for use with 26 | // apply. 27 | func SubjectTransform() *SubjectTransformApplyConfiguration { 28 | return &SubjectTransformApplyConfiguration{} 29 | } 30 | 31 | // WithSource sets the Source field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the Source field is set to the value of the last call. 34 | func (b *SubjectTransformApplyConfiguration) WithSource(value string) *SubjectTransformApplyConfiguration { 35 | b.Source = &value 36 | return b 37 | } 38 | 39 | // WithDest sets the Dest field in the declarative configuration to the given value 40 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 41 | // If called multiple times, the Dest field is set to the value of the last call. 42 | func (b *SubjectTransformApplyConfiguration) WithDest(value string) *SubjectTransformApplyConfiguration { 43 | b.Dest = &value 44 | return b 45 | } 46 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // TLSApplyConfiguration represents a declarative configuration of the TLS type for use 19 | // with apply. 20 | type TLSApplyConfiguration struct { 21 | ClientCert *string `json:"clientCert,omitempty"` 22 | ClientKey *string `json:"clientKey,omitempty"` 23 | RootCAs []string `json:"rootCas,omitempty"` 24 | } 25 | 26 | // TLSApplyConfiguration constructs a declarative configuration of the TLS type for use with 27 | // apply. 28 | func TLS() *TLSApplyConfiguration { 29 | return &TLSApplyConfiguration{} 30 | } 31 | 32 | // WithClientCert sets the ClientCert field in the declarative configuration to the given value 33 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 34 | // If called multiple times, the ClientCert field is set to the value of the last call. 35 | func (b *TLSApplyConfiguration) WithClientCert(value string) *TLSApplyConfiguration { 36 | b.ClientCert = &value 37 | return b 38 | } 39 | 40 | // WithClientKey sets the ClientKey field in the declarative configuration to the given value 41 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 42 | // If called multiple times, the ClientKey field is set to the value of the last call. 43 | func (b *TLSApplyConfiguration) WithClientKey(value string) *TLSApplyConfiguration { 44 | b.ClientKey = &value 45 | return b 46 | } 47 | 48 | // WithRootCAs adds the given value to the RootCAs field in the declarative configuration 49 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 50 | // If called multiple times, values provided by each call will be appended to the RootCAs field. 51 | func (b *TLSApplyConfiguration) WithRootCAs(values ...string) *TLSApplyConfiguration { 52 | for i := range values { 53 | b.RootCAs = append(b.RootCAs, values[i]) 54 | } 55 | return b 56 | } 57 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tlssecret.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // TLSSecretApplyConfiguration represents a declarative configuration of the TLSSecret type for use 19 | // with apply. 20 | type TLSSecretApplyConfiguration struct { 21 | ClientCert *string `json:"cert,omitempty"` 22 | ClientKey *string `json:"key,omitempty"` 23 | RootCAs *string `json:"ca,omitempty"` 24 | Secret *SecretRefApplyConfiguration `json:"secret,omitempty"` 25 | } 26 | 27 | // TLSSecretApplyConfiguration constructs a declarative configuration of the TLSSecret type for use with 28 | // apply. 29 | func TLSSecret() *TLSSecretApplyConfiguration { 30 | return &TLSSecretApplyConfiguration{} 31 | } 32 | 33 | // WithClientCert sets the ClientCert field in the declarative configuration to the given value 34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 35 | // If called multiple times, the ClientCert field is set to the value of the last call. 36 | func (b *TLSSecretApplyConfiguration) WithClientCert(value string) *TLSSecretApplyConfiguration { 37 | b.ClientCert = &value 38 | return b 39 | } 40 | 41 | // WithClientKey sets the ClientKey field in the declarative configuration to the given value 42 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 43 | // If called multiple times, the ClientKey field is set to the value of the last call. 44 | func (b *TLSSecretApplyConfiguration) WithClientKey(value string) *TLSSecretApplyConfiguration { 45 | b.ClientKey = &value 46 | return b 47 | } 48 | 49 | // WithRootCAs sets the RootCAs field in the declarative configuration to the given value 50 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 51 | // If called multiple times, the RootCAs field is set to the value of the last call. 52 | func (b *TLSSecretApplyConfiguration) WithRootCAs(value string) *TLSSecretApplyConfiguration { 53 | b.RootCAs = &value 54 | return b 55 | } 56 | 57 | // WithSecret sets the Secret field in the declarative configuration to the given value 58 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 59 | // If called multiple times, the Secret field is set to the value of the last call. 60 | func (b *TLSSecretApplyConfiguration) WithSecret(value *SecretRefApplyConfiguration) *TLSSecretApplyConfiguration { 61 | b.Secret = value 62 | return b 63 | } 64 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/tokensecret.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // TokenSecretApplyConfiguration represents a declarative configuration of the TokenSecret type for use 19 | // with apply. 20 | type TokenSecretApplyConfiguration struct { 21 | Token *string `json:"token,omitempty"` 22 | Secret *SecretRefApplyConfiguration `json:"secret,omitempty"` 23 | } 24 | 25 | // TokenSecretApplyConfiguration constructs a declarative configuration of the TokenSecret type for use with 26 | // apply. 27 | func TokenSecret() *TokenSecretApplyConfiguration { 28 | return &TokenSecretApplyConfiguration{} 29 | } 30 | 31 | // WithToken sets the Token field in the declarative configuration to the given value 32 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 33 | // If called multiple times, the Token field is set to the value of the last call. 34 | func (b *TokenSecretApplyConfiguration) WithToken(value string) *TokenSecretApplyConfiguration { 35 | b.Token = &value 36 | return b 37 | } 38 | 39 | // WithSecret sets the Secret field in the declarative configuration to the given value 40 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 41 | // If called multiple times, the Secret field is set to the value of the last call. 42 | func (b *TokenSecretApplyConfiguration) WithSecret(value *SecretRefApplyConfiguration) *TokenSecretApplyConfiguration { 43 | b.Secret = value 44 | return b 45 | } 46 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2/user.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // UserApplyConfiguration represents a declarative configuration of the User type for use 19 | // with apply. 20 | type UserApplyConfiguration struct { 21 | User *string `json:"user,omitempty"` 22 | Password *string `json:"password,omitempty"` 23 | Secret *SecretRefApplyConfiguration `json:"secret,omitempty"` 24 | } 25 | 26 | // UserApplyConfiguration constructs a declarative configuration of the User type for use with 27 | // apply. 28 | func User() *UserApplyConfiguration { 29 | return &UserApplyConfiguration{} 30 | } 31 | 32 | // WithUser sets the User field in the declarative configuration to the given value 33 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 34 | // If called multiple times, the User field is set to the value of the last call. 35 | func (b *UserApplyConfiguration) WithUser(value string) *UserApplyConfiguration { 36 | b.User = &value 37 | return b 38 | } 39 | 40 | // WithPassword sets the Password field in the declarative configuration to the given value 41 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 42 | // If called multiple times, the Password field is set to the value of the last call. 43 | func (b *UserApplyConfiguration) WithPassword(value string) *UserApplyConfiguration { 44 | b.Password = &value 45 | return b 46 | } 47 | 48 | // WithSecret sets the Secret field in the declarative configuration to the given value 49 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 50 | // If called multiple times, the Secret field is set to the value of the last call. 51 | func (b *UserApplyConfiguration) WithSecret(value *SecretRefApplyConfiguration) *UserApplyConfiguration { 52 | b.Secret = value 53 | return b 54 | } 55 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/applyconfiguration/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 15 | 16 | package applyconfiguration 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | internal "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/internal" 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 22 | runtime "k8s.io/apimachinery/pkg/runtime" 23 | schema "k8s.io/apimachinery/pkg/runtime/schema" 24 | testing "k8s.io/client-go/testing" 25 | ) 26 | 27 | // ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no 28 | // apply configuration type exists for the given GroupVersionKind. 29 | func ForKind(kind schema.GroupVersionKind) interface{} { 30 | switch kind { 31 | // Group=jetstream.nats.io, Version=v1beta2 32 | case v1beta2.SchemeGroupVersion.WithKind("Account"): 33 | return &jetstreamv1beta2.AccountApplyConfiguration{} 34 | case v1beta2.SchemeGroupVersion.WithKind("AccountSpec"): 35 | return &jetstreamv1beta2.AccountSpecApplyConfiguration{} 36 | case v1beta2.SchemeGroupVersion.WithKind("BaseStreamConfig"): 37 | return &jetstreamv1beta2.BaseStreamConfigApplyConfiguration{} 38 | case v1beta2.SchemeGroupVersion.WithKind("Condition"): 39 | return &jetstreamv1beta2.ConditionApplyConfiguration{} 40 | case v1beta2.SchemeGroupVersion.WithKind("ConnectionOpts"): 41 | return &jetstreamv1beta2.ConnectionOptsApplyConfiguration{} 42 | case v1beta2.SchemeGroupVersion.WithKind("Consumer"): 43 | return &jetstreamv1beta2.ConsumerApplyConfiguration{} 44 | case v1beta2.SchemeGroupVersion.WithKind("ConsumerLimits"): 45 | return &jetstreamv1beta2.ConsumerLimitsApplyConfiguration{} 46 | case v1beta2.SchemeGroupVersion.WithKind("ConsumerSpec"): 47 | return &jetstreamv1beta2.ConsumerSpecApplyConfiguration{} 48 | case v1beta2.SchemeGroupVersion.WithKind("CredsSecret"): 49 | return &jetstreamv1beta2.CredsSecretApplyConfiguration{} 50 | case v1beta2.SchemeGroupVersion.WithKind("KeyValue"): 51 | return &jetstreamv1beta2.KeyValueApplyConfiguration{} 52 | case v1beta2.SchemeGroupVersion.WithKind("KeyValueSpec"): 53 | return &jetstreamv1beta2.KeyValueSpecApplyConfiguration{} 54 | case v1beta2.SchemeGroupVersion.WithKind("ObjectStore"): 55 | return &jetstreamv1beta2.ObjectStoreApplyConfiguration{} 56 | case v1beta2.SchemeGroupVersion.WithKind("ObjectStoreSpec"): 57 | return &jetstreamv1beta2.ObjectStoreSpecApplyConfiguration{} 58 | case v1beta2.SchemeGroupVersion.WithKind("RePublish"): 59 | return &jetstreamv1beta2.RePublishApplyConfiguration{} 60 | case v1beta2.SchemeGroupVersion.WithKind("SecretRef"): 61 | return &jetstreamv1beta2.SecretRefApplyConfiguration{} 62 | case v1beta2.SchemeGroupVersion.WithKind("Status"): 63 | return &jetstreamv1beta2.StatusApplyConfiguration{} 64 | case v1beta2.SchemeGroupVersion.WithKind("Stream"): 65 | return &jetstreamv1beta2.StreamApplyConfiguration{} 66 | case v1beta2.SchemeGroupVersion.WithKind("StreamPlacement"): 67 | return &jetstreamv1beta2.StreamPlacementApplyConfiguration{} 68 | case v1beta2.SchemeGroupVersion.WithKind("StreamSource"): 69 | return &jetstreamv1beta2.StreamSourceApplyConfiguration{} 70 | case v1beta2.SchemeGroupVersion.WithKind("StreamSpec"): 71 | return &jetstreamv1beta2.StreamSpecApplyConfiguration{} 72 | case v1beta2.SchemeGroupVersion.WithKind("SubjectTransform"): 73 | return &jetstreamv1beta2.SubjectTransformApplyConfiguration{} 74 | case v1beta2.SchemeGroupVersion.WithKind("TLS"): 75 | return &jetstreamv1beta2.TLSApplyConfiguration{} 76 | case v1beta2.SchemeGroupVersion.WithKind("TLSSecret"): 77 | return &jetstreamv1beta2.TLSSecretApplyConfiguration{} 78 | case v1beta2.SchemeGroupVersion.WithKind("TokenSecret"): 79 | return &jetstreamv1beta2.TokenSecretApplyConfiguration{} 80 | case v1beta2.SchemeGroupVersion.WithKind("User"): 81 | return &jetstreamv1beta2.UserApplyConfiguration{} 82 | 83 | } 84 | return nil 85 | } 86 | 87 | func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { 88 | return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} 89 | } 90 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/clientset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package versioned 17 | 18 | import ( 19 | fmt "fmt" 20 | http "net/http" 21 | 22 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 23 | discovery "k8s.io/client-go/discovery" 24 | rest "k8s.io/client-go/rest" 25 | flowcontrol "k8s.io/client-go/util/flowcontrol" 26 | ) 27 | 28 | type Interface interface { 29 | Discovery() discovery.DiscoveryInterface 30 | JetstreamV1beta2() jetstreamv1beta2.JetstreamV1beta2Interface 31 | } 32 | 33 | // Clientset contains the clients for groups. 34 | type Clientset struct { 35 | *discovery.DiscoveryClient 36 | jetstreamV1beta2 *jetstreamv1beta2.JetstreamV1beta2Client 37 | } 38 | 39 | // JetstreamV1beta2 retrieves the JetstreamV1beta2Client 40 | func (c *Clientset) JetstreamV1beta2() jetstreamv1beta2.JetstreamV1beta2Interface { 41 | return c.jetstreamV1beta2 42 | } 43 | 44 | // Discovery retrieves the DiscoveryClient 45 | func (c *Clientset) Discovery() discovery.DiscoveryInterface { 46 | if c == nil { 47 | return nil 48 | } 49 | return c.DiscoveryClient 50 | } 51 | 52 | // NewForConfig creates a new Clientset for the given config. 53 | // If config's RateLimiter is not set and QPS and Burst are acceptable, 54 | // NewForConfig will generate a rate-limiter in configShallowCopy. 55 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 56 | // where httpClient was generated with rest.HTTPClientFor(c). 57 | func NewForConfig(c *rest.Config) (*Clientset, error) { 58 | configShallowCopy := *c 59 | 60 | if configShallowCopy.UserAgent == "" { 61 | configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() 62 | } 63 | 64 | // share the transport between all clients 65 | httpClient, err := rest.HTTPClientFor(&configShallowCopy) 66 | if err != nil { 67 | return nil, err 68 | } 69 | 70 | return NewForConfigAndClient(&configShallowCopy, httpClient) 71 | } 72 | 73 | // NewForConfigAndClient creates a new Clientset for the given config and http client. 74 | // Note the http client provided takes precedence over the configured transport values. 75 | // If config's RateLimiter is not set and QPS and Burst are acceptable, 76 | // NewForConfigAndClient will generate a rate-limiter in configShallowCopy. 77 | func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { 78 | configShallowCopy := *c 79 | if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { 80 | if configShallowCopy.Burst <= 0 { 81 | 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") 82 | } 83 | configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) 84 | } 85 | 86 | var cs Clientset 87 | var err error 88 | cs.jetstreamV1beta2, err = jetstreamv1beta2.NewForConfigAndClient(&configShallowCopy, httpClient) 89 | if err != nil { 90 | return nil, err 91 | } 92 | 93 | cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) 94 | if err != nil { 95 | return nil, err 96 | } 97 | return &cs, nil 98 | } 99 | 100 | // NewForConfigOrDie creates a new Clientset for the given config and 101 | // panics if there is an error in the config. 102 | func NewForConfigOrDie(c *rest.Config) *Clientset { 103 | cs, err := NewForConfig(c) 104 | if err != nil { 105 | panic(err) 106 | } 107 | return cs 108 | } 109 | 110 | // New creates a new Clientset for the given RESTClient. 111 | func New(c rest.Interface) *Clientset { 112 | var cs Clientset 113 | cs.jetstreamV1beta2 = jetstreamv1beta2.New(c) 114 | 115 | cs.DiscoveryClient = discovery.NewDiscoveryClient(c) 116 | return &cs 117 | } 118 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | // This package has the automatically generated fake clientset. 17 | package fake 18 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/fake/register.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | runtime "k8s.io/apimachinery/pkg/runtime" 22 | schema "k8s.io/apimachinery/pkg/runtime/schema" 23 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 24 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 25 | ) 26 | 27 | var scheme = runtime.NewScheme() 28 | var codecs = serializer.NewCodecFactory(scheme) 29 | 30 | var localSchemeBuilder = runtime.SchemeBuilder{ 31 | jetstreamv1beta2.AddToScheme, 32 | } 33 | 34 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 35 | // of clientsets, like in: 36 | // 37 | // import ( 38 | // "k8s.io/client-go/kubernetes" 39 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 40 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 41 | // ) 42 | // 43 | // kclientset, _ := kubernetes.NewForConfig(c) 44 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 45 | // 46 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 47 | // correctly. 48 | var AddToScheme = localSchemeBuilder.AddToScheme 49 | 50 | func init() { 51 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 52 | utilruntime.Must(AddToScheme(scheme)) 53 | } 54 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | // This package contains the scheme of the automatically generated clientset. 17 | package scheme 18 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/scheme/register.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package scheme 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | runtime "k8s.io/apimachinery/pkg/runtime" 22 | schema "k8s.io/apimachinery/pkg/runtime/schema" 23 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 24 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 25 | ) 26 | 27 | var Scheme = runtime.NewScheme() 28 | var Codecs = serializer.NewCodecFactory(Scheme) 29 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 30 | var localSchemeBuilder = runtime.SchemeBuilder{ 31 | jetstreamv1beta2.AddToScheme, 32 | } 33 | 34 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 35 | // of clientsets, like in: 36 | // 37 | // import ( 38 | // "k8s.io/client-go/kubernetes" 39 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 40 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 41 | // ) 42 | // 43 | // kclientset, _ := kubernetes.NewForConfig(c) 44 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 45 | // 46 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 47 | // correctly. 48 | var AddToScheme = localSchemeBuilder.AddToScheme 49 | 50 | func init() { 51 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 52 | utilruntime.Must(AddToScheme(Scheme)) 53 | } 54 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/account.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | context "context" 20 | 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | applyconfigurationjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 23 | scheme "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/scheme" 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | types "k8s.io/apimachinery/pkg/types" 26 | watch "k8s.io/apimachinery/pkg/watch" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // AccountsGetter has a method to return a AccountInterface. 31 | // A group's client should implement this interface. 32 | type AccountsGetter interface { 33 | Accounts(namespace string) AccountInterface 34 | } 35 | 36 | // AccountInterface has methods to work with Account resources. 37 | type AccountInterface interface { 38 | Create(ctx context.Context, account *jetstreamv1beta2.Account, opts v1.CreateOptions) (*jetstreamv1beta2.Account, error) 39 | Update(ctx context.Context, account *jetstreamv1beta2.Account, opts v1.UpdateOptions) (*jetstreamv1beta2.Account, error) 40 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 41 | UpdateStatus(ctx context.Context, account *jetstreamv1beta2.Account, opts v1.UpdateOptions) (*jetstreamv1beta2.Account, error) 42 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 43 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 44 | Get(ctx context.Context, name string, opts v1.GetOptions) (*jetstreamv1beta2.Account, error) 45 | List(ctx context.Context, opts v1.ListOptions) (*jetstreamv1beta2.AccountList, error) 46 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 47 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *jetstreamv1beta2.Account, err error) 48 | Apply(ctx context.Context, account *applyconfigurationjetstreamv1beta2.AccountApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.Account, err error) 49 | // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). 50 | ApplyStatus(ctx context.Context, account *applyconfigurationjetstreamv1beta2.AccountApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.Account, err error) 51 | AccountExpansion 52 | } 53 | 54 | // accounts implements AccountInterface 55 | type accounts struct { 56 | *gentype.ClientWithListAndApply[*jetstreamv1beta2.Account, *jetstreamv1beta2.AccountList, *applyconfigurationjetstreamv1beta2.AccountApplyConfiguration] 57 | } 58 | 59 | // newAccounts returns a Accounts 60 | func newAccounts(c *JetstreamV1beta2Client, namespace string) *accounts { 61 | return &accounts{ 62 | gentype.NewClientWithListAndApply[*jetstreamv1beta2.Account, *jetstreamv1beta2.AccountList, *applyconfigurationjetstreamv1beta2.AccountApplyConfiguration]( 63 | "accounts", 64 | c.RESTClient(), 65 | scheme.ParameterCodec, 66 | namespace, 67 | func() *jetstreamv1beta2.Account { return &jetstreamv1beta2.Account{} }, 68 | func() *jetstreamv1beta2.AccountList { return &jetstreamv1beta2.AccountList{} }, 69 | ), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/consumer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | context "context" 20 | 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | applyconfigurationjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 23 | scheme "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/scheme" 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | types "k8s.io/apimachinery/pkg/types" 26 | watch "k8s.io/apimachinery/pkg/watch" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // ConsumersGetter has a method to return a ConsumerInterface. 31 | // A group's client should implement this interface. 32 | type ConsumersGetter interface { 33 | Consumers(namespace string) ConsumerInterface 34 | } 35 | 36 | // ConsumerInterface has methods to work with Consumer resources. 37 | type ConsumerInterface interface { 38 | Create(ctx context.Context, consumer *jetstreamv1beta2.Consumer, opts v1.CreateOptions) (*jetstreamv1beta2.Consumer, error) 39 | Update(ctx context.Context, consumer *jetstreamv1beta2.Consumer, opts v1.UpdateOptions) (*jetstreamv1beta2.Consumer, error) 40 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 41 | UpdateStatus(ctx context.Context, consumer *jetstreamv1beta2.Consumer, opts v1.UpdateOptions) (*jetstreamv1beta2.Consumer, error) 42 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 43 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 44 | Get(ctx context.Context, name string, opts v1.GetOptions) (*jetstreamv1beta2.Consumer, error) 45 | List(ctx context.Context, opts v1.ListOptions) (*jetstreamv1beta2.ConsumerList, error) 46 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 47 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *jetstreamv1beta2.Consumer, err error) 48 | Apply(ctx context.Context, consumer *applyconfigurationjetstreamv1beta2.ConsumerApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.Consumer, err error) 49 | // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). 50 | ApplyStatus(ctx context.Context, consumer *applyconfigurationjetstreamv1beta2.ConsumerApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.Consumer, err error) 51 | ConsumerExpansion 52 | } 53 | 54 | // consumers implements ConsumerInterface 55 | type consumers struct { 56 | *gentype.ClientWithListAndApply[*jetstreamv1beta2.Consumer, *jetstreamv1beta2.ConsumerList, *applyconfigurationjetstreamv1beta2.ConsumerApplyConfiguration] 57 | } 58 | 59 | // newConsumers returns a Consumers 60 | func newConsumers(c *JetstreamV1beta2Client, namespace string) *consumers { 61 | return &consumers{ 62 | gentype.NewClientWithListAndApply[*jetstreamv1beta2.Consumer, *jetstreamv1beta2.ConsumerList, *applyconfigurationjetstreamv1beta2.ConsumerApplyConfiguration]( 63 | "consumers", 64 | c.RESTClient(), 65 | scheme.ParameterCodec, 66 | namespace, 67 | func() *jetstreamv1beta2.Consumer { return &jetstreamv1beta2.Consumer{} }, 68 | func() *jetstreamv1beta2.ConsumerList { return &jetstreamv1beta2.ConsumerList{} }, 69 | ), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | // This package has the automatically generated typed clients. 17 | package v1beta2 18 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | // Package fake has the automatically generated clients. 17 | package fake 18 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_account.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 21 | typedjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 22 | gentype "k8s.io/client-go/gentype" 23 | ) 24 | 25 | // fakeAccounts implements AccountInterface 26 | type fakeAccounts struct { 27 | *gentype.FakeClientWithListAndApply[*v1beta2.Account, *v1beta2.AccountList, *jetstreamv1beta2.AccountApplyConfiguration] 28 | Fake *FakeJetstreamV1beta2 29 | } 30 | 31 | func newFakeAccounts(fake *FakeJetstreamV1beta2, namespace string) typedjetstreamv1beta2.AccountInterface { 32 | return &fakeAccounts{ 33 | gentype.NewFakeClientWithListAndApply[*v1beta2.Account, *v1beta2.AccountList, *jetstreamv1beta2.AccountApplyConfiguration]( 34 | fake.Fake, 35 | namespace, 36 | v1beta2.SchemeGroupVersion.WithResource("accounts"), 37 | v1beta2.SchemeGroupVersion.WithKind("Account"), 38 | func() *v1beta2.Account { return &v1beta2.Account{} }, 39 | func() *v1beta2.AccountList { return &v1beta2.AccountList{} }, 40 | func(dst, src *v1beta2.AccountList) { dst.ListMeta = src.ListMeta }, 41 | func(list *v1beta2.AccountList) []*v1beta2.Account { return gentype.ToPointerSlice(list.Items) }, 42 | func(list *v1beta2.AccountList, items []*v1beta2.Account) { 43 | list.Items = gentype.FromPointerSlice(items) 44 | }, 45 | ), 46 | fake, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_consumer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 21 | typedjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 22 | gentype "k8s.io/client-go/gentype" 23 | ) 24 | 25 | // fakeConsumers implements ConsumerInterface 26 | type fakeConsumers struct { 27 | *gentype.FakeClientWithListAndApply[*v1beta2.Consumer, *v1beta2.ConsumerList, *jetstreamv1beta2.ConsumerApplyConfiguration] 28 | Fake *FakeJetstreamV1beta2 29 | } 30 | 31 | func newFakeConsumers(fake *FakeJetstreamV1beta2, namespace string) typedjetstreamv1beta2.ConsumerInterface { 32 | return &fakeConsumers{ 33 | gentype.NewFakeClientWithListAndApply[*v1beta2.Consumer, *v1beta2.ConsumerList, *jetstreamv1beta2.ConsumerApplyConfiguration]( 34 | fake.Fake, 35 | namespace, 36 | v1beta2.SchemeGroupVersion.WithResource("consumers"), 37 | v1beta2.SchemeGroupVersion.WithKind("Consumer"), 38 | func() *v1beta2.Consumer { return &v1beta2.Consumer{} }, 39 | func() *v1beta2.ConsumerList { return &v1beta2.ConsumerList{} }, 40 | func(dst, src *v1beta2.ConsumerList) { dst.ListMeta = src.ListMeta }, 41 | func(list *v1beta2.ConsumerList) []*v1beta2.Consumer { return gentype.ToPointerSlice(list.Items) }, 42 | func(list *v1beta2.ConsumerList, items []*v1beta2.Consumer) { 43 | list.Items = gentype.FromPointerSlice(items) 44 | }, 45 | ), 46 | fake, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_jetstream_client.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 20 | rest "k8s.io/client-go/rest" 21 | testing "k8s.io/client-go/testing" 22 | ) 23 | 24 | type FakeJetstreamV1beta2 struct { 25 | *testing.Fake 26 | } 27 | 28 | func (c *FakeJetstreamV1beta2) Accounts(namespace string) v1beta2.AccountInterface { 29 | return newFakeAccounts(c, namespace) 30 | } 31 | 32 | func (c *FakeJetstreamV1beta2) Consumers(namespace string) v1beta2.ConsumerInterface { 33 | return newFakeConsumers(c, namespace) 34 | } 35 | 36 | func (c *FakeJetstreamV1beta2) KeyValues(namespace string) v1beta2.KeyValueInterface { 37 | return newFakeKeyValues(c, namespace) 38 | } 39 | 40 | func (c *FakeJetstreamV1beta2) ObjectStores(namespace string) v1beta2.ObjectStoreInterface { 41 | return newFakeObjectStores(c, namespace) 42 | } 43 | 44 | func (c *FakeJetstreamV1beta2) Streams(namespace string) v1beta2.StreamInterface { 45 | return newFakeStreams(c, namespace) 46 | } 47 | 48 | // RESTClient returns a RESTClient that is used to communicate 49 | // with API server by this client implementation. 50 | func (c *FakeJetstreamV1beta2) RESTClient() rest.Interface { 51 | var ret *rest.RESTClient 52 | return ret 53 | } 54 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_keyvalue.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 21 | typedjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 22 | gentype "k8s.io/client-go/gentype" 23 | ) 24 | 25 | // fakeKeyValues implements KeyValueInterface 26 | type fakeKeyValues struct { 27 | *gentype.FakeClientWithListAndApply[*v1beta2.KeyValue, *v1beta2.KeyValueList, *jetstreamv1beta2.KeyValueApplyConfiguration] 28 | Fake *FakeJetstreamV1beta2 29 | } 30 | 31 | func newFakeKeyValues(fake *FakeJetstreamV1beta2, namespace string) typedjetstreamv1beta2.KeyValueInterface { 32 | return &fakeKeyValues{ 33 | gentype.NewFakeClientWithListAndApply[*v1beta2.KeyValue, *v1beta2.KeyValueList, *jetstreamv1beta2.KeyValueApplyConfiguration]( 34 | fake.Fake, 35 | namespace, 36 | v1beta2.SchemeGroupVersion.WithResource("keyvalues"), 37 | v1beta2.SchemeGroupVersion.WithKind("KeyValue"), 38 | func() *v1beta2.KeyValue { return &v1beta2.KeyValue{} }, 39 | func() *v1beta2.KeyValueList { return &v1beta2.KeyValueList{} }, 40 | func(dst, src *v1beta2.KeyValueList) { dst.ListMeta = src.ListMeta }, 41 | func(list *v1beta2.KeyValueList) []*v1beta2.KeyValue { return gentype.ToPointerSlice(list.Items) }, 42 | func(list *v1beta2.KeyValueList, items []*v1beta2.KeyValue) { 43 | list.Items = gentype.FromPointerSlice(items) 44 | }, 45 | ), 46 | fake, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_objectstore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 21 | typedjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 22 | gentype "k8s.io/client-go/gentype" 23 | ) 24 | 25 | // fakeObjectStores implements ObjectStoreInterface 26 | type fakeObjectStores struct { 27 | *gentype.FakeClientWithListAndApply[*v1beta2.ObjectStore, *v1beta2.ObjectStoreList, *jetstreamv1beta2.ObjectStoreApplyConfiguration] 28 | Fake *FakeJetstreamV1beta2 29 | } 30 | 31 | func newFakeObjectStores(fake *FakeJetstreamV1beta2, namespace string) typedjetstreamv1beta2.ObjectStoreInterface { 32 | return &fakeObjectStores{ 33 | gentype.NewFakeClientWithListAndApply[*v1beta2.ObjectStore, *v1beta2.ObjectStoreList, *jetstreamv1beta2.ObjectStoreApplyConfiguration]( 34 | fake.Fake, 35 | namespace, 36 | v1beta2.SchemeGroupVersion.WithResource("objectstores"), 37 | v1beta2.SchemeGroupVersion.WithKind("ObjectStore"), 38 | func() *v1beta2.ObjectStore { return &v1beta2.ObjectStore{} }, 39 | func() *v1beta2.ObjectStoreList { return &v1beta2.ObjectStoreList{} }, 40 | func(dst, src *v1beta2.ObjectStoreList) { dst.ListMeta = src.ListMeta }, 41 | func(list *v1beta2.ObjectStoreList) []*v1beta2.ObjectStore { return gentype.ToPointerSlice(list.Items) }, 42 | func(list *v1beta2.ObjectStoreList, items []*v1beta2.ObjectStore) { 43 | list.Items = gentype.FromPointerSlice(items) 44 | }, 45 | ), 46 | fake, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/fake/fake_stream.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package fake 17 | 18 | import ( 19 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 21 | typedjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2" 22 | gentype "k8s.io/client-go/gentype" 23 | ) 24 | 25 | // fakeStreams implements StreamInterface 26 | type fakeStreams struct { 27 | *gentype.FakeClientWithListAndApply[*v1beta2.Stream, *v1beta2.StreamList, *jetstreamv1beta2.StreamApplyConfiguration] 28 | Fake *FakeJetstreamV1beta2 29 | } 30 | 31 | func newFakeStreams(fake *FakeJetstreamV1beta2, namespace string) typedjetstreamv1beta2.StreamInterface { 32 | return &fakeStreams{ 33 | gentype.NewFakeClientWithListAndApply[*v1beta2.Stream, *v1beta2.StreamList, *jetstreamv1beta2.StreamApplyConfiguration]( 34 | fake.Fake, 35 | namespace, 36 | v1beta2.SchemeGroupVersion.WithResource("streams"), 37 | v1beta2.SchemeGroupVersion.WithKind("Stream"), 38 | func() *v1beta2.Stream { return &v1beta2.Stream{} }, 39 | func() *v1beta2.StreamList { return &v1beta2.StreamList{} }, 40 | func(dst, src *v1beta2.StreamList) { dst.ListMeta = src.ListMeta }, 41 | func(list *v1beta2.StreamList) []*v1beta2.Stream { return gentype.ToPointerSlice(list.Items) }, 42 | func(list *v1beta2.StreamList, items []*v1beta2.Stream) { list.Items = gentype.FromPointerSlice(items) }, 43 | ), 44 | fake, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | type AccountExpansion interface{} 19 | 20 | type ConsumerExpansion interface{} 21 | 22 | type KeyValueExpansion interface{} 23 | 24 | type ObjectStoreExpansion interface{} 25 | 26 | type StreamExpansion interface{} 27 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/jetstream_client.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | http "net/http" 20 | 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | scheme "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/scheme" 23 | rest "k8s.io/client-go/rest" 24 | ) 25 | 26 | type JetstreamV1beta2Interface interface { 27 | RESTClient() rest.Interface 28 | AccountsGetter 29 | ConsumersGetter 30 | KeyValuesGetter 31 | ObjectStoresGetter 32 | StreamsGetter 33 | } 34 | 35 | // JetstreamV1beta2Client is used to interact with features provided by the jetstream.nats.io group. 36 | type JetstreamV1beta2Client struct { 37 | restClient rest.Interface 38 | } 39 | 40 | func (c *JetstreamV1beta2Client) Accounts(namespace string) AccountInterface { 41 | return newAccounts(c, namespace) 42 | } 43 | 44 | func (c *JetstreamV1beta2Client) Consumers(namespace string) ConsumerInterface { 45 | return newConsumers(c, namespace) 46 | } 47 | 48 | func (c *JetstreamV1beta2Client) KeyValues(namespace string) KeyValueInterface { 49 | return newKeyValues(c, namespace) 50 | } 51 | 52 | func (c *JetstreamV1beta2Client) ObjectStores(namespace string) ObjectStoreInterface { 53 | return newObjectStores(c, namespace) 54 | } 55 | 56 | func (c *JetstreamV1beta2Client) Streams(namespace string) StreamInterface { 57 | return newStreams(c, namespace) 58 | } 59 | 60 | // NewForConfig creates a new JetstreamV1beta2Client for the given config. 61 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 62 | // where httpClient was generated with rest.HTTPClientFor(c). 63 | func NewForConfig(c *rest.Config) (*JetstreamV1beta2Client, error) { 64 | config := *c 65 | setConfigDefaults(&config) 66 | httpClient, err := rest.HTTPClientFor(&config) 67 | if err != nil { 68 | return nil, err 69 | } 70 | return NewForConfigAndClient(&config, httpClient) 71 | } 72 | 73 | // NewForConfigAndClient creates a new JetstreamV1beta2Client for the given config and http client. 74 | // Note the http client provided takes precedence over the configured transport values. 75 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*JetstreamV1beta2Client, error) { 76 | config := *c 77 | setConfigDefaults(&config) 78 | client, err := rest.RESTClientForConfigAndClient(&config, h) 79 | if err != nil { 80 | return nil, err 81 | } 82 | return &JetstreamV1beta2Client{client}, nil 83 | } 84 | 85 | // NewForConfigOrDie creates a new JetstreamV1beta2Client for the given config and 86 | // panics if there is an error in the config. 87 | func NewForConfigOrDie(c *rest.Config) *JetstreamV1beta2Client { 88 | client, err := NewForConfig(c) 89 | if err != nil { 90 | panic(err) 91 | } 92 | return client 93 | } 94 | 95 | // New creates a new JetstreamV1beta2Client for the given RESTClient. 96 | func New(c rest.Interface) *JetstreamV1beta2Client { 97 | return &JetstreamV1beta2Client{c} 98 | } 99 | 100 | func setConfigDefaults(config *rest.Config) { 101 | gv := jetstreamv1beta2.SchemeGroupVersion 102 | config.GroupVersion = &gv 103 | config.APIPath = "/apis" 104 | config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() 105 | 106 | if config.UserAgent == "" { 107 | config.UserAgent = rest.DefaultKubernetesUserAgent() 108 | } 109 | } 110 | 111 | // RESTClient returns a RESTClient that is used to communicate 112 | // with API server by this client implementation. 113 | func (c *JetstreamV1beta2Client) RESTClient() rest.Interface { 114 | if c == nil { 115 | return nil 116 | } 117 | return c.restClient 118 | } 119 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/keyvalue.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | context "context" 20 | 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | applyconfigurationjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 23 | scheme "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/scheme" 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | types "k8s.io/apimachinery/pkg/types" 26 | watch "k8s.io/apimachinery/pkg/watch" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // KeyValuesGetter has a method to return a KeyValueInterface. 31 | // A group's client should implement this interface. 32 | type KeyValuesGetter interface { 33 | KeyValues(namespace string) KeyValueInterface 34 | } 35 | 36 | // KeyValueInterface has methods to work with KeyValue resources. 37 | type KeyValueInterface interface { 38 | Create(ctx context.Context, keyValue *jetstreamv1beta2.KeyValue, opts v1.CreateOptions) (*jetstreamv1beta2.KeyValue, error) 39 | Update(ctx context.Context, keyValue *jetstreamv1beta2.KeyValue, opts v1.UpdateOptions) (*jetstreamv1beta2.KeyValue, error) 40 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 41 | UpdateStatus(ctx context.Context, keyValue *jetstreamv1beta2.KeyValue, opts v1.UpdateOptions) (*jetstreamv1beta2.KeyValue, error) 42 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 43 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 44 | Get(ctx context.Context, name string, opts v1.GetOptions) (*jetstreamv1beta2.KeyValue, error) 45 | List(ctx context.Context, opts v1.ListOptions) (*jetstreamv1beta2.KeyValueList, error) 46 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 47 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *jetstreamv1beta2.KeyValue, err error) 48 | Apply(ctx context.Context, keyValue *applyconfigurationjetstreamv1beta2.KeyValueApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.KeyValue, err error) 49 | // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). 50 | ApplyStatus(ctx context.Context, keyValue *applyconfigurationjetstreamv1beta2.KeyValueApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.KeyValue, err error) 51 | KeyValueExpansion 52 | } 53 | 54 | // keyValues implements KeyValueInterface 55 | type keyValues struct { 56 | *gentype.ClientWithListAndApply[*jetstreamv1beta2.KeyValue, *jetstreamv1beta2.KeyValueList, *applyconfigurationjetstreamv1beta2.KeyValueApplyConfiguration] 57 | } 58 | 59 | // newKeyValues returns a KeyValues 60 | func newKeyValues(c *JetstreamV1beta2Client, namespace string) *keyValues { 61 | return &keyValues{ 62 | gentype.NewClientWithListAndApply[*jetstreamv1beta2.KeyValue, *jetstreamv1beta2.KeyValueList, *applyconfigurationjetstreamv1beta2.KeyValueApplyConfiguration]( 63 | "keyvalues", 64 | c.RESTClient(), 65 | scheme.ParameterCodec, 66 | namespace, 67 | func() *jetstreamv1beta2.KeyValue { return &jetstreamv1beta2.KeyValue{} }, 68 | func() *jetstreamv1beta2.KeyValueList { return &jetstreamv1beta2.KeyValueList{} }, 69 | ), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/objectstore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | context "context" 20 | 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | applyconfigurationjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 23 | scheme "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/scheme" 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | types "k8s.io/apimachinery/pkg/types" 26 | watch "k8s.io/apimachinery/pkg/watch" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // ObjectStoresGetter has a method to return a ObjectStoreInterface. 31 | // A group's client should implement this interface. 32 | type ObjectStoresGetter interface { 33 | ObjectStores(namespace string) ObjectStoreInterface 34 | } 35 | 36 | // ObjectStoreInterface has methods to work with ObjectStore resources. 37 | type ObjectStoreInterface interface { 38 | Create(ctx context.Context, objectStore *jetstreamv1beta2.ObjectStore, opts v1.CreateOptions) (*jetstreamv1beta2.ObjectStore, error) 39 | Update(ctx context.Context, objectStore *jetstreamv1beta2.ObjectStore, opts v1.UpdateOptions) (*jetstreamv1beta2.ObjectStore, error) 40 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 41 | UpdateStatus(ctx context.Context, objectStore *jetstreamv1beta2.ObjectStore, opts v1.UpdateOptions) (*jetstreamv1beta2.ObjectStore, error) 42 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 43 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 44 | Get(ctx context.Context, name string, opts v1.GetOptions) (*jetstreamv1beta2.ObjectStore, error) 45 | List(ctx context.Context, opts v1.ListOptions) (*jetstreamv1beta2.ObjectStoreList, error) 46 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 47 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *jetstreamv1beta2.ObjectStore, err error) 48 | Apply(ctx context.Context, objectStore *applyconfigurationjetstreamv1beta2.ObjectStoreApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.ObjectStore, err error) 49 | // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). 50 | ApplyStatus(ctx context.Context, objectStore *applyconfigurationjetstreamv1beta2.ObjectStoreApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.ObjectStore, err error) 51 | ObjectStoreExpansion 52 | } 53 | 54 | // objectStores implements ObjectStoreInterface 55 | type objectStores struct { 56 | *gentype.ClientWithListAndApply[*jetstreamv1beta2.ObjectStore, *jetstreamv1beta2.ObjectStoreList, *applyconfigurationjetstreamv1beta2.ObjectStoreApplyConfiguration] 57 | } 58 | 59 | // newObjectStores returns a ObjectStores 60 | func newObjectStores(c *JetstreamV1beta2Client, namespace string) *objectStores { 61 | return &objectStores{ 62 | gentype.NewClientWithListAndApply[*jetstreamv1beta2.ObjectStore, *jetstreamv1beta2.ObjectStoreList, *applyconfigurationjetstreamv1beta2.ObjectStoreApplyConfiguration]( 63 | "objectstores", 64 | c.RESTClient(), 65 | scheme.ParameterCodec, 66 | namespace, 67 | func() *jetstreamv1beta2.ObjectStore { return &jetstreamv1beta2.ObjectStore{} }, 68 | func() *jetstreamv1beta2.ObjectStoreList { return &jetstreamv1beta2.ObjectStoreList{} }, 69 | ), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/clientset/versioned/typed/jetstream/v1beta2/stream.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by client-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | context "context" 20 | 21 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | applyconfigurationjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/applyconfiguration/jetstream/v1beta2" 23 | scheme "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned/scheme" 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | types "k8s.io/apimachinery/pkg/types" 26 | watch "k8s.io/apimachinery/pkg/watch" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // StreamsGetter has a method to return a StreamInterface. 31 | // A group's client should implement this interface. 32 | type StreamsGetter interface { 33 | Streams(namespace string) StreamInterface 34 | } 35 | 36 | // StreamInterface has methods to work with Stream resources. 37 | type StreamInterface interface { 38 | Create(ctx context.Context, stream *jetstreamv1beta2.Stream, opts v1.CreateOptions) (*jetstreamv1beta2.Stream, error) 39 | Update(ctx context.Context, stream *jetstreamv1beta2.Stream, opts v1.UpdateOptions) (*jetstreamv1beta2.Stream, error) 40 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 41 | UpdateStatus(ctx context.Context, stream *jetstreamv1beta2.Stream, opts v1.UpdateOptions) (*jetstreamv1beta2.Stream, error) 42 | Delete(ctx context.Context, name string, opts v1.DeleteOptions) error 43 | DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error 44 | Get(ctx context.Context, name string, opts v1.GetOptions) (*jetstreamv1beta2.Stream, error) 45 | List(ctx context.Context, opts v1.ListOptions) (*jetstreamv1beta2.StreamList, error) 46 | Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) 47 | Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *jetstreamv1beta2.Stream, err error) 48 | Apply(ctx context.Context, stream *applyconfigurationjetstreamv1beta2.StreamApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.Stream, err error) 49 | // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). 50 | ApplyStatus(ctx context.Context, stream *applyconfigurationjetstreamv1beta2.StreamApplyConfiguration, opts v1.ApplyOptions) (result *jetstreamv1beta2.Stream, err error) 51 | StreamExpansion 52 | } 53 | 54 | // streams implements StreamInterface 55 | type streams struct { 56 | *gentype.ClientWithListAndApply[*jetstreamv1beta2.Stream, *jetstreamv1beta2.StreamList, *applyconfigurationjetstreamv1beta2.StreamApplyConfiguration] 57 | } 58 | 59 | // newStreams returns a Streams 60 | func newStreams(c *JetstreamV1beta2Client, namespace string) *streams { 61 | return &streams{ 62 | gentype.NewClientWithListAndApply[*jetstreamv1beta2.Stream, *jetstreamv1beta2.StreamList, *applyconfigurationjetstreamv1beta2.StreamApplyConfiguration]( 63 | "streams", 64 | c.RESTClient(), 65 | scheme.ParameterCodec, 66 | namespace, 67 | func() *jetstreamv1beta2.Stream { return &jetstreamv1beta2.Stream{} }, 68 | func() *jetstreamv1beta2.StreamList { return &jetstreamv1beta2.StreamList{} }, 69 | ), 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/informers/externalversions/generic.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by informer-gen. DO NOT EDIT. 15 | 16 | package externalversions 17 | 18 | import ( 19 | fmt "fmt" 20 | 21 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 22 | schema "k8s.io/apimachinery/pkg/runtime/schema" 23 | cache "k8s.io/client-go/tools/cache" 24 | ) 25 | 26 | // GenericInformer is type of SharedIndexInformer which will locate and delegate to other 27 | // sharedInformers based on type 28 | type GenericInformer interface { 29 | Informer() cache.SharedIndexInformer 30 | Lister() cache.GenericLister 31 | } 32 | 33 | type genericInformer struct { 34 | informer cache.SharedIndexInformer 35 | resource schema.GroupResource 36 | } 37 | 38 | // Informer returns the SharedIndexInformer. 39 | func (f *genericInformer) Informer() cache.SharedIndexInformer { 40 | return f.informer 41 | } 42 | 43 | // Lister returns the GenericLister. 44 | func (f *genericInformer) Lister() cache.GenericLister { 45 | return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) 46 | } 47 | 48 | // ForResource gives generic access to a shared informer of the matching type 49 | // TODO extend this to unknown resources with a client pool 50 | func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { 51 | switch resource { 52 | // Group=jetstream.nats.io, Version=v1beta2 53 | case v1beta2.SchemeGroupVersion.WithResource("accounts"): 54 | return &genericInformer{resource: resource.GroupResource(), informer: f.Jetstream().V1beta2().Accounts().Informer()}, nil 55 | case v1beta2.SchemeGroupVersion.WithResource("consumers"): 56 | return &genericInformer{resource: resource.GroupResource(), informer: f.Jetstream().V1beta2().Consumers().Informer()}, nil 57 | case v1beta2.SchemeGroupVersion.WithResource("keyvalues"): 58 | return &genericInformer{resource: resource.GroupResource(), informer: f.Jetstream().V1beta2().KeyValues().Informer()}, nil 59 | case v1beta2.SchemeGroupVersion.WithResource("objectstores"): 60 | return &genericInformer{resource: resource.GroupResource(), informer: f.Jetstream().V1beta2().ObjectStores().Informer()}, nil 61 | case v1beta2.SchemeGroupVersion.WithResource("streams"): 62 | return &genericInformer{resource: resource.GroupResource(), informer: f.Jetstream().V1beta2().Streams().Informer()}, nil 63 | 64 | } 65 | 66 | return nil, fmt.Errorf("no informer found for %v", resource) 67 | } 68 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by informer-gen. DO NOT EDIT. 15 | 16 | package internalinterfaces 17 | 18 | import ( 19 | time "time" 20 | 21 | versioned "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned" 22 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 | runtime "k8s.io/apimachinery/pkg/runtime" 24 | cache "k8s.io/client-go/tools/cache" 25 | ) 26 | 27 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 28 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 29 | 30 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 31 | type SharedInformerFactory interface { 32 | Start(stopCh <-chan struct{}) 33 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 34 | } 35 | 36 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 37 | type TweakListOptionsFunc func(*v1.ListOptions) 38 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/informers/externalversions/jetstream/interface.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by informer-gen. DO NOT EDIT. 15 | 16 | package jetstream 17 | 18 | import ( 19 | internalinterfaces "github.com/nats-io/nack/pkg/jetstream/generated/informers/externalversions/internalinterfaces" 20 | v1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2" 21 | ) 22 | 23 | // Interface provides access to each of this group's versions. 24 | type Interface interface { 25 | // V1beta2 provides access to shared informers for resources in V1beta2. 26 | V1beta2() v1beta2.Interface 27 | } 28 | 29 | type group struct { 30 | factory internalinterfaces.SharedInformerFactory 31 | namespace string 32 | tweakListOptions internalinterfaces.TweakListOptionsFunc 33 | } 34 | 35 | // New returns a new Interface. 36 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 37 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 38 | } 39 | 40 | // V1beta2 returns a new v1beta2.Interface. 41 | func (g *group) V1beta2() v1beta2.Interface { 42 | return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) 43 | } 44 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/interface.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by informer-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | internalinterfaces "github.com/nats-io/nack/pkg/jetstream/generated/informers/externalversions/internalinterfaces" 20 | ) 21 | 22 | // Interface provides access to all the informers in this group version. 23 | type Interface interface { 24 | // Accounts returns a AccountInformer. 25 | Accounts() AccountInformer 26 | // Consumers returns a ConsumerInformer. 27 | Consumers() ConsumerInformer 28 | // KeyValues returns a KeyValueInformer. 29 | KeyValues() KeyValueInformer 30 | // ObjectStores returns a ObjectStoreInformer. 31 | ObjectStores() ObjectStoreInformer 32 | // Streams returns a StreamInformer. 33 | Streams() StreamInformer 34 | } 35 | 36 | type version struct { 37 | factory internalinterfaces.SharedInformerFactory 38 | namespace string 39 | tweakListOptions internalinterfaces.TweakListOptionsFunc 40 | } 41 | 42 | // New returns a new Interface. 43 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 44 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 45 | } 46 | 47 | // Accounts returns a AccountInformer. 48 | func (v *version) Accounts() AccountInformer { 49 | return &accountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 50 | } 51 | 52 | // Consumers returns a ConsumerInformer. 53 | func (v *version) Consumers() ConsumerInformer { 54 | return &consumerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 55 | } 56 | 57 | // KeyValues returns a KeyValueInformer. 58 | func (v *version) KeyValues() KeyValueInformer { 59 | return &keyValueInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 60 | } 61 | 62 | // ObjectStores returns a ObjectStoreInformer. 63 | func (v *version) ObjectStores() ObjectStoreInformer { 64 | return &objectStoreInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 65 | } 66 | 67 | // Streams returns a StreamInformer. 68 | func (v *version) Streams() StreamInformer { 69 | return &streamInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 70 | } 71 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/informers/externalversions/jetstream/v1beta2/stream.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by informer-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | context "context" 20 | time "time" 21 | 22 | apisjetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 23 | versioned "github.com/nats-io/nack/pkg/jetstream/generated/clientset/versioned" 24 | internalinterfaces "github.com/nats-io/nack/pkg/jetstream/generated/informers/externalversions/internalinterfaces" 25 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/generated/listers/jetstream/v1beta2" 26 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 27 | runtime "k8s.io/apimachinery/pkg/runtime" 28 | watch "k8s.io/apimachinery/pkg/watch" 29 | cache "k8s.io/client-go/tools/cache" 30 | ) 31 | 32 | // StreamInformer provides access to a shared informer and lister for 33 | // Streams. 34 | type StreamInformer interface { 35 | Informer() cache.SharedIndexInformer 36 | Lister() jetstreamv1beta2.StreamLister 37 | } 38 | 39 | type streamInformer struct { 40 | factory internalinterfaces.SharedInformerFactory 41 | tweakListOptions internalinterfaces.TweakListOptionsFunc 42 | namespace string 43 | } 44 | 45 | // NewStreamInformer constructs a new informer for Stream type. 46 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 47 | // one. This reduces memory footprint and number of connections to the server. 48 | func NewStreamInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 49 | return NewFilteredStreamInformer(client, namespace, resyncPeriod, indexers, nil) 50 | } 51 | 52 | // NewFilteredStreamInformer constructs a new informer for Stream type. 53 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 54 | // one. This reduces memory footprint and number of connections to the server. 55 | func NewFilteredStreamInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 56 | return cache.NewSharedIndexInformer( 57 | &cache.ListWatch{ 58 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 59 | if tweakListOptions != nil { 60 | tweakListOptions(&options) 61 | } 62 | return client.JetstreamV1beta2().Streams(namespace).List(context.Background(), options) 63 | }, 64 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 65 | if tweakListOptions != nil { 66 | tweakListOptions(&options) 67 | } 68 | return client.JetstreamV1beta2().Streams(namespace).Watch(context.Background(), options) 69 | }, 70 | ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { 71 | if tweakListOptions != nil { 72 | tweakListOptions(&options) 73 | } 74 | return client.JetstreamV1beta2().Streams(namespace).List(ctx, options) 75 | }, 76 | WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { 77 | if tweakListOptions != nil { 78 | tweakListOptions(&options) 79 | } 80 | return client.JetstreamV1beta2().Streams(namespace).Watch(ctx, options) 81 | }, 82 | }, 83 | &apisjetstreamv1beta2.Stream{}, 84 | resyncPeriod, 85 | indexers, 86 | ) 87 | } 88 | 89 | func (f *streamInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 90 | return NewFilteredStreamInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 91 | } 92 | 93 | func (f *streamInformer) Informer() cache.SharedIndexInformer { 94 | return f.factory.InformerFor(&apisjetstreamv1beta2.Stream{}, f.defaultInformer) 95 | } 96 | 97 | func (f *streamInformer) Lister() jetstreamv1beta2.StreamLister { 98 | return jetstreamv1beta2.NewStreamLister(f.Informer().GetIndexer()) 99 | } 100 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/listers/jetstream/v1beta2/account.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by lister-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | labels "k8s.io/apimachinery/pkg/labels" 21 | listers "k8s.io/client-go/listers" 22 | cache "k8s.io/client-go/tools/cache" 23 | ) 24 | 25 | // AccountLister helps list Accounts. 26 | // All objects returned here must be treated as read-only. 27 | type AccountLister interface { 28 | // List lists all Accounts in the indexer. 29 | // Objects returned here must be treated as read-only. 30 | List(selector labels.Selector) (ret []*jetstreamv1beta2.Account, err error) 31 | // Accounts returns an object that can list and get Accounts. 32 | Accounts(namespace string) AccountNamespaceLister 33 | AccountListerExpansion 34 | } 35 | 36 | // accountLister implements the AccountLister interface. 37 | type accountLister struct { 38 | listers.ResourceIndexer[*jetstreamv1beta2.Account] 39 | } 40 | 41 | // NewAccountLister returns a new AccountLister. 42 | func NewAccountLister(indexer cache.Indexer) AccountLister { 43 | return &accountLister{listers.New[*jetstreamv1beta2.Account](indexer, jetstreamv1beta2.Resource("account"))} 44 | } 45 | 46 | // Accounts returns an object that can list and get Accounts. 47 | func (s *accountLister) Accounts(namespace string) AccountNamespaceLister { 48 | return accountNamespaceLister{listers.NewNamespaced[*jetstreamv1beta2.Account](s.ResourceIndexer, namespace)} 49 | } 50 | 51 | // AccountNamespaceLister helps list and get Accounts. 52 | // All objects returned here must be treated as read-only. 53 | type AccountNamespaceLister interface { 54 | // List lists all Accounts in the indexer for a given namespace. 55 | // Objects returned here must be treated as read-only. 56 | List(selector labels.Selector) (ret []*jetstreamv1beta2.Account, err error) 57 | // Get retrieves the Account from the indexer for a given namespace and name. 58 | // Objects returned here must be treated as read-only. 59 | Get(name string) (*jetstreamv1beta2.Account, error) 60 | AccountNamespaceListerExpansion 61 | } 62 | 63 | // accountNamespaceLister implements the AccountNamespaceLister 64 | // interface. 65 | type accountNamespaceLister struct { 66 | listers.ResourceIndexer[*jetstreamv1beta2.Account] 67 | } 68 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/listers/jetstream/v1beta2/consumer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by lister-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | labels "k8s.io/apimachinery/pkg/labels" 21 | listers "k8s.io/client-go/listers" 22 | cache "k8s.io/client-go/tools/cache" 23 | ) 24 | 25 | // ConsumerLister helps list Consumers. 26 | // All objects returned here must be treated as read-only. 27 | type ConsumerLister interface { 28 | // List lists all Consumers in the indexer. 29 | // Objects returned here must be treated as read-only. 30 | List(selector labels.Selector) (ret []*jetstreamv1beta2.Consumer, err error) 31 | // Consumers returns an object that can list and get Consumers. 32 | Consumers(namespace string) ConsumerNamespaceLister 33 | ConsumerListerExpansion 34 | } 35 | 36 | // consumerLister implements the ConsumerLister interface. 37 | type consumerLister struct { 38 | listers.ResourceIndexer[*jetstreamv1beta2.Consumer] 39 | } 40 | 41 | // NewConsumerLister returns a new ConsumerLister. 42 | func NewConsumerLister(indexer cache.Indexer) ConsumerLister { 43 | return &consumerLister{listers.New[*jetstreamv1beta2.Consumer](indexer, jetstreamv1beta2.Resource("consumer"))} 44 | } 45 | 46 | // Consumers returns an object that can list and get Consumers. 47 | func (s *consumerLister) Consumers(namespace string) ConsumerNamespaceLister { 48 | return consumerNamespaceLister{listers.NewNamespaced[*jetstreamv1beta2.Consumer](s.ResourceIndexer, namespace)} 49 | } 50 | 51 | // ConsumerNamespaceLister helps list and get Consumers. 52 | // All objects returned here must be treated as read-only. 53 | type ConsumerNamespaceLister interface { 54 | // List lists all Consumers in the indexer for a given namespace. 55 | // Objects returned here must be treated as read-only. 56 | List(selector labels.Selector) (ret []*jetstreamv1beta2.Consumer, err error) 57 | // Get retrieves the Consumer from the indexer for a given namespace and name. 58 | // Objects returned here must be treated as read-only. 59 | Get(name string) (*jetstreamv1beta2.Consumer, error) 60 | ConsumerNamespaceListerExpansion 61 | } 62 | 63 | // consumerNamespaceLister implements the ConsumerNamespaceLister 64 | // interface. 65 | type consumerNamespaceLister struct { 66 | listers.ResourceIndexer[*jetstreamv1beta2.Consumer] 67 | } 68 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/listers/jetstream/v1beta2/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by lister-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | // AccountListerExpansion allows custom methods to be added to 19 | // AccountLister. 20 | type AccountListerExpansion interface{} 21 | 22 | // AccountNamespaceListerExpansion allows custom methods to be added to 23 | // AccountNamespaceLister. 24 | type AccountNamespaceListerExpansion interface{} 25 | 26 | // ConsumerListerExpansion allows custom methods to be added to 27 | // ConsumerLister. 28 | type ConsumerListerExpansion interface{} 29 | 30 | // ConsumerNamespaceListerExpansion allows custom methods to be added to 31 | // ConsumerNamespaceLister. 32 | type ConsumerNamespaceListerExpansion interface{} 33 | 34 | // KeyValueListerExpansion allows custom methods to be added to 35 | // KeyValueLister. 36 | type KeyValueListerExpansion interface{} 37 | 38 | // KeyValueNamespaceListerExpansion allows custom methods to be added to 39 | // KeyValueNamespaceLister. 40 | type KeyValueNamespaceListerExpansion interface{} 41 | 42 | // ObjectStoreListerExpansion allows custom methods to be added to 43 | // ObjectStoreLister. 44 | type ObjectStoreListerExpansion interface{} 45 | 46 | // ObjectStoreNamespaceListerExpansion allows custom methods to be added to 47 | // ObjectStoreNamespaceLister. 48 | type ObjectStoreNamespaceListerExpansion interface{} 49 | 50 | // StreamListerExpansion allows custom methods to be added to 51 | // StreamLister. 52 | type StreamListerExpansion interface{} 53 | 54 | // StreamNamespaceListerExpansion allows custom methods to be added to 55 | // StreamNamespaceLister. 56 | type StreamNamespaceListerExpansion interface{} 57 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/listers/jetstream/v1beta2/keyvalue.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by lister-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | labels "k8s.io/apimachinery/pkg/labels" 21 | listers "k8s.io/client-go/listers" 22 | cache "k8s.io/client-go/tools/cache" 23 | ) 24 | 25 | // KeyValueLister helps list KeyValues. 26 | // All objects returned here must be treated as read-only. 27 | type KeyValueLister interface { 28 | // List lists all KeyValues in the indexer. 29 | // Objects returned here must be treated as read-only. 30 | List(selector labels.Selector) (ret []*jetstreamv1beta2.KeyValue, err error) 31 | // KeyValues returns an object that can list and get KeyValues. 32 | KeyValues(namespace string) KeyValueNamespaceLister 33 | KeyValueListerExpansion 34 | } 35 | 36 | // keyValueLister implements the KeyValueLister interface. 37 | type keyValueLister struct { 38 | listers.ResourceIndexer[*jetstreamv1beta2.KeyValue] 39 | } 40 | 41 | // NewKeyValueLister returns a new KeyValueLister. 42 | func NewKeyValueLister(indexer cache.Indexer) KeyValueLister { 43 | return &keyValueLister{listers.New[*jetstreamv1beta2.KeyValue](indexer, jetstreamv1beta2.Resource("keyvalue"))} 44 | } 45 | 46 | // KeyValues returns an object that can list and get KeyValues. 47 | func (s *keyValueLister) KeyValues(namespace string) KeyValueNamespaceLister { 48 | return keyValueNamespaceLister{listers.NewNamespaced[*jetstreamv1beta2.KeyValue](s.ResourceIndexer, namespace)} 49 | } 50 | 51 | // KeyValueNamespaceLister helps list and get KeyValues. 52 | // All objects returned here must be treated as read-only. 53 | type KeyValueNamespaceLister interface { 54 | // List lists all KeyValues in the indexer for a given namespace. 55 | // Objects returned here must be treated as read-only. 56 | List(selector labels.Selector) (ret []*jetstreamv1beta2.KeyValue, err error) 57 | // Get retrieves the KeyValue from the indexer for a given namespace and name. 58 | // Objects returned here must be treated as read-only. 59 | Get(name string) (*jetstreamv1beta2.KeyValue, error) 60 | KeyValueNamespaceListerExpansion 61 | } 62 | 63 | // keyValueNamespaceLister implements the KeyValueNamespaceLister 64 | // interface. 65 | type keyValueNamespaceLister struct { 66 | listers.ResourceIndexer[*jetstreamv1beta2.KeyValue] 67 | } 68 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/listers/jetstream/v1beta2/objectstore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by lister-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | labels "k8s.io/apimachinery/pkg/labels" 21 | listers "k8s.io/client-go/listers" 22 | cache "k8s.io/client-go/tools/cache" 23 | ) 24 | 25 | // ObjectStoreLister helps list ObjectStores. 26 | // All objects returned here must be treated as read-only. 27 | type ObjectStoreLister interface { 28 | // List lists all ObjectStores in the indexer. 29 | // Objects returned here must be treated as read-only. 30 | List(selector labels.Selector) (ret []*jetstreamv1beta2.ObjectStore, err error) 31 | // ObjectStores returns an object that can list and get ObjectStores. 32 | ObjectStores(namespace string) ObjectStoreNamespaceLister 33 | ObjectStoreListerExpansion 34 | } 35 | 36 | // objectStoreLister implements the ObjectStoreLister interface. 37 | type objectStoreLister struct { 38 | listers.ResourceIndexer[*jetstreamv1beta2.ObjectStore] 39 | } 40 | 41 | // NewObjectStoreLister returns a new ObjectStoreLister. 42 | func NewObjectStoreLister(indexer cache.Indexer) ObjectStoreLister { 43 | return &objectStoreLister{listers.New[*jetstreamv1beta2.ObjectStore](indexer, jetstreamv1beta2.Resource("objectstore"))} 44 | } 45 | 46 | // ObjectStores returns an object that can list and get ObjectStores. 47 | func (s *objectStoreLister) ObjectStores(namespace string) ObjectStoreNamespaceLister { 48 | return objectStoreNamespaceLister{listers.NewNamespaced[*jetstreamv1beta2.ObjectStore](s.ResourceIndexer, namespace)} 49 | } 50 | 51 | // ObjectStoreNamespaceLister helps list and get ObjectStores. 52 | // All objects returned here must be treated as read-only. 53 | type ObjectStoreNamespaceLister interface { 54 | // List lists all ObjectStores in the indexer for a given namespace. 55 | // Objects returned here must be treated as read-only. 56 | List(selector labels.Selector) (ret []*jetstreamv1beta2.ObjectStore, err error) 57 | // Get retrieves the ObjectStore from the indexer for a given namespace and name. 58 | // Objects returned here must be treated as read-only. 59 | Get(name string) (*jetstreamv1beta2.ObjectStore, error) 60 | ObjectStoreNamespaceListerExpansion 61 | } 62 | 63 | // objectStoreNamespaceLister implements the ObjectStoreNamespaceLister 64 | // interface. 65 | type objectStoreNamespaceLister struct { 66 | listers.ResourceIndexer[*jetstreamv1beta2.ObjectStore] 67 | } 68 | -------------------------------------------------------------------------------- /pkg/jetstream/generated/listers/jetstream/v1beta2/stream.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // Code generated by lister-gen. DO NOT EDIT. 15 | 16 | package v1beta2 17 | 18 | import ( 19 | jetstreamv1beta2 "github.com/nats-io/nack/pkg/jetstream/apis/jetstream/v1beta2" 20 | labels "k8s.io/apimachinery/pkg/labels" 21 | listers "k8s.io/client-go/listers" 22 | cache "k8s.io/client-go/tools/cache" 23 | ) 24 | 25 | // StreamLister helps list Streams. 26 | // All objects returned here must be treated as read-only. 27 | type StreamLister interface { 28 | // List lists all Streams in the indexer. 29 | // Objects returned here must be treated as read-only. 30 | List(selector labels.Selector) (ret []*jetstreamv1beta2.Stream, err error) 31 | // Streams returns an object that can list and get Streams. 32 | Streams(namespace string) StreamNamespaceLister 33 | StreamListerExpansion 34 | } 35 | 36 | // streamLister implements the StreamLister interface. 37 | type streamLister struct { 38 | listers.ResourceIndexer[*jetstreamv1beta2.Stream] 39 | } 40 | 41 | // NewStreamLister returns a new StreamLister. 42 | func NewStreamLister(indexer cache.Indexer) StreamLister { 43 | return &streamLister{listers.New[*jetstreamv1beta2.Stream](indexer, jetstreamv1beta2.Resource("stream"))} 44 | } 45 | 46 | // Streams returns an object that can list and get Streams. 47 | func (s *streamLister) Streams(namespace string) StreamNamespaceLister { 48 | return streamNamespaceLister{listers.NewNamespaced[*jetstreamv1beta2.Stream](s.ResourceIndexer, namespace)} 49 | } 50 | 51 | // StreamNamespaceLister helps list and get Streams. 52 | // All objects returned here must be treated as read-only. 53 | type StreamNamespaceLister interface { 54 | // List lists all Streams in the indexer for a given namespace. 55 | // Objects returned here must be treated as read-only. 56 | List(selector labels.Selector) (ret []*jetstreamv1beta2.Stream, err error) 57 | // Get retrieves the Stream from the indexer for a given namespace and name. 58 | // Objects returned here must be treated as read-only. 59 | Get(name string) (*jetstreamv1beta2.Stream, error) 60 | StreamNamespaceListerExpansion 61 | } 62 | 63 | // streamNamespaceLister implements the StreamNamespaceLister 64 | // interface. 65 | type streamNamespaceLister struct { 66 | listers.ResourceIndexer[*jetstreamv1beta2.Stream] 67 | } 68 | -------------------------------------------------------------------------------- /pkg/k8scodegen/file-header.txt: -------------------------------------------------------------------------------- 1 | // Copyright 2025 The NATS Authors 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | -------------------------------------------------------------------------------- /pkg/k8scodegen/k8scodegen.go: -------------------------------------------------------------------------------- 1 | package k8scodegen 2 | 3 | import _ "k8s.io/code-generator" 4 | -------------------------------------------------------------------------------- /tests/nack.yaml: -------------------------------------------------------------------------------- 1 | jetstream: 2 | enabled: true 3 | 4 | nats: 5 | url: nats://nats:4222 6 | 7 | namespaced: true 8 | -------------------------------------------------------------------------------- /tests/nats.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | global: 3 | labels: 4 | app: main-jetstream 5 | 6 | natsBox: 7 | enabled: false 8 | 9 | config: 10 | cluster: 11 | enabled: false 12 | 13 | gateway: 14 | enabled: false 15 | 16 | jetstream: 17 | enabled: true 18 | 19 | memoryStore: 20 | enabled: true 21 | maxSize: 256Mi 22 | 23 | memoryStore: 24 | enabled: true 25 | pvc: 26 | enabled: true 27 | size: 256Mi 28 | -------------------------------------------------------------------------------- /tests/stream-creation/00-nack.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kuttl.dev/v1beta1 2 | kind: TestStep 3 | unitTest: false 4 | commands: 5 | - command: helm uninstall --namespace $NAMESPACE nats 6 | ignoreFailure: true 7 | - command: helm uninstall --namespace $NAMESPACE nack 8 | ignoreFailure: true 9 | - command: helm repo add nats https://nats-io.github.io/k8s/helm/charts 10 | - command: helm upgrade --install --wait --namespace $NAMESPACE nats nats/nats -f ../nats.yaml 11 | - command: helm upgrade --install --wait --namespace $NAMESPACE nack nats/nack -f ../nack.yaml 12 | -------------------------------------------------------------------------------- /tests/stream-creation/01-stream.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kuttl.dev/v1beta1 2 | kind: TestStep 3 | apply: 4 | - rides-stream.yaml 5 | assert: 6 | - asserted-rides-stream.yaml 7 | unitTest: false 8 | -------------------------------------------------------------------------------- /tests/stream-creation/02-natscli-stream.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kuttl.dev/v1beta1 2 | kind: TestStep 3 | apply: 4 | - natscli.yaml 5 | assert: 6 | - asserted-natscli.yaml 7 | unitTest: false 8 | -------------------------------------------------------------------------------- /tests/stream-creation/asserted-natscli.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | labels: 5 | run: natscli 6 | name: natscli 7 | status: 8 | phase: Succeeded 9 | -------------------------------------------------------------------------------- /tests/stream-creation/asserted-rides-stream.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: jetstream.nats.io/v1beta2 2 | kind: Stream 3 | metadata: 4 | name: rides 5 | spec: 6 | allowDirect: false 7 | allowRollup: false 8 | compression: "" 9 | creds: "" 10 | denyDelete: false 11 | discard: old 12 | discardPerSubject: false 13 | firstSequence: 0 14 | maxAge: "" 15 | maxBytes: -1 16 | maxConsumers: -1 17 | maxMsgSize: -1 18 | maxMsgs: -1 19 | maxMsgsPerSubject: 0 20 | name: rides 21 | nkey: "" 22 | noAck: false 23 | preventDelete: false 24 | preventUpdate: false 25 | replicas: 1 26 | retention: limits 27 | servers: [] 28 | storage: memory 29 | subjects: 30 | - rides.> 31 | -------------------------------------------------------------------------------- /tests/stream-creation/natscli.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | labels: 5 | run: natscli 6 | name: natscli 7 | spec: 8 | restartPolicy: Never 9 | containers: 10 | - image: natsio/nats-box 11 | name: natscli 12 | command: 13 | - nats 14 | args: 15 | - -s 16 | - nats://nats:4222 17 | - stream 18 | - info 19 | - rides 20 | -------------------------------------------------------------------------------- /tests/stream-creation/rides-stream.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: jetstream.nats.io/v1beta2 2 | kind: Stream 3 | metadata: 4 | name: rides 5 | spec: 6 | name: rides 7 | subjects: 8 | - "rides.>" 9 | storage: memory 10 | replicas: 1 11 | --------------------------------------------------------------------------------