Showing preview only (1,001K chars total). Download the full file or copy to clipboard to get everything.
Repository: rancher/wrangler
Branch: main
Commit: b8c7650c8e9f
Files: 237
Total size: 933.1 KB
Directory structure:
gitextract_a9xsblpa/
├── .github/
│ ├── renovate.json
│ └── workflows/
│ ├── ci.yaml
│ ├── fossa.yml
│ ├── release.yaml
│ └── renovate-vault.yml
├── .gitignore
├── .golangci.json
├── CODEOWNERS
├── LICENSE
├── Makefile
├── README.md
├── VERSION.md
├── codegen.go
├── go.mod
├── go.sum
├── pkg/
│ ├── apply/
│ │ ├── apply.go
│ │ ├── client_factory.go
│ │ ├── desiredset.go
│ │ ├── desiredset_apply.go
│ │ ├── desiredset_compare.go
│ │ ├── desiredset_compare_test.go
│ │ ├── desiredset_crud.go
│ │ ├── desiredset_owner.go
│ │ ├── desiredset_process.go
│ │ ├── desiredset_process_test.go
│ │ ├── fake/
│ │ │ └── apply.go
│ │ ├── injectors/
│ │ │ └── registry.go
│ │ └── reconcilers.go
│ ├── broadcast/
│ │ └── generic.go
│ ├── cleanup/
│ │ └── cleanup.go
│ ├── clients/
│ │ └── clients.go
│ ├── codegen/
│ │ └── main.go
│ ├── condition/
│ │ └── condition.go
│ ├── controller-gen/
│ │ ├── OWNERS
│ │ ├── README.md
│ │ ├── args/
│ │ │ ├── args.go
│ │ │ ├── groupversion.go
│ │ │ ├── groupversion_test.go
│ │ │ └── testdata/
│ │ │ └── test.go
│ │ ├── generators/
│ │ │ ├── client_generator.go
│ │ │ ├── factory_go.go
│ │ │ ├── group_interface_go.go
│ │ │ ├── group_version_interface_go.go
│ │ │ ├── list_type_go.go
│ │ │ ├── register_group_go.go
│ │ │ ├── register_group_version_go.go
│ │ │ ├── target.go
│ │ │ ├── type_go.go
│ │ │ └── util.go
│ │ └── main.go
│ ├── crd/
│ │ ├── crd.go
│ │ ├── crd_test.go
│ │ ├── init.go
│ │ ├── mockCRDClient_test.go
│ │ └── print.go
│ ├── data/
│ │ ├── convert/
│ │ │ ├── convert.go
│ │ │ └── convert_test.go
│ │ ├── data.go
│ │ ├── merge.go
│ │ ├── values.go
│ │ └── values_test.go
│ ├── generated/
│ │ └── controllers/
│ │ ├── admissionregistration.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ ├── mutatingwebhookconfiguration.go
│ │ │ └── validatingwebhookconfiguration.go
│ │ ├── apiextensions.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── customresourcedefinition.go
│ │ │ └── interface.go
│ │ ├── apiregistration.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── apiservice.go
│ │ │ └── interface.go
│ │ ├── apps/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── daemonset.go
│ │ │ ├── deployment.go
│ │ │ ├── interface.go
│ │ │ └── statefulset.go
│ │ ├── batch/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ └── job.go
│ │ ├── coordination.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ └── lease.go
│ │ ├── core/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── configmap.go
│ │ │ ├── endpoints.go
│ │ │ ├── event.go
│ │ │ ├── interface.go
│ │ │ ├── limitrange.go
│ │ │ ├── namespace.go
│ │ │ ├── node.go
│ │ │ ├── persistentvolume.go
│ │ │ ├── persistentvolumeclaim.go
│ │ │ ├── pod.go
│ │ │ ├── resourcequota.go
│ │ │ ├── secret.go
│ │ │ ├── service.go
│ │ │ └── serviceaccount.go
│ │ ├── discovery/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── endpointslice.go
│ │ │ └── interface.go
│ │ ├── extensions/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1beta1/
│ │ │ ├── ingress.go
│ │ │ └── interface.go
│ │ ├── networking.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ └── networkpolicy.go
│ │ ├── rbac/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── clusterrole.go
│ │ │ ├── clusterrolebinding.go
│ │ │ ├── interface.go
│ │ │ ├── role.go
│ │ │ └── rolebinding.go
│ │ └── storage/
│ │ ├── factory.go
│ │ ├── interface.go
│ │ └── v1/
│ │ ├── interface.go
│ │ └── storageclass.go
│ ├── generic/
│ │ ├── cache.go
│ │ ├── cache_test.go
│ │ ├── clientMocks_test.go
│ │ ├── controller.go
│ │ ├── controllerFactoryMocks_test.go
│ │ ├── controller_test.go
│ │ ├── embeddedClient.go
│ │ ├── factory.go
│ │ ├── fake/
│ │ │ ├── README.md
│ │ │ ├── cache.go
│ │ │ ├── controller.go
│ │ │ ├── fake_test.go
│ │ │ └── generate.go
│ │ ├── generating.go
│ │ ├── generating_test.go
│ │ ├── remove.go
│ │ └── remove_test.go
│ ├── genericcondition/
│ │ └── condition.go
│ ├── gvk/
│ │ ├── detect.go
│ │ └── get.go
│ ├── k8scheck/
│ │ └── wait.go
│ ├── kstatus/
│ │ └── kstatus.go
│ ├── kubeconfig/
│ │ └── loader.go
│ ├── kv/
│ │ └── split.go
│ ├── leader/
│ │ ├── leader.go
│ │ ├── leader_test.go
│ │ └── manager.go
│ ├── merr/
│ │ └── error.go
│ ├── name/
│ │ ├── name.go
│ │ └── name_test.go
│ ├── needacert/
│ │ ├── needacert.go
│ │ └── needacert_test.go
│ ├── objectset/
│ │ ├── objectset.go
│ │ └── objectset_test.go
│ ├── patch/
│ │ ├── apply.go
│ │ └── style.go
│ ├── randomtoken/
│ │ └── token.go
│ ├── ratelimit/
│ │ └── none.go
│ ├── relatedresource/
│ │ ├── all.go
│ │ ├── changeset.go
│ │ ├── changeset_test.go
│ │ └── owner.go
│ ├── resolvehome/
│ │ └── main.go
│ ├── schemas/
│ │ ├── definition/
│ │ │ └── definition.go
│ │ ├── mapper.go
│ │ ├── mappers/
│ │ │ ├── access.go
│ │ │ ├── alias.go
│ │ │ ├── check.go
│ │ │ ├── condition.go
│ │ │ ├── copy.go
│ │ │ ├── default.go
│ │ │ ├── drop.go
│ │ │ ├── embed.go
│ │ │ ├── empty.go
│ │ │ ├── enum.go
│ │ │ ├── exists.go
│ │ │ ├── json_keys.go
│ │ │ ├── metadata.go
│ │ │ ├── move.go
│ │ │ ├── set_value.go
│ │ │ └── slice_to_map.go
│ │ ├── openapi/
│ │ │ └── generate.go
│ │ ├── reflection.go
│ │ ├── schemas.go
│ │ ├── types.go
│ │ └── validation/
│ │ ├── error.go
│ │ └── validation.go
│ ├── schemes/
│ │ └── all.go
│ ├── seen/
│ │ └── strings.go
│ ├── signals/
│ │ ├── signal.go
│ │ ├── signal_posix.go
│ │ └── signal_windows.go
│ ├── slice/
│ │ └── contains.go
│ ├── start/
│ │ └── all.go
│ ├── stringset/
│ │ ├── stringset.go
│ │ └── stringset_test.go
│ ├── summary/
│ │ ├── capi_cluster_test.go
│ │ ├── capi_machine_test.go
│ │ ├── capi_machineset_test.go
│ │ ├── cattletypes.go
│ │ ├── cattletypes_test.go
│ │ ├── client/
│ │ │ ├── interface.go
│ │ │ ├── options.go
│ │ │ └── simple.go
│ │ ├── condition.go
│ │ ├── condition_test.go
│ │ ├── coretypes.go
│ │ ├── gvk.go
│ │ ├── gvk_test.go
│ │ ├── informer/
│ │ │ ├── informer.go
│ │ │ ├── informer_test.go
│ │ │ ├── interface.go
│ │ │ └── watchlist.go
│ │ ├── lister/
│ │ │ ├── interface.go
│ │ │ ├── lister.go
│ │ │ └── shim.go
│ │ ├── summarized.go
│ │ ├── summarizers.go
│ │ ├── summarizers_test.go
│ │ └── summary.go
│ ├── ticker/
│ │ └── ticker.go
│ ├── trigger/
│ │ └── evalall.go
│ ├── unstructured/
│ │ └── unstructured.go
│ ├── webhook/
│ │ ├── match.go
│ │ └── router.go
│ └── yaml/
│ ├── objects_test.go
│ ├── yaml.go
│ └── yaml_test.go
└── scripts/
├── boilerplate.go.txt
└── ci
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/renovate.json
================================================
{
"extends": [
"github>rancher/renovate-config#release"
],
"baseBranchPatterns": [
"main",
"release/v2"
],
"prHourlyLimit": 2,
"packageRules": [
{
"enabled": false,
"matchPackageNames": [
"/k8s.io/*/",
"/sigs.k8s.io/*/",
"/go.opentelemetry.io/*/",
"/github.com/prometheus/*/"
]
},
{
"matchUpdateTypes": [
"major",
"minor"
],
"enabled": false,
"matchPackageNames": [
"/github.com/rancher/lasso/*/"
]
}
]
}
================================================
FILE: .github/workflows/ci.yaml
================================================
name: Wrangler CI
on:
push:
pull_request:
tags:
- v*
branches:
- 'release/*'
- 'main'
jobs:
ci:
strategy:
matrix:
arch:
- amd64
- arm64
runs-on: org-${{ github.repository_owner_id }}-${{ matrix.arch }}-k8s
container: registry.suse.com/bci/golang:1.25
steps:
- name : Checkout repository
# https://github.com/actions/checkout/releases/tag/v4.1.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name : Install mockgen
run: go install -v -x go.uber.org/mock/mockgen@v0.6.0
- name : Run CI
run: bash scripts/ci
golangci:
name: golangci-lint
runs-on: ubuntu-latest
env:
SETUP_GO_VERSION: '^1.25'
GOLANG_CI_LINT_VERSION: v2.7.1
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: recursive
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Generate Golang
run: |
export PATH=$PATH:/home/runner/go/bin/
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: ${{ env.GOLANG_CI_LINT_VERSION }}
================================================
FILE: .github/workflows/fossa.yml
================================================
name: FOSSA Scanning
on:
push:
branches: ["main", "master", "release/**"]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
fossa-scanning:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
# The FOSSA token is shared between all repos in Rancher's GH org. It can be
# used directly and there is no need to request specific access to EIO.
- name: Read FOSSA token
uses: rancher-eio/read-vault-secrets@0da85151ad1f19ed7986c41587e45aac1ace74b6 # v3
with:
secrets: |
secret/data/github/org/rancher/fossa/push token | FOSSA_API_KEY_PUSH_ONLY
- name: FOSSA scan
uses: fossas/fossa-action@c414b9ad82eaad041e47a7cf62a4f02411f427a0 # v1.8.0
with:
api-key: ${{ env.FOSSA_API_KEY_PUSH_ONLY }}
# Only runs the scan and do not provide/returns any results back to the
# pipeline.
run-tests: false
================================================
FILE: .github/workflows/release.yaml
================================================
name: Release
on:
push:
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name : Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Create release on Github
env:
GH_TOKEN: ${{ github.token }}
run: |
if [[ "${{ github.ref_name }}" == *-rc* ]]; then
gh --repo "${{ github.repository }}" release create ${{ github.ref_name }} --verify-tag --generate-notes --prerelease
else
gh --repo "${{ github.repository }}" release create ${{ github.ref_name }} --verify-tag --generate-notes
fi
================================================
FILE: .github/workflows/renovate-vault.yml
================================================
name: Renovate
on:
workflow_dispatch:
inputs:
logLevel:
description: "Override default log level"
required: false
default: "info"
type: string
overrideSchedule:
description: "Override all schedules"
required: false
default: "false"
type: string
# Run twice in the early morning (UTC) for initial and follow up steps (create pull request and merge)
schedule:
- cron: '30 4,6 * * *'
permissions:
contents: read
id-token: write
jobs:
call-workflow:
uses: rancher/renovate-config/.github/workflows/renovate-vault.yml@84bf074154364f80af052ebba8e23614212b79df # release
with:
logLevel: ${{ inputs.logLevel || 'info' }}
overrideSchedule: ${{ github.event.inputs.overrideSchedule == 'true' && '{''schedule'':null}' || '' }}
secrets: inherit
================================================
FILE: .gitignore
================================================
/.dapper
/bin
/dist
/build
*.swp
/.trash-cache
/trash.lock
/.idea
/package/rancher
/package/agent
/tests/MANIFEST
/tests/integration/MANIFEST
tests/integration/MANIFEST
tests/integration/.idea/
/tests/.cache
/tests/.tox
/tests/integration/.tox/
/tests/.venv
/tests/.idea
/default.etcd
*.pyc
__pycache__
/management-state
/rancher
*.pytest_cache
.kube/
.vscode/
.DS_Store
tests/validation/.idea
all.yaml
kustomization.yaml
================================================
FILE: .golangci.json
================================================
{
"formatters": {
"enable": [
"gofmt",
"goimports"
],
"exclusions": {
"generated": "lax",
"paths": [
"vendor",
"tests",
"pkg/client",
"pkg/generated",
"third_party$",
"builtin$",
"examples$"
]
},
"settings": {
"gofmt": {
"simplify": false
}
}
},
"linters": {
"default": "none",
"enable": [
"govet",
"ineffassign",
"misspell",
"revive"
],
"exclusions": {
"generated": "lax",
"paths": [
"vendor",
"tests",
"pkg/client",
"pkg/generated",
"third_party$",
"builtin$",
"examples$"
],
"presets": [
"comments",
"common-false-positives",
"legacy",
"std-error-handling"
],
"rules": [
{
"linters": [
"govet"
],
"text": "^(nilness|structtag)"
},
{
"path": "pkg/apis/management.cattle.io/v3/globaldns_types.go",
"text": ".*lobalDns.*"
},
{
"path": "pkg/apis/management.cattle.io/v3/zz_generated_register.go",
"text": ".*lobalDns.*"
},
{
"path": "pkg/apis/management.cattle.io/v3/zz_generated_list_types.go",
"text": ".*lobalDns.*"
},
{
"linters": [
"revive"
],
"text": "should have comment"
},
{
"linters": [
"revive"
],
"text": "should be of the form"
},
{
"linters": [
"revive"
],
"text": "by other packages, and that stutters"
},
{
"linters": [
"revive"
],
"text": "unused-parameter"
},
{
"linters": [
"revive"
],
"text": "redefines-builtin-id"
},
{
"linters": [
"revive"
],
"text": "superfluous-else"
},
{
"linters": [
"revive"
],
"text": "empty-block"
},
{
"linters": [
"revive"
],
"text": "if-return: redundant if"
},
{
"linters": [
"revive"
],
"text": "var-naming: avoid meaningless package names"
}
]
}
},
"run": {
"tests": false
},
"version": "2"
}
================================================
FILE: CODEOWNERS
================================================
* @rancher/rancher-squad-frameworks
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
================================================
FILE: Makefile
================================================
all: generate validate build
generate:
go generate
validate:
go fmt ./...
go vet ./...
build:
go build ./...
================================================
FILE: README.md
================================================
# Wrangler
Most people writing controllers are a bit lost as they find that there is nothing in Kubernetes that is like `type Controller interface` where you can just do `NewController`. Instead a controller is really just a pattern of how you use the generated clientsets, informers, and listers combined with some custom event handlers and a workqueue.
Wrangler is a framework for using controllers. Controllers wrap clients, informers, listers into a simple usable controller pattern that promotes some good practices.
<br>
## Some Projects that use Wrangler
[rancher](https://github.com/rancher/rancher)
[eks-operator](https://github.com/rancher/eks-operator)
[aks-operator](https://github.com/rancher/aks-operator)
[gke-operator](https://github.com/rancher/gke-operator)
## Versioning and Updates
Wrangler releases use [semantic versioning](https://semver.org/). New major releases are created for breaking changes, new minor releases are created for features, and patches are added for everything else.
The most recent Major.Minor.x release and any releases being used by the most recent patch version of a [supported rancher version](https://www.suse.com/lifecycle/#rancher) will be maintained. The most recent major will receive minor releases, along with patch releases on its most up to date minor release. Older Major.Minor.x releases still in use by rancher will receive security patches at minimum. Consequently, there will be 1-3 maintained releases of the form Major.Minor.x at a time. Currently maintained versions:
| Wrangler Version | Rancher Version | Update Level |
| ---------------- | --------------- | ---------------------- |
| 1.0.x | 2.6.x | Security Fixes |
| 1.1.x | 2.7.x | Bug and Security Fixes |
Wrangler releases are not from the default branch. Instead they are from branches with the naming pattern `release-MAJOR.MINOR`. The default branch (i.e. master) is where changes initially go. This includes bug fixes and new features. Bug fixes are cherry-picked to release branches to be included in patch releases. When it's time to create a new minor or major release, a new release branch is created from the default branch.
<br>
# Table of Contents
1. [How it Works](#How-it-works)
1. [Useful Definitions](#useful-definitions)
2. [How to Use Wrangler](#how-to-use-wrangler)
1. [How to Write and Register a Handler](#how-to-write-and-register-a-handler-to-a-controller)
1. [Creating an Instance of a Controller](#creating-an-instance-of-a-controller)
2. [How to Run Handlers](#how-to-run-handlers)
3. [Different Ways of Interacting with Objects](#different-ways-of-interacting-with-objects)
4. [A Look at Structures Used in Wrangler](#a-look-at-structures-used-in-wrangler)
<br>
# How it Works
Wrangler provides a code generator that will generate the clientset, informers, listers and
additionally generate a controller per resource type. The interface to the controller can be seen in the [Looking at Structures Used in Wrangler](#a-look-at-structures-used-in-wrangler) section.
<br>
The controller interface along with other helpful structs, interfaces, and functions are provided by another project [lasso](https://github.com/rancher/lasso). Lasso ties together the aforementioned tools while wrangler leverages them in a user friendly way.
To use the controller to run custom code for Kubernetes resource types all one needs to do is register OnChange handlers and run the controller. Also using the controller interface one can access the client and caches through a simple flat API.
A typical, non-wrangler Kubernetes application would most likely use an informer for a resource type to add an event handler. Instead, wrangler uses lasso to register each handler which then aggregates the handlers into one function that accepts an object for the controller's resource type and then runs that object through all the handlers. This function is then registered to the Kubernetes informer for that controller's respective resource type. This is done so that an object can run through the handlers in a serialized way. This allows each handler to receive the updated version of the object and avoid many conflicts that would otherwise occur if the handlers were not chained together in this fashion.
<br>
## Useful Definitions:
<dl>
<dt>factory</dt>
<dd>Factories manage controllers. Wrangler generates factories for each API group. Wrangler factories use lasso shared factories for caches and controllers underneath.
The lasso factories do most of the heavy lifting but are more resource type agnostic. Wrangler wraps lasso's factories to provide resource type specific clients and controllers.
When accessing a wrangler generated controller, a controller for that resource type is requested from a lasso factory. If the controller exists it will be returned. Otherwise, the lasso factory will create it, persist it, and return it. You can consult the [lasso](https://github.com/rancher/lasso) repository for more details on factories.</dd>
<dt>informers</dt>
<dd>Broadcasts events for a given resource type and can register handlers for those events.</dd>
<dt>listers</dt>
<dd>Sometimes referred to as a cache, uses informers to update a local list of objects for a certain resource type to avoid making requests to the K8s API.</dd>
<dt>event handlers</dt>
<dd>Functions that run when a particular event is applied to the resource type the event handler is assigned to.</dd>
<dt>workqueue</dt>
<dd>A queue of items to be processed. In this context a queue will usually be a queue of objects of a certain resource type waiting to be processed by all handlers assigned to that resource type.</dd>
</dl>
<br>
# How to Use Wrangler
Generate controllers for CRDs by using Run() from the controllergen package. This will look like the
following:
```golang
controllergen.Run(args.Options{
OutputPackage: "github.com/rancher/rancher/pkg/generated",
Boilerplate: "scripts/boilerplate.go.txt",
Groups: map[string]args.Group{
"management.cattle.io": {
PackageName: "management.cattle.io",
Types: []interface{}{
// All structs with an embedded ObjectMeta field will be picked up
"./pkg/apis/management.cattle.io/v3",
// ProjectCatalog and ClusterCatalog are named
// explicitly here because they do not have an
// ObjectMeta field in their struct. Instead
// they embed type v3.Catalog{} which
// is a valid object on its own and is generated
// above.
v3.ProjectCatalog{},
v3.ClusterCatalog{},
},
GenerateTypes: true,
},
"ui.cattle.io": {
PackageName: "ui.cattle.io",
Types: []interface{}{
"./pkg/apis/ui.cattle.io/v1",
},
GenerateTypes: true,
},
},
})
```
For the structs to be used when generating controllers they must have the following comments above the structs (note the newline between the comment and struct so it is not rejected by linters):
```
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
```
Four types are shown below. This file would be located at
`"pkg/apis/management.cattle.io/v3"` relative to the project root
directory. The line passing the "./pkg/apis/management.cattle.io/v3"
path ensure that the Setting and Catalog controllers are generated.
The lines naming the ProjectCatalog and ClusterCatalog structs ensure
the respective controllers are generated since neither directly have
an ObjectMeta field.:
``` golang
import (
"github.com/rancher/norman/types"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Setting struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Value string `json:"value" norman:"required"`
Default string `json:"default" norman:"nocreate,noupdate"`
Customized bool `json:"customized" norman:"nocreate,noupdate"`
Source string `json:"source" norman:"nocreate,noupdate,options=db|default|env"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ProjectCatalog struct {
types.Namespaced
Catalog `json:",inline" mapstructure:",squash"`
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterCatalog struct {
types.Namespaced
Catalog `json:",inline" mapstructure:",squash"`
ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"`
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Catalog struct {
metav1.TypeMeta `json:",inline"`
// Standard object’s metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the catalog. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec CatalogSpec `json:"spec"`
Status CatalogStatus `json:"status"`
}
```
__Note:__ This is real code taken from [rancher](https://github.com/rancher/rancher) and may not run at the time of reading this. This is meant to provide an example of how one might begin to use wrangler.
<br>
### Creating an Instance of a Controller
Controllers are categorized by their API group and bundled into a struct called a factory. Functions to create factories are generated by the Run function discussed above. To run one of the functions that creates a factory, import the proper package from the output directory of the generated code.
```golang
import (
"github.com/rancher/rancher/pkg/generated/controllers/management.cattle.io"
"k8s.io/client-go/rest"
)
func createFactory(config *rest.Config) {
mgmt, err := management.NewFactoryFromConfig(restConfig)
if err != nil {
return nil, err
}
}
// Running the functions Management() and V3(), which are the api group and version of the resource types I have generated in this example, is necessary
// to instantiate the controller factories for the group and version. User() instantiates the controller for the user resource. This
// can be done elsewhere, like when creating a struct but it must be done before the controller is run. Otherwise, the cache will
// not work. In this case we are registering a handler so we would have ended up using these methods by necessity, but if we wanted
// to access a cache for another resource type in our handler then we also need to make sure it is instantiated in a similar fashion.
users := mgmt.Management().V3().User("")
```
## How to Write and Register a Handler to a Controller
Registering a handler means to assign a handler to a specific Kubernetes resource's controller. These handlers will then run when
the appropriate event occurs on an object of that controller's resource type.
This will be a continuation of our above example:
```golang
import (
"context"
"github.com/rancher/rancher/pkg/generated/controllers/management.cattle.io"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/core"
"k8s.io/client-go/rest"
)
mgmt, err := management.NewFactoryFromConfig(restConfig)
if err != nil {
return nil, err
}
users := mgmt.Management().V3().User("")
// passing a namespace here is optional. If an empty string is passed then the client will look at
// all configmap objects from all namespaces
configmaps := core.Management().Core().Configmaps("examplenamespace")
syncHandler := func(id string, obj *v3.User) (*v3.User, error) {
if obj != nil {
return obj, nil
}
recordedNote := obj.Annotations != nil && obj.Annotations["wroteanoteaboutuser"] == "true"
if recordedNote {
// there already is a note, noop
return obj, nil
}
// we are getting the "mainrecord" configmap from the configmap cache. The cache is maintained
// locally and can try to fulfill requests without using the k8s api. This is much faster and
// efficient, however it does not update immediately so it is possible that if the object
// being requested was recently created that the cache will miss and return a not found error.
// In this scenario you can either count on the handler reenqueueing and retrying or you can
// just use the regular client.
record, err := configmaps.Cache().Get("", "mainrecord")
if err != nil {
return obj, err
}
record.Data[obj.name] = "recorded"
record, err = configmaps.Update(record)
if err != nil {
return obj, err
}
// This is done because obj is from the cache that is iterated over to run handlers and perform other tasks. If the subsequent
// update fails then we will end up with an object on our cache that does not match the "truth" (how the object is in etcd).
obj = obj.DeepCopy()
if obj.Annotations == nil {
obj.Anotations = make(map[string]string)
}
obj.Annotations["wroteanoteaboutuser"] = "true"
// Here we are using the k8s client embedded onto the users controller to perform an update. This will go to the K8s API.
return users.Update(obj)
}
users.OnChange(context.Background(), "user-example-annotate-note-handler", syncHandler)
```
### How to Run Handlers
Now that we have registered an OnChange handler, we can run it like so:
`mgmt.Start(context.Background(), 50)`
<br>
### Different Ways of Interacting With Objects
In the above example, two clients and one cache are being used to interact with objects. A client can
Create, Update, UpdateStatus, Delete, Get, Watch and Patch an object, or List and Watch objects of its respective resource type. A Cache can get an object or list the objects for its respective resource type and will try to get the data locally (from its cache) if possible. The client and cache are the most common ways to interact with an object using wrangler.
Another way to interact with objects is to use the Apply client. The apply client works similarly to applying yaml using kubectl. This has benefits such as not assuming the existence of an object like the Update method on a client does. Instead, you can apply a state and the object will be created if it does not exist already or be updated to match the passed desired state if the object does exist
already. Apply also allows the use of multiple Owner References in a way unique from the client- if any owner reference is deleted the object will be deleted.
<br>
## A Look at Structures Used in Wrangler
```golang
type FooController interface {
FooClient
// OnChange registers a handler that will run whenever an object of the matching resource type is created or updated. This function accepts a sync function specifically generated for the object type and then wraps the function in a function that is compatible with AddGenericHandler. It then uses AddGenericHandler to register the wrapped function.
OnChange(ctx context.Context, name string, sync FooHandler)
// OnRemove registers a handler that will run whenever an object of the matching resource type is removed. This function accepts a sync function specifically generated for the object type and then wraps the function in a function that is compatible with AddGenericRemoveHandler. It then uses AddGenericRemoveHandler to register the wrapped function.
OnRemove(ctx context.Context, name string, sync FooHandler)
// Enqueue will rerun all handlers registered to the object's type against the object
Enqueue(namespace, name string)
// Cache returns a locally maintained cache that can be used for get and list requests
Cache() FooCache
// Informer returns an informer for the resource type
Informer() cache.SharedIndexInformer
// GroupVersionKind returns the API group, version, and Kind of the resource type the controller is for
GroupVersionKind() schema.GroupVersionKind
// AddGenericHandler registers the handler function for the controller
AddGenericHandler(ctx context.Context, name string, handler generic.Handler)
// AddGenericRemoveHandler registers a handler that will happen when an object of the controller's resource type is removed
AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler)
// Updater returns a function that accepts a runtime.Object and asserts it as the controller's respective resource type struct. It then passes the object to the resource type's client's update function. This is mainly consumed internally by wrangler to implement other functionality.
Updater() generic.Updater
}
type FooClient interface {
// Create creates a new instance of resource type in kubernetes
Create(*v1alpha1.Foo) (*v1alpha1.Foo, error)
// Update updates the given object in kubernetes
Update(*v1alpha1.Foo) (*v1alpha1.Foo, error)
// Status of type's CRD must be a subresource for this method to be generated. Only updates
// status and does not trigger OnChange handlers.
UpdateStatus(*v1alpha1.Foo) (*v1alpha1.Foo, error)
// Delete deletes the given object in kubernetes
Delete(namespace, name string, options *metav1.DeleteOptions) error
// Get gets the object of the given name and namespace in kubernetes
Get(namespace, name string, options metav1.GetOptions) (*v1alpha1.Foo, error)
// List lists all the objects matching the given namespace for the resource type
List(namespace string, opts metav1.ListOptions) (*v1alpha1.FooList, error)
// Watch returns a channel that will stream objects as they are created, removed, or updated
Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error)
// Patch accepts a diff that can be applied to an existing object for the client's resource type. Depending on PatchType, which specifies the strategy
// to be used when applying the diff, patch can also create a new object. See the following for more information: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/, https://kubernetes.io/docs/reference/using-api/server-side-apply/.
Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Foo, err error)
}
type FooCache interface {
// Get gets the object of the given name and namespace from the local cache
Get(namespace, name string) (*v1alpha1.Foo, error)
// List lists all the objects matching the given namespace for the resource type from the cache
List(namespace string, selector labels.Selector) ([]*v1alpha1.Foo, error)
// AddIndexer is used to register a function will be used to organize objects in the cache. The indexer will return a string which indicates something about the object.
AddIndexer(indexName string, indexer FooIndexer)
// GetByIndex will search for objects that match the given key when the named indexer is applied to it
GetByIndex(indexName, key string) ([]*v1alpha1.Foo, error)
}
type FooIndexer func(obj *v1alpha1.Foo) ([]string, error)
```
# Versioning
See [VERSION.md](VERSION.md).
================================================
FILE: VERSION.md
================================================
Each wrangler major version supports a range of Kubernetes minor versions. The range supported by each major release line is include below. Wrangler follows the following rules for changes between major/minor/patch:
<ins>Major Version Increases</ins>:
- Support for a kubernetes version is explicitly removed (note that this means that wrangler uses a feature that does not work on this version).
- A breaking change is made, which is not necessary to resolve a defect.
<ins>Minor Version Increases</ins>:
- Support for a kubernetes version is added.
- A breaking change in an exported function is made to resolve a defect.
<ins>Patch Version Increases</ins>
- A bug was fixed.
- A feature was added, in a backwards-compatible way.
- A breaking change in an exported function is made to resolve a CVE.
<ins>Dealing with Kubernetes 1.35</ins>
Clients working with versions of Kubernetes before 1.35 might not work with the `main`
branch. Use a tag off the `release/v3` branch instead. At a later point there will be
a Wrangler Major version `v4`.
The current supported release lines are:
| Wrangler Branch | Wrangler Major version | Supported Kubernetes Versions |
|--------------------------|------------------------------------|------------------------------------------------|
| main | v3 | v1.26 - v1.35 |
| release/v2 | v2 | v1.23 - v1.26 |
| release/v3 | v3 | v1.23 - v1.34 |
================================================
FILE: codegen.go
================================================
//go:generate /bin/rm -rf pkg/generated
//go:generate go run pkg/codegen/main.go
package main
import (
"fmt"
)
var (
Version = "v0.0.0-dev"
GitCommit = "v0.0.0-dev"
)
func main() {
fmt.Println("Run go generate")
}
================================================
FILE: go.mod
================================================
module github.com/rancher/wrangler/v3
go 1.25.0
require (
github.com/evanphx/json-patch v5.9.11+incompatible
github.com/ghodss/yaml v1.0.0
github.com/moby/locker v1.0.1
github.com/rancher/lasso v0.2.7
github.com/sirupsen/logrus v1.9.4
github.com/stretchr/testify v1.11.1
go.uber.org/mock v0.6.0
golang.org/x/sync v0.20.0
golang.org/x/text v0.35.0
golang.org/x/tools v0.43.0
k8s.io/api v0.35.0
k8s.io/apiextensions-apiserver v0.35.0
k8s.io/apimachinery v0.35.0
k8s.io/client-go v0.35.0
k8s.io/code-generator v0.35.0
k8s.io/gengo v0.0.0-20250130153323-76c5745d3511
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b
k8s.io/kube-aggregator v0.35.0
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912
sigs.k8s.io/cli-utils v0.37.2
)
require (
cel.dev/expr v0.24.0 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/google/cel-go v0.26.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/spf13/cobra v1.10.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel v1.36.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect
go.opentelemetry.io/otel/sdk v1.36.0 // indirect
go.opentelemetry.io/otel/trace v1.36.0 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.34.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/term v0.41.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
google.golang.org/grpc v1.72.2 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.35.0 // indirect
k8s.io/component-base v0.35.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
================================================
FILE: go.sum
================================================
cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY=
cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU=
github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v5.9.11+incompatible h1:ixHHqfcGvxhWkniF1tWxBHA0yb4Z+d1UQi45df52xW8=
github.com/evanphx/json-patch v5.9.11+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI=
github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8=
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8=
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns=
github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs=
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA=
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
github.com/rancher/lasso v0.2.7 h1:N56Pm8KJSk7gRVYILSGb35QBfjcDDeGFMfwUCivsbeg=
github.com/rancher/lasso v0.2.7/go.mod h1:L3ol8PdO21KoMhNa3RWjpR3ZBnE70JCAod1nJuOvT1E=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/spf13/cobra v1.10.0 h1:a5/WeUlSDCvV5a45ljW2ZFtV0bTDpkfSAj3uqB6Sc+0=
github.com/spf13/cobra v1.10.0/go.mod h1:9dhySC7dnTtEiqzmqfkLj47BslqLCUPMXjG2lj/NgoE=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.8/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.etcd.io/etcd/api/v3 v3.6.5 h1:pMMc42276sgR1j1raO/Qv3QI9Af/AuyQUW6CBAWuntA=
go.etcd.io/etcd/api/v3 v3.6.5/go.mod h1:ob0/oWA/UQQlT1BmaEkWQzI0sJ1M0Et0mMpaABxguOQ=
go.etcd.io/etcd/client/pkg/v3 v3.6.5 h1:Duz9fAzIZFhYWgRjp/FgNq2gO1jId9Yae/rLn3RrBP8=
go.etcd.io/etcd/client/pkg/v3 v3.6.5/go.mod h1:8Wx3eGRPiy0qOFMZT/hfvdos+DjEaPxdIDiCDUv/FQk=
go.etcd.io/etcd/client/v3 v3.6.5 h1:yRwZNFBx/35VKHTcLDeO7XVLbCBFbPi+XV4OC3QJf2U=
go.etcd.io/etcd/client/v3 v3.6.5/go.mod h1:ZqwG/7TAFZ0BJ0jXRPoJjKQJtbFo/9NIY8uoFFKcCyo=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg=
go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE=
go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE=
go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs=
go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs=
go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY=
go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis=
go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4=
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU=
golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM=
golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY=
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM=
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8=
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo=
gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.35.0 h1:iBAU5LTyBI9vw3L5glmat1njFK34srdLmktWwLTprlY=
k8s.io/api v0.35.0/go.mod h1:AQ0SNTzm4ZAczM03QH42c7l3bih1TbAXYo0DkF8ktnA=
k8s.io/apiextensions-apiserver v0.35.0 h1:3xHk2rTOdWXXJM+RDQZJvdx0yEOgC0FgQ1PlJatA5T4=
k8s.io/apiextensions-apiserver v0.35.0/go.mod h1:E1Ahk9SADaLQ4qtzYFkwUqusXTcaV2uw3l14aqpL2LU=
k8s.io/apimachinery v0.35.0 h1:Z2L3IHvPVv/MJ7xRxHEtk6GoJElaAqDCCU0S6ncYok8=
k8s.io/apimachinery v0.35.0/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
k8s.io/apiserver v0.35.0 h1:CUGo5o+7hW9GcAEF3x3usT3fX4f9r8xmgQeCBDaOgX4=
k8s.io/apiserver v0.35.0/go.mod h1:QUy1U4+PrzbJaM3XGu2tQ7U9A4udRRo5cyxkFX0GEds=
k8s.io/client-go v0.35.0 h1:IAW0ifFbfQQwQmga0UdoH0yvdqrbwMdq9vIFEhRpxBE=
k8s.io/client-go v0.35.0/go.mod h1:q2E5AAyqcbeLGPdoRB+Nxe3KYTfPce1Dnu1myQdqz9o=
k8s.io/code-generator v0.35.0 h1:TvrtfKYZTm9oDF2z+veFKSCcgZE3Igv0svY+ehCmjHQ=
k8s.io/code-generator v0.35.0/go.mod h1:iS1gvVf3c/T71N5DOGYO+Gt3PdJ6B9LYSvIyQ4FHzgc=
k8s.io/component-base v0.35.0 h1:+yBrOhzri2S1BVqyVSvcM3PtPyx5GUxCK2tinZz1G94=
k8s.io/component-base v0.35.0/go.mod h1:85SCX4UCa6SCFt6p3IKAPej7jSnF3L8EbfSyMZayJR0=
k8s.io/gengo v0.0.0-20250130153323-76c5745d3511 h1:4eL6zr5VCj71nu2nOuQ6j6m/kqh5WueXBN8daZkNe90=
k8s.io/gengo v0.0.0-20250130153323-76c5745d3511/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b h1:gMplByicHV/TJBizHd9aVEsTYoJBnnUAT5MHlTkbjhQ=
k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-aggregator v0.35.0 h1:FBtbuRFA7Ohe2QKirFZcJf8rgimC8oSaNiCi4pdU5xw=
k8s.io/kube-aggregator v0.35.0/go.mod h1:vKBRpQUfDryb7udwUwF3eCSvv3AJNgHtL4PGl6PqAg8=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ=
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck=
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/cli-utils v0.37.2 h1:GOfKw5RV2HDQZDJlru5KkfLO1tbxqMoyn1IYUxqBpNg=
sigs.k8s.io/cli-utils v0.37.2/go.mod h1:V+IZZr4UoGj7gMJXklWBg6t5xbdThFBcpj4MrZuCYco=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco=
sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
================================================
FILE: pkg/apply/apply.go
================================================
package apply
import (
"context"
"fmt"
"sync"
"github.com/rancher/wrangler/v3/pkg/apply/injectors"
"github.com/rancher/wrangler/v3/pkg/objectset"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
)
const (
defaultNamespace = "default"
)
type Patcher func(namespace, name string, pt types.PatchType, data []byte) (runtime.Object, error)
// Reconciler return false if it did not handle this object
type Reconciler func(oldObj runtime.Object, newObj runtime.Object) (bool, error)
type ClientFactory func(gvr schema.GroupVersionResource) (dynamic.NamespaceableResourceInterface, error)
type InformerFactory interface {
Get(gvk schema.GroupVersionKind, gvr schema.GroupVersionResource) (cache.SharedIndexInformer, error)
}
type InformerGetter interface {
Informer() cache.SharedIndexInformer
GroupVersionKind() schema.GroupVersionKind
}
type PatchByGVK map[schema.GroupVersionKind]map[objectset.ObjectKey]string
func (p PatchByGVK) Add(gvk schema.GroupVersionKind, namespace, name, patch string) {
d, ok := p[gvk]
if !ok {
d = map[objectset.ObjectKey]string{}
p[gvk] = d
}
d[objectset.ObjectKey{
Name: name,
Namespace: namespace,
}] = patch
}
type Plan struct {
Create objectset.ObjectKeyByGVK
Delete objectset.ObjectKeyByGVK
Update PatchByGVK
Objects []runtime.Object
}
type Apply interface {
Apply(set *objectset.ObjectSet) error
ApplyObjects(objs ...runtime.Object) error
WithContext(ctx context.Context) Apply
WithCacheTypes(igs ...InformerGetter) Apply
WithCacheTypeFactory(factory InformerFactory) Apply
WithSetID(id string) Apply
WithOwner(obj runtime.Object) Apply
WithOwnerKey(key string, gvk schema.GroupVersionKind) Apply
WithInjector(injs ...injectors.ConfigInjector) Apply
WithInjectorName(injs ...string) Apply
WithPatcher(gvk schema.GroupVersionKind, patchers Patcher) Apply
WithReconciler(gvk schema.GroupVersionKind, reconciler Reconciler) Apply
WithStrictCaching() Apply
WithDynamicLookup() Apply
WithRestrictClusterScoped() Apply
WithDefaultNamespace(ns string) Apply
WithListerNamespace(ns string) Apply
WithRateLimiting(ratelimitingQPS float32) Apply
WithNoDelete() Apply
WithNoDeleteGVK(gvks ...schema.GroupVersionKind) Apply
WithGVK(gvks ...schema.GroupVersionKind) Apply
WithSetOwnerReference(controller, block bool) Apply
WithIgnorePreviousApplied() Apply
WithDiffPatch(gvk schema.GroupVersionKind, namespace, name string, patch []byte) Apply
FindOwner(obj runtime.Object) (runtime.Object, error)
PurgeOrphan(obj runtime.Object) error
DryRun(objs ...runtime.Object) (Plan, error)
}
func NewForConfig(cfg *rest.Config) (Apply, error) {
discovery, err := discovery.NewDiscoveryClientForConfig(cfg)
if err != nil {
return nil, err
}
return New(discovery, NewClientFactory(cfg)), nil
}
func New(discovery discovery.DiscoveryInterface, cf ClientFactory, igs ...InformerGetter) Apply {
a := &apply{
clients: &clients{
clientFactory: cf,
discovery: discovery,
namespaced: map[schema.GroupVersionKind]bool{},
gvkToGVR: map[schema.GroupVersionKind]schema.GroupVersionResource{},
clients: map[schema.GroupVersionKind]dynamic.NamespaceableResourceInterface{},
},
informers: map[schema.GroupVersionKind]cache.SharedIndexInformer{},
}
for _, ig := range igs {
a.informers[ig.GroupVersionKind()] = ig.Informer()
}
return a
}
type apply struct {
clients *clients
informers map[schema.GroupVersionKind]cache.SharedIndexInformer
}
type clients struct {
sync.Mutex
clientFactory ClientFactory
discovery discovery.DiscoveryInterface
namespaced map[schema.GroupVersionKind]bool
gvkToGVR map[schema.GroupVersionKind]schema.GroupVersionResource
clients map[schema.GroupVersionKind]dynamic.NamespaceableResourceInterface
}
func (c *clients) IsNamespaced(gvk schema.GroupVersionKind) (bool, error) {
c.Lock()
ok, exists := c.namespaced[gvk]
c.Unlock()
if exists {
return ok, nil
}
_, err := c.client(gvk)
if err != nil {
return false, err
}
c.Lock()
defer c.Unlock()
return c.namespaced[gvk], nil
}
func (c *clients) gvr(gvk schema.GroupVersionKind) schema.GroupVersionResource {
c.Lock()
defer c.Unlock()
return c.gvkToGVR[gvk]
}
func (c *clients) client(gvk schema.GroupVersionKind) (dynamic.NamespaceableResourceInterface, error) {
c.Lock()
defer c.Unlock()
if client, ok := c.clients[gvk]; ok {
return client, nil
}
resources, err := c.discovery.ServerResourcesForGroupVersion(gvk.GroupVersion().String())
if err != nil {
return nil, err
}
for _, resource := range resources.APIResources {
if resource.Kind != gvk.Kind {
continue
}
client, err := c.clientFactory(gvk.GroupVersion().WithResource(resource.Name))
if err != nil {
return nil, err
}
c.namespaced[gvk] = resource.Namespaced
c.clients[gvk] = client
c.gvkToGVR[gvk] = gvk.GroupVersion().WithResource(resource.Name)
return client, nil
}
return nil, fmt.Errorf("failed to discover client for %s", gvk)
}
func (a *apply) newDesiredSet() desiredSet {
return desiredSet{
a: a,
defaultNamespace: defaultNamespace,
ctx: context.Background(),
ratelimitingQPS: 1,
reconcilers: defaultReconcilers,
strictCaching: true,
}
}
func (a *apply) DryRun(objs ...runtime.Object) (Plan, error) {
return a.newDesiredSet().DryRun(objs...)
}
func (a *apply) Apply(set *objectset.ObjectSet) error {
return a.newDesiredSet().Apply(set)
}
func (a *apply) ApplyObjects(objs ...runtime.Object) error {
os := objectset.NewObjectSet()
os.Add(objs...)
return a.newDesiredSet().Apply(os)
}
func (a *apply) WithSetID(id string) Apply {
return a.newDesiredSet().WithSetID(id)
}
func (a *apply) WithOwner(obj runtime.Object) Apply {
return a.newDesiredSet().WithOwner(obj)
}
func (a *apply) WithOwnerKey(key string, gvk schema.GroupVersionKind) Apply {
return a.newDesiredSet().WithOwnerKey(key, gvk)
}
func (a *apply) WithInjector(injs ...injectors.ConfigInjector) Apply {
return a.newDesiredSet().WithInjector(injs...)
}
func (a *apply) WithInjectorName(injs ...string) Apply {
return a.newDesiredSet().WithInjectorName(injs...)
}
func (a *apply) WithCacheTypes(igs ...InformerGetter) Apply {
return a.newDesiredSet().WithCacheTypes(igs...)
}
func (a *apply) WithCacheTypeFactory(factory InformerFactory) Apply {
return a.newDesiredSet().WithCacheTypeFactory(factory)
}
func (a *apply) WithGVK(gvks ...schema.GroupVersionKind) Apply {
return a.newDesiredSet().WithGVK(gvks...)
}
func (a *apply) WithPatcher(gvk schema.GroupVersionKind, patcher Patcher) Apply {
return a.newDesiredSet().WithPatcher(gvk, patcher)
}
func (a *apply) WithReconciler(gvk schema.GroupVersionKind, reconciler Reconciler) Apply {
return a.newDesiredSet().WithReconciler(gvk, reconciler)
}
func (a *apply) WithStrictCaching() Apply {
return a.newDesiredSet().WithStrictCaching()
}
func (a *apply) WithDynamicLookup() Apply {
return a.newDesiredSet().WithDynamicLookup()
}
func (a *apply) WithRestrictClusterScoped() Apply {
return a.newDesiredSet().WithRestrictClusterScoped()
}
func (a *apply) WithDefaultNamespace(ns string) Apply {
return a.newDesiredSet().WithDefaultNamespace(ns)
}
func (a *apply) WithListerNamespace(ns string) Apply {
return a.newDesiredSet().WithListerNamespace(ns)
}
func (a *apply) WithRateLimiting(ratelimitingQPS float32) Apply {
return a.newDesiredSet().WithRateLimiting(ratelimitingQPS)
}
func (a *apply) WithNoDelete() Apply {
return a.newDesiredSet().WithNoDelete()
}
func (a *apply) WithNoDeleteGVK(gvks ...schema.GroupVersionKind) Apply {
return a.newDesiredSet().WithNoDeleteGVK(gvks...)
}
func (a *apply) WithSetOwnerReference(controller, block bool) Apply {
return a.newDesiredSet().WithSetOwnerReference(controller, block)
}
func (a *apply) WithContext(ctx context.Context) Apply {
return a.newDesiredSet().WithContext(ctx)
}
func (a *apply) WithIgnorePreviousApplied() Apply {
return a.newDesiredSet().WithIgnorePreviousApplied()
}
func (a *apply) FindOwner(obj runtime.Object) (runtime.Object, error) {
return a.newDesiredSet().FindOwner(obj)
}
func (a *apply) PurgeOrphan(obj runtime.Object) error {
return a.newDesiredSet().PurgeOrphan(obj)
}
func (a *apply) WithDiffPatch(gvk schema.GroupVersionKind, namespace, name string, patch []byte) Apply {
return a.newDesiredSet().WithDiffPatch(gvk, namespace, name, patch)
}
================================================
FILE: pkg/apply/client_factory.go
================================================
package apply
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
)
func NewClientFactory(config *rest.Config) ClientFactory {
return func(gvr schema.GroupVersionResource) (dynamic.NamespaceableResourceInterface, error) {
client, err := dynamic.NewForConfig(config)
if err != nil {
return nil, err
}
return client.Resource(gvr), nil
}
}
================================================
FILE: pkg/apply/desiredset.go
================================================
package apply
import (
"context"
"errors"
"fmt"
"github.com/rancher/wrangler/v3/pkg/apply/injectors"
"github.com/rancher/wrangler/v3/pkg/kv"
"github.com/rancher/wrangler/v3/pkg/merr"
"github.com/rancher/wrangler/v3/pkg/objectset"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/meta"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/tools/cache"
)
// Indexer name added for cached types
const byHash = "wrangler.byObjectSetHash"
type patchKey struct {
schema.GroupVersionKind
objectset.ObjectKey
}
type desiredSet struct {
a *apply
ctx context.Context
defaultNamespace string
listerNamespace string
ignorePreviousApplied bool
setOwnerReference bool
ownerReferenceController bool
ownerReferenceBlock bool
strictCaching bool
restrictClusterScoped bool
pruneTypes map[schema.GroupVersionKind]cache.SharedIndexInformer
patchers map[schema.GroupVersionKind]Patcher
reconcilers map[schema.GroupVersionKind]Reconciler
diffPatches map[patchKey][][]byte
informerFactory InformerFactory
remove bool
noDelete bool
noDeleteGVK map[schema.GroupVersionKind]struct{}
setID string
objs *objectset.ObjectSet
owner runtime.Object
injectors []injectors.ConfigInjector
ratelimitingQPS float32
injectorNames []string
errs []error
createPlan bool
plan Plan
}
func (o *desiredSet) err(err error) error {
o.errs = append(o.errs, err)
return o.Err()
}
func (o desiredSet) Err() error {
return merr.NewErrors(append(o.errs, o.objs.Err())...)
}
func (o desiredSet) DryRun(objs ...runtime.Object) (Plan, error) {
o.objs = objectset.NewObjectSet()
o.objs.Add(objs...)
return o.dryRun()
}
func (o desiredSet) Apply(set *objectset.ObjectSet) error {
if set == nil {
set = objectset.NewObjectSet()
}
o.objs = set
return o.apply()
}
func (o desiredSet) ApplyObjects(objs ...runtime.Object) error {
os := objectset.NewObjectSet()
os.Add(objs...)
return o.Apply(os)
}
func (o desiredSet) WithDiffPatch(gvk schema.GroupVersionKind, namespace, name string, patch []byte) Apply {
patches := map[patchKey][][]byte{}
for k, v := range o.diffPatches {
patches[k] = v
}
key := patchKey{
GroupVersionKind: gvk,
ObjectKey: objectset.ObjectKey{
Name: name,
Namespace: namespace,
},
}
patches[key] = append(patches[key], patch)
o.diffPatches = patches
return o
}
// WithGVK uses a known listing of existing gvks to modify the the prune types to allow for deletion of objects
func (o desiredSet) WithGVK(gvks ...schema.GroupVersionKind) Apply {
pruneTypes := make(map[schema.GroupVersionKind]cache.SharedIndexInformer, len(gvks))
for k, v := range o.pruneTypes {
pruneTypes[k] = v
}
for _, gvk := range gvks {
pruneTypes[gvk] = nil
}
o.pruneTypes = pruneTypes
return o
}
func (o desiredSet) WithSetID(id string) Apply {
o.setID = id
return o
}
func (o desiredSet) WithOwnerKey(key string, gvk schema.GroupVersionKind) Apply {
obj := &v1.PartialObjectMetadata{}
obj.Namespace, obj.Name = kv.RSplit(key, "/")
obj.SetGroupVersionKind(gvk)
o.owner = obj
return o
}
func (o desiredSet) WithOwner(obj runtime.Object) Apply {
o.owner = obj
return o
}
func (o desiredSet) WithSetOwnerReference(controller, block bool) Apply {
o.setOwnerReference = true
o.ownerReferenceController = controller
o.ownerReferenceBlock = block
return o
}
func (o desiredSet) WithInjector(injs ...injectors.ConfigInjector) Apply {
o.injectors = append(o.injectors, injs...)
return o
}
func (o desiredSet) WithInjectorName(injs ...string) Apply {
o.injectorNames = append(o.injectorNames, injs...)
return o
}
func (o desiredSet) WithCacheTypeFactory(factory InformerFactory) Apply {
o.informerFactory = factory
return o
}
func (o desiredSet) WithIgnorePreviousApplied() Apply {
o.ignorePreviousApplied = true
return o
}
func (o desiredSet) WithCacheTypes(igs ...InformerGetter) Apply {
pruneTypes := make(map[schema.GroupVersionKind]cache.SharedIndexInformer, len(igs))
for k, v := range o.pruneTypes {
pruneTypes[k] = v
}
for _, ig := range igs {
informer := ig.Informer()
if err := addIndexerByHash(informer.GetIndexer()); err != nil {
// Ignore repeatedly adding the same indexer for different types
if !errors.Is(err, errIndexerAlreadyExists) {
logrus.Warnf("Problem adding hash indexer to informer [%s]: %v", ig.GroupVersionKind().Kind, err)
}
}
pruneTypes[ig.GroupVersionKind()] = informer
}
o.pruneTypes = pruneTypes
return o
}
// addIndexerByHash an Informer to index objects by the hash annotation value
func addIndexerByHash(indexer cache.Indexer) error {
if _, alreadyAdded := indexer.GetIndexers()[byHash]; alreadyAdded {
return fmt.Errorf("adding indexer %q: %w", byHash, errIndexerAlreadyExists)
}
return indexer.AddIndexers(map[string]cache.IndexFunc{
byHash: func(obj interface{}) ([]string, error) {
metadata, err := meta.Accessor(obj)
if err != nil {
return nil, err
}
labels := metadata.GetLabels()
if labels == nil || labels[LabelHash] == "" {
return nil, nil
}
return []string{labels[LabelHash]}, nil
},
})
}
func (o desiredSet) WithPatcher(gvk schema.GroupVersionKind, patcher Patcher) Apply {
patchers := map[schema.GroupVersionKind]Patcher{}
for k, v := range o.patchers {
patchers[k] = v
}
patchers[gvk] = patcher
o.patchers = patchers
return o
}
func (o desiredSet) WithReconciler(gvk schema.GroupVersionKind, reconciler Reconciler) Apply {
reconcilers := map[schema.GroupVersionKind]Reconciler{}
for k, v := range o.reconcilers {
reconcilers[k] = v
}
reconcilers[gvk] = reconciler
o.reconcilers = reconcilers
return o
}
func (o desiredSet) WithStrictCaching() Apply {
o.strictCaching = true
return o
}
func (o desiredSet) WithDynamicLookup() Apply {
o.strictCaching = false
return o
}
func (o desiredSet) WithRestrictClusterScoped() Apply {
o.restrictClusterScoped = true
return o
}
func (o desiredSet) WithDefaultNamespace(ns string) Apply {
if ns == "" {
o.defaultNamespace = defaultNamespace
} else {
o.defaultNamespace = ns
}
return o
}
func (o desiredSet) WithListerNamespace(ns string) Apply {
o.listerNamespace = ns
return o
}
func (o desiredSet) WithRateLimiting(ratelimitingQPS float32) Apply {
o.ratelimitingQPS = ratelimitingQPS
return o
}
func (o desiredSet) WithNoDelete() Apply {
o.noDelete = true
return o
}
func (o desiredSet) WithNoDeleteGVK(gvks ...schema.GroupVersionKind) Apply {
if o.noDeleteGVK == nil {
o.noDeleteGVK = make(map[schema.GroupVersionKind]struct{})
}
for _, curr := range gvks {
o.noDeleteGVK[curr] = struct{}{}
}
return o
}
func (o desiredSet) WithContext(ctx context.Context) Apply {
o.ctx = ctx
return o
}
================================================
FILE: pkg/apply/desiredset_apply.go
================================================
package apply
import (
"crypto/sha1"
"encoding/hex"
"errors"
"fmt"
"sync"
"time"
"github.com/sirupsen/logrus"
gvk2 "github.com/rancher/wrangler/v3/pkg/gvk"
"github.com/rancher/wrangler/v3/pkg/apply/injectors"
"github.com/rancher/wrangler/v3/pkg/objectset"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/client-go/util/flowcontrol"
)
const (
LabelID = "objectset.rio.cattle.io/id"
LabelGVK = "objectset.rio.cattle.io/owner-gvk"
LabelName = "objectset.rio.cattle.io/owner-name"
LabelNamespace = "objectset.rio.cattle.io/owner-namespace"
LabelHash = "objectset.rio.cattle.io/hash"
LabelPrefix = "objectset.rio.cattle.io/"
LabelPrune = "objectset.rio.cattle.io/prune"
)
var (
hashOrder = []string{
LabelID,
LabelGVK,
LabelName,
LabelNamespace,
}
rls = map[string]flowcontrol.RateLimiter{}
rlsLock sync.Mutex
errIndexerAlreadyExists = errors.New("an indexer with the same already exists")
)
func (o *desiredSet) getRateLimit(labelHash string) flowcontrol.RateLimiter {
var rl flowcontrol.RateLimiter
rlsLock.Lock()
defer rlsLock.Unlock()
if o.remove {
delete(rls, labelHash)
} else {
rl = rls[labelHash]
if rl == nil {
rl = flowcontrol.NewTokenBucketRateLimiter(o.ratelimitingQPS, 10)
rls[labelHash] = rl
}
}
return rl
}
func (o *desiredSet) dryRun() (Plan, error) {
o.createPlan = true
o.plan.Create = objectset.ObjectKeyByGVK{}
o.plan.Update = PatchByGVK{}
o.plan.Delete = objectset.ObjectKeyByGVK{}
err := o.apply()
return o.plan, err
}
func (o *desiredSet) apply() error {
if o.objs == nil || o.objs.Len() == 0 {
o.remove = true
}
if err := o.Err(); err != nil {
return err
}
labelSet, annotationSet, err := GetLabelsAndAnnotations(o.setID, o.owner)
if err != nil {
return o.err(err)
}
rl := o.getRateLimit(labelSet[LabelHash])
if rl != nil {
t := time.Now()
rl.Accept()
if d := time.Now().Sub(t); d.Seconds() > 1 {
logrus.Infof("rate limited %s(%s) %s", o.setID, labelSet, d)
}
}
objList, err := o.injectLabelsAndAnnotations(labelSet, annotationSet)
if err != nil {
return o.err(err)
}
objList, err = o.runInjectors(objList)
if err != nil {
return o.err(err)
}
objs := o.collect(objList)
debugID := o.debugID()
sel, err := GetSelector(labelSet)
if err != nil {
return o.err(err)
}
for _, gvk := range o.objs.GVKOrder(o.knownGVK()...) {
o.process(debugID, sel, gvk, objs[gvk])
}
return o.Err()
}
func (o *desiredSet) knownGVK() (ret []schema.GroupVersionKind) {
for k := range o.pruneTypes {
ret = append(ret, k)
}
return
}
func (o *desiredSet) debugID() string {
if o.owner == nil {
return o.setID
}
metadata, err := meta.Accessor(o.owner)
if err != nil {
return o.setID
}
return fmt.Sprintf("%s %s", o.setID, objectset.ObjectKey{
Namespace: metadata.GetNamespace(),
Name: metadata.GetName(),
})
}
func (o *desiredSet) collect(objList []runtime.Object) objectset.ObjectByGVK {
result := objectset.ObjectByGVK{}
for _, obj := range objList {
_, _ = result.Add(obj)
}
return result
}
func (o *desiredSet) runInjectors(objList []runtime.Object) ([]runtime.Object, error) {
var err error
for _, inj := range o.injectors {
if inj == nil {
continue
}
objList, err = inj(objList)
if err != nil {
return nil, err
}
}
for _, name := range o.injectorNames {
inj := injectors.Get(name)
if inj == nil {
continue
}
objList, err = inj(objList)
if err != nil {
return nil, err
}
}
return objList, nil
}
// GetSelectorFromOwner returns the label selector for the owner object which is useful
// to list the dependents
func GetSelectorFromOwner(setID string, owner runtime.Object) (labels.Selector, error) {
// Build the labels, we want the hash label for the lister
ownerLabel, _, err := GetLabelsAndAnnotations(setID, owner)
if err != nil {
return nil, err
}
return GetSelector(ownerLabel)
}
func GetSelector(labelSet map[string]string) (labels.Selector, error) {
req, err := labels.NewRequirement(LabelHash, selection.Equals, []string{labelSet[LabelHash]})
if err != nil {
return nil, err
}
return labels.NewSelector().Add(*req), nil
}
func GetLabelsAndAnnotations(setID string, owner runtime.Object) (map[string]string, map[string]string, error) {
if setID == "" && owner == nil {
return nil, nil, fmt.Errorf("set ID or owner must be set")
}
annotations := map[string]string{
LabelID: setID,
}
if owner != nil {
gvk, err := gvk2.Get(owner)
if err != nil {
return nil, nil, err
}
annotations[LabelGVK] = gvk.String()
metadata, err := meta.Accessor(owner)
if err != nil {
return nil, nil, fmt.Errorf("failed to get metadata for %s", gvk)
}
annotations[LabelName] = metadata.GetName()
annotations[LabelNamespace] = metadata.GetNamespace()
}
labels := map[string]string{
LabelHash: objectSetHash(annotations),
}
return labels, annotations, nil
}
func (o *desiredSet) injectLabelsAndAnnotations(labels, annotations map[string]string) ([]runtime.Object, error) {
var result []runtime.Object
for _, objMap := range o.objs.ObjectsByGVK() {
for key, obj := range objMap {
obj = obj.DeepCopyObject()
meta, err := meta.Accessor(obj)
if err != nil {
return nil, fmt.Errorf("failed to get metadata for %s: %w", key, err)
}
setLabels(meta, labels)
setAnnotations(meta, annotations)
result = append(result, obj)
}
}
return result, nil
}
func setAnnotations(meta metav1.Object, annotations map[string]string) {
objAnn := meta.GetAnnotations()
if objAnn == nil {
objAnn = map[string]string{}
}
delete(objAnn, LabelApplied)
for k, v := range annotations {
objAnn[k] = v
}
meta.SetAnnotations(objAnn)
}
func setLabels(meta metav1.Object, labels map[string]string) {
objLabels := meta.GetLabels()
if objLabels == nil {
objLabels = map[string]string{}
}
for k, v := range labels {
objLabels[k] = v
}
meta.SetLabels(objLabels)
}
func objectSetHash(labels map[string]string) string {
dig := sha1.New()
for _, key := range hashOrder {
dig.Write([]byte(labels[key]))
}
return hex.EncodeToString(dig.Sum(nil))
}
================================================
FILE: pkg/apply/desiredset_compare.go
================================================
package apply
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"strings"
"sync"
jsonpatch "github.com/evanphx/json-patch"
data2 "github.com/rancher/wrangler/v3/pkg/data"
"github.com/rancher/wrangler/v3/pkg/data/convert"
"github.com/rancher/wrangler/v3/pkg/objectset"
patch2 "github.com/rancher/wrangler/v3/pkg/patch"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/meta"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/jsonmergepatch"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/client-go/dynamic"
)
const (
LabelApplied = "objectset.rio.cattle.io/applied"
)
var (
knownListKeys = map[string]bool{
"apiVersion": true,
"containerPort": true,
"devicePath": true,
"ip": true,
"kind": true,
"mountPath": true,
"name": true,
"port": true,
"topologyKey": true,
"type": true,
}
// Pools used by gzip writers
buffersPool = sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
}
gzipWritersPool = sync.Pool{
New: func() interface{} {
// Initialize a new writer with discarding destination
// It should be reconfigured prior usage with an actual buffer using Reset()
return gzip.NewWriter(io.Discard)
},
}
)
func prepareObjectForCreate(gvk schema.GroupVersionKind, obj runtime.Object) (runtime.Object, error) {
serialized, err := serializeApplied(obj)
if err != nil {
return nil, err
}
obj = obj.DeepCopyObject()
m, err := meta.Accessor(obj)
if err != nil {
return nil, err
}
annotations := m.GetAnnotations()
if annotations == nil {
annotations = map[string]string{}
}
annotations[LabelApplied] = appliedToAnnotation(serialized)
m.SetAnnotations(annotations)
typed, err := meta.TypeAccessor(obj)
if err != nil {
return nil, err
}
apiVersion, kind := gvk.ToAPIVersionAndKind()
typed.SetAPIVersion(apiVersion)
typed.SetKind(kind)
return obj, nil
}
func originalAndModified(gvk schema.GroupVersionKind, oldMetadata v1.Object, newObject runtime.Object) ([]byte, []byte, error) {
original, err := getOriginalBytes(gvk, oldMetadata)
if err != nil {
return nil, nil, err
}
newObject, err = prepareObjectForCreate(gvk, newObject)
if err != nil {
return nil, nil, err
}
modified, err := json.Marshal(newObject)
return original, modified, err
}
func emptyMaps(data map[string]interface{}, keys ...string) bool {
for _, key := range append(keys, "__invalid_key__") {
if len(data) == 0 {
// map is empty so all children are empty too
return true
} else if len(data) > 1 {
// map has more than one key so not empty
return false
}
value, ok := data[key]
if !ok {
// map has one key but not what we are expecting so not considered empty
return false
}
data = convert.ToMapInterface(value)
}
return true
}
func sanitizePatch(patch []byte, removeObjectSetAnnotation bool) ([]byte, error) {
mod := false
data := map[string]interface{}{}
err := json.Unmarshal(patch, &data)
if err != nil {
return nil, err
}
if _, ok := data["kind"]; ok {
mod = true
delete(data, "kind")
}
if _, ok := data["apiVersion"]; ok {
mod = true
delete(data, "apiVersion")
}
if _, ok := data["status"]; ok {
mod = true
delete(data, "status")
}
if deleted := removeCreationTimestamp(data); deleted {
mod = true
}
if removeObjectSetAnnotation {
metadata := convert.ToMapInterface(data2.GetValueN(data, "metadata"))
annotations := convert.ToMapInterface(data2.GetValueN(data, "metadata", "annotations"))
for k := range annotations {
if strings.HasPrefix(k, LabelPrefix) {
mod = true
delete(annotations, k)
}
}
if mod && len(annotations) == 0 {
delete(metadata, "annotations")
if len(metadata) == 0 {
delete(data, "metadata")
}
}
}
if emptyMaps(data, "metadata", "annotations") {
return []byte("{}"), nil
}
if !mod {
return patch, nil
}
return json.Marshal(data)
}
func applyPatch(gvk schema.GroupVersionKind, reconciler Reconciler, patcher Patcher, debugID string, ignoreOriginal bool, oldObject, newObject runtime.Object, diffPatches [][]byte) (bool, error) {
oldMetadata, err := meta.Accessor(oldObject)
if err != nil {
return false, err
}
original, modified, err := originalAndModified(gvk, oldMetadata, newObject)
if err != nil {
return false, err
}
if ignoreOriginal {
original = nil
}
current, err := json.Marshal(oldObject)
if err != nil {
return false, err
}
patchType, patch, err := doPatch(gvk, original, modified, current, diffPatches)
if err != nil {
return false, fmt.Errorf("patch generation: %w", err)
}
if string(patch) == "{}" {
return false, nil
}
patch, err = sanitizePatch(patch, false)
if err != nil {
return false, err
}
if string(patch) == "{}" {
return false, nil
}
logrus.Debugf("DesiredSet - Patch %s %s/%s for %s -- [PATCH:%s, ORIGINAL:%s, MODIFIED:%s, CURRENT:%s]", gvk, oldMetadata.GetNamespace(), oldMetadata.GetName(), debugID, patch, original, modified, current)
if reconciler != nil {
newObject, err := prepareObjectForCreate(gvk, newObject)
if err != nil {
return false, err
}
originalObject, err := getOriginalObject(gvk, oldMetadata)
if err != nil {
return false, err
}
if originalObject == nil {
originalObject = oldObject
}
handled, err := reconciler(originalObject, newObject)
if err != nil {
return false, err
}
if handled {
return true, nil
}
}
logrus.Debugf("DesiredSet - Updated %s %s/%s for %s -- %s %s", gvk, oldMetadata.GetNamespace(), oldMetadata.GetName(), debugID, patchType, patch)
_, err = patcher(oldMetadata.GetNamespace(), oldMetadata.GetName(), patchType, patch)
return true, err
}
func (o *desiredSet) compareObjects(gvk schema.GroupVersionKind, reconciler Reconciler, patcher Patcher, client dynamic.NamespaceableResourceInterface, debugID string, oldObject, newObject runtime.Object, force bool) error {
oldMetadata, err := meta.Accessor(oldObject)
if err != nil {
return err
}
if o.createPlan {
o.plan.Objects = append(o.plan.Objects, oldObject)
}
diffPatches := o.diffPatches[patchKey{
GroupVersionKind: gvk,
ObjectKey: objectset.ObjectKey{
Namespace: oldMetadata.GetNamespace(),
Name: oldMetadata.GetName(),
},
}]
diffPatches = append(diffPatches, o.diffPatches[patchKey{
GroupVersionKind: gvk,
}]...)
if ran, err := applyPatch(gvk, reconciler, patcher, debugID, o.ignorePreviousApplied, oldObject, newObject, diffPatches); err != nil {
return err
} else if !ran {
logrus.Debugf("DesiredSet - No change(2) %s %s/%s for %s", gvk, oldMetadata.GetNamespace(), oldMetadata.GetName(), debugID)
}
return nil
}
func removeCreationTimestamp(data map[string]interface{}) bool {
metadata, ok := data["metadata"]
if !ok {
return false
}
data = convert.ToMapInterface(metadata)
if _, ok := data["creationTimestamp"]; ok {
delete(data, "creationTimestamp")
return true
}
return false
}
func getOriginalObject(gvk schema.GroupVersionKind, obj v1.Object) (runtime.Object, error) {
original := appliedFromAnnotation(obj.GetAnnotations()[LabelApplied])
if len(original) == 0 {
return nil, nil
}
mapObj := map[string]interface{}{}
err := json.Unmarshal(original, &mapObj)
if err != nil {
return nil, err
}
removeCreationTimestamp(mapObj)
return prepareObjectForCreate(gvk, &unstructured.Unstructured{
Object: mapObj,
})
}
func getOriginalBytes(gvk schema.GroupVersionKind, obj v1.Object) ([]byte, error) {
objCopy, err := getOriginalObject(gvk, obj)
if err != nil {
return nil, err
}
if objCopy == nil {
return []byte("{}"), nil
}
return json.Marshal(objCopy)
}
func appliedFromAnnotation(str string) []byte {
if len(str) == 0 || str[0] == '{' {
return []byte(str)
}
b, err := base64.RawStdEncoding.DecodeString(str)
if err != nil {
return nil
}
r, err := gzip.NewReader(bytes.NewBuffer(b))
if err != nil {
return nil
}
b, err = ioutil.ReadAll(r)
if err != nil {
return nil
}
return b
}
func pruneList(data []interface{}) []interface{} {
result := make([]interface{}, 0, len(data))
for _, v := range data {
switch typed := v.(type) {
case map[string]interface{}:
result = append(result, pruneValues(typed, true))
case []interface{}:
result = append(result, pruneList(typed))
default:
result = append(result, v)
}
}
return result
}
func pruneValues(data map[string]interface{}, isList bool) map[string]interface{} {
result := map[string]interface{}{}
for k, v := range data {
switch typed := v.(type) {
case map[string]interface{}:
result[k] = pruneValues(typed, false)
case []interface{}:
result[k] = pruneList(typed)
default:
if isList && knownListKeys[k] {
result[k] = v
} else {
switch x := v.(type) {
case string:
if len(x) > 64 {
result[k] = x[:64]
} else {
result[k] = v
}
case []byte:
result[k] = nil
default:
result[k] = v
}
}
}
}
return result
}
func serializeApplied(obj runtime.Object) ([]byte, error) {
data, err := convert.EncodeToMap(obj)
if err != nil {
return nil, err
}
data = pruneValues(data, false)
return json.Marshal(data)
}
func appliedToAnnotation(b []byte) string {
return compressAndEncode(b)
}
func compressAndEncode(b []byte) string {
buf := buffersPool.Get().(*bytes.Buffer)
buf.Reset()
defer buffersPool.Put(buf)
w := gzipWritersPool.Get().(*gzip.Writer)
w.Reset(buf)
defer gzipWritersPool.Put(w)
if _, err := w.Write(b); err != nil {
return string(b)
}
if err := w.Close(); err != nil {
return string(b)
}
return base64.RawStdEncoding.EncodeToString(buf.Bytes())
}
func stripIgnores(original, modified, current []byte, patches [][]byte) ([]byte, []byte, []byte, error) {
for _, patch := range patches {
patch, err := jsonpatch.DecodePatch(patch)
if err != nil {
return nil, nil, nil, err
}
if len(original) > 0 {
b, err := patch.Apply(original)
if err == nil {
original = b
}
}
b, err := patch.Apply(modified)
if err == nil {
modified = b
}
b, err = patch.Apply(current)
if err == nil {
current = b
}
}
return original, modified, current, nil
}
// doPatch is adapted from "kubectl apply"
func doPatch(gvk schema.GroupVersionKind, original, modified, current []byte, diffPatch [][]byte) (types.PatchType, []byte, error) {
var (
patchType types.PatchType
patch []byte
)
original, modified, current, err := stripIgnores(original, modified, current, diffPatch)
if err != nil {
return patchType, nil, err
}
patchType, lookupPatchMeta, err := patch2.GetMergeStyle(gvk)
if err != nil {
return patchType, nil, err
}
if patchType == types.StrategicMergePatchType {
patch, err = strategicpatch.CreateThreeWayMergePatch(original, modified, current, lookupPatchMeta, true)
} else {
patch, err = jsonmergepatch.CreateThreeWayJSONMergePatch(original, modified, current)
}
if err != nil {
logrus.Errorf("Failed to calcuated patch: %v", err)
}
return patchType, patch, err
}
================================================
FILE: pkg/apply/desiredset_compare_test.go
================================================
package apply
import (
"bytes"
"testing"
)
func TestCompressAndEncode(t *testing.T) {
testCases := []struct {
name string
input []byte
expected string
}{
{
name: "Empty string",
input: []byte(""),
expected: "H4sIAAAAAAAA/wEAAP//AAAAAAAAAAA",
},
{
name: "Short string",
input: []byte("hello world"),
expected: "H4sIAAAAAAAA/8pIzcnJVyjPL8pJAQQAAP//hRFKDQsAAAA",
},
{
name: "JSON payload",
input: []byte(`{"id": 123, "status": "active", "message": "hello"}`),
expected: "H4sIAAAAAAAA/6pWykxRslIwNDLWUVAqLkksKS1WslJQSkwuySxLVdJRUMpNLS5OTE8FCWak5uTkK9UCAgAA//9XG2xwMwAAAA",
},
{
name: "Longer repeating string",
input: bytes.Repeat([]byte("test data "), 10),
expected: "H4sIAAAAAAAA/ypJLS5RSEksSVSgHQsQAAD//02/IfBkAAAA",
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
// Compare the result against our hardcoded golden value
if got, want := compressAndEncode(tc.input), tc.expected; got != want {
t.Errorf("got %q, want %q", got, want)
}
})
}
}
================================================
FILE: pkg/apply/desiredset_crud.go
================================================
package apply
import (
"bytes"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/client-go/dynamic"
)
var (
deletePolicy = v1.DeletePropagationBackground
)
func (o *desiredSet) toUnstructured(obj runtime.Object) (*unstructured.Unstructured, error) {
unstruct, ok := obj.(*unstructured.Unstructured)
if ok {
return unstruct, nil
}
buf := &bytes.Buffer{}
if err := json.NewEncoder(buf).Encode(obj); err != nil {
return nil, err
}
unstruct = &unstructured.Unstructured{
Object: map[string]interface{}{},
}
return unstruct, json.Unmarshal(buf.Bytes(), &unstruct.Object)
}
func (o *desiredSet) create(nsed bool, namespace string, client dynamic.NamespaceableResourceInterface, obj runtime.Object) (runtime.Object, error) {
unstr, err := o.toUnstructured(obj)
if err != nil {
return nil, err
}
if nsed {
return client.Namespace(namespace).Create(o.ctx, unstr, v1.CreateOptions{})
}
return client.Create(o.ctx, unstr, v1.CreateOptions{})
}
func (o *desiredSet) get(nsed bool, namespace, name string, client dynamic.NamespaceableResourceInterface) (runtime.Object, error) {
if nsed {
return client.Namespace(namespace).Get(o.ctx, name, v1.GetOptions{})
}
return client.Get(o.ctx, name, v1.GetOptions{})
}
func (o *desiredSet) delete(nsed bool, namespace, name string, client dynamic.NamespaceableResourceInterface, force bool, gvk schema.GroupVersionKind) error {
if !force {
if o.noDelete {
return nil
}
if _, ok := o.noDeleteGVK[gvk]; ok {
return nil
}
}
opts := v1.DeleteOptions{
PropagationPolicy: &deletePolicy,
}
if nsed {
return client.Namespace(namespace).Delete(o.ctx, name, opts)
}
return client.Delete(o.ctx, name, opts)
}
================================================
FILE: pkg/apply/desiredset_owner.go
================================================
package apply
import (
"errors"
"fmt"
"strings"
"github.com/rancher/wrangler/v3/pkg/gvk"
"github.com/rancher/wrangler/v3/pkg/kv"
namer "github.com/rancher/wrangler/v3/pkg/name"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/tools/cache"
)
var (
ErrOwnerNotFound = errors.New("owner not found")
ErrNoInformerFound = errors.New("informer not found")
)
func notFound(name string, gvk schema.GroupVersionKind) error {
// this is not proper, but does it really matter that much? If you find this
// line while researching a bug, then the answer is probably yes.
resource := namer.GuessPluralName(strings.ToLower(gvk.Kind))
return apierrors.NewNotFound(schema.GroupResource{
Group: gvk.Group,
Resource: resource,
}, name)
}
func getGVK(gvkLabel string, gvk *schema.GroupVersionKind) error {
parts := strings.Split(gvkLabel, ", Kind=")
if len(parts) != 2 {
return fmt.Errorf("invalid GVK format: %s", gvkLabel)
}
gvk.Group, gvk.Version = kv.Split(parts[0], "/")
gvk.Kind = parts[1]
return nil
}
func (o desiredSet) FindOwner(obj runtime.Object) (runtime.Object, error) {
if obj == nil {
return nil, ErrOwnerNotFound
}
meta, err := meta.Accessor(obj)
if err != nil {
return nil, err
}
var (
debugID = fmt.Sprintf("%s/%s", meta.GetNamespace(), meta.GetName())
gvkLabel = meta.GetAnnotations()[LabelGVK]
namespace = meta.GetAnnotations()[LabelNamespace]
name = meta.GetAnnotations()[LabelName]
gvk schema.GroupVersionKind
)
if gvkLabel == "" {
return nil, ErrOwnerNotFound
}
if err := getGVK(gvkLabel, &gvk); err != nil {
return nil, err
}
cache, client, err := o.getControllerAndClient(debugID, gvk)
if err != nil {
return nil, err
}
if cache != nil {
return o.fromCache(cache, namespace, name, gvk)
}
return o.fromClient(client, namespace, name, gvk)
}
func (o *desiredSet) fromClient(client dynamic.NamespaceableResourceInterface, namespace, name string, gvk schema.GroupVersionKind) (runtime.Object, error) {
var (
err error
obj interface{}
)
if namespace == "" {
obj, err = client.Get(o.ctx, name, metav1.GetOptions{})
} else {
obj, err = client.Namespace(namespace).Get(o.ctx, name, metav1.GetOptions{})
}
if err != nil {
return nil, err
}
if ro, ok := obj.(runtime.Object); ok {
return ro, nil
}
return nil, notFound(name, gvk)
}
func (o *desiredSet) fromCache(cache cache.SharedInformer, namespace, name string, gvk schema.GroupVersionKind) (runtime.Object, error) {
var key string
if namespace == "" {
key = name
} else {
key = namespace + "/" + name
}
item, ok, err := cache.GetStore().GetByKey(key)
if err != nil {
return nil, err
} else if !ok {
return nil, notFound(name, gvk)
} else if ro, ok := item.(runtime.Object); ok {
return ro, nil
}
return nil, notFound(name, gvk)
}
func (o desiredSet) PurgeOrphan(obj runtime.Object) error {
if obj == nil {
return nil
}
meta, err := meta.Accessor(obj)
if err != nil {
return err
}
if _, err := o.FindOwner(obj); apierrors.IsNotFound(err) {
gvk, err := gvk.Get(obj)
if err != nil {
return err
}
o.strictCaching = false
_, client, err := o.getControllerAndClient(meta.GetName(), gvk)
if err != nil {
return err
}
if meta.GetNamespace() == "" {
return client.Delete(o.ctx, meta.GetName(), metav1.DeleteOptions{})
}
return client.Namespace(meta.GetNamespace()).Delete(o.ctx, meta.GetName(), metav1.DeleteOptions{})
} else if err == ErrOwnerNotFound {
return nil
} else if err != nil {
return err
}
return nil
}
================================================
FILE: pkg/apply/desiredset_process.go
================================================
package apply
import (
"context"
"errors"
"fmt"
"sort"
"sync"
gvk2 "github.com/rancher/wrangler/v3/pkg/gvk"
"github.com/rancher/wrangler/v3/pkg/merr"
"github.com/rancher/wrangler/v3/pkg/objectset"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
errors2 "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
types2 "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/tools/cache"
)
var (
ErrReplace = errors.New("replace object with changes")
ReplaceOnChange = func(name string, o runtime.Object, patchType types2.PatchType, data []byte, subresources ...string) (runtime.Object, error) {
return nil, ErrReplace
}
)
func (o *desiredSet) getControllerAndClient(debugID string, gvk schema.GroupVersionKind) (cache.SharedIndexInformer, dynamic.NamespaceableResourceInterface, error) {
// client needs to be accessed first so that the gvk->gvr mapping gets cached
client, err := o.a.clients.client(gvk)
if err != nil {
return nil, nil, err
}
informer, ok := o.pruneTypes[gvk]
if !ok {
informer = o.a.informers[gvk]
}
if informer == nil && o.informerFactory != nil {
newInformer, err := o.informerFactory.Get(gvk, o.a.clients.gvr(gvk))
if err != nil {
return nil, nil, fmt.Errorf("failed to construct informer for %v for %s: %w", gvk, debugID, err)
}
informer = newInformer
}
if informer == nil && o.strictCaching {
return nil, nil, fmt.Errorf("failed to find informer for %s for %s: %w", gvk, debugID, ErrNoInformerFound)
}
return informer, client, nil
}
func (o *desiredSet) assignOwnerReference(gvk schema.GroupVersionKind, objs objectset.ObjectByKey) error {
if o.owner == nil {
return fmt.Errorf("no owner set to assign owner reference")
}
ownerMeta, err := meta.Accessor(o.owner)
if err != nil {
return err
}
ownerGVK, err := gvk2.Get(o.owner)
if err != nil {
return err
}
ownerNSed, err := o.a.clients.IsNamespaced(ownerGVK)
if err != nil {
return err
}
for k, v := range objs {
// can't set owners across boundaries
if ownerNSed {
if nsed, err := o.a.clients.IsNamespaced(gvk); err != nil {
return err
} else if !nsed {
continue
}
}
assignNS := false
assignOwner := true
if nsed, err := o.a.clients.IsNamespaced(gvk); err != nil {
return err
} else if nsed {
if k.Namespace == "" {
assignNS = true
} else if k.Namespace != ownerMeta.GetNamespace() && ownerNSed {
assignOwner = false
}
}
if !assignOwner {
continue
}
v = v.DeepCopyObject()
meta, err := meta.Accessor(v)
if err != nil {
return err
}
if assignNS {
meta.SetNamespace(ownerMeta.GetNamespace())
}
shouldSet := true
for _, of := range meta.GetOwnerReferences() {
if ownerMeta.GetUID() == of.UID {
shouldSet = false
break
}
}
if shouldSet {
meta.SetOwnerReferences(append(meta.GetOwnerReferences(), v1.OwnerReference{
APIVersion: ownerGVK.GroupVersion().String(),
Kind: ownerGVK.Kind,
Name: ownerMeta.GetName(),
UID: ownerMeta.GetUID(),
Controller: &o.ownerReferenceController,
BlockOwnerDeletion: &o.ownerReferenceBlock,
}))
}
objs[k] = v
if assignNS {
delete(objs, k)
k.Namespace = ownerMeta.GetNamespace()
objs[k] = v
}
}
return nil
}
func (o *desiredSet) adjustNamespace(gvk schema.GroupVersionKind, objs objectset.ObjectByKey) error {
for k, v := range objs {
if k.Namespace != "" {
continue
}
v = v.DeepCopyObject()
meta, err := meta.Accessor(v)
if err != nil {
return err
}
meta.SetNamespace(o.defaultNamespace)
delete(objs, k)
k.Namespace = o.defaultNamespace
objs[k] = v
}
return nil
}
func (o *desiredSet) clearNamespace(objs objectset.ObjectByKey) error {
for k, v := range objs {
if k.Namespace == "" {
continue
}
v = v.DeepCopyObject()
meta, err := meta.Accessor(v)
if err != nil {
return err
}
meta.SetNamespace("")
delete(objs, k)
k.Namespace = ""
objs[k] = v
}
return nil
}
func (o *desiredSet) createPatcher(client dynamic.NamespaceableResourceInterface) Patcher {
return func(namespace, name string, pt types2.PatchType, data []byte) (object runtime.Object, e error) {
if namespace != "" {
return client.Namespace(namespace).Patch(o.ctx, name, pt, data, v1.PatchOptions{})
}
return client.Patch(o.ctx, name, pt, data, v1.PatchOptions{})
}
}
func (o *desiredSet) filterCrossVersion(gvk schema.GroupVersionKind, keys []objectset.ObjectKey) []objectset.ObjectKey {
result := make([]objectset.ObjectKey, 0, len(keys))
gk := gvk.GroupKind()
for _, key := range keys {
if o.objs.Contains(gk, key) {
continue
}
if key.Namespace == o.defaultNamespace && o.objs.Contains(gk, objectset.ObjectKey{Name: key.Name}) {
continue
}
result = append(result, key)
}
return result
}
func (o *desiredSet) process(debugID string, set labels.Selector, gvk schema.GroupVersionKind, objs objectset.ObjectByKey) {
controller, client, err := o.getControllerAndClient(debugID, gvk)
if err != nil {
o.err(err)
return
}
nsed, err := o.a.clients.IsNamespaced(gvk)
if err != nil {
o.err(err)
return
}
if !nsed && o.restrictClusterScoped {
o.err(fmt.Errorf("invalid cluster scoped gvk: %v", gvk))
return
}
if o.setOwnerReference && o.owner != nil {
if err := o.assignOwnerReference(gvk, objs); err != nil {
o.err(err)
return
}
}
if nsed {
if err := o.adjustNamespace(gvk, objs); err != nil {
o.err(err)
return
}
} else {
if err := o.clearNamespace(objs); err != nil {
o.err(err)
return
}
}
patcher, ok := o.patchers[gvk]
if !ok {
patcher = o.createPatcher(client)
}
reconciler := o.reconcilers[gvk]
existing, err := o.list(nsed, controller, client, set, objs)
if err != nil {
o.err(fmt.Errorf("failed to list %s for %s: %w", gvk, debugID, err))
return
}
toCreate, toDelete, toUpdate := compareSets(existing, objs)
// check for resources in the objectset but under a different version of the same group/kind
toDelete = o.filterCrossVersion(gvk, toDelete)
if o.createPlan {
o.plan.Create[gvk] = toCreate
o.plan.Delete[gvk] = toDelete
reconciler = nil
patcher = func(namespace, name string, pt types2.PatchType, data []byte) (runtime.Object, error) {
data, err := sanitizePatch(data, true)
if err != nil {
return nil, err
}
if string(data) != "{}" {
o.plan.Update.Add(gvk, namespace, name, string(data))
}
return nil, nil
}
toCreate = nil
toDelete = nil
}
createF := func(k objectset.ObjectKey) {
obj := objs[k]
obj, err := prepareObjectForCreate(gvk, obj)
if err != nil {
o.err(fmt.Errorf("failed to prepare create %s %s for %s: %w", k, gvk, debugID, err))
return
}
_, err = o.create(nsed, k.Namespace, client, obj)
if errors2.IsAlreadyExists(err) {
// Taking over an object that wasn't previously managed by us
existingObj, err := o.get(nsed, k.Namespace, k.Name, client)
if err == nil {
toUpdate = append(toUpdate, k)
existing[k] = existingObj
return
}
}
if err != nil {
o.err(fmt.Errorf("failed to create %s %s for %s: %w", k, gvk, debugID, err))
return
}
logrus.Debugf("DesiredSet - Created %s %s for %s", gvk, k, debugID)
}
deleteF := func(k objectset.ObjectKey, force bool) {
if err := o.delete(nsed, k.Namespace, k.Name, client, force, gvk); err != nil {
o.err(fmt.Errorf("failed to delete %s %s for %s: %w", k, gvk, debugID, err))
return
}
logrus.Debugf("DesiredSet - Delete %s %s for %s", gvk, k, debugID)
}
updateF := func(k objectset.ObjectKey) {
err := o.compareObjects(gvk, reconciler, patcher, client, debugID, existing[k], objs[k], len(toCreate) > 0 || len(toDelete) > 0)
if err == ErrReplace {
deleteF(k, true)
o.err(fmt.Errorf("DesiredSet - Replace Wait %s %s for %s", gvk, k, debugID))
} else if err != nil {
o.err(fmt.Errorf("failed to update %s %s for %s: %w", k, gvk, debugID, err))
}
}
for _, k := range toCreate {
createF(k)
}
for _, k := range toUpdate {
updateF(k)
}
for _, k := range toDelete {
deleteF(k, false)
}
}
func (o *desiredSet) list(namespaced bool, informer cache.SharedIndexInformer, client dynamic.NamespaceableResourceInterface, selector labels.Selector, desiredObjects objectset.ObjectByKey) (map[objectset.ObjectKey]runtime.Object, error) {
var (
errs []error
objs = objectset.ObjectByKey{}
)
if informer == nil {
// If a lister namespace is set, assume all objects belong to the listerNamespace. If the
// desiredSet has an owner but no lister namespace, list objects from all namespaces to ensure
// we're cleaning up any owned resources. Otherwise, search only objects from the namespaces
// used by the objects. Note: desiredSets without owners will never return objects to delete;
// deletion requires an owner to track object references across multiple apply runs.
var namespaces []string
if o.listerNamespace != "" {
namespaces = append(namespaces, o.listerNamespace)
} else {
namespaces = desiredObjects.Namespaces()
}
if o.owner != nil && o.listerNamespace == "" {
// owner set and unspecified lister namespace, search all namespaces
err := allNamespaceList(o.ctx, client, selector, func(obj unstructured.Unstructured) {
if err := addObjectToMap(objs, &obj); err != nil {
errs = append(errs, err)
}
})
if err != nil {
errs = append(errs, err)
}
} else {
// no owner or lister namespace intentionally restricted; only search in specified namespaces
err := multiNamespaceList(o.ctx, namespaces, client, selector, func(obj unstructured.Unstructured) {
if err := addObjectToMap(objs, &obj); err != nil {
errs = append(errs, err)
}
})
if err != nil {
errs = append(errs, err)
}
}
return objs, merr.NewErrors(errs...)
}
var namespace string
if namespaced {
namespace = o.listerNamespace
}
// Special case for listing only by hash using indexers
indexer := informer.GetIndexer()
if hash, ok := getIndexableHash(indexer, selector); ok {
return listByHash(indexer, hash, namespace)
}
if err := cache.ListAllByNamespace(indexer, namespace, selector, func(obj interface{}) {
if err := addObjectToMap(objs, obj); err != nil {
errs = append(errs, err)
}
}); err != nil {
errs = append(errs, err)
}
return objs, merr.NewErrors(errs...)
}
func shouldPrune(obj runtime.Object) bool {
meta, err := meta.Accessor(obj)
if err != nil {
return true
}
return meta.GetLabels()[LabelPrune] != "false"
}
func compareSets(existingSet, newSet objectset.ObjectByKey) (toCreate, toDelete, toUpdate []objectset.ObjectKey) {
for k := range newSet {
if _, ok := existingSet[k]; ok {
toUpdate = append(toUpdate, k)
} else {
toCreate = append(toCreate, k)
}
}
for k, obj := range existingSet {
if _, ok := newSet[k]; !ok {
if shouldPrune(obj) {
toDelete = append(toDelete, k)
}
}
}
sortObjectKeys(toCreate)
sortObjectKeys(toDelete)
sortObjectKeys(toUpdate)
return
}
func sortObjectKeys(keys []objectset.ObjectKey) {
sort.Slice(keys, func(i, j int) bool {
return keys[i].String() < keys[j].String()
})
}
func addObjectToMap(objs objectset.ObjectByKey, obj interface{}) error {
metadata, err := meta.Accessor(obj)
if err != nil {
return err
}
objs[objectset.ObjectKey{
Namespace: metadata.GetNamespace(),
Name: metadata.GetName(),
}] = obj.(runtime.Object)
return nil
}
// allNamespaceList lists objects across all namespaces.
func allNamespaceList(ctx context.Context, baseClient dynamic.NamespaceableResourceInterface, selector labels.Selector, appendFn func(obj unstructured.Unstructured)) error {
list, err := baseClient.List(ctx, v1.ListOptions{
LabelSelector: selector.String(),
})
if err != nil {
return err
}
for _, obj := range list.Items {
appendFn(obj)
}
return nil
}
// multiNamespaceList lists objects across all given namespaces, because requests are concurrent it is possible for appendFn to be called before errors are reported.
func multiNamespaceList(ctx context.Context, namespaces []string, baseClient dynamic.NamespaceableResourceInterface, selector labels.Selector, appendFn func(obj unstructured.Unstructured)) error {
var mu sync.Mutex
wg, _ctx := errgroup.WithContext(ctx)
// list all namespaces concurrently
for _, namespace := range namespaces {
namespace := namespace
wg.Go(func() error {
list, err := baseClient.Namespace(namespace).List(_ctx, v1.ListOptions{
LabelSelector: selector.String(),
})
if err != nil {
return err
}
mu.Lock()
for _, obj := range list.Items {
appendFn(obj)
}
mu.Unlock()
return nil
})
}
return wg.Wait()
}
// getIndexableHash detects if provided selector can be replaced by using the hash index, if configured, in which case returns the hash value
func getIndexableHash(indexer cache.Indexer, selector labels.Selector) (string, bool) {
// Check if indexer was added
if indexer == nil || indexer.GetIndexers()[byHash] == nil {
return "", false
}
// Check specific case of listing with exact hash label selector
if req, selectable := selector.Requirements(); len(req) != 1 || !selectable {
return "", false
}
return selector.RequiresExactMatch(LabelHash)
}
// inNamespace checks whether a given object is a Kubernetes object and is part of the provided namespace
func inNamespace(namespace string, obj interface{}) bool {
metadata, err := meta.Accessor(obj)
return err == nil && metadata.GetNamespace() == namespace
}
// listByHash use a pre-configured indexer to list objects of a certain type by their hash label
func listByHash(indexer cache.Indexer, hash string, namespace string) (map[objectset.ObjectKey]runtime.Object, error) {
var (
errs []error
objs = objectset.ObjectByKey{}
)
res, err := indexer.ByIndex(byHash, hash)
if err != nil {
return nil, err
}
for _, obj := range res {
if namespace != "" && !inNamespace(namespace, obj) {
continue
}
if err := addObjectToMap(objs, obj); err != nil {
errs = append(errs, err)
}
}
return objs, merr.NewErrors(errs...)
}
================================================
FILE: pkg/apply/desiredset_process_test.go
================================================
package apply
import (
"context"
"errors"
"strings"
"testing"
"github.com/rancher/wrangler/v3/pkg/objectset"
"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/dynamic/fake"
k8stesting "k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache"
)
func Test_multiNamespaceList(t *testing.T) {
results := map[string]*unstructured.UnstructuredList{
"ns1": {Items: []unstructured.Unstructured{
{Object: map[string]interface{}{"name": "o1", "namespace": "ns1"}},
{Object: map[string]interface{}{"name": "o2", "namespace": "ns1"}},
{Object: map[string]interface{}{"name": "o3", "namespace": "ns1"}},
}},
"ns2": {Items: []unstructured.Unstructured{
{Object: map[string]interface{}{"name": "o4", "namespace": "ns2"}},
{Object: map[string]interface{}{"name": "o5", "namespace": "ns2"}},
}},
"ns3": {Items: []unstructured.Unstructured{}},
}
s := runtime.NewScheme()
err := appsv1.SchemeBuilder.AddToScheme(s)
assert.NoError(t, err, "Failed to build schema.")
baseClient := fake.NewSimpleDynamicClient(s)
baseClient.PrependReactor("list", "*", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
if strings.Contains(action.GetNamespace(), "error") {
return true, nil, errors.New("simulated failure")
}
return true, results[action.GetNamespace()], nil
})
type args struct {
namespaces []string
}
tests := []struct {
name string
args args
expectedCalls int
expectError bool
}{
{
name: "no namespaces",
args: args{
namespaces: []string{},
},
expectError: false,
expectedCalls: 0,
},
{
name: "1 namespace",
args: args{
namespaces: []string{"ns1"},
},
expectError: false,
expectedCalls: 3,
},
{
name: "many namespaces",
args: args{
namespaces: []string{"ns1", "ns2", "ns3"},
},
expectError: false,
expectedCalls: 5,
},
{
name: "1 namespace error",
args: args{
namespaces: []string{"error", "ns2", "ns3"},
},
expectError: true,
expectedCalls: -1,
},
{
name: "many namespace errors",
args: args{
namespaces: []string{"error", "error1", "error2"},
},
expectError: true,
expectedCalls: -1,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var calls int
err := multiNamespaceList(context.TODO(), tt.args.namespaces, baseClient.Resource(appsv1.SchemeGroupVersion.WithResource("deployments")), labels.NewSelector(), func(obj unstructured.Unstructured) {
calls += 1
})
if tt.expectError {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
if tt.expectedCalls >= 0 {
assert.Equal(t, tt.expectedCalls, calls)
}
})
}
}
func Test_getIndexableHash(t *testing.T) {
const hash = "somehash"
hashSelector, err := GetSelector(map[string]string{LabelHash: hash})
if err != nil {
t.Fatal(err)
}
envLabelSelector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{MatchLabels: map[string]string{"env": "dev"}})
if err != nil {
t.Fatal(err)
}
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{byHash: func(obj interface{}) ([]string, error) {
return nil, nil
}})
type args struct {
indexer cache.Indexer
selector labels.Selector
}
tests := []struct {
name string
args args
wantHash string
want bool
}{
{name: "indexer configured", args: args{
indexer: indexer,
selector: hashSelector,
}, wantHash: hash, want: true},
{name: "indexer not configured", args: args{
indexer: cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{}),
selector: hashSelector,
}, wantHash: "", want: false},
{name: "using Everything selector", args: args{
indexer: indexer,
selector: labels.Everything(),
}, wantHash: "", want: false},
{name: "using other label selectors", args: args{
indexer: indexer,
selector: envLabelSelector,
}, wantHash: "", want: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotHash, got := getIndexableHash(tt.args.indexer, tt.args.selector)
assert.Equalf(t, tt.wantHash, gotHash, "getIndexableHash(%v, %v)", tt.args.indexer, tt.args.selector)
assert.Equalf(t, tt.want, got, "getIndexableHash(%v, %v)", tt.args.indexer, tt.args.selector)
})
}
}
func Test_inNamespace(t *testing.T) {
type args struct {
namespace string
obj interface{}
}
tests := []struct {
name string
args args
want bool
}{
{name: "object in namespace", args: args{
namespace: "ns", obj: &metav1.ObjectMeta{
Namespace: "ns",
},
}, want: true},
{name: "object not in namespace", args: args{
namespace: "ns", obj: &metav1.ObjectMeta{
Namespace: "another-ns",
},
}, want: false},
{name: "object not namespaced", args: args{
namespace: "ns", obj: &corev1.Namespace{},
}, want: false},
{name: "non k8s object", args: args{
namespace: "ns", obj: &struct{}{},
}, want: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, inNamespace(tt.args.namespace, tt.args.obj), "inNamespace(%v, %v)", tt.args.namespace, tt.args.obj)
})
}
}
func Test_listByHash(t *testing.T) {
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{})
if err := addIndexerByHash(indexer); err != nil {
t.Fatal(err)
}
addObject := func(name, namespace, hash string) *corev1.Pod {
t.Helper()
obj := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: map[string]string{LabelHash: hash},
},
}
if err := indexer.Add(obj); err != nil {
t.Fatal(err)
}
return obj
}
namespace := "ns"
objects := []*corev1.Pod{
// 3 objects with the same hash
addObject("obj0", namespace, "hash0"),
addObject("obj01", namespace, "hash0"),
addObject("obj02", "another-ns", "hash0"),
// Single object for hash
addObject("obj1", namespace, "hash1"),
}
type args struct {
hash string
namespace string
}
tests := []struct {
name string
args args
want map[objectset.ObjectKey]runtime.Object
}{
{name: "finds object by hash in all namespaces",
args: args{
hash: "hash0",
}, want: map[objectset.ObjectKey]runtime.Object{
objectset.NewObjectKey(objects[0]): objects[0],
objectset.NewObjectKey(objects[1]): objects[1],
objectset.NewObjectKey(objects[2]): objects[2],
}},
{name: "finds object by hash in namespace",
args: args{
hash: "hash0",
namespace: namespace,
}, want: map[objectset.ObjectKey]runtime.Object{
objectset.NewObjectKey(objects[0]): objects[0],
objectset.NewObjectKey(objects[1]): objects[1],
}},
{name: "returns empty if namespace does not match",
args: args{
hash: "hash1",
namespace: "another-ns",
}, want: map[objectset.ObjectKey]runtime.Object{}},
{name: "finds object by hash",
args: args{
hash: "hash1",
namespace: namespace,
}, want: map[objectset.ObjectKey]runtime.Object{
objectset.NewObjectKey(objects[3]): objects[3],
}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := listByHash(indexer, tt.args.hash, tt.args.namespace)
assert.NoError(t, err)
assert.Equalf(t, tt.want, got, "listByHash(%v, %v, %v)", indexer, tt.args.hash, tt.args.namespace)
})
}
}
================================================
FILE: pkg/apply/fake/apply.go
================================================
package fake
import (
"context"
"github.com/rancher/wrangler/v3/pkg/apply"
"github.com/rancher/wrangler/v3/pkg/apply/injectors"
"github.com/rancher/wrangler/v3/pkg/objectset"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var _ apply.Apply = (*FakeApply)(nil)
type FakeApply struct {
Objects []*objectset.ObjectSet
Count int
}
func (f *FakeApply) Apply(set *objectset.ObjectSet) error {
f.Objects = append(f.Objects, set)
f.Count++
return nil
}
func (f *FakeApply) ApplyObjects(objs ...runtime.Object) error {
os := objectset.NewObjectSet()
os.Add(objs...)
return f.Apply(os)
}
func (f *FakeApply) WithCacheTypes(igs ...apply.InformerGetter) apply.Apply {
return f
}
func (f *FakeApply) WithIgnorePreviousApplied() apply.Apply {
return f
}
func (f *FakeApply) WithGVK(gvks ...schema.GroupVersionKind) apply.Apply {
return f
}
func (f *FakeApply) WithSetID(id string) apply.Apply {
return f
}
func (f *FakeApply) WithOwner(obj runtime.Object) apply.Apply {
return f
}
func (f *FakeApply) WithInjector(injs ...injectors.ConfigInjector) apply.Apply {
return f
}
func (f *FakeApply) WithInjectorName(injs ...string) apply.Apply {
return f
}
func (f *FakeApply) WithPatcher(gvk schema.GroupVersionKind, patchers apply.Patcher) apply.Apply {
return f
}
func (f *FakeApply) WithReconciler(gvk schema.GroupVersionKind, reconciler apply.Reconciler) apply.Apply {
return f
}
func (f *FakeApply) WithStrictCaching() apply.Apply {
return f
}
func (f *FakeApply) WithDynamicLookup() apply.Apply {
return f
}
func (f *FakeApply) WithDefaultNamespace(ns string) apply.Apply {
return f
}
func (f *FakeApply) WithListerNamespace(ns string) apply.Apply {
return f
}
func (f *FakeApply) WithRestrictClusterScoped() apply.Apply {
return f
}
func (f *FakeApply) WithSetOwnerReference(controller, block bool) apply.Apply {
return f
}
func (f *FakeApply) WithRateLimiting(ratelimitingQPS float32) apply.Apply {
return f
}
func (f *FakeApply) WithNoDelete() apply.Apply {
return f
}
func (f *FakeApply) WithNoDeleteGVK(gvks ...schema.GroupVersionKind) apply.Apply {
return f
}
func (f *FakeApply) WithContext(ctx context.Context) apply.Apply {
return f
}
func (f *FakeApply) WithCacheTypeFactory(factory apply.InformerFactory) apply.Apply {
return f
}
func (f *FakeApply) DryRun(objs ...runtime.Object) (apply.Plan, error) {
return apply.Plan{}, nil
}
func (f *FakeApply) FindOwner(obj runtime.Object) (runtime.Object, error) {
return nil, nil
}
func (f *FakeApply) PurgeOrphan(obj runtime.Object) error {
return nil
}
func (f *FakeApply) WithOwnerKey(key string, gvk schema.GroupVersionKind) apply.Apply {
return f
}
func (f *FakeApply) WithDiffPatch(gvk schema.GroupVersionKind, namespace, name string, patch []byte) apply.Apply {
return f
}
================================================
FILE: pkg/apply/injectors/registry.go
================================================
package injectors
import "k8s.io/apimachinery/pkg/runtime"
var (
injectors = map[string]ConfigInjector{}
order []string
)
type ConfigInjector func(config []runtime.Object) ([]runtime.Object, error)
func Register(name string, injector ConfigInjector) {
if _, ok := injectors[name]; !ok {
order = append(order, name)
}
injectors[name] = injector
}
func Get(name string) ConfigInjector {
return injectors[name]
}
================================================
FILE: pkg/apply/reconcilers.go
================================================
package apply
import (
"encoding/json"
"fmt"
"reflect"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
defaultReconcilers = map[schema.GroupVersionKind]Reconciler{
v1.SchemeGroupVersion.WithKind("Secret"): reconcileSecret,
v1.SchemeGroupVersion.WithKind("Service"): reconcileService,
batchv1.SchemeGroupVersion.WithKind("Job"): reconcileJob,
appsv1.SchemeGroupVersion.WithKind("Deployment"): reconcileDeployment,
appsv1.SchemeGroupVersion.WithKind("DaemonSet"): reconcileDaemonSet,
}
)
func reconcileDaemonSet(oldObj, newObj runtime.Object) (bool, error) {
oldSvc, ok := oldObj.(*appsv1.DaemonSet)
if !ok {
oldSvc = &appsv1.DaemonSet{}
if err := convertObj(oldObj, oldSvc); err != nil {
return false, err
}
}
newSvc, ok := newObj.(*appsv1.DaemonSet)
if !ok {
newSvc = &appsv1.DaemonSet{}
if err := convertObj(newObj, newSvc); err != nil {
return false, err
}
}
if !equality.Semantic.DeepEqual(oldSvc.Spec.Selector, newSvc.Spec.Selector) {
return false, ErrReplace
}
return false, nil
}
func reconcileDeployment(oldObj, newObj runtime.Object) (bool, error) {
oldSvc, ok := oldObj.(*appsv1.Deployment)
if !ok {
oldSvc = &appsv1.Deployment{}
if err := convertObj(oldObj, oldSvc); err != nil {
return false, err
}
}
newSvc, ok := newObj.(*appsv1.Deployment)
if !ok {
newSvc = &appsv1.Deployment{}
if err := convertObj(newObj, newSvc); err != nil {
return false, err
}
}
if !equality.Semantic.DeepEqual(oldSvc.Spec.Selector, newSvc.Spec.Selector) {
return false, ErrReplace
}
return false, nil
}
func reconcileSecret(oldObj, newObj runtime.Object) (bool, error) {
oldSvc, ok := oldObj.(*v1.Secret)
if !ok {
oldSvc = &v1.Secret{}
if err := convertObj(oldObj, oldSvc); err != nil {
return false, err
}
}
newSvc, ok := newObj.(*v1.Secret)
if !ok {
newSvc = &v1.Secret{}
if err := convertObj(newObj, newSvc); err != nil {
return false, err
}
}
if newSvc.Type != "" && oldSvc.Type != newSvc.Type {
return false, ErrReplace
}
return false, nil
}
func reconcileService(oldObj, newObj runtime.Object) (bool, error) {
oldSvc, ok := oldObj.(*v1.Service)
if !ok {
oldSvc = &v1.Service{}
if err := convertObj(oldObj, oldSvc); err != nil {
return false, err
}
}
newSvc, ok := newObj.(*v1.Service)
if !ok {
newSvc = &v1.Service{}
if err := convertObj(newObj, newSvc); err != nil {
return false, err
}
}
if newSvc.Spec.Type != "" && oldSvc.Spec.Type != newSvc.Spec.Type {
return false, ErrReplace
}
return false, nil
}
func reconcileJob(oldObj, newObj runtime.Object) (bool, error) {
oldJob, ok := oldObj.(*batchv1.Job)
if !ok {
oldJob = &batchv1.Job{}
if err := convertObj(oldObj, oldJob); err != nil {
return false, err
}
}
newJob, ok := newObj.(*batchv1.Job)
if !ok {
newJob = &batchv1.Job{}
if err := convertObj(newObj, newJob); err != nil {
return false, err
}
}
// We round trip the object here because when serializing to the applied
// annotation values are truncated to 64 bytes.
prunedJob, err := getOriginalObject(newJob.GroupVersionKind(), newJob)
if err != nil {
return false, err
}
newPrunedJob := &batchv1.Job{}
if err := convertObj(prunedJob, newPrunedJob); err != nil {
return false, err
}
if !equality.Semantic.DeepEqual(oldJob.Spec.Template, newPrunedJob.Spec.Template) {
return false, ErrReplace
}
return false, nil
}
func convertObj(src interface{}, obj interface{}) error {
uObj, ok := src.(*unstructured.Unstructured)
if !ok {
return fmt.Errorf("expected unstructured but got %v", reflect.TypeOf(src))
}
bytes, err := uObj.MarshalJSON()
if err != nil {
return err
}
return json.Unmarshal(bytes, obj)
}
================================================
FILE: pkg/broadcast/generic.go
================================================
package broadcast
import (
"context"
"sync"
)
type ConnectFunc func() (chan interface{}, error)
type Broadcaster struct {
sync.Mutex
running bool
subs map[chan interface{}]struct{}
}
func (b *Broadcaster) Subscribe(ctx context.Context, connect ConnectFunc) (chan interface{}, error) {
b.Lock()
defer b.Unlock()
if !b.running {
if err := b.start(connect); err != nil {
return nil, err
}
}
sub := make(chan interface{}, 100)
if b.subs == nil {
b.subs = map[chan interface{}]struct{}{}
}
b.subs[sub] = struct{}{}
go func() {
<-ctx.Done()
b.unsub(sub, true)
}()
return sub, nil
}
func (b *Broadcaster) unsub(sub chan interface{}, lock bool) {
if lock {
b.Lock()
}
if _, ok := b.subs[sub]; ok {
close(sub)
delete(b.subs, sub)
}
if lock {
b.Unlock()
}
}
func (b *Broadcaster) start(connect ConnectFunc) error {
c, err := connect()
if err != nil {
return err
}
go b.stream(c)
b.running = true
return nil
}
func (b *Broadcaster) stream(input chan interface{}) {
for item := range input {
b.Lock()
for sub := range b.subs {
select {
case sub <- item:
default:
// Slow consumer, drop
go b.unsub(sub, true)
}
}
b.Unlock()
}
b.Lock()
for sub := range b.subs {
b.unsub(sub, false)
}
b.running = false
b.Unlock()
}
================================================
FILE: pkg/cleanup/cleanup.go
================================================
package cleanup
import (
"fmt"
"os"
"path/filepath"
"strings"
)
func Cleanup(path string) error {
return filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
fmt.Println(path)
if err != nil {
return err
}
if strings.Contains(path, "vendor") {
return filepath.SkipDir
}
if strings.HasPrefix(info.Name(), "zz_generated") {
fmt.Println("Removing", path)
if err := os.Remove(path); err != nil {
return err
}
}
return nil
})
}
================================================
FILE: pkg/clients/clients.go
================================================
package clients
import (
"context"
"time"
"github.com/rancher/lasso/pkg/controller"
"github.com/rancher/lasso/pkg/dynamic"
"github.com/rancher/wrangler/v3/pkg/apply"
admissionreg "github.com/rancher/wrangler/v3/pkg/generated/controllers/admissionregistration.k8s.io"
admissionregcontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/admissionregistration.k8s.io/v1"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/apiextensions.k8s.io"
crdcontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/apiextensions.k8s.io/v1"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/apiregistration.k8s.io"
apicontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/apiregistration.k8s.io/v1"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/apps"
appcontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/apps/v1"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/batch"
batchcontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/batch/v1"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/core"
corecontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/core/v1"
"github.com/rancher/wrangler/v3/pkg/generated/controllers/rbac"
rbaccontrollers "github.com/rancher/wrangler/v3/pkg/generated/controllers/rbac/v1"
"github.com/rancher/wrangler/v3/pkg/generic"
"github.com/rancher/wrangler/v3/pkg/ratelimit"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/client-go/discovery"
"k8s.io/client-go/discovery/cached/memory"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/restmapper"
"k8s.io/client-go/tools/clientcmd"
)
type Clients struct {
K8s kubernetes.Interface
Core corecontrollers.Interface
RBAC rbaccontrollers.Interface
Apps appcontrollers.Interface
CRD crdcontrollers.Interface
API apicontrollers.Interface
Admission admissionregcontrollers.Interface
Batch batchcontrollers.Interface
Apply apply.Apply
Dynamic *dynamic.Controller
ClientConfig clientcmd.ClientConfig
RESTConfig *rest.Config
CachedDiscovery discovery.CachedDiscoveryInterface
SharedControllerFactory controller.SharedControllerFactory
RESTMapper meta.RESTMapper
FactoryOptions *generic.FactoryOptions
}
func ensureSharedFactory(cfg *rest.Config, opts *generic.FactoryOptions) (*generic.FactoryOptions, error) {
if opts == nil {
opts = &generic.FactoryOptions{}
}
copy := *opts
factory, err := generic.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
copy.SharedControllerFactory = factory.ControllerFactory()
copy.SharedCacheFactory = factory.ControllerFactory().SharedCacheFactory()
return ©, nil
}
func New(clientConfig clientcmd.ClientConfig, opts *generic.FactoryOptions) (*Clients, error) {
cfg, err := clientConfig.ClientConfig()
if err != nil {
return nil, err
}
clients, err := NewFromConfig(cfg, opts)
if err != nil {
return nil, err
}
clients.ClientConfig = clientConfig
return clients, nil
}
func NewFromConfig(cfg *rest.Config, opts *generic.FactoryOptions) (*Clients, error) {
cfg = restConfigDefaults(cfg)
opts, err := ensureSharedFactory(cfg, opts)
if err != nil {
return nil, err
}
core, err := core.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
rbac, err := rbac.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
apps, err := apps.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
api, err := apiregistration.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
crd, err := apiextensions.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
adminReg, err := admissionreg.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
k8s, err := kubernetes.NewForConfig(cfg)
if err != nil {
return nil, err
}
batch, err := batch.NewFactoryFromConfigWithOptions(cfg, opts)
if err != nil {
return nil, err
}
cache := memory.NewMemCacheClient(k8s.Discovery())
restMapper := restmapper.NewDeferredDiscoveryRESTMapper(cache)
apply, err := apply.NewForConfig(cfg)
if err != nil {
return nil, err
}
return &Clients{
K8s: k8s,
Core: core.Core().V1(),
RBAC: rbac.Rbac().V1(),
Apps: apps.Apps().V1(),
CRD: crd.Apiextensions().V1(),
API: api.Apiregistration().V1(),
Admission: adminReg.Admissionregistration().V1(),
Batch: batch.Batch().V1(),
Apply: apply.WithSetOwnerReference(false, false),
RESTConfig: cfg,
CachedDiscovery: cache,
SharedControllerFactory: opts.SharedControllerFactory,
RESTMapper: restMapper,
FactoryOptions: opts,
Dynamic: dynamic.New(k8s.Discovery()),
}, nil
}
func (c *Clients) ToRawKubeConfigLoader() clientcmd.ClientConfig {
return c.ClientConfig
}
func (c *Clients) ToRESTConfig() (*rest.Config, error) {
return c.RESTConfig, nil
}
func (c *Clients) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) {
return c.CachedDiscovery, nil
}
func (c *Clients) ToRESTMapper() (meta.RESTMapper, error) {
return c.RESTMapper, nil
}
func (c *Clients) Start(ctx context.Context) error {
if err := c.Dynamic.Register(ctx, c.SharedControllerFactory); err != nil {
return err
}
return c.SharedControllerFactory.Start(ctx, 5)
}
func restConfigDefaults(cfg *rest.Config) *rest.Config {
cfg = rest.CopyConfig(cfg)
cfg.Timeout = 15 * time.Minute
cfg.RateLimiter = ratelimit.None
return cfg
}
================================================
FILE: pkg/codegen/main.go
================================================
package main
import (
controllergen "github.com/rancher/wrangler/v3/pkg/controller-gen"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
coordinationv1 "k8s.io/api/coordination/v1"
v1 "k8s.io/api/core/v1"
discoveryv1 "k8s.io/api/discovery/v1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
rbacv1 "k8s.io/api/rbac/v1"
storagev1 "k8s.io/api/storage/v1"
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
)
func main() {
controllergen.Run(args.Options{
ImportPackage: "github.com/rancher/wrangler/v3/pkg/generated",
OutputPackage: "github.com/rancher/wrangler/pkg/generated",
Boilerplate: "scripts/boilerplate.go.txt",
Groups: map[string]args.Group{
v1.GroupName: {
Types: []interface{}{
v1.Event{},
v1.Node{},
v1.Namespace{},
v1.Secret{},
v1.Service{},
v1.ServiceAccount{},
v1.Endpoints{},
v1.ConfigMap{},
v1.PersistentVolume{},
v1.PersistentVolumeClaim{},
v1.Pod{},
v1.LimitRange{},
v1.ResourceQuota{},
},
},
discoveryv1.GroupName: {
Types: []interface{}{
discoveryv1.EndpointSlice{},
},
OutputControllerPackageName: "discovery",
},
extensionsv1beta1.GroupName: {
Types: []interface{}{
extensionsv1beta1.Ingress{},
},
},
rbacv1.GroupName: {
Types: []interface{}{
rbacv1.Role{},
rbacv1.RoleBinding{},
rbacv1.ClusterRole{},
rbacv1.ClusterRoleBinding{},
},
OutputControllerPackageName: "rbac",
},
appsv1.GroupName: {
Types: []interface{}{
appsv1.Deployment{},
appsv1.DaemonSet{},
appsv1.StatefulSet{},
},
},
storagev1.GroupName: {
OutputControllerPackageName: "storage",
Types: []interface{}{
storagev1.StorageClass{},
},
},
apiextv1.GroupName: {
Types: []interface{}{
apiextv1.CustomResourceDefinition{},
},
},
apiv1.GroupName: {
Types: []interface{}{
apiv1.APIService{},
},
},
batchv1.GroupName: {
Types: []interface{}{
batchv1.Job{},
},
},
networkingv1.GroupName: {
Types: []interface{}{
networkingv1.NetworkPolicy{},
},
},
admissionregistrationv1.GroupName: {
Types: []interface{}{
admissionregistrationv1.ValidatingWebhookConfiguration{},
admissionregistrationv1.MutatingWebhookConfiguration{},
},
},
coordinationv1.GroupName: {
Types: []interface{}{
coordinationv1.Lease{},
},
},
},
})
}
================================================
FILE: pkg/condition/condition.go
================================================
package condition
import (
"reflect"
"time"
"github.com/rancher/wrangler/v3/pkg/generic"
"github.com/sirupsen/logrus"
)
type Cond string
func (c Cond) GetStatus(obj interface{}) string {
return getStatus(obj, string(c))
}
func (c Cond) SetError(obj interface{}, reason string, err error) {
if err == nil || err == generic.ErrSkip {
c.True(obj)
c.Message(obj, "")
c.Reason(obj, reason)
return
}
if reason == "" {
reason = "Error"
}
c.False(obj)
c.Message(obj, err.Error())
c.Reason(obj, reason)
}
func (c Cond) MatchesError(obj interface{}, reason string, err error) bool {
if err == nil {
return c.IsTrue(obj) &&
c.GetMessage(obj) == "" &&
c.GetReason(obj) == reason
}
if reason == "" {
reason = "Error"
}
return c.IsFalse(obj) &&
c.GetMessage(obj) == err.Error() &&
c.GetReason(obj) == reason
}
func (c Cond) SetStatus(obj interface{}, status string) {
setStatus(obj, string(c), status)
}
func (c Cond) SetStatusBool(obj interface{}, val bool) {
if val {
setStatus(obj, string(c), "True")
} else {
setStatus(obj, string(c), "False")
}
}
func (c Cond) True(obj interface{}) {
setStatus(obj, string(c), "True")
}
func (c Cond) IsTrue(obj interface{}) bool {
return getStatus(obj, string(c)) == "True"
}
func (c Cond) False(obj interface{}) {
setStatus(obj, string(c), "False")
}
func (c Cond) IsFalse(obj interface{}) bool {
return getStatus(obj, string(c)) == "False"
}
func (c Cond) Unknown(obj interface{}) {
setStatus(obj, string(c), "Unknown")
}
func (c Cond) IsUnknown(obj interface{}) bool {
return getStatus(obj, string(c)) == "Unknown"
}
func (c Cond) LastUpdated(obj interface{}, ts string) {
setTS(obj, string(c), ts)
}
func (c Cond) GetLastUpdated(obj interface{}) string {
return getTS(obj, string(c))
}
func (c Cond) CreateUnknownIfNotExists(obj interface{}) {
condSlice := getValue(obj, "Status", "Conditions")
if !condSlice.IsValid() {
condSlice = getValue(obj, "Conditions")
}
cond := findCond(obj, condSlice, string(c))
if cond == nil {
c.Unknown(obj)
}
}
func (c Cond) Reason(obj interface{}, reason string) {
cond := findOrCreateCond(obj, string(c))
getFieldValue(cond, "Reason").SetString(reason)
}
func (c Cond) GetReason(obj interface{}) string {
cond := findOrNotCreateCond(obj, string(c))
if cond == nil {
return ""
}
return getFieldValue(*cond, "Reason").String()
}
func (c Cond) SetMessageIfBlank(obj interface{}, message string) {
if c.GetMessage(obj) == "" {
c.Message(obj, message)
}
}
func (c Cond) Message(obj interface{}, message string) {
cond := findOrCreateCond(obj, string(c))
setValue(cond, "Message", message)
}
func (c Cond) GetMessage(obj interface{}) string {
cond := findOrNotCreateCond(obj, string(c))
if cond == nil {
return ""
}
return getFieldValue(*cond, "Message").String()
}
func touchTS(value reflect.Value) {
now := time.Now().UTC().Format(time.RFC3339)
getFieldValue(value, "LastUpdateTime").SetString(now)
}
func getStatus(obj interface{}, condName string) string {
cond := findOrNotCreateCond(obj, condName)
if cond == nil {
return ""
}
return getFieldValue(*cond, "Status").String()
}
func setTS(obj interface{}, condName, ts string) {
cond := findOrCreateCond(obj, condName)
getFieldValue(cond, "LastUpdateTime").SetString(ts)
}
func getTS(obj interface{}, condName string) string {
cond := findOrNotCreateCond(obj, condName)
if cond == nil {
return ""
}
return getFieldValue(*cond, "LastUpdateTime").String()
}
func setStatus(obj interface{}, condName, status string) {
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
panic("obj passed must be a pointer")
}
cond := findOrCreateCond(obj, condName)
setValue(cond, "Status", status)
}
func setValue(cond reflect.Value, fieldName, newValue string) {
value := getFieldValue(cond, fieldName)
if value.String() != newValue {
value.SetString(newValue)
touchTS(cond)
}
}
func findOrNotCreateCond(obj interface{}, condName string) *reflect.Value {
condSlice := getValue(obj, "Status", "Conditions")
if !condSlice.IsValid() {
condSlice = getValue(obj, "Conditions")
}
return findCond(obj, condSlice, condName)
}
func findOrCreateCond(obj interface{}, condName string) reflect.Value {
condSlice := getValue(obj, "Status", "Conditions")
if !condSlice.IsValid() {
condSlice = getValue(obj, "Conditions")
}
cond := findCond(obj, condSlice, condName)
if cond != nil {
return *cond
}
newCond := reflect.New(condSlice.Type().Elem()).Elem()
newCond.FieldByName("Type").SetString(condName)
newCond.FieldByName("Status").SetString("Unknown")
condSlice.Set(reflect.Append(condSlice, newCond))
return *findCond(obj, condSlice, condName)
}
func findCond(obj interface{}, val reflect.Value, name string) *reflect.Value {
defer func() {
if recover() != nil {
logrus.Fatalf("failed to find .Status.Conditions field on %v", reflect.TypeOf(obj))
}
}()
for i := 0; i < val.Len(); i++ {
cond := val.Index(i)
typeVal := getFieldValue(cond, "Type")
if typeVal.String() == name {
return &cond
}
}
return nil
}
func getValue(obj interface{}, name ...string) reflect.Value {
if obj == nil {
return reflect.Value{}
}
v := reflect.ValueOf(obj)
t := v.Type()
if t.Kind() == reflect.Ptr {
v = v.Elem()
}
field := v.FieldByName(name[0])
if len(name) == 1 {
return field
}
return getFieldValue(field, name[1:]...)
}
func getFieldValue(v reflect.Value, name ...string) reflect.Value {
if !v.IsValid() {
return v
}
field := v.FieldByName(name[0])
if len(name) == 1 {
return field
}
return getFieldValue(field, name[1:]...)
}
func Error(reason string, err error) error {
return &conditionError{
reason: reason,
message: err.Error(),
}
}
type conditionError struct {
reason string
message string
}
func (e *conditionError) Error() string {
return e.message
}
================================================
FILE: pkg/controller-gen/OWNERS
================================================
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- lavalamp
- wojtek-t
- caesarxuchao
reviewers:
- lavalamp
- wojtek-t
- caesarxuchao
================================================
FILE: pkg/controller-gen/README.md
================================================
See [generating-clientset.md](https://git.k8s.io/community/contributors/devel/sig-api-machinery/generating-clientset.md)
[]()
================================================
FILE: pkg/controller-gen/args/args.go
================================================
package args
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/gengo/v2/types"
)
type CustomArgs struct {
// Package is the directory path where generated code output will be located
Package string
ImportPackage string
TypesByGroup map[schema.GroupVersion][]*types.Name
Options Options
OutputBase string
// BoilerplateContent is the actual boilerplate content that has been
// read. It will be added to every generated files.
BoilerplateContent []byte
}
type Options struct {
ImportPackage string
// OutputPackage is the directory path where generated code output will be located
OutputPackage string
Groups map[string]Group
// Boilerplate is the filepath to a boilerplate file whose content will
// be added to every generated files.
Boilerplate string
}
type Type struct {
Version string
Package string
Name string
}
type Group struct {
// Types is a slice of the following types
// Instance of any struct: used for reflection to describe the type
// string: a directory that will be listed (non-recursively) for types
// Type: a description of a type
Types []interface{}
GenerateTypes bool
// Generate clientsets
GenerateClients bool
OutputControllerPackageName string
// Generate listers
GenerateListers bool
// Generate informers
GenerateInformers bool
// Generate openapi
GenerateOpenAPI bool
// Open API model package name
OpenAPIModelPackageName string
// OpenAPI extra dependencies
OpenAPIDependencies []string
// The package name of the API types
PackageName string
}
================================================
FILE: pkg/controller-gen/args/groupversion.go
================================================
package args
import (
gotypes "go/types"
"reflect"
"sort"
"strings"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/imports"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/code-generator/cmd/client-gen/generators/util"
"k8s.io/gengo/v2/types"
)
const (
needsComment = `
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
`
objectComment = "+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object"
)
func translate(types []Type, err error) (result []interface{}, _ error) {
for _, v := range types {
result = append(result, v)
}
return result, err
}
func ObjectsToGroupVersion(group string, objs []interface{}, ret map[schema.GroupVersion][]*types.Name) error {
for _, obj := range objs {
if s, ok := obj.(string); ok {
types, err := translate(ScanDirectory(s))
if err != nil {
return err
}
if err := ObjectsToGroupVersion(group, types, ret); err != nil {
return err
}
continue
}
version, t := toVersionType(obj)
gv := schema.GroupVersion{
Group: group,
Version: version,
}
ret[gv] = append(ret[gv], t)
}
return nil
}
func toVersionType(obj interface{}) (string, *types.Name) {
switch v := obj.(type) {
case Type:
return v.Version, &types.Name{
Package: v.Package,
Name: v.Name,
}
case *Type:
return v.Version, &types.Name{
Package: v.Package,
Name: v.Name,
}
}
t := reflect.TypeOf(obj)
if t.Kind() == reflect.Ptr {
t = t.Elem()
}
pkg := imports.VendorlessPath(t.PkgPath())
return versionFromPackage(pkg), &types.Name{
Package: pkg,
Name: t.Name(),
}
}
func versionFromPackage(pkg string) string {
parts := strings.Split(pkg, "/")
return parts[len(parts)-1]
}
func CheckType(passedType *types.Type) {
tags := util.MustParseClientGenTags(passedType.SecondClosestCommentLines)
if !tags.GenerateClient {
panic("Type " + passedType.String() + " is missing comment " + needsComment)
}
found := false
for _, line := range passedType.SecondClosestCommentLines {
if strings.Contains(line, objectComment) {
found = true
}
}
if !found {
panic("Type " + passedType.String() + " is missing comment " + objectComment)
}
}
func ScanDirectory(pkgPath string) (result []Type, err error) {
pkgs, err := packages.Load(&packages.Config{
Mode: packages.NeedName | packages.NeedTypes | packages.NeedTypesInfo | packages.NeedSyntax,
Dir: pkgPath,
})
if err != nil {
return nil, err
}
for _, v := range pkgs[0].TypesInfo.Defs {
typeAndName, ok := v.(*gotypes.TypeName)
if !ok {
continue
}
s, ok := typeAndName.Type().Underlying().(*gotypes.Struct)
if !ok {
continue
}
for i := 0; i < s.NumFields(); i++ {
f := s.Field(i)
if f.Embedded() && f.Type().String() == "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta" {
pkgPath := imports.VendorlessPath(pkgs[0].PkgPath)
result = append(result, Type{
Package: pkgPath,
Version: versionFromPackage(pkgPath),
Name: typeAndName.Name(),
})
}
}
}
sort.Slice(result, func(i, j int) bool {
return result[i].Name < result[j].Name
})
return
}
================================================
FILE: pkg/controller-gen/args/groupversion_test.go
================================================
package args
import (
"fmt"
"os"
"testing"
)
func TestScan(t *testing.T) {
cwd, _ := os.Getwd()
fmt.Println(cwd)
_, _ = ScanDirectory("./testdata")
}
================================================
FILE: pkg/controller-gen/args/testdata/test.go
================================================
package testdata
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type SomeStruct struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
}
================================================
FILE: pkg/controller-gen/generators/client_generator.go
================================================
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package generators
import (
"fmt"
"path/filepath"
"strings"
args "github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/types"
)
type ClientGenerator struct {
Fakes map[string][]string
}
func NewClientGenerator() *ClientGenerator {
return &ClientGenerator{
Fakes: make(map[string][]string),
}
}
// Packages makes the client package definition.
func (cg *ClientGenerator) GetTargets(context *generator.Context, customArgs *args.CustomArgs) []generator.Target {
generateTypesGroups := map[string]bool{}
for groupName, group := range customArgs.Options.Groups {
if group.GenerateTypes {
generateTypesGroups[groupName] = true
}
}
var (
packageList []generator.Target
groups = map[string]bool{}
)
for gv, types := range customArgs.TypesByGroup {
if !groups[gv.Group] {
packageList = append(packageList, cg.groupPackage(gv.Group, customArgs))
if generateTypesGroups[gv.Group] {
packageList = append(packageList, cg.typesGroupPackage(types[0], gv, customArgs))
}
}
groups[gv.Group] = true
packageList = append(packageList, cg.groupVersionPackage(gv, customArgs))
if generateTypesGroups[gv.Group] {
packageList = append(packageList, cg.typesGroupVersionPackage(types[0], gv, customArgs))
packageList = append(packageList, cg.typesGroupVersionDocPackage(types[0], gv, customArgs))
}
}
return packageList
}
func (cg *ClientGenerator) typesGroupPackage(name *types.Name, gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Target {
packagePath := strings.TrimSuffix(name.Package, "/"+gv.Version)
return Target(customArgs, packagePath, func(context *generator.Context) []generator.Generator {
return []generator.Generator{
RegisterGroupGo(gv.Group, customArgs),
}
})
}
func (cg *ClientGenerator) typesGroupVersionDocPackage(name *types.Name, gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Target {
packagePath := name.Package
p := Target(customArgs, packagePath, func(context *generator.Context) []generator.Generator {
return []generator.Generator{
generator.GoGenerator{
OutputFilename: "doc.go",
},
RegisterGroupVersionGo(gv, customArgs),
ListTypesGo(gv, customArgs),
}
})
openAPIDirective := ""
if customArgs.Options.Groups[gv.Group].GenerateOpenAPI {
openAPIDirective = fmt.Sprintf("\n// +k8s:openapi-gen=true")
}
if customArgs.Options.Groups[gv.Group].OpenAPIModelPackageName != "" {
openAPIDirective += fmt.Sprintf("\n// +k8s:openapi-model-package=%s", customArgs.Options.Groups[gv.Group].OpenAPIModelPackageName)
}
p.HeaderComment = []byte(fmt.Sprintf(`
%s
%s
// +k8s:deepcopy-gen=package
// +groupName=%s
`, string(customArgs.BoilerplateContent), openAPIDirective, gv.Group))
return p
}
func (cg *ClientGenerator) typesGroupVersionPackage(name *types.Name, gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Target {
packagePath := name.Package
return Target(customArgs, packagePath, func(context *generator.Context) []generator.Generator {
return []generator.Generator{
RegisterGroupVersionGo(gv, customArgs),
ListTypesGo(gv, customArgs),
}
})
}
func (cg *ClientGenerator) groupPackage(group string, customArgs *args.CustomArgs) generator.Target {
packagePath := filepath.Join(customArgs.Package, "controllers", groupPackageName(group, customArgs.Options.Groups[group].OutputControllerPackageName))
return Target(customArgs, packagePath, func(context *generator.Context) []generator.Generator {
return []generator.Generator{
FactoryGo(group, customArgs),
GroupInterfaceGo(group, customArgs),
}
})
}
func (cg *ClientGenerator) groupVersionPackage(gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Target {
packagePath := filepath.Join(customArgs.Package, "controllers", groupPackageName(gv.Group, customArgs.Options.Groups[gv.Group].OutputControllerPackageName), gv.Version)
return Target(customArgs, packagePath, func(context *generator.Context) []generator.Generator {
generators := []generator.Generator{
GroupVersionInterfaceGo(gv, customArgs),
}
for _, t := range customArgs.TypesByGroup[gv] {
generators = append(generators, TypeGo(gv, t, customArgs))
cg.Fakes[packagePath] = append(cg.Fakes[packagePath], t.Name)
}
return generators
})
}
================================================
FILE: pkg/controller-gen/generators/factory_go.go
================================================
package generators
import (
"fmt"
"io"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/gengo/v2/generator"
)
func FactoryGo(group string, customArgs *args.CustomArgs) generator.Generator {
return &factory{
group: group,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: "factory.go",
OptionalBody: []byte(factoryBody),
},
}
}
type factory struct {
generator.GoGenerator
group string
customArgs *args.CustomArgs
}
func (f *factory) Imports(*generator.Context) []string {
imports := Imports
for gv, types := range f.customArgs.TypesByGroup {
if f.group == gv.Group && len(types) > 0 {
imports = append(imports,
fmt.Sprintf("%s \"%s\"", gv.Version, types[0].Package))
}
}
return imports
}
func (f *factory) Init(c *generator.Context, w io.Writer) error {
if err := f.GoGenerator.Init(c, w); err != nil {
return err
}
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
m := map[string]interface{}{
"groupName": upperLowercase(f.group),
}
sw.Do("\n\nfunc (c *Factory) {{.groupName}}() Interface {\n", m)
sw.Do(" return New(c.ControllerFactory())\n", m)
sw.Do("}\n\n", m)
sw.Do("\n\nfunc (c *Factory) WithAgent(userAgent string) Interface {\n", m)
sw.Do(" return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()))\n", m)
sw.Do("}\n\n", m)
return sw.Error()
}
var factoryBody = `
type Factory struct {
*generic.Factory
}
func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
f, err := NewFactoryFromConfig(config)
if err != nil {
panic(err)
}
return f
}
func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
return NewFactoryFromConfigWithOptions(config, nil)
}
func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace string) (*Factory, error) {
return NewFactoryFromConfigWithOptions(config, &FactoryOptions{
Namespace: namespace,
})
}
type FactoryOptions = generic.FactoryOptions
func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryOptions) (*Factory, error) {
f, err := generic.NewFactoryFromConfigWithOptions(config, opts)
return &Factory{
Factory: f,
}, err
}
func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOptions) *Factory {
f, err := NewFactoryFromConfigWithOptions(config, opts)
if err != nil {
panic(err)
}
return f
}
`
================================================
FILE: pkg/controller-gen/generators/group_interface_go.go
================================================
package generators
import (
"fmt"
"io"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/namer"
)
func GroupInterfaceGo(group string, customArgs *args.CustomArgs) generator.Generator {
return &interfaceGo{
group: group,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: "interface.go",
OptionalBody: []byte(interfaceBody),
},
}
}
type interfaceGo struct {
generator.GoGenerator
group string
customArgs *args.CustomArgs
}
func (f *interfaceGo) Imports(context *generator.Context) []string {
packages := Imports
for gv := range f.customArgs.TypesByGroup {
if gv.Group != f.group {
continue
}
pkg := f.customArgs.ImportPackage
if pkg == "" {
pkg = f.customArgs.Package
}
packages = append(packages, fmt.Sprintf("%s \"%s/controllers/%s/%s\"", gv.Version, pkg,
groupPackageName(gv.Group, f.customArgs.Options.Groups[gv.Group].OutputControllerPackageName), gv.Version))
}
return packages
}
func (f *interfaceGo) Init(c *generator.Context, w io.Writer) error {
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
sw.Do("type Interface interface {\n", nil)
for gv := range f.customArgs.TypesByGroup {
if gv.Group != f.group {
continue
}
sw.Do("{{.upperVersion}}() {{.version}}.Interface\n", map[string]interface{}{
"upperVersion": namer.IC(gv.Version),
"version": gv.Version,
})
}
sw.Do("}\n", nil)
if err := f.GoGenerator.Init(c, w); err != nil {
return err
}
for gv := range f.customArgs.TypesByGroup {
if gv.Group != f.group {
continue
}
m := map[string]interface{}{
"upperGroup": upperLowercase(f.group),
"upperVersion": namer.IC(gv.Version),
"version": gv.Version,
}
sw.Do("\nfunc (g *group) {{.upperVersion}}() {{.version}}.Interface {\n", m)
sw.Do("return {{.version}}.New(g.controllerFactory)\n", m)
sw.Do("}\n", m)
}
return sw.Error()
}
var interfaceBody = `
type group struct {
controllerFactory controller.SharedControllerFactory
}
// New returns a new Interface.
func New(controllerFactory controller.SharedControllerFactory) Interface {
return &group{
controllerFactory: controllerFactory,
}
}
`
================================================
FILE: pkg/controller-gen/generators/group_version_interface_go.go
================================================
package generators
import (
"fmt"
"io"
"strings"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/namer"
"k8s.io/gengo/v2/types"
)
func GroupVersionInterfaceGo(gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Generator {
return &groupInterfaceGo{
gv: gv,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: "interface.go",
},
}
}
type groupInterfaceGo struct {
generator.GoGenerator
gv schema.GroupVersion
customArgs *args.CustomArgs
}
func (f *groupInterfaceGo) Imports(context *generator.Context) []string {
firstType := f.customArgs.TypesByGroup[f.gv][0]
packages := append(Imports,
fmt.Sprintf("%s \"%s\"", f.gv.Version, firstType.Package))
return packages
}
var (
pluralExceptions = map[string]string{
"Endpoints": "Endpoints",
}
plural = namer.NewPublicPluralNamer(pluralExceptions)
)
func (f *groupInterfaceGo) Init(c *generator.Context, w io.Writer) error {
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
orderer := namer.Orderer{Namer: namer.NewPrivateNamer(0)}
var types []*types.Type
for _, name := range f.customArgs.TypesByGroup[f.gv] {
types = append(types, c.Universe.Type(*name))
}
types = orderer.OrderTypes(types)
sw.Do("func init() {\n", nil)
sw.Do("schemes.Register("+f.gv.Version+".AddToScheme)\n", nil)
sw.Do("}\n", nil)
sw.Do("type Interface interface {\n", nil)
for _, t := range types {
m := map[string]interface{}{
"type": t.Name.Name,
}
sw.Do("{{.type}}() {{.type}}Controller\n", m)
}
sw.Do("}\n", nil)
m := map[string]interface{}{
"version": f.gv.Version,
"versionUpper": namer.IC(f.gv.Version),
"groupUpper": upperLowercase(f.gv.Group),
}
sw.Do(groupInterfaceBody, m)
for _, t := range types {
m := map[string]interface{}{
"type": t.Name.Name,
"plural": plural.Name(t),
"pluralLower": strings.ToLower(plural.Name(t)),
"version": f.gv.Version,
"group": f.gv.Group,
"namespaced": namespaced(t),
"versionUpper": namer.IC(f.gv.Version),
"groupUpper": upperLowercase(f.gv.Group),
}
body := `
func (v *version) {{.type}}() {{.type}}Controller {
return generic.New{{ if not .namespaced}}NonNamespaced{{end}}Controller[*{{.version}}.{{.type}}, *{{.version}}.{{.type}}List](schema.GroupVersionKind{Group: "{{.group}}", Version: "{{.version}}", Kind: "{{.type}}"}, "{{.pluralLower}}", {{ if .namespaced}}true, {{end}}v.controllerFactory)
}
`
sw.Do(body, m)
}
return sw.Error()
}
var groupInterfaceBody = `
func New(controllerFactory controller.SharedControllerFactory) Interface {
return &version{
controllerFactory: controllerFactory,
}
}
type version struct {
controllerFactory controller.SharedControllerFactory
}
`
================================================
FILE: pkg/controller-gen/generators/list_type_go.go
================================================
package generators
import (
"io"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/gengo/v2/generator"
)
func ListTypesGo(gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Generator {
return &listTypesGo{
gv: gv,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: "zz_generated_list_types.go",
},
}
}
type listTypesGo struct {
generator.GoGenerator
gv schema.GroupVersion
customArgs *args.CustomArgs
}
func (f *listTypesGo) Imports(*generator.Context) []string {
return Imports
}
func (f *listTypesGo) Init(c *generator.Context, w io.Writer) error {
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
for _, t := range f.customArgs.TypesByGroup[f.gv] {
m := map[string]interface{}{
"type": t.Name,
}
args.CheckType(c.Universe.Type(*t))
sw.Do(string(listTypesBody), m)
}
return sw.Error()
}
var listTypesBody = `
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// {{.type}}List is a list of {{.type}} resources
type {{.type}}List struct {
metav1.TypeMeta ` + "`" + `json:",inline"` + "`" + `
metav1.ListMeta ` + "`" + `json:"metadata"` + "`" + `
Items []{{.type}} ` + "`" + `json:"items"` + "`" + `
}
func New{{.type}}(namespace, name string, obj {{.type}}) *{{.type}} {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("{{.type}}").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
`
================================================
FILE: pkg/controller-gen/generators/register_group_go.go
================================================
package generators
import (
"fmt"
"strings"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/gengo/v2/generator"
)
func RegisterGroupGo(group string, customArgs *args.CustomArgs) generator.Generator {
return ®isterGroupGo{
group: group,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: "zz_generated_register.go",
},
}
}
type registerGroupGo struct {
generator.GoGenerator
group string
customArgs *args.CustomArgs
}
func (f *registerGroupGo) Name() string {
// Keep the old behavior of generating comments without the .go suffix
return strings.TrimSuffix(f.Filename(), ".go")
}
func (f *registerGroupGo) PackageConsts(*generator.Context) []string {
return []string{
fmt.Sprintf("GroupName = \"%s\"", f.group),
}
}
================================================
FILE: pkg/controller-gen/generators/register_group_version_go.go
================================================
package generators
import (
"fmt"
"io"
"strings"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"github.com/rancher/wrangler/v3/pkg/name"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/namer"
"k8s.io/gengo/v2/types"
)
func RegisterGroupVersionGo(gv schema.GroupVersion, customArgs *args.CustomArgs) generator.Generator {
return ®isterGroupVersionGo{
gv: gv,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: "zz_generated_register.go",
},
}
}
type registerGroupVersionGo struct {
generator.GoGenerator
gv schema.GroupVersion
customArgs *args.CustomArgs
}
func (f *registerGroupVersionGo) Imports(*generator.Context) []string {
firstType := f.customArgs.TypesByGroup[f.gv][0]
typeGroupPath := strings.TrimSuffix(firstType.Package, "/"+f.gv.Version)
packages := append(Imports,
fmt.Sprintf("%s \"%s\"", groupPath(f.gv.Group), typeGroupPath))
return packages
}
func (f *registerGroupVersionGo) Init(c *generator.Context, w io.Writer) error {
var (
types []*types.Type
orderer = namer.Orderer{Namer: namer.NewPrivateNamer(0)}
sw = generator.NewSnippetWriter(w, c, "{{", "}}")
)
for _, name := range f.customArgs.TypesByGroup[f.gv] {
types = append(types, c.Universe.Type(*name))
}
types = orderer.OrderTypes(types)
m := map[string]interface{}{
"version": f.gv.Version,
"groupPath": groupPath(f.gv.Group),
}
sw.Do("var (\n", nil)
for _, t := range types {
m := map[string]interface{}{
"name": t.Name.Name + "ResourceName",
"plural": name.GuessPluralName(strings.ToLower(t.Name.Name)),
}
sw.Do("{{.name}} = \"{{.plural}}\"\n", m)
}
sw.Do(")\n", nil)
sw.Do(registerGroupVersionBody, m)
for _, t := range types {
m := map[string]interface{}{
"type": t.Name.Name,
}
sw.Do("&{{.type}}{},\n", m)
sw.Do("&{{.type}}List{},\n", m)
}
sw.Do(registerGroupVersionBodyEnd, nil)
return sw.Error()
}
var registerGroupVersionBody = `
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: {{.groupPath}}.GroupName, Version: "{{.version}}"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
`
var registerGroupVersionBodyEnd = `
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
`
================================================
FILE: pkg/controller-gen/generators/target.go
================================================
package generators
import (
"path/filepath"
"strings"
args "github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/gengo/v2/generator"
)
func Target(customArgs *args.CustomArgs, name string, generators func(context *generator.Context) []generator.Generator) generator.SimpleTarget {
parts := strings.Split(name, "/")
return generator.SimpleTarget{
PkgName: groupPath(parts[len(parts)-1]),
PkgPath: name,
PkgDir: filepath.Join(customArgs.OutputBase, name),
HeaderComment: customArgs.BoilerplateContent,
GeneratorsFunc: generators,
}
}
================================================
FILE: pkg/controller-gen/generators/type_go.go
================================================
package generators
import (
"fmt"
"io"
"strings"
"github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/namer"
"k8s.io/gengo/v2/types"
)
func TypeGo(gv schema.GroupVersion, name *types.Name, customArgs *args.CustomArgs) generator.Generator {
return &typeGo{
name: name,
gv: gv,
customArgs: customArgs,
GoGenerator: generator.GoGenerator{
OutputFilename: fmt.Sprintf("%s.go", strings.ToLower(name.Name)),
},
}
}
type typeGo struct {
generator.GoGenerator
name *types.Name
gv schema.GroupVersion
customArgs *args.CustomArgs
}
func (f *typeGo) Imports(context *generator.Context) []string {
packages := append(Imports,
fmt.Sprintf("%s \"%s\"", f.gv.Version, f.name.Package))
return packages
}
func (f *typeGo) Init(c *generator.Context, w io.Writer) error {
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
if err := f.GoGenerator.Init(c, w); err != nil {
return err
}
t := c.Universe.Type(*f.name)
m := map[string]interface{}{
"type": f.name.Name,
"lowerName": namer.IL(f.name.Name),
"plural": plural.Name(t),
"version": f.gv.Version,
"namespaced": namespaced(t),
"hasStatus": hasStatus(t),
"statusType": statusType(t),
}
sw.Do(typeBody, m)
return sw.Error()
}
func statusType(t *types.Type) string {
for _, m := range t.Members {
if m.Name == "Status" {
return m.Type.Name.Name
}
}
return ""
}
func hasStatus(t *types.Type) bool {
for _, m := range t.Members {
if m.Name == "Status" && m.Type.Name.Package == t.Name.Package {
return true
}
}
return false
}
var typeBody = `
// {{.type}}Controller interface for managing {{.type}} resources.
type {{.type}}Controller interface {
generic.{{ if not .namespaced}}NonNamespaced{{end}}ControllerInterface[*{{.version}}.{{.type}}, *{{.version}}.{{.type}}List]
}
// {{.type}}Client interface for managing {{.type}} resources in Kubernetes.
type {{.type}}Client interface {
generic.{{ if not .namespaced}}NonNamespaced{{end}}ClientInterface[*{{.version}}.{{.type}}, *{{.version}}.{{.type}}List]
}
// {{.type}}Cache interface for retrieving {{.type}} resources in memory.
type {{.type}}Cache interface {
generic.{{ if not .namespaced}}NonNamespaced{{end}}CacheInterface[*{{.version}}.{{.type}}]
}
{{ if .hasStatus -}}
// {{.type}}StatusHandler is executed for every added or modified {{.type}}. Should return the new status to be updated
type {{.type}}StatusHandler func(obj *{{.version}}.{{.type}}, status {{.version}}.{{.statusType}}) ({{.version}}.{{.statusType}}, error)
// {{.type}}GeneratingHandler is the top-level handler that is executed for every {{.type}} event. It extends {{.type}}StatusHandler by a returning a slice of child objects to be passed to apply.Apply
type {{.type}}GeneratingHandler func(obj *{{.version}}.{{.type}}, status {{.version}}.{{.statusType}}) ([]runtime.Object, {{.version}}.{{.statusType}}, error)
// Register{{.type}}StatusHandler configures a {{.type}}Controller to execute a {{.type}}StatusHandler for every events observed.
// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution
func Register{{.type}}StatusHandler(ctx context.Context, controller {{.type}}Controller, condition condition.Cond, name string, handler {{.type}}StatusHandler) {
statusHandler := &{{.lowerName}}StatusHandler{
client: controller,
condition: condition,
handler: handler,
}
controller.AddGenericHandler(ctx, name, generic.FromObjectHandlerToHandler(statusHandler.sync))
}
// Register{{.type}}GeneratingHandler configures a {{.type}}Controller to execute a {{.type}}GeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply.
// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution
func Register{{.type}}GeneratingHandler(ctx context.Context, controller {{.type}}Controller, apply apply.Apply,
condition condition.Cond, name string, handler {{.type}}GeneratingHandler, opts *generic.GeneratingHandlerOptions) {
statusHandler := &{{.lowerName}}GeneratingHandler{
{{.type}}GeneratingHandler: handler,
apply: apply,
name: name,
gvk: controller.GroupVersionKind(),
}
if opts != nil {
statusHandler.opts = *opts
}
controller.OnChange(ctx, name, statusHandler.Remove)
Register{{.type}}StatusHandler(ctx, controller, condition, name, statusHandler.Handle)
}
type {{.lowerName}}StatusHandler struct {
client {{.type}}Client
condition condition.Cond
handler {{.type}}StatusHandler
}
// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API
func (a *{{.lowerName}}StatusHandler) sync(key string, obj *{{.version}}.{{.type}}) (*{{.version}}.{{.type}}, error) {
if obj == nil {
return obj, nil
}
origStatus := obj.Status.DeepCopy()
obj = obj.DeepCopy()
newStatus, err := a.handler(obj, obj.Status)
if err != nil {
// Revert to old status on error
newStatus = *origStatus.DeepCopy()
}
if a.condition != "" {
if errors.IsConflict(err) {
a.condition.SetError(&newStatus, "", nil)
} else {
a.condition.SetError(&newStatus, "", err)
}
}
if !equality.Semantic.DeepEqual(origStatus, &newStatus) {
if a.condition != "" {
// Since status has changed, update the lastUpdatedTime
a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339))
}
var newErr error
obj.Status = newStatus
newObj, newErr := a.client.UpdateStatus(obj)
if err == nil {
err = newErr
}
if newErr == nil {
obj = newObj
}
}
return obj, err
}
type {{.lowerName}}GeneratingHandler struct {
{{.type}}GeneratingHandler
apply apply.Apply
opts generic.GeneratingHandlerOptions
gvk schema.GroupVersionKind
name string
seen sync.Map
}
// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied
func (a *{{.lowerName}}GeneratingHandler) Remove(key string, obj *{{.version}}.{{.type}}) (*{{.version}}.{{.type}}, error) {
if obj != nil {
return obj, nil
}
obj = &{{.version}}.{{.type}}{}
obj.Namespace, obj.Name = kv.RSplit(key, "/")
obj.SetGroupVersionKind(a.gvk)
if a.opts.UniqueApplyForResourceVersion {
a.seen.Delete(key)
}
return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts).
WithOwner(obj).
WithSetID(a.name).
ApplyObjects()
}
// Handle executes the configured {{.type}}GeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource
func (a *{{.lowerName}}GeneratingHandler) Handle(obj *{{.version}}.{{.type}}, status {{.version}}.{{.statusType}}) ({{.version}}.{{.statusType}}, error) {
if !obj.DeletionTimestamp.IsZero() {
return status, nil
}
objs, newStatus, err := a.{{.type}}GeneratingHandler(obj, status)
if err != nil {
return newStatus, err
}
if !a.isNewResourceVersion(obj) {
return newStatus, nil
}
err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts).
WithOwner(obj).
WithSetID(a.name).
ApplyObjects(objs...)
if err != nil {
return newStatus, err
}
a.storeResourceVersion(obj)
return newStatus, nil
}
// isNewResourceVersion detects if a specific resource version was already successfully processed.
// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions
func (a *{{.lowerName}}GeneratingHandler) isNewResourceVersion(obj *{{.version}}.{{.type}}) bool {
if !a.opts.UniqueApplyForResourceVersion {
return true
}
// Apply once per resource version
key := obj.Namespace + "/" + obj.Name
previous, ok := a.seen.Load(key)
return !ok || previous != obj.ResourceVersion
}
// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed
// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions
func (a *{{.lowerName}}GeneratingHandler) storeResourceVersion(obj *{{.version}}.{{.type}}) {
if !a.opts.UniqueApplyForResourceVersion {
return
}
key := obj.Namespace + "/" + obj.Name
a.seen.Store(key, obj.ResourceVersion)
}
{{- end }}
`
================================================
FILE: pkg/controller-gen/generators/util.go
================================================
package generators
import (
"strings"
"k8s.io/code-generator/cmd/client-gen/generators/util"
"k8s.io/gengo/v2/namer"
"k8s.io/gengo/v2/types"
)
var (
Imports = []string{
"context",
"sync",
"time",
"k8s.io/client-go/rest",
"github.com/rancher/wrangler/v3/pkg/apply",
"github.com/rancher/lasso/pkg/controller",
"github.com/rancher/wrangler/v3/pkg/condition",
"github.com/rancher/wrangler/v3/pkg/schemes",
"github.com/rancher/wrangler/v3/pkg/generic",
"github.com/rancher/wrangler/v3/pkg/kv",
"k8s.io/apimachinery/pkg/api/equality",
"k8s.io/apimachinery/pkg/api/errors",
"metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"",
"k8s.io/apimachinery/pkg/labels",
"k8s.io/apimachinery/pkg/runtime",
"k8s.io/apimachinery/pkg/runtime/schema",
"k8s.io/apimachinery/pkg/types",
"k8s.io/apimachinery/pkg/watch",
}
)
func namespaced(t *types.Type) bool {
if util.MustParseClientGenTags(t.SecondClosestCommentLines).NonNamespaced {
return false
}
kubeBuilder := false
for _, line := range t.SecondClosestCommentLines {
if strings.HasPrefix(line, "+kubebuilder:resource:path=") {
kubeBuilder = true
if strings.Contains(line, "scope=Namespaced") {
return true
}
}
}
return !kubeBuilder
}
func groupPath(group string) string {
g := strings.Replace(strings.Split(group, ".")[0], "-", "", -1)
return groupPackageName(g, "")
}
func groupPackageName(group, groupPackageName string) string {
if groupPackageName != "" {
return groupPackageName
}
if group == "" {
return "core"
}
return group
}
func upperLowercase(name string) string {
return namer.IC(strings.ToLower(groupPath(name)))
}
================================================
FILE: pkg/controller-gen/main.go
================================================
package controllergen
import (
"fmt"
"io"
"os"
"path/filepath"
"sort"
"strings"
"k8s.io/gengo/args"
"k8s.io/gengo/v2"
"k8s.io/gengo/v2/generator"
"k8s.io/gengo/v2/types"
cgargs "github.com/rancher/wrangler/v3/pkg/controller-gen/args"
"github.com/rancher/wrangler/v3/pkg/controller-gen/generators"
"github.com/sirupsen/logrus"
"golang.org/x/tools/imports"
"k8s.io/apimachinery/pkg/runtime/schema"
csargs "k8s.io/code-generator/cmd/client-gen/args"
cs "k8s.io/code-generator/cmd/client-gen/generators"
types2 "k8s.io/code-generator/cmd/client-gen/types"
dpargs "k8s.io/code-generator/cmd/deepcopy-gen/args"
dp "k8s.io/code-generator/cmd/deepcopy-gen/generators"
infargs "k8s.io/code-generator/cmd/informer-gen/args"
inf "k8s.io/code-generator/cmd/informer-gen/generators"
lsargs "k8s.io/code-generator/cmd/lister-gen/args"
ls "k8s.io/code-generator/cmd/lister-gen/generators"
oaargs "k8s.io/kube-openapi/cmd/openapi-gen/args"
oa "k8s.io/kube-openapi/pkg/generators"
)
func Run(opts cgargs.Options) {
genericArgs := args.Default().WithoutDefaultFlagParsing()
genericArgs.GoHeaderFilePath = opts.Boilerplate
if genericArgs.OutputBase == "./" { //go modules
tempDir, err := os.MkdirTemp("", "")
if err != nil {
return
}
genericArgs.OutputBase = tempDir
defer os.RemoveAll(tempDir)
}
boilerplate, err := genericArgs.LoadGoBoilerplate()
if err != nil {
logrus.Fatalf("Loading boilerplate: %v", err)
}
customArgs := &cgargs.CustomArgs{
ImportPackage: opts.ImportPackage,
Options: opts,
TypesByGroup: map[schema.GroupVersion][]*types.Name{},
Package: opts.OutputPackage,
OutputBase: genericArgs.OutputBase,
BoilerplateContent: boilerplate,
}
inputDirs := parseTypes(customArgs)
clientGen := generators.NewClientGenerator()
getTargets := func(context *generator.Context) []generator.Target {
// replace the default formatter options to ensure unused imports are pruned.
// ref: https://github.com/kubernetes/gengo/pull/277#issuecomment-2557462569
goGenerator := generator.NewGoFile()
goGenerator.Format = func(src []byte) ([]byte, error) {
return imports.Process("", src, nil)
}
context.FileTypes[generator.GoFileType] = goGenerator
return clientGen.GetTargets(context, customArgs)
}
if err := gengo.Execute(
cs.NameSystems(nil),
cs.DefaultNameSystem(),
getTargets,
gengo.StdBuildTag,
inputDirs,
); err != nil {
logrus.Fatalf("Error: %v", err)
}
groups := map[string]bool{}
listerGroups := map[string]bool{}
informerGroups := map[string]bool{}
deepCopygroups := map[string]bool{}
openAPIGroups := map[string]bool{}
for groupName, group := range customArgs.Options.Groups {
if group.GenerateTypes {
deepCopygroups[groupName] = true
}
if group.GenerateClients {
groups[groupName] = true
}
if group.GenerateListers {
listerGroups[groupName] = true
}
if group.GenerateInformers {
informerGroups[groupName] = true
}
if group.GenerateOpenAPI {
openAPIGroups[groupName] = true
}
}
if len(deepCopygroups) == 0 && len(groups) == 0 && len(listerGroups) == 0 && len(informerGroups) == 0 && len(openAPIGroups) == 0 {
if err := copyGoPathToModules(customArgs); err != nil {
logrus.Fatalf("go modules copy failed: %v", err)
}
return
}
if err := copyGoPathToModules(customArgs); err != nil {
logrus.Fatalf("go modules copy failed: %v", err)
}
if err := generateDeepcopy(deepCopygroups, customArgs); err != nil {
logrus.Fatalf("deepcopy failed: %v", err)
}
if err := generateClientset(groups, customArgs); err != nil {
logrus.Fatalf("clientset failed: %v", err)
}
if err := generateListers(listerGroups, customArgs); err != nil {
logrus.Fatalf("listers failed: %v", err)
}
if err
gitextract_a9xsblpa/
├── .github/
│ ├── renovate.json
│ └── workflows/
│ ├── ci.yaml
│ ├── fossa.yml
│ ├── release.yaml
│ └── renovate-vault.yml
├── .gitignore
├── .golangci.json
├── CODEOWNERS
├── LICENSE
├── Makefile
├── README.md
├── VERSION.md
├── codegen.go
├── go.mod
├── go.sum
├── pkg/
│ ├── apply/
│ │ ├── apply.go
│ │ ├── client_factory.go
│ │ ├── desiredset.go
│ │ ├── desiredset_apply.go
│ │ ├── desiredset_compare.go
│ │ ├── desiredset_compare_test.go
│ │ ├── desiredset_crud.go
│ │ ├── desiredset_owner.go
│ │ ├── desiredset_process.go
│ │ ├── desiredset_process_test.go
│ │ ├── fake/
│ │ │ └── apply.go
│ │ ├── injectors/
│ │ │ └── registry.go
│ │ └── reconcilers.go
│ ├── broadcast/
│ │ └── generic.go
│ ├── cleanup/
│ │ └── cleanup.go
│ ├── clients/
│ │ └── clients.go
│ ├── codegen/
│ │ └── main.go
│ ├── condition/
│ │ └── condition.go
│ ├── controller-gen/
│ │ ├── OWNERS
│ │ ├── README.md
│ │ ├── args/
│ │ │ ├── args.go
│ │ │ ├── groupversion.go
│ │ │ ├── groupversion_test.go
│ │ │ └── testdata/
│ │ │ └── test.go
│ │ ├── generators/
│ │ │ ├── client_generator.go
│ │ │ ├── factory_go.go
│ │ │ ├── group_interface_go.go
│ │ │ ├── group_version_interface_go.go
│ │ │ ├── list_type_go.go
│ │ │ ├── register_group_go.go
│ │ │ ├── register_group_version_go.go
│ │ │ ├── target.go
│ │ │ ├── type_go.go
│ │ │ └── util.go
│ │ └── main.go
│ ├── crd/
│ │ ├── crd.go
│ │ ├── crd_test.go
│ │ ├── init.go
│ │ ├── mockCRDClient_test.go
│ │ └── print.go
│ ├── data/
│ │ ├── convert/
│ │ │ ├── convert.go
│ │ │ └── convert_test.go
│ │ ├── data.go
│ │ ├── merge.go
│ │ ├── values.go
│ │ └── values_test.go
│ ├── generated/
│ │ └── controllers/
│ │ ├── admissionregistration.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ ├── mutatingwebhookconfiguration.go
│ │ │ └── validatingwebhookconfiguration.go
│ │ ├── apiextensions.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── customresourcedefinition.go
│ │ │ └── interface.go
│ │ ├── apiregistration.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── apiservice.go
│ │ │ └── interface.go
│ │ ├── apps/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── daemonset.go
│ │ │ ├── deployment.go
│ │ │ ├── interface.go
│ │ │ └── statefulset.go
│ │ ├── batch/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ └── job.go
│ │ ├── coordination.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ └── lease.go
│ │ ├── core/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── configmap.go
│ │ │ ├── endpoints.go
│ │ │ ├── event.go
│ │ │ ├── interface.go
│ │ │ ├── limitrange.go
│ │ │ ├── namespace.go
│ │ │ ├── node.go
│ │ │ ├── persistentvolume.go
│ │ │ ├── persistentvolumeclaim.go
│ │ │ ├── pod.go
│ │ │ ├── resourcequota.go
│ │ │ ├── secret.go
│ │ │ ├── service.go
│ │ │ └── serviceaccount.go
│ │ ├── discovery/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── endpointslice.go
│ │ │ └── interface.go
│ │ ├── extensions/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1beta1/
│ │ │ ├── ingress.go
│ │ │ └── interface.go
│ │ ├── networking.k8s.io/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── interface.go
│ │ │ └── networkpolicy.go
│ │ ├── rbac/
│ │ │ ├── factory.go
│ │ │ ├── interface.go
│ │ │ └── v1/
│ │ │ ├── clusterrole.go
│ │ │ ├── clusterrolebinding.go
│ │ │ ├── interface.go
│ │ │ ├── role.go
│ │ │ └── rolebinding.go
│ │ └── storage/
│ │ ├── factory.go
│ │ ├── interface.go
│ │ └── v1/
│ │ ├── interface.go
│ │ └── storageclass.go
│ ├── generic/
│ │ ├── cache.go
│ │ ├── cache_test.go
│ │ ├── clientMocks_test.go
│ │ ├── controller.go
│ │ ├── controllerFactoryMocks_test.go
│ │ ├── controller_test.go
│ │ ├── embeddedClient.go
│ │ ├── factory.go
│ │ ├── fake/
│ │ │ ├── README.md
│ │ │ ├── cache.go
│ │ │ ├── controller.go
│ │ │ ├── fake_test.go
│ │ │ └── generate.go
│ │ ├── generating.go
│ │ ├── generating_test.go
│ │ ├── remove.go
│ │ └── remove_test.go
│ ├── genericcondition/
│ │ └── condition.go
│ ├── gvk/
│ │ ├── detect.go
│ │ └── get.go
│ ├── k8scheck/
│ │ └── wait.go
│ ├── kstatus/
│ │ └── kstatus.go
│ ├── kubeconfig/
│ │ └── loader.go
│ ├── kv/
│ │ └── split.go
│ ├── leader/
│ │ ├── leader.go
│ │ ├── leader_test.go
│ │ └── manager.go
│ ├── merr/
│ │ └── error.go
│ ├── name/
│ │ ├── name.go
│ │ └── name_test.go
│ ├── needacert/
│ │ ├── needacert.go
│ │ └── needacert_test.go
│ ├── objectset/
│ │ ├── objectset.go
│ │ └── objectset_test.go
│ ├── patch/
│ │ ├── apply.go
│ │ └── style.go
│ ├── randomtoken/
│ │ └── token.go
│ ├── ratelimit/
│ │ └── none.go
│ ├── relatedresource/
│ │ ├── all.go
│ │ ├── changeset.go
│ │ ├── changeset_test.go
│ │ └── owner.go
│ ├── resolvehome/
│ │ └── main.go
│ ├── schemas/
│ │ ├── definition/
│ │ │ └── definition.go
│ │ ├── mapper.go
│ │ ├── mappers/
│ │ │ ├── access.go
│ │ │ ├── alias.go
│ │ │ ├── check.go
│ │ │ ├── condition.go
│ │ │ ├── copy.go
│ │ │ ├── default.go
│ │ │ ├── drop.go
│ │ │ ├── embed.go
│ │ │ ├── empty.go
│ │ │ ├── enum.go
│ │ │ ├── exists.go
│ │ │ ├── json_keys.go
│ │ │ ├── metadata.go
│ │ │ ├── move.go
│ │ │ ├── set_value.go
│ │ │ └── slice_to_map.go
│ │ ├── openapi/
│ │ │ └── generate.go
│ │ ├── reflection.go
│ │ ├── schemas.go
│ │ ├── types.go
│ │ └── validation/
│ │ ├── error.go
│ │ └── validation.go
│ ├── schemes/
│ │ └── all.go
│ ├── seen/
│ │ └── strings.go
│ ├── signals/
│ │ ├── signal.go
│ │ ├── signal_posix.go
│ │ └── signal_windows.go
│ ├── slice/
│ │ └── contains.go
│ ├── start/
│ │ └── all.go
│ ├── stringset/
│ │ ├── stringset.go
│ │ └── stringset_test.go
│ ├── summary/
│ │ ├── capi_cluster_test.go
│ │ ├── capi_machine_test.go
│ │ ├── capi_machineset_test.go
│ │ ├── cattletypes.go
│ │ ├── cattletypes_test.go
│ │ ├── client/
│ │ │ ├── interface.go
│ │ │ ├── options.go
│ │ │ └── simple.go
│ │ ├── condition.go
│ │ ├── condition_test.go
│ │ ├── coretypes.go
│ │ ├── gvk.go
│ │ ├── gvk_test.go
│ │ ├── informer/
│ │ │ ├── informer.go
│ │ │ ├── informer_test.go
│ │ │ ├── interface.go
│ │ │ └── watchlist.go
│ │ ├── lister/
│ │ │ ├── interface.go
│ │ │ ├── lister.go
│ │ │ └── shim.go
│ │ ├── summarized.go
│ │ ├── summarizers.go
│ │ ├── summarizers_test.go
│ │ └── summary.go
│ ├── ticker/
│ │ └── ticker.go
│ ├── trigger/
│ │ └── evalall.go
│ ├── unstructured/
│ │ └── unstructured.go
│ ├── webhook/
│ │ ├── match.go
│ │ └── router.go
│ └── yaml/
│ ├── objects_test.go
│ ├── yaml.go
│ └── yaml_test.go
└── scripts/
├── boilerplate.go.txt
└── ci
SYMBOL INDEX (1854 symbols across 215 files)
FILE: codegen.go
function main (line 15) | func main() {
FILE: pkg/apply/apply.go
constant defaultNamespace (line 20) | defaultNamespace = "default"
type Patcher (line 23) | type Patcher
type Reconciler (line 26) | type Reconciler
type ClientFactory (line 28) | type ClientFactory
type InformerFactory (line 30) | type InformerFactory interface
type InformerGetter (line 34) | type InformerGetter interface
type PatchByGVK (line 39) | type PatchByGVK
method Add (line 41) | func (p PatchByGVK) Add(gvk schema.GroupVersionKind, namespace, name, ...
type Plan (line 53) | type Plan struct
type Apply (line 60) | type Apply interface
function NewForConfig (line 91) | func NewForConfig(cfg *rest.Config) (Apply, error) {
function New (line 100) | func New(discovery discovery.DiscoveryInterface, cf ClientFactory, igs ....
type apply (line 119) | type apply struct
method newDesiredSet (line 190) | func (a *apply) newDesiredSet() desiredSet {
method DryRun (line 201) | func (a *apply) DryRun(objs ...runtime.Object) (Plan, error) {
method Apply (line 205) | func (a *apply) Apply(set *objectset.ObjectSet) error {
method ApplyObjects (line 209) | func (a *apply) ApplyObjects(objs ...runtime.Object) error {
method WithSetID (line 215) | func (a *apply) WithSetID(id string) Apply {
method WithOwner (line 219) | func (a *apply) WithOwner(obj runtime.Object) Apply {
method WithOwnerKey (line 223) | func (a *apply) WithOwnerKey(key string, gvk schema.GroupVersionKind) ...
method WithInjector (line 227) | func (a *apply) WithInjector(injs ...injectors.ConfigInjector) Apply {
method WithInjectorName (line 231) | func (a *apply) WithInjectorName(injs ...string) Apply {
method WithCacheTypes (line 235) | func (a *apply) WithCacheTypes(igs ...InformerGetter) Apply {
method WithCacheTypeFactory (line 239) | func (a *apply) WithCacheTypeFactory(factory InformerFactory) Apply {
method WithGVK (line 243) | func (a *apply) WithGVK(gvks ...schema.GroupVersionKind) Apply {
method WithPatcher (line 247) | func (a *apply) WithPatcher(gvk schema.GroupVersionKind, patcher Patch...
method WithReconciler (line 251) | func (a *apply) WithReconciler(gvk schema.GroupVersionKind, reconciler...
method WithStrictCaching (line 255) | func (a *apply) WithStrictCaching() Apply {
method WithDynamicLookup (line 259) | func (a *apply) WithDynamicLookup() Apply {
method WithRestrictClusterScoped (line 263) | func (a *apply) WithRestrictClusterScoped() Apply {
method WithDefaultNamespace (line 267) | func (a *apply) WithDefaultNamespace(ns string) Apply {
method WithListerNamespace (line 271) | func (a *apply) WithListerNamespace(ns string) Apply {
method WithRateLimiting (line 275) | func (a *apply) WithRateLimiting(ratelimitingQPS float32) Apply {
method WithNoDelete (line 279) | func (a *apply) WithNoDelete() Apply {
method WithNoDeleteGVK (line 283) | func (a *apply) WithNoDeleteGVK(gvks ...schema.GroupVersionKind) Apply {
method WithSetOwnerReference (line 287) | func (a *apply) WithSetOwnerReference(controller, block bool) Apply {
method WithContext (line 291) | func (a *apply) WithContext(ctx context.Context) Apply {
method WithIgnorePreviousApplied (line 295) | func (a *apply) WithIgnorePreviousApplied() Apply {
method FindOwner (line 299) | func (a *apply) FindOwner(obj runtime.Object) (runtime.Object, error) {
method PurgeOrphan (line 303) | func (a *apply) PurgeOrphan(obj runtime.Object) error {
method WithDiffPatch (line 307) | func (a *apply) WithDiffPatch(gvk schema.GroupVersionKind, namespace, ...
type clients (line 124) | type clients struct
method IsNamespaced (line 134) | func (c *clients) IsNamespaced(gvk schema.GroupVersionKind) (bool, err...
method gvr (line 152) | func (c *clients) gvr(gvk schema.GroupVersionKind) schema.GroupVersion...
method client (line 158) | func (c *clients) client(gvk schema.GroupVersionKind) (dynamic.Namespa...
FILE: pkg/apply/client_factory.go
function NewClientFactory (line 9) | func NewClientFactory(config *rest.Config) ClientFactory {
FILE: pkg/apply/desiredset.go
constant byHash (line 21) | byHash = "wrangler.byObjectSetHash"
type patchKey (line 23) | type patchKey struct
type desiredSet (line 28) | type desiredSet struct
method err (line 59) | func (o *desiredSet) err(err error) error {
method Err (line 64) | func (o desiredSet) Err() error {
method DryRun (line 68) | func (o desiredSet) DryRun(objs ...runtime.Object) (Plan, error) {
method Apply (line 74) | func (o desiredSet) Apply(set *objectset.ObjectSet) error {
method ApplyObjects (line 82) | func (o desiredSet) ApplyObjects(objs ...runtime.Object) error {
method WithDiffPatch (line 88) | func (o desiredSet) WithDiffPatch(gvk schema.GroupVersionKind, namespa...
method WithGVK (line 106) | func (o desiredSet) WithGVK(gvks ...schema.GroupVersionKind) Apply {
method WithSetID (line 118) | func (o desiredSet) WithSetID(id string) Apply {
method WithOwnerKey (line 123) | func (o desiredSet) WithOwnerKey(key string, gvk schema.GroupVersionKi...
method WithOwner (line 131) | func (o desiredSet) WithOwner(obj runtime.Object) Apply {
method WithSetOwnerReference (line 136) | func (o desiredSet) WithSetOwnerReference(controller, block bool) Apply {
method WithInjector (line 143) | func (o desiredSet) WithInjector(injs ...injectors.ConfigInjector) App...
method WithInjectorName (line 148) | func (o desiredSet) WithInjectorName(injs ...string) Apply {
method WithCacheTypeFactory (line 153) | func (o desiredSet) WithCacheTypeFactory(factory InformerFactory) Apply {
method WithIgnorePreviousApplied (line 158) | func (o desiredSet) WithIgnorePreviousApplied() Apply {
method WithCacheTypes (line 163) | func (o desiredSet) WithCacheTypes(igs ...InformerGetter) Apply {
method WithPatcher (line 204) | func (o desiredSet) WithPatcher(gvk schema.GroupVersionKind, patcher P...
method WithReconciler (line 214) | func (o desiredSet) WithReconciler(gvk schema.GroupVersionKind, reconc...
method WithStrictCaching (line 224) | func (o desiredSet) WithStrictCaching() Apply {
method WithDynamicLookup (line 228) | func (o desiredSet) WithDynamicLookup() Apply {
method WithRestrictClusterScoped (line 233) | func (o desiredSet) WithRestrictClusterScoped() Apply {
method WithDefaultNamespace (line 238) | func (o desiredSet) WithDefaultNamespace(ns string) Apply {
method WithListerNamespace (line 247) | func (o desiredSet) WithListerNamespace(ns string) Apply {
method WithRateLimiting (line 252) | func (o desiredSet) WithRateLimiting(ratelimitingQPS float32) Apply {
method WithNoDelete (line 257) | func (o desiredSet) WithNoDelete() Apply {
method WithNoDeleteGVK (line 262) | func (o desiredSet) WithNoDeleteGVK(gvks ...schema.GroupVersionKind) A...
method WithContext (line 272) | func (o desiredSet) WithContext(ctx context.Context) Apply {
function addIndexerByHash (line 185) | func addIndexerByHash(indexer cache.Indexer) error {
FILE: pkg/apply/desiredset_apply.go
constant LabelID (line 27) | LabelID = "objectset.rio.cattle.io/id"
constant LabelGVK (line 28) | LabelGVK = "objectset.rio.cattle.io/owner-gvk"
constant LabelName (line 29) | LabelName = "objectset.rio.cattle.io/owner-name"
constant LabelNamespace (line 30) | LabelNamespace = "objectset.rio.cattle.io/owner-namespace"
constant LabelHash (line 31) | LabelHash = "objectset.rio.cattle.io/hash"
constant LabelPrefix (line 32) | LabelPrefix = "objectset.rio.cattle.io/"
constant LabelPrune (line 33) | LabelPrune = "objectset.rio.cattle.io/prune"
method getRateLimit (line 48) | func (o *desiredSet) getRateLimit(labelHash string) flowcontrol.RateLimi...
method dryRun (line 66) | func (o *desiredSet) dryRun() (Plan, error) {
method apply (line 75) | func (o *desiredSet) apply() error {
method knownGVK (line 123) | func (o *desiredSet) knownGVK() (ret []schema.GroupVersionKind) {
method debugID (line 130) | func (o *desiredSet) debugID() string {
method collect (line 145) | func (o *desiredSet) collect(objList []runtime.Object) objectset.ObjectB...
method runInjectors (line 153) | func (o *desiredSet) runInjectors(objList []runtime.Object) ([]runtime.O...
function GetSelectorFromOwner (line 184) | func GetSelectorFromOwner(setID string, owner runtime.Object) (labels.Se...
function GetSelector (line 193) | func GetSelector(labelSet map[string]string) (labels.Selector, error) {
function GetLabelsAndAnnotations (line 201) | func GetLabelsAndAnnotations(setID string, owner runtime.Object) (map[st...
method injectLabelsAndAnnotations (line 231) | func (o *desiredSet) injectLabelsAndAnnotations(labels, annotations map[...
function setAnnotations (line 252) | func setAnnotations(meta metav1.Object, annotations map[string]string) {
function setLabels (line 264) | func setLabels(meta metav1.Object, labels map[string]string) {
function objectSetHash (line 275) | func objectSetHash(labels map[string]string) string {
FILE: pkg/apply/desiredset_compare.go
constant LabelApplied (line 32) | LabelApplied = "objectset.rio.cattle.io/applied"
function prepareObjectForCreate (line 65) | func prepareObjectForCreate(gvk schema.GroupVersionKind, obj runtime.Obj...
function originalAndModified (line 96) | func originalAndModified(gvk schema.GroupVersionKind, oldMetadata v1.Obj...
function emptyMaps (line 112) | func emptyMaps(data map[string]interface{}, keys ...string) bool {
function sanitizePatch (line 134) | func sanitizePatch(patch []byte, removeObjectSetAnnotation bool) ([]byte...
function applyPatch (line 189) | func applyPatch(gvk schema.GroupVersionKind, reconciler Reconciler, patc...
method compareObjects (line 255) | func (o *desiredSet) compareObjects(gvk schema.GroupVersionKind, reconci...
function removeCreationTimestamp (line 285) | func removeCreationTimestamp(data map[string]interface{}) bool {
function getOriginalObject (line 300) | func getOriginalObject(gvk schema.GroupVersionKind, obj v1.Object) (runt...
function getOriginalBytes (line 318) | func getOriginalBytes(gvk schema.GroupVersionKind, obj v1.Object) ([]byt...
function appliedFromAnnotation (line 329) | func appliedFromAnnotation(str string) []byte {
function pruneList (line 352) | func pruneList(data []interface{}) []interface{} {
function pruneValues (line 367) | func pruneValues(data map[string]interface{}, isList bool) map[string]in...
function serializeApplied (line 397) | func serializeApplied(obj runtime.Object) ([]byte, error) {
function appliedToAnnotation (line 406) | func appliedToAnnotation(b []byte) string {
function compressAndEncode (line 410) | func compressAndEncode(b []byte) string {
function stripIgnores (line 428) | func stripIgnores(original, modified, current []byte, patches [][]byte) ...
function doPatch (line 454) | func doPatch(gvk schema.GroupVersionKind, original, modified, current []...
FILE: pkg/apply/desiredset_compare_test.go
function TestCompressAndEncode (line 8) | func TestCompressAndEncode(t *testing.T) {
FILE: pkg/apply/desiredset_crud.go
method toUnstructured (line 18) | func (o *desiredSet) toUnstructured(obj runtime.Object) (*unstructured.U...
method create (line 36) | func (o *desiredSet) create(nsed bool, namespace string, client dynamic....
method get (line 48) | func (o *desiredSet) get(nsed bool, namespace, name string, client dynam...
method delete (line 55) | func (o *desiredSet) delete(nsed bool, namespace, name string, client dy...
FILE: pkg/apply/desiredset_owner.go
function notFound (line 27) | func notFound(name string, gvk schema.GroupVersionKind) error {
function getGVK (line 37) | func getGVK(gvkLabel string, gvk *schema.GroupVersionKind) error {
method FindOwner (line 47) | func (o desiredSet) FindOwner(obj runtime.Object) (runtime.Object, error) {
method fromClient (line 84) | func (o *desiredSet) fromClient(client dynamic.NamespaceableResourceInte...
method fromCache (line 103) | func (o *desiredSet) fromCache(cache cache.SharedInformer, namespace, na...
method PurgeOrphan (line 121) | func (o desiredSet) PurgeOrphan(obj runtime.Object) error {
FILE: pkg/apply/desiredset_process.go
method getControllerAndClient (line 34) | func (o *desiredSet) getControllerAndClient(debugID string, gvk schema.G...
method assignOwnerReference (line 59) | func (o *desiredSet) assignOwnerReference(gvk schema.GroupVersionKind, o...
method adjustNamespace (line 143) | func (o *desiredSet) adjustNamespace(gvk schema.GroupVersionKind, objs o...
method clearNamespace (line 164) | func (o *desiredSet) clearNamespace(objs objectset.ObjectByKey) error {
method createPatcher (line 186) | func (o *desiredSet) createPatcher(client dynamic.NamespaceableResourceI...
method filterCrossVersion (line 195) | func (o *desiredSet) filterCrossVersion(gvk schema.GroupVersionKind, key...
method process (line 210) | func (o *desiredSet) process(debugID string, set labels.Selector, gvk sc...
method list (line 341) | func (o *desiredSet) list(namespaced bool, informer cache.SharedIndexInf...
function shouldPrune (line 407) | func shouldPrune(obj runtime.Object) bool {
function compareSets (line 415) | func compareSets(existingSet, newSet objectset.ObjectByKey) (toCreate, t...
function sortObjectKeys (line 439) | func sortObjectKeys(keys []objectset.ObjectKey) {
function addObjectToMap (line 445) | func addObjectToMap(objs objectset.ObjectByKey, obj interface{}) error {
function allNamespaceList (line 460) | func allNamespaceList(ctx context.Context, baseClient dynamic.Namespacea...
function multiNamespaceList (line 474) | func multiNamespaceList(ctx context.Context, namespaces []string, baseCl...
function getIndexableHash (line 503) | func getIndexableHash(indexer cache.Indexer, selector labels.Selector) (...
function inNamespace (line 518) | func inNamespace(namespace string, obj interface{}) bool {
function listByHash (line 524) | func listByHash(indexer cache.Indexer, hash string, namespace string) (m...
FILE: pkg/apply/desiredset_process_test.go
function Test_multiNamespaceList (line 23) | func Test_multiNamespaceList(t *testing.T) {
function Test_getIndexableHash (line 118) | func Test_getIndexableHash(t *testing.T) {
function Test_inNamespace (line 168) | func Test_inNamespace(t *testing.T) {
function Test_listByHash (line 202) | func Test_listByHash(t *testing.T) {
FILE: pkg/apply/fake/apply.go
type FakeApply (line 15) | type FakeApply struct
method Apply (line 20) | func (f *FakeApply) Apply(set *objectset.ObjectSet) error {
method ApplyObjects (line 26) | func (f *FakeApply) ApplyObjects(objs ...runtime.Object) error {
method WithCacheTypes (line 32) | func (f *FakeApply) WithCacheTypes(igs ...apply.InformerGetter) apply....
method WithIgnorePreviousApplied (line 36) | func (f *FakeApply) WithIgnorePreviousApplied() apply.Apply {
method WithGVK (line 40) | func (f *FakeApply) WithGVK(gvks ...schema.GroupVersionKind) apply.App...
method WithSetID (line 44) | func (f *FakeApply) WithSetID(id string) apply.Apply {
method WithOwner (line 48) | func (f *FakeApply) WithOwner(obj runtime.Object) apply.Apply {
method WithInjector (line 52) | func (f *FakeApply) WithInjector(injs ...injectors.ConfigInjector) app...
method WithInjectorName (line 56) | func (f *FakeApply) WithInjectorName(injs ...string) apply.Apply {
method WithPatcher (line 60) | func (f *FakeApply) WithPatcher(gvk schema.GroupVersionKind, patchers ...
method WithReconciler (line 64) | func (f *FakeApply) WithReconciler(gvk schema.GroupVersionKind, reconc...
method WithStrictCaching (line 68) | func (f *FakeApply) WithStrictCaching() apply.Apply {
method WithDynamicLookup (line 72) | func (f *FakeApply) WithDynamicLookup() apply.Apply {
method WithDefaultNamespace (line 76) | func (f *FakeApply) WithDefaultNamespace(ns string) apply.Apply {
method WithListerNamespace (line 80) | func (f *FakeApply) WithListerNamespace(ns string) apply.Apply {
method WithRestrictClusterScoped (line 84) | func (f *FakeApply) WithRestrictClusterScoped() apply.Apply {
method WithSetOwnerReference (line 88) | func (f *FakeApply) WithSetOwnerReference(controller, block bool) appl...
method WithRateLimiting (line 92) | func (f *FakeApply) WithRateLimiting(ratelimitingQPS float32) apply.Ap...
method WithNoDelete (line 96) | func (f *FakeApply) WithNoDelete() apply.Apply {
method WithNoDeleteGVK (line 100) | func (f *FakeApply) WithNoDeleteGVK(gvks ...schema.GroupVersionKind) a...
method WithContext (line 104) | func (f *FakeApply) WithContext(ctx context.Context) apply.Apply {
method WithCacheTypeFactory (line 108) | func (f *FakeApply) WithCacheTypeFactory(factory apply.InformerFactory...
method DryRun (line 112) | func (f *FakeApply) DryRun(objs ...runtime.Object) (apply.Plan, error) {
method FindOwner (line 116) | func (f *FakeApply) FindOwner(obj runtime.Object) (runtime.Object, err...
method PurgeOrphan (line 120) | func (f *FakeApply) PurgeOrphan(obj runtime.Object) error {
method WithOwnerKey (line 124) | func (f *FakeApply) WithOwnerKey(key string, gvk schema.GroupVersionKi...
method WithDiffPatch (line 128) | func (f *FakeApply) WithDiffPatch(gvk schema.GroupVersionKind, namespa...
FILE: pkg/apply/injectors/registry.go
type ConfigInjector (line 10) | type ConfigInjector
function Register (line 12) | func Register(name string, injector ConfigInjector) {
function Get (line 19) | func Get(name string) ConfigInjector {
FILE: pkg/apply/reconcilers.go
function reconcileDaemonSet (line 27) | func reconcileDaemonSet(oldObj, newObj runtime.Object) (bool, error) {
function reconcileDeployment (line 50) | func reconcileDeployment(oldObj, newObj runtime.Object) (bool, error) {
function reconcileSecret (line 73) | func reconcileSecret(oldObj, newObj runtime.Object) (bool, error) {
function reconcileService (line 96) | func reconcileService(oldObj, newObj runtime.Object) (bool, error) {
function reconcileJob (line 119) | func reconcileJob(oldObj, newObj runtime.Object) (bool, error) {
function convertObj (line 155) | func convertObj(src interface{}, obj interface{}) error {
FILE: pkg/broadcast/generic.go
type ConnectFunc (line 8) | type ConnectFunc
type Broadcaster (line 10) | type Broadcaster struct
method Subscribe (line 16) | func (b *Broadcaster) Subscribe(ctx context.Context, connect ConnectFu...
method unsub (line 39) | func (b *Broadcaster) unsub(sub chan interface{}, lock bool) {
method start (line 52) | func (b *Broadcaster) start(connect ConnectFunc) error {
method stream (line 63) | func (b *Broadcaster) stream(input chan interface{}) {
FILE: pkg/cleanup/cleanup.go
function Cleanup (line 10) | func Cleanup(path string) error {
FILE: pkg/clients/clients.go
type Clients (line 35) | type Clients struct
method ToRawKubeConfigLoader (line 161) | func (c *Clients) ToRawKubeConfigLoader() clientcmd.ClientConfig {
method ToRESTConfig (line 165) | func (c *Clients) ToRESTConfig() (*rest.Config, error) {
method ToDiscoveryClient (line 169) | func (c *Clients) ToDiscoveryClient() (discovery.CachedDiscoveryInterf...
method ToRESTMapper (line 173) | func (c *Clients) ToRESTMapper() (meta.RESTMapper, error) {
method Start (line 177) | func (c *Clients) Start(ctx context.Context) error {
function ensureSharedFactory (line 55) | func ensureSharedFactory(cfg *rest.Config, opts *generic.FactoryOptions)...
function New (line 71) | func New(clientConfig clientcmd.ClientConfig, opts *generic.FactoryOptio...
function NewFromConfig (line 86) | func NewFromConfig(cfg *rest.Config, opts *generic.FactoryOptions) (*Cli...
function restConfigDefaults (line 184) | func restConfigDefaults(cfg *rest.Config) *rest.Config {
FILE: pkg/codegen/main.go
function main (line 20) | func main() {
FILE: pkg/condition/condition.go
type Cond (line 11) | type Cond
method GetStatus (line 13) | func (c Cond) GetStatus(obj interface{}) string {
method SetError (line 17) | func (c Cond) SetError(obj interface{}, reason string, err error) {
method MatchesError (line 32) | func (c Cond) MatchesError(obj interface{}, reason string, err error) ...
method SetStatus (line 46) | func (c Cond) SetStatus(obj interface{}, status string) {
method SetStatusBool (line 50) | func (c Cond) SetStatusBool(obj interface{}, val bool) {
method True (line 58) | func (c Cond) True(obj interface{}) {
method IsTrue (line 62) | func (c Cond) IsTrue(obj interface{}) bool {
method False (line 66) | func (c Cond) False(obj interface{}) {
method IsFalse (line 70) | func (c Cond) IsFalse(obj interface{}) bool {
method Unknown (line 74) | func (c Cond) Unknown(obj interface{}) {
method IsUnknown (line 78) | func (c Cond) IsUnknown(obj interface{}) bool {
method LastUpdated (line 82) | func (c Cond) LastUpdated(obj interface{}, ts string) {
method GetLastUpdated (line 86) | func (c Cond) GetLastUpdated(obj interface{}) string {
method CreateUnknownIfNotExists (line 90) | func (c Cond) CreateUnknownIfNotExists(obj interface{}) {
method Reason (line 101) | func (c Cond) Reason(obj interface{}, reason string) {
method GetReason (line 106) | func (c Cond) GetReason(obj interface{}) string {
method SetMessageIfBlank (line 114) | func (c Cond) SetMessageIfBlank(obj interface{}, message string) {
method Message (line 120) | func (c Cond) Message(obj interface{}, message string) {
method GetMessage (line 125) | func (c Cond) GetMessage(obj interface{}) string {
function touchTS (line 133) | func touchTS(value reflect.Value) {
function getStatus (line 138) | func getStatus(obj interface{}, condName string) string {
function setTS (line 146) | func setTS(obj interface{}, condName, ts string) {
function getTS (line 151) | func getTS(obj interface{}, condName string) string {
function setStatus (line 159) | func setStatus(obj interface{}, condName, status string) {
function setValue (line 167) | func setValue(cond reflect.Value, fieldName, newValue string) {
function findOrNotCreateCond (line 175) | func findOrNotCreateCond(obj interface{}, condName string) *reflect.Value {
function findOrCreateCond (line 183) | func findOrCreateCond(obj interface{}, condName string) reflect.Value {
function findCond (line 200) | func findCond(obj interface{}, val reflect.Value, name string) *reflect....
function getValue (line 218) | func getValue(obj interface{}, name ...string) reflect.Value {
function getFieldValue (line 235) | func getFieldValue(v reflect.Value, name ...string) reflect.Value {
function Error (line 246) | func Error(reason string, err error) error {
type conditionError (line 253) | type conditionError struct
method Error (line 258) | func (e *conditionError) Error() string {
FILE: pkg/controller-gen/args/args.go
type CustomArgs (line 8) | type CustomArgs struct
type Options (line 20) | type Options struct
type Type (line 30) | type Type struct
type Group (line 36) | type Group struct
FILE: pkg/controller-gen/args/groupversion.go
constant needsComment (line 17) | needsComment = `
constant objectComment (line 21) | objectComment = "+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/ru...
function translate (line 24) | func translate(types []Type, err error) (result []interface{}, _ error) {
function ObjectsToGroupVersion (line 31) | func ObjectsToGroupVersion(group string, objs []interface{}, ret map[sch...
function toVersionType (line 55) | func toVersionType(obj interface{}) (string, *types.Name) {
function versionFromPackage (line 80) | func versionFromPackage(pkg string) string {
function CheckType (line 85) | func CheckType(passedType *types.Type) {
function ScanDirectory (line 101) | func ScanDirectory(pkgPath string) (result []Type, err error) {
FILE: pkg/controller-gen/args/groupversion_test.go
function TestScan (line 9) | func TestScan(t *testing.T) {
FILE: pkg/controller-gen/args/testdata/test.go
type SomeStruct (line 7) | type SomeStruct struct
FILE: pkg/controller-gen/generators/client_generator.go
type ClientGenerator (line 30) | type ClientGenerator struct
method GetTargets (line 41) | func (cg *ClientGenerator) GetTargets(context *generator.Context, cust...
method typesGroupPackage (line 74) | func (cg *ClientGenerator) typesGroupPackage(name *types.Name, gv sche...
method typesGroupVersionDocPackage (line 83) | func (cg *ClientGenerator) typesGroupVersionDocPackage(name *types.Nam...
method typesGroupVersionPackage (line 114) | func (cg *ClientGenerator) typesGroupVersionPackage(name *types.Name, ...
method groupPackage (line 124) | func (cg *ClientGenerator) groupPackage(group string, customArgs *args...
method groupVersionPackage (line 134) | func (cg *ClientGenerator) groupVersionPackage(gv schema.GroupVersion,...
function NewClientGenerator (line 34) | func NewClientGenerator() *ClientGenerator {
FILE: pkg/controller-gen/generators/factory_go.go
function FactoryGo (line 11) | func FactoryGo(group string, customArgs *args.CustomArgs) generator.Gene...
type factory (line 22) | type factory struct
method Imports (line 29) | func (f *factory) Imports(*generator.Context) []string {
method Init (line 42) | func (f *factory) Init(c *generator.Context, w io.Writer) error {
FILE: pkg/controller-gen/generators/group_interface_go.go
function GroupInterfaceGo (line 12) | func GroupInterfaceGo(group string, customArgs *args.CustomArgs) generat...
type interfaceGo (line 23) | type interfaceGo struct
method Imports (line 30) | func (f *interfaceGo) Imports(context *generator.Context) []string {
method Init (line 48) | func (f *interfaceGo) Init(c *generator.Context, w io.Writer) error {
FILE: pkg/controller-gen/generators/group_version_interface_go.go
function GroupVersionInterfaceGo (line 15) | func GroupVersionInterfaceGo(gv schema.GroupVersion, customArgs *args.Cu...
type groupInterfaceGo (line 25) | type groupInterfaceGo struct
method Imports (line 32) | func (f *groupInterfaceGo) Imports(context *generator.Context) []string {
method Init (line 48) | func (f *groupInterfaceGo) Init(c *generator.Context, w io.Writer) err...
FILE: pkg/controller-gen/generators/list_type_go.go
function ListTypesGo (line 11) | func ListTypesGo(gv schema.GroupVersion, customArgs *args.CustomArgs) ge...
type listTypesGo (line 21) | type listTypesGo struct
method Imports (line 28) | func (f *listTypesGo) Imports(*generator.Context) []string {
method Init (line 32) | func (f *listTypesGo) Init(c *generator.Context, w io.Writer) error {
FILE: pkg/controller-gen/generators/register_group_go.go
function RegisterGroupGo (line 11) | func RegisterGroupGo(group string, customArgs *args.CustomArgs) generato...
type registerGroupGo (line 21) | type registerGroupGo struct
method Name (line 28) | func (f *registerGroupGo) Name() string {
method PackageConsts (line 33) | func (f *registerGroupGo) PackageConsts(*generator.Context) []string {
FILE: pkg/controller-gen/generators/register_group_version_go.go
function RegisterGroupVersionGo (line 16) | func RegisterGroupVersionGo(gv schema.GroupVersion, customArgs *args.Cus...
type registerGroupVersionGo (line 26) | type registerGroupVersionGo struct
method Imports (line 33) | func (f *registerGroupVersionGo) Imports(*generator.Context) []string {
method Init (line 43) | func (f *registerGroupVersionGo) Init(c *generator.Context, w io.Write...
FILE: pkg/controller-gen/generators/target.go
function Target (line 11) | func Target(customArgs *args.CustomArgs, name string, generators func(co...
FILE: pkg/controller-gen/generators/type_go.go
function TypeGo (line 15) | func TypeGo(gv schema.GroupVersion, name *types.Name, customArgs *args.C...
type typeGo (line 26) | type typeGo struct
method Imports (line 34) | func (f *typeGo) Imports(context *generator.Context) []string {
method Init (line 41) | func (f *typeGo) Init(c *generator.Context, w io.Writer) error {
function statusType (line 63) | func statusType(t *types.Type) string {
function hasStatus (line 72) | func hasStatus(t *types.Type) bool {
FILE: pkg/controller-gen/generators/util.go
function namespaced (line 34) | func namespaced(t *types.Type) bool {
function groupPath (line 52) | func groupPath(group string) string {
function groupPackageName (line 57) | func groupPackageName(group, groupPackageName string) string {
function upperLowercase (line 67) | func upperLowercase(name string) string {
FILE: pkg/controller-gen/main.go
function Run (line 35) | func Run(opts cgargs.Options) {
function sourcePackagePath (line 144) | func sourcePackagePath(customArgs *cgargs.CustomArgs, pkgName string) st...
function copyGoPathToModules (line 151) | func copyGoPathToModules(customArgs *cgargs.CustomArgs) error {
function copyFile (line 182) | func copyFile(src, dst string) error {
function generateDeepcopy (line 207) | func generateDeepcopy(groups map[string]bool, customArgs *cgargs.CustomA...
function generateClientset (line 238) | func generateClientset(groups map[string]bool, customArgs *cgargs.Custom...
function generateOpenAPI (line 292) | func generateOpenAPI(groups map[string]bool, customArgs *cgargs.CustomAr...
function setGenClient (line 372) | func setGenClient(
function generateInformers (line 431) | func generateInformers(groups map[string]bool, customArgs *cgargs.Custom...
function generateListers (line 464) | func generateListers(groups map[string]bool, customArgs *cgargs.CustomAr...
function parseTypes (line 494) | func parseTypes(customArgs *cgargs.CustomArgs) []string {
FILE: pkg/crd/crd.go
constant waitInterval (line 18) | waitInterval = 500 * time.Millisecond
function BatchCreateCRDs (line 23) | func BatchCreateCRDs(ctx context.Context, crdClient clientv1.CustomResou...
function getExistingCRDs (line 59) | func getExistingCRDs(ctx context.Context, crdClient clientv1.CustomResou...
function ensureCRD (line 79) | func ensureCRD(ctx context.Context, crd *apiextv1.CustomResourceDefiniti...
function waitCRD (line 109) | func waitCRD(ctx context.Context, crdName string, crdClient clientv1.Cus...
function crdIsReady (line 126) | func crdIsReady(crd *apiextv1.CustomResourceDefinition) bool {
FILE: pkg/crd/crd_test.go
function TestBatchCreateCRDs (line 28) | func TestBatchCreateCRDs(t *testing.T) {
function TestCreateCRDWithColumns (line 317) | func TestCreateCRDWithColumns(t *testing.T) {
FILE: pkg/crd/init.go
constant CRDKind (line 42) | CRDKind = "CustomResourceDefinition"
type Factory (line 44) | type Factory struct
method BatchWait (line 520) | func (f *Factory) BatchWait() error {
method BatchCreateCRDs (line 525) | func (f *Factory) BatchCreateCRDs(ctx context.Context, crds ...CRD) *F...
method CreateCRDs (line 536) | func (f *Factory) CreateCRDs(ctx context.Context, crds ...CRD) (map[sc...
method waitCRD (line 581) | func (f *Factory) waitCRD(ctx context.Context, crdName string, gvk sch...
method createCRD (line 615) | func (f *Factory) createCRD(ctx context.Context, crdDef CRD, ready map...
method ensureAccess (line 634) | func (f *Factory) ensureAccess(ctx context.Context) (bool, error) {
method getReadyCRDs (line 642) | func (f *Factory) getReadyCRDs(ctx context.Context) (map[string]*apiex...
type CRD (line 53) | type CRD struct
method WithSchema (line 71) | func (c CRD) WithSchema(schema *apiextv1.JSONSchemaProps) CRD {
method WithSchemaFromStruct (line 76) | func (c CRD) WithSchemaFromStruct(obj interface{}) CRD {
method WithColumn (line 81) | func (c CRD) WithColumn(name, path string) CRD {
method WithColumnsFromStruct (line 103) | func (c CRD) WithColumnsFromStruct(obj interface{}) CRD {
method WithCustomColumn (line 230) | func (c CRD) WithCustomColumn(columns ...apiextv1.CustomResourceColumn...
method WithStatus (line 235) | func (c CRD) WithStatus() CRD {
method WithScale (line 240) | func (c CRD) WithScale() CRD {
method WithCategories (line 245) | func (c CRD) WithCategories(categories ...string) CRD {
method WithGroup (line 250) | func (c CRD) WithGroup(group string) CRD {
method WithShortNames (line 255) | func (c CRD) WithShortNames(shortNames ...string) CRD {
method ToCustomResourceDefinition (line 260) | func (c CRD) ToCustomResourceDefinition() (runtime.Object, error) {
method ToCustomResourceDefinitionV1Beta1 (line 386) | func (c CRD) ToCustomResourceDefinitionV1Beta1() (*apiextv1beta1.Custo...
method Name (line 423) | func (c *CRD) Name() string {
function getType (line 91) | func getType(obj interface{}) reflect.Type {
function fieldName (line 108) | func fieldName(f reflect.StructField) string {
function tagToColumn (line 120) | func tagToColumn(f reflect.StructField, kind reflect.Kind, format, path ...
function kindToType (line 159) | func kindToType(k reflect.Kind) string {
type openAPISchemaProvider (line 179) | type openAPISchemaProvider interface
function openAPISchema (line 184) | func openAPISchema(t reflect.Type) (reflect.Kind, string) {
function readCustomColumns (line 198) | func readCustomColumns(t reflect.Type, path string) (result []apiextv1.C...
function NamespacedType (line 447) | func NamespacedType(name string) CRD {
function New (line 459) | func New(group, version string) CRD {
function NamespacedTypes (line 477) | func NamespacedTypes(names ...string) (ret []CRD) {
function NonNamespacedType (line 484) | func NonNamespacedType(name string) CRD {
function NonNamespacedTypes (line 490) | func NonNamespacedTypes(names ...string) (ret []CRD) {
function FromGV (line 497) | func FromGV(gv schema.GroupVersion, kind string) CRD {
function NewFactoryFromClient (line 503) | func NewFactoryFromClient(config *rest.Config) (*Factory, error) {
FILE: pkg/crd/mockCRDClient_test.go
type MockCustomResourceDefinitionInterface (line 25) | type MockCustomResourceDefinitionInterface struct
method EXPECT (line 44) | func (m *MockCustomResourceDefinitionInterface) EXPECT() *MockCustomRe...
method Apply (line 49) | func (m *MockCustomResourceDefinitionInterface) Apply(ctx context.Cont...
method ApplyStatus (line 64) | func (m *MockCustomResourceDefinitionInterface) ApplyStatus(ctx contex...
method Create (line 79) | func (m *MockCustomResourceDefinitionInterface) Create(ctx context.Con...
method Delete (line 94) | func (m *MockCustomResourceDefinitionInterface) Delete(ctx context.Con...
method DeleteCollection (line 108) | func (m *MockCustomResourceDefinitionInterface) DeleteCollection(ctx c...
method Get (line 122) | func (m *MockCustomResourceDefinitionInterface) Get(ctx context.Contex...
method List (line 137) | func (m *MockCustomResourceDefinitionInterface) List(ctx context.Conte...
method Patch (line 152) | func (m *MockCustomResourceDefinitionInterface) Patch(ctx context.Cont...
method Update (line 172) | func (m *MockCustomResourceDefinitionInterface) Update(ctx context.Con...
method UpdateStatus (line 187) | func (m *MockCustomResourceDefinitionInterface) UpdateStatus(ctx conte...
method Watch (line 202) | func (m *MockCustomResourceDefinitionInterface) Watch(ctx context.Cont...
type MockCustomResourceDefinitionInterfaceMockRecorder (line 32) | type MockCustomResourceDefinitionInterfaceMockRecorder struct
method Apply (line 58) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Apply(ctx...
method ApplyStatus (line 73) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) ApplyStat...
method Create (line 88) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Create(ct...
method Delete (line 102) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Delete(ct...
method DeleteCollection (line 116) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) DeleteCol...
method Get (line 131) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Get(ctx, ...
method List (line 146) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) List(ctx,...
method Patch (line 165) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Patch(ctx...
method Update (line 181) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Update(ct...
method UpdateStatus (line 196) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) UpdateSta...
method Watch (line 211) | func (mr *MockCustomResourceDefinitionInterfaceMockRecorder) Watch(ctx...
function NewMockCustomResourceDefinitionInterface (line 37) | func NewMockCustomResourceDefinitionInterface(ctrl *gomock.Controller) *...
FILE: pkg/crd/print.go
function WriteFile (line 14) | func WriteFile(filename string, crds []CRD) error {
function Print (line 27) | func Print(out io.Writer, crds []CRD) error {
function Objects (line 42) | func Objects(crds []CRD) (result []runtime.Object, err error) {
function Create (line 57) | func Create(ctx context.Context, cfg *rest.Config, crds []CRD) error {
FILE: pkg/data/convert/convert.go
function Singular (line 18) | func Singular(value interface{}) interface{} {
function ToStringNoTrim (line 34) | func ToStringNoTrim(value interface{}) string {
function ToString (line 45) | func ToString(value interface{}) string {
function ToTimestamp (line 49) | func ToTimestamp(value interface{}) (int64, error) {
function ToBool (line 61) | func ToBool(value interface{}) bool {
function ToNumber (line 73) | func ToNumber(value interface{}) (int64, error) {
function ToFloat (line 95) | func ToFloat(value interface{}) (float64, error) {
function Capitalize (line 119) | func Capitalize(s string) string {
function Uncapitalize (line 127) | func Uncapitalize(s string) string {
function LowerTitle (line 135) | func LowerTitle(input string) string {
function IsEmptyValue (line 151) | func IsEmptyValue(v interface{}) bool {
function ToMapInterface (line 164) | func ToMapInterface(obj interface{}) map[string]interface{} {
function ToInterfaceSlice (line 169) | func ToInterfaceSlice(obj interface{}) []interface{} {
function ToMapSlice (line 176) | func ToMapSlice(obj interface{}) []map[string]interface{} {
function ToStringSlice (line 193) | func ToStringSlice(data interface{}) []string {
function ToObj (line 210) | func ToObj(data interface{}, into interface{}) error {
function EncodeToMap (line 218) | func EncodeToMap(obj interface{}) (map[string]interface{}, error) {
function ToJSONKey (line 237) | func ToJSONKey(str string) string {
function ToYAMLKey (line 247) | func ToYAMLKey(str string) string {
function ToArgKey (line 275) | func ToArgKey(str string) string {
FILE: pkg/data/convert/convert_test.go
type data (line 7) | type data struct
function TestJSON (line 11) | func TestJSON(t *testing.T) {
function TestArgKey (line 27) | func TestArgKey(t *testing.T) {
FILE: pkg/data/data.go
type List (line 7) | type List
type Object (line 9) | type Object
method Map (line 23) | func (o Object) Map(names ...string) Object {
method Slice (line 29) | func (o Object) Slice(names ...string) (result []Object) {
method Values (line 37) | func (o Object) Values() (result []Object) {
method String (line 44) | func (o Object) String(names ...string) string {
method StringSlice (line 49) | func (o Object) StringSlice(names ...string) []string {
method Set (line 54) | func (o Object) Set(key string, obj interface{}) {
method SetNested (line 61) | func (o Object) SetNested(obj interface{}, key ...string) {
method Bool (line 65) | func (o Object) Bool(key ...string) bool {
function New (line 11) | func New() Object {
function Convert (line 15) | func Convert(obj interface{}) (Object, error) {
FILE: pkg/data/merge.go
function MergeMaps (line 3) | func MergeMaps(base, overlay map[string]interface{}) map[string]interfac...
function bothMaps (line 17) | func bothMaps(left, right interface{}) (map[string]interface{}, map[stri...
function bothSlices (line 26) | func bothSlices(left, right interface{}) ([]interface{}, []interface{}, ...
function MergeMapsConcatSlice (line 35) | func MergeMapsConcatSlice(base, overlay map[string]interface{}) map[stri...
FILE: pkg/data/values.go
function RemoveValue (line 13) | func RemoveValue(data map[string]interface{}, keys ...string) (interface...
function GetValueN (line 26) | func GetValueN(data map[string]interface{}, keys ...string) interface{} {
function GetValue (line 33) | func GetValue(data map[string]interface{}, keys ...string) (interface{},...
function GetValueFromAny (line 49) | func GetValueFromAny(data interface{}, keys ...string) (interface{}, boo...
function PutValue (line 92) | func PutValue(data map[string]interface{}, val interface{}, keys ...stri...
FILE: pkg/data/values_test.go
function TestGetValueFromAny (line 9) | func TestGetValueFromAny(t *testing.T) {
FILE: pkg/generated/controllers/admissionregistration.k8s.io/factory.go
type Factory (line 27) | type Factory struct
method Admissionregistration (line 66) | func (c *Factory) Admissionregistration() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/admissionregistration.k8s.io/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/admissionregistration.k8s.io/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 38) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 44) | type version struct
method MutatingWebhookConfiguration (line 48) | func (v *version) MutatingWebhookConfiguration() MutatingWebhookConfig...
method ValidatingWebhookConfiguration (line 52) | func (v *version) ValidatingWebhookConfiguration() ValidatingWebhookCo...
FILE: pkg/generated/controllers/admissionregistration.k8s.io/v1/mutatingwebhookconfiguration.go
type MutatingWebhookConfigurationController (line 27) | type MutatingWebhookConfigurationController interface
type MutatingWebhookConfigurationClient (line 32) | type MutatingWebhookConfigurationClient interface
type MutatingWebhookConfigurationCache (line 37) | type MutatingWebhookConfigurationCache interface
FILE: pkg/generated/controllers/admissionregistration.k8s.io/v1/validatingwebhookconfiguration.go
type ValidatingWebhookConfigurationController (line 27) | type ValidatingWebhookConfigurationController interface
type ValidatingWebhookConfigurationClient (line 32) | type ValidatingWebhookConfigurationClient interface
type ValidatingWebhookConfigurationCache (line 37) | type ValidatingWebhookConfigurationCache interface
FILE: pkg/generated/controllers/apiextensions.k8s.io/factory.go
type Factory (line 27) | type Factory struct
method Apiextensions (line 66) | func (c *Factory) Apiextensions() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/apiextensions.k8s.io/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/apiextensions.k8s.io/v1/customresourcedefinition.go
type CustomResourceDefinitionController (line 38) | type CustomResourceDefinitionController interface
type CustomResourceDefinitionClient (line 43) | type CustomResourceDefinitionClient interface
type CustomResourceDefinitionCache (line 48) | type CustomResourceDefinitionCache interface
type CustomResourceDefinitionStatusHandler (line 53) | type CustomResourceDefinitionStatusHandler
type CustomResourceDefinitionGeneratingHandler (line 56) | type CustomResourceDefinitionGeneratingHandler
function RegisterCustomResourceDefinitionStatusHandler (line 60) | func RegisterCustomResourceDefinitionStatusHandler(ctx context.Context, ...
function RegisterCustomResourceDefinitionGeneratingHandler (line 71) | func RegisterCustomResourceDefinitionGeneratingHandler(ctx context.Conte...
type customResourceDefinitionStatusHandler (line 86) | type customResourceDefinitionStatusHandler struct
method sync (line 93) | func (a *customResourceDefinitionStatusHandler) sync(key string, obj *...
type customResourceDefinitionGeneratingHandler (line 132) | type customResourceDefinitionGeneratingHandler struct
method Remove (line 142) | func (a *customResourceDefinitionGeneratingHandler) Remove(key string,...
method Handle (line 162) | func (a *customResourceDefinitionGeneratingHandler) Handle(obj *v1.Cus...
method isNewResourceVersion (line 188) | func (a *customResourceDefinitionGeneratingHandler) isNewResourceVersi...
method storeResourceVersion (line 201) | func (a *customResourceDefinitionGeneratingHandler) storeResourceVersi...
FILE: pkg/generated/controllers/apiextensions.k8s.io/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method CustomResourceDefinition (line 47) | func (v *version) CustomResourceDefinition() CustomResourceDefinitionC...
FILE: pkg/generated/controllers/apiregistration.k8s.io/factory.go
type Factory (line 27) | type Factory struct
method Apiregistration (line 66) | func (c *Factory) Apiregistration() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/apiregistration.k8s.io/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/apiregistration.k8s.io/v1/apiservice.go
type APIServiceController (line 38) | type APIServiceController interface
type APIServiceClient (line 43) | type APIServiceClient interface
type APIServiceCache (line 48) | type APIServiceCache interface
type APIServiceStatusHandler (line 53) | type APIServiceStatusHandler
type APIServiceGeneratingHandler (line 56) | type APIServiceGeneratingHandler
function RegisterAPIServiceStatusHandler (line 60) | func RegisterAPIServiceStatusHandler(ctx context.Context, controller API...
function RegisterAPIServiceGeneratingHandler (line 71) | func RegisterAPIServiceGeneratingHandler(ctx context.Context, controller...
type aPIServiceStatusHandler (line 86) | type aPIServiceStatusHandler struct
method sync (line 93) | func (a *aPIServiceStatusHandler) sync(key string, obj *v1.APIService)...
type aPIServiceGeneratingHandler (line 132) | type aPIServiceGeneratingHandler struct
method Remove (line 142) | func (a *aPIServiceGeneratingHandler) Remove(key string, obj *v1.APISe...
method Handle (line 162) | func (a *aPIServiceGeneratingHandler) Handle(obj *v1.APIService, statu...
method isNewResourceVersion (line 188) | func (a *aPIServiceGeneratingHandler) isNewResourceVersion(obj *v1.API...
method storeResourceVersion (line 201) | func (a *aPIServiceGeneratingHandler) storeResourceVersion(obj *v1.API...
FILE: pkg/generated/controllers/apiregistration.k8s.io/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method APIService (line 47) | func (v *version) APIService() APIServiceController {
FILE: pkg/generated/controllers/apps/factory.go
type Factory (line 27) | type Factory struct
method Apps (line 66) | func (c *Factory) Apps() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/apps/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/apps/v1/daemonset.go
type DaemonSetController (line 38) | type DaemonSetController interface
type DaemonSetClient (line 43) | type DaemonSetClient interface
type DaemonSetCache (line 48) | type DaemonSetCache interface
type DaemonSetStatusHandler (line 53) | type DaemonSetStatusHandler
type DaemonSetGeneratingHandler (line 56) | type DaemonSetGeneratingHandler
function RegisterDaemonSetStatusHandler (line 60) | func RegisterDaemonSetStatusHandler(ctx context.Context, controller Daem...
function RegisterDaemonSetGeneratingHandler (line 71) | func RegisterDaemonSetGeneratingHandler(ctx context.Context, controller ...
type daemonSetStatusHandler (line 86) | type daemonSetStatusHandler struct
method sync (line 93) | func (a *daemonSetStatusHandler) sync(key string, obj *v1.DaemonSet) (...
type daemonSetGeneratingHandler (line 132) | type daemonSetGeneratingHandler struct
method Remove (line 142) | func (a *daemonSetGeneratingHandler) Remove(key string, obj *v1.Daemon...
method Handle (line 162) | func (a *daemonSetGeneratingHandler) Handle(obj *v1.DaemonSet, status ...
method isNewResourceVersion (line 188) | func (a *daemonSetGeneratingHandler) isNewResourceVersion(obj *v1.Daem...
method storeResourceVersion (line 201) | func (a *daemonSetGeneratingHandler) storeResourceVersion(obj *v1.Daem...
FILE: pkg/generated/controllers/apps/v1/deployment.go
type DeploymentController (line 38) | type DeploymentController interface
type DeploymentClient (line 43) | type DeploymentClient interface
type DeploymentCache (line 48) | type DeploymentCache interface
type DeploymentStatusHandler (line 53) | type DeploymentStatusHandler
type DeploymentGeneratingHandler (line 56) | type DeploymentGeneratingHandler
function RegisterDeploymentStatusHandler (line 60) | func RegisterDeploymentStatusHandler(ctx context.Context, controller Dep...
function RegisterDeploymentGeneratingHandler (line 71) | func RegisterDeploymentGeneratingHandler(ctx context.Context, controller...
type deploymentStatusHandler (line 86) | type deploymentStatusHandler struct
method sync (line 93) | func (a *deploymentStatusHandler) sync(key string, obj *v1.Deployment)...
type deploymentGeneratingHandler (line 132) | type deploymentGeneratingHandler struct
method Remove (line 142) | func (a *deploymentGeneratingHandler) Remove(key string, obj *v1.Deplo...
method Handle (line 162) | func (a *deploymentGeneratingHandler) Handle(obj *v1.Deployment, statu...
method isNewResourceVersion (line 188) | func (a *deploymentGeneratingHandler) isNewResourceVersion(obj *v1.Dep...
method storeResourceVersion (line 201) | func (a *deploymentGeneratingHandler) storeResourceVersion(obj *v1.Dep...
FILE: pkg/generated/controllers/apps/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 39) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 45) | type version struct
method DaemonSet (line 49) | func (v *version) DaemonSet() DaemonSetController {
method Deployment (line 53) | func (v *version) Deployment() DeploymentController {
method StatefulSet (line 57) | func (v *version) StatefulSet() StatefulSetController {
FILE: pkg/generated/controllers/apps/v1/statefulset.go
type StatefulSetController (line 38) | type StatefulSetController interface
type StatefulSetClient (line 43) | type StatefulSetClient interface
type StatefulSetCache (line 48) | type StatefulSetCache interface
type StatefulSetStatusHandler (line 53) | type StatefulSetStatusHandler
type StatefulSetGeneratingHandler (line 56) | type StatefulSetGeneratingHandler
function RegisterStatefulSetStatusHandler (line 60) | func RegisterStatefulSetStatusHandler(ctx context.Context, controller St...
function RegisterStatefulSetGeneratingHandler (line 71) | func RegisterStatefulSetGeneratingHandler(ctx context.Context, controlle...
type statefulSetStatusHandler (line 86) | type statefulSetStatusHandler struct
method sync (line 93) | func (a *statefulSetStatusHandler) sync(key string, obj *v1.StatefulSe...
type statefulSetGeneratingHandler (line 132) | type statefulSetGeneratingHandler struct
method Remove (line 142) | func (a *statefulSetGeneratingHandler) Remove(key string, obj *v1.Stat...
method Handle (line 162) | func (a *statefulSetGeneratingHandler) Handle(obj *v1.StatefulSet, sta...
method isNewResourceVersion (line 188) | func (a *statefulSetGeneratingHandler) isNewResourceVersion(obj *v1.St...
method storeResourceVersion (line 201) | func (a *statefulSetGeneratingHandler) storeResourceVersion(obj *v1.St...
FILE: pkg/generated/controllers/batch/factory.go
type Factory (line 27) | type Factory struct
method Batch (line 66) | func (c *Factory) Batch() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/batch/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/batch/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method Job (line 47) | func (v *version) Job() JobController {
FILE: pkg/generated/controllers/batch/v1/job.go
type JobController (line 38) | type JobController interface
type JobClient (line 43) | type JobClient interface
type JobCache (line 48) | type JobCache interface
type JobStatusHandler (line 53) | type JobStatusHandler
type JobGeneratingHandler (line 56) | type JobGeneratingHandler
function RegisterJobStatusHandler (line 60) | func RegisterJobStatusHandler(ctx context.Context, controller JobControl...
function RegisterJobGeneratingHandler (line 71) | func RegisterJobGeneratingHandler(ctx context.Context, controller JobCon...
type jobStatusHandler (line 86) | type jobStatusHandler struct
method sync (line 93) | func (a *jobStatusHandler) sync(key string, obj *v1.Job) (*v1.Job, err...
type jobGeneratingHandler (line 132) | type jobGeneratingHandler struct
method Remove (line 142) | func (a *jobGeneratingHandler) Remove(key string, obj *v1.Job) (*v1.Jo...
method Handle (line 162) | func (a *jobGeneratingHandler) Handle(obj *v1.Job, status v1.JobStatus...
method isNewResourceVersion (line 188) | func (a *jobGeneratingHandler) isNewResourceVersion(obj *v1.Job) bool {
method storeResourceVersion (line 201) | func (a *jobGeneratingHandler) storeResourceVersion(obj *v1.Job) {
FILE: pkg/generated/controllers/coordination.k8s.io/factory.go
type Factory (line 27) | type Factory struct
method Coordination (line 66) | func (c *Factory) Coordination() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/coordination.k8s.io/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/coordination.k8s.io/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method Lease (line 47) | func (v *version) Lease() LeaseController {
FILE: pkg/generated/controllers/coordination.k8s.io/v1/lease.go
type LeaseController (line 27) | type LeaseController interface
type LeaseClient (line 32) | type LeaseClient interface
type LeaseCache (line 37) | type LeaseCache interface
FILE: pkg/generated/controllers/core/factory.go
type Factory (line 27) | type Factory struct
method Core (line 66) | func (c *Factory) Core() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/core/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/core/v1/configmap.go
type ConfigMapController (line 27) | type ConfigMapController interface
type ConfigMapClient (line 32) | type ConfigMapClient interface
type ConfigMapCache (line 37) | type ConfigMapCache interface
FILE: pkg/generated/controllers/core/v1/endpoints.go
type EndpointsController (line 27) | type EndpointsController interface
type EndpointsClient (line 32) | type EndpointsClient interface
type EndpointsCache (line 37) | type EndpointsCache interface
FILE: pkg/generated/controllers/core/v1/event.go
type EventController (line 27) | type EventController interface
type EventClient (line 32) | type EventClient interface
type EventCache (line 37) | type EventCache interface
FILE: pkg/generated/controllers/core/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 49) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 55) | type version struct
method ConfigMap (line 59) | func (v *version) ConfigMap() ConfigMapController {
method Endpoints (line 63) | func (v *version) Endpoints() EndpointsController {
method Event (line 67) | func (v *version) Event() EventController {
method LimitRange (line 71) | func (v *version) LimitRange() LimitRangeController {
method Namespace (line 75) | func (v *version) Namespace() NamespaceController {
method Node (line 79) | func (v *version) Node() NodeController {
method PersistentVolume (line 83) | func (v *version) PersistentVolume() PersistentVolumeController {
method PersistentVolumeClaim (line 87) | func (v *version) PersistentVolumeClaim() PersistentVolumeClaimControl...
method Pod (line 91) | func (v *version) Pod() PodController {
method ResourceQuota (line 95) | func (v *version) ResourceQuota() ResourceQuotaController {
method Secret (line 99) | func (v *version) Secret() SecretController {
method Service (line 103) | func (v *version) Service() ServiceController {
method ServiceAccount (line 107) | func (v *version) ServiceAccount() ServiceAccountController {
FILE: pkg/generated/controllers/core/v1/limitrange.go
type LimitRangeController (line 27) | type LimitRangeController interface
type LimitRangeClient (line 32) | type LimitRangeClient interface
type LimitRangeCache (line 37) | type LimitRangeCache interface
FILE: pkg/generated/controllers/core/v1/namespace.go
type NamespaceController (line 38) | type NamespaceController interface
type NamespaceClient (line 43) | type NamespaceClient interface
type NamespaceCache (line 48) | type NamespaceCache interface
type NamespaceStatusHandler (line 53) | type NamespaceStatusHandler
type NamespaceGeneratingHandler (line 56) | type NamespaceGeneratingHandler
function RegisterNamespaceStatusHandler (line 60) | func RegisterNamespaceStatusHandler(ctx context.Context, controller Name...
function RegisterNamespaceGeneratingHandler (line 71) | func RegisterNamespaceGeneratingHandler(ctx context.Context, controller ...
type namespaceStatusHandler (line 86) | type namespaceStatusHandler struct
method sync (line 93) | func (a *namespaceStatusHandler) sync(key string, obj *v1.Namespace) (...
type namespaceGeneratingHandler (line 132) | type namespaceGeneratingHandler struct
method Remove (line 142) | func (a *namespaceGeneratingHandler) Remove(key string, obj *v1.Namesp...
method Handle (line 162) | func (a *namespaceGeneratingHandler) Handle(obj *v1.Namespace, status ...
method isNewResourceVersion (line 188) | func (a *namespaceGeneratingHandler) isNewResourceVersion(obj *v1.Name...
method storeResourceVersion (line 201) | func (a *namespaceGeneratingHandler) storeResourceVersion(obj *v1.Name...
FILE: pkg/generated/controllers/core/v1/node.go
type NodeController (line 38) | type NodeController interface
type NodeClient (line 43) | type NodeClient interface
type NodeCache (line 48) | type NodeCache interface
type NodeStatusHandler (line 53) | type NodeStatusHandler
type NodeGeneratingHandler (line 56) | type NodeGeneratingHandler
function RegisterNodeStatusHandler (line 60) | func RegisterNodeStatusHandler(ctx context.Context, controller NodeContr...
function RegisterNodeGeneratingHandler (line 71) | func RegisterNodeGeneratingHandler(ctx context.Context, controller NodeC...
type nodeStatusHandler (line 86) | type nodeStatusHandler struct
method sync (line 93) | func (a *nodeStatusHandler) sync(key string, obj *v1.Node) (*v1.Node, ...
type nodeGeneratingHandler (line 132) | type nodeGeneratingHandler struct
method Remove (line 142) | func (a *nodeGeneratingHandler) Remove(key string, obj *v1.Node) (*v1....
method Handle (line 162) | func (a *nodeGeneratingHandler) Handle(obj *v1.Node, status v1.NodeSta...
method isNewResourceVersion (line 188) | func (a *nodeGeneratingHandler) isNewResourceVersion(obj *v1.Node) bool {
method storeResourceVersion (line 201) | func (a *nodeGeneratingHandler) storeResourceVersion(obj *v1.Node) {
FILE: pkg/generated/controllers/core/v1/persistentvolume.go
type PersistentVolumeController (line 38) | type PersistentVolumeController interface
type PersistentVolumeClient (line 43) | type PersistentVolumeClient interface
type PersistentVolumeCache (line 48) | type PersistentVolumeCache interface
type PersistentVolumeStatusHandler (line 53) | type PersistentVolumeStatusHandler
type PersistentVolumeGeneratingHandler (line 56) | type PersistentVolumeGeneratingHandler
function RegisterPersistentVolumeStatusHandler (line 60) | func RegisterPersistentVolumeStatusHandler(ctx context.Context, controll...
function RegisterPersistentVolumeGeneratingHandler (line 71) | func RegisterPersistentVolumeGeneratingHandler(ctx context.Context, cont...
type persistentVolumeStatusHandler (line 86) | type persistentVolumeStatusHandler struct
method sync (line 93) | func (a *persistentVolumeStatusHandler) sync(key string, obj *v1.Persi...
type persistentVolumeGeneratingHandler (line 132) | type persistentVolumeGeneratingHandler struct
method Remove (line 142) | func (a *persistentVolumeGeneratingHandler) Remove(key string, obj *v1...
method Handle (line 162) | func (a *persistentVolumeGeneratingHandler) Handle(obj *v1.PersistentV...
method isNewResourceVersion (line 188) | func (a *persistentVolumeGeneratingHandler) isNewResourceVersion(obj *...
method storeResourceVersion (line 201) | func (a *persistentVolumeGeneratingHandler) storeResourceVersion(obj *...
FILE: pkg/generated/controllers/core/v1/persistentvolumeclaim.go
type PersistentVolumeClaimController (line 38) | type PersistentVolumeClaimController interface
type PersistentVolumeClaimClient (line 43) | type PersistentVolumeClaimClient interface
type PersistentVolumeClaimCache (line 48) | type PersistentVolumeClaimCache interface
type PersistentVolumeClaimStatusHandler (line 53) | type PersistentVolumeClaimStatusHandler
type PersistentVolumeClaimGeneratingHandler (line 56) | type PersistentVolumeClaimGeneratingHandler
function RegisterPersistentVolumeClaimStatusHandler (line 60) | func RegisterPersistentVolumeClaimStatusHandler(ctx context.Context, con...
function RegisterPersistentVolumeClaimGeneratingHandler (line 71) | func RegisterPersistentVolumeClaimGeneratingHandler(ctx context.Context,...
type persistentVolumeClaimStatusHandler (line 86) | type persistentVolumeClaimStatusHandler struct
method sync (line 93) | func (a *persistentVolumeClaimStatusHandler) sync(key string, obj *v1....
type persistentVolumeClaimGeneratingHandler (line 132) | type persistentVolumeClaimGeneratingHandler struct
method Remove (line 142) | func (a *persistentVolumeClaimGeneratingHandler) Remove(key string, ob...
method Handle (line 162) | func (a *persistentVolumeClaimGeneratingHandler) Handle(obj *v1.Persis...
method isNewResourceVersion (line 188) | func (a *persistentVolumeClaimGeneratingHandler) isNewResourceVersion(...
method storeResourceVersion (line 201) | func (a *persistentVolumeClaimGeneratingHandler) storeResourceVersion(...
FILE: pkg/generated/controllers/core/v1/pod.go
type PodController (line 38) | type PodController interface
type PodClient (line 43) | type PodClient interface
type PodCache (line 48) | type PodCache interface
type PodStatusHandler (line 53) | type PodStatusHandler
type PodGeneratingHandler (line 56) | type PodGeneratingHandler
function RegisterPodStatusHandler (line 60) | func RegisterPodStatusHandler(ctx context.Context, controller PodControl...
function RegisterPodGeneratingHandler (line 71) | func RegisterPodGeneratingHandler(ctx context.Context, controller PodCon...
type podStatusHandler (line 86) | type podStatusHandler struct
method sync (line 93) | func (a *podStatusHandler) sync(key string, obj *v1.Pod) (*v1.Pod, err...
type podGeneratingHandler (line 132) | type podGeneratingHandler struct
method Remove (line 142) | func (a *podGeneratingHandler) Remove(key string, obj *v1.Pod) (*v1.Po...
method Handle (line 162) | func (a *podGeneratingHandler) Handle(obj *v1.Pod, status v1.PodStatus...
method isNewResourceVersion (line 188) | func (a *podGeneratingHandler) isNewResourceVersion(obj *v1.Pod) bool {
method storeResourceVersion (line 201) | func (a *podGeneratingHandler) storeResourceVersion(obj *v1.Pod) {
FILE: pkg/generated/controllers/core/v1/resourcequota.go
type ResourceQuotaController (line 38) | type ResourceQuotaController interface
type ResourceQuotaClient (line 43) | type ResourceQuotaClient interface
type ResourceQuotaCache (line 48) | type ResourceQuotaCache interface
type ResourceQuotaStatusHandler (line 53) | type ResourceQuotaStatusHandler
type ResourceQuotaGeneratingHandler (line 56) | type ResourceQuotaGeneratingHandler
function RegisterResourceQuotaStatusHandler (line 60) | func RegisterResourceQuotaStatusHandler(ctx context.Context, controller ...
function RegisterResourceQuotaGeneratingHandler (line 71) | func RegisterResourceQuotaGeneratingHandler(ctx context.Context, control...
type resourceQuotaStatusHandler (line 86) | type resourceQuotaStatusHandler struct
method sync (line 93) | func (a *resourceQuotaStatusHandler) sync(key string, obj *v1.Resource...
type resourceQuotaGeneratingHandler (line 132) | type resourceQuotaGeneratingHandler struct
method Remove (line 142) | func (a *resourceQuotaGeneratingHandler) Remove(key string, obj *v1.Re...
method Handle (line 162) | func (a *resourceQuotaGeneratingHandler) Handle(obj *v1.ResourceQuota,...
method isNewResourceVersion (line 188) | func (a *resourceQuotaGeneratingHandler) isNewResourceVersion(obj *v1....
method storeResourceVersion (line 201) | func (a *resourceQuotaGeneratingHandler) storeResourceVersion(obj *v1....
FILE: pkg/generated/controllers/core/v1/secret.go
type SecretController (line 27) | type SecretController interface
type SecretClient (line 32) | type SecretClient interface
type SecretCache (line 37) | type SecretCache interface
FILE: pkg/generated/controllers/core/v1/service.go
type ServiceController (line 38) | type ServiceController interface
type ServiceClient (line 43) | type ServiceClient interface
type ServiceCache (line 48) | type ServiceCache interface
type ServiceStatusHandler (line 53) | type ServiceStatusHandler
type ServiceGeneratingHandler (line 56) | type ServiceGeneratingHandler
function RegisterServiceStatusHandler (line 60) | func RegisterServiceStatusHandler(ctx context.Context, controller Servic...
function RegisterServiceGeneratingHandler (line 71) | func RegisterServiceGeneratingHandler(ctx context.Context, controller Se...
type serviceStatusHandler (line 86) | type serviceStatusHandler struct
method sync (line 93) | func (a *serviceStatusHandler) sync(key string, obj *v1.Service) (*v1....
type serviceGeneratingHandler (line 132) | type serviceGeneratingHandler struct
method Remove (line 142) | func (a *serviceGeneratingHandler) Remove(key string, obj *v1.Service)...
method Handle (line 162) | func (a *serviceGeneratingHandler) Handle(obj *v1.Service, status v1.S...
method isNewResourceVersion (line 188) | func (a *serviceGeneratingHandler) isNewResourceVersion(obj *v1.Servic...
method storeResourceVersion (line 201) | func (a *serviceGeneratingHandler) storeResourceVersion(obj *v1.Servic...
FILE: pkg/generated/controllers/core/v1/serviceaccount.go
type ServiceAccountController (line 27) | type ServiceAccountController interface
type ServiceAccountClient (line 32) | type ServiceAccountClient interface
type ServiceAccountCache (line 37) | type ServiceAccountCache interface
FILE: pkg/generated/controllers/discovery/factory.go
type Factory (line 27) | type Factory struct
method Discovery (line 66) | func (c *Factory) Discovery() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/discovery/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/discovery/v1/endpointslice.go
type EndpointSliceController (line 27) | type EndpointSliceController interface
type EndpointSliceClient (line 32) | type EndpointSliceClient interface
type EndpointSliceCache (line 37) | type EndpointSliceCache interface
FILE: pkg/generated/controllers/discovery/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method EndpointSlice (line 47) | func (v *version) EndpointSlice() EndpointSliceController {
FILE: pkg/generated/controllers/extensions/factory.go
type Factory (line 27) | type Factory struct
method Extensions (line 66) | func (c *Factory) Extensions() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/extensions/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1beta1 (line 41) | func (g *group) V1beta1() v1beta1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/extensions/v1beta1/ingress.go
type IngressController (line 38) | type IngressController interface
type IngressClient (line 43) | type IngressClient interface
type IngressCache (line 48) | type IngressCache interface
type IngressStatusHandler (line 53) | type IngressStatusHandler
type IngressGeneratingHandler (line 56) | type IngressGeneratingHandler
function RegisterIngressStatusHandler (line 60) | func RegisterIngressStatusHandler(ctx context.Context, controller Ingres...
function RegisterIngressGeneratingHandler (line 71) | func RegisterIngressGeneratingHandler(ctx context.Context, controller In...
type ingressStatusHandler (line 86) | type ingressStatusHandler struct
method sync (line 93) | func (a *ingressStatusHandler) sync(key string, obj *v1beta1.Ingress) ...
type ingressGeneratingHandler (line 132) | type ingressGeneratingHandler struct
method Remove (line 142) | func (a *ingressGeneratingHandler) Remove(key string, obj *v1beta1.Ing...
method Handle (line 162) | func (a *ingressGeneratingHandler) Handle(obj *v1beta1.Ingress, status...
method isNewResourceVersion (line 188) | func (a *ingressGeneratingHandler) isNewResourceVersion(obj *v1beta1.I...
method storeResourceVersion (line 201) | func (a *ingressGeneratingHandler) storeResourceVersion(obj *v1beta1.I...
FILE: pkg/generated/controllers/extensions/v1beta1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method Ingress (line 47) | func (v *version) Ingress() IngressController {
FILE: pkg/generated/controllers/networking.k8s.io/factory.go
type Factory (line 27) | type Factory struct
method Networking (line 66) | func (c *Factory) Networking() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/networking.k8s.io/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/networking.k8s.io/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method NetworkPolicy (line 47) | func (v *version) NetworkPolicy() NetworkPolicyController {
FILE: pkg/generated/controllers/networking.k8s.io/v1/networkpolicy.go
type NetworkPolicyController (line 27) | type NetworkPolicyController interface
type NetworkPolicyClient (line 32) | type NetworkPolicyClient interface
type NetworkPolicyCache (line 37) | type NetworkPolicyCache interface
FILE: pkg/generated/controllers/rbac/factory.go
type Factory (line 27) | type Factory struct
method Rbac (line 66) | func (c *Factory) Rbac() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/rbac/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/rbac/v1/clusterrole.go
type ClusterRoleController (line 27) | type ClusterRoleController interface
type ClusterRoleClient (line 32) | type ClusterRoleClient interface
type ClusterRoleCache (line 37) | type ClusterRoleCache interface
FILE: pkg/generated/controllers/rbac/v1/clusterrolebinding.go
type ClusterRoleBindingController (line 27) | type ClusterRoleBindingController interface
type ClusterRoleBindingClient (line 32) | type ClusterRoleBindingClient interface
type ClusterRoleBindingCache (line 37) | type ClusterRoleBindingCache interface
FILE: pkg/generated/controllers/rbac/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 40) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 46) | type version struct
method ClusterRole (line 50) | func (v *version) ClusterRole() ClusterRoleController {
method ClusterRoleBinding (line 54) | func (v *version) ClusterRoleBinding() ClusterRoleBindingController {
method Role (line 58) | func (v *version) Role() RoleController {
method RoleBinding (line 62) | func (v *version) RoleBinding() RoleBindingController {
FILE: pkg/generated/controllers/rbac/v1/role.go
type RoleController (line 27) | type RoleController interface
type RoleClient (line 32) | type RoleClient interface
type RoleCache (line 37) | type RoleCache interface
FILE: pkg/generated/controllers/rbac/v1/rolebinding.go
type RoleBindingController (line 27) | type RoleBindingController interface
type RoleBindingClient (line 32) | type RoleBindingClient interface
type RoleBindingCache (line 37) | type RoleBindingCache interface
FILE: pkg/generated/controllers/storage/factory.go
type Factory (line 27) | type Factory struct
method Storage (line 66) | func (c *Factory) Storage() Interface {
method WithAgent (line 70) | func (c *Factory) WithAgent(userAgent string) Interface {
function NewFactoryFromConfigOrDie (line 31) | func NewFactoryFromConfigOrDie(config *rest.Config) *Factory {
function NewFactoryFromConfig (line 39) | func NewFactoryFromConfig(config *rest.Config) (*Factory, error) {
function NewFactoryFromConfigWithNamespace (line 43) | func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace st...
function NewFactoryFromConfigWithOptions (line 51) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
function NewFactoryFromConfigWithOptionsOrDie (line 58) | func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *Fac...
FILE: pkg/generated/controllers/storage/interface.go
type Interface (line 26) | type Interface interface
type group (line 30) | type group struct
method V1 (line 41) | func (g *group) V1() v1.Interface {
function New (line 35) | func New(controllerFactory controller.SharedControllerFactory) Interface {
FILE: pkg/generated/controllers/storage/v1/interface.go
function init (line 29) | func init() {
type Interface (line 33) | type Interface interface
function New (line 37) | func New(controllerFactory controller.SharedControllerFactory) Interface {
type version (line 43) | type version struct
method StorageClass (line 47) | func (v *version) StorageClass() StorageClassController {
FILE: pkg/generated/controllers/storage/v1/storageclass.go
type StorageClassController (line 27) | type StorageClassController interface
type StorageClassClient (line 32) | type StorageClassClient interface
type StorageClassCache (line 37) | type StorageClassCache interface
FILE: pkg/generic/cache.go
type CacheInterface (line 16) | type CacheInterface interface
type NonNamespacedCacheInterface (line 33) | type NonNamespacedCacheInterface interface
function NewCache (line 49) | func NewCache[T runtime.Object](indexer cache.Indexer, resource schema.G...
function NewNonNamespacedCache (line 56) | func NewNonNamespacedCache[T runtime.Object](indexer cache.Indexer, reso...
type Cache (line 66) | type Cache struct
type NonNamespacedCache (line 72) | type NonNamespacedCache struct
method Get (line 77) | func (c *Cache[T]) Get(namespace, name string) (T, error) {
method List (line 98) | func (c *Cache[T]) List(namespace string, selector labels.Selector) (ret...
method AddIndexer (line 108) | func (c *Cache[T]) AddIndexer(indexName string, indexer Indexer[T]) {
method GetByIndex (line 118) | func (c *Cache[T]) GetByIndex(indexName, key string) (result []T, err er...
method Get (line 135) | func (c *NonNamespacedCache[T]) Get(name string) (T, error) {
method List (line 140) | func (c *NonNamespacedCache[T]) List(selector labels.Selector) (ret []T,...
FILE: pkg/generic/cache_test.go
function TestCache (line 11) | func TestCache(t *testing.T) {
function TestNonNamespacedCache (line 40) | func TestNonNamespacedCache(t *testing.T) {
FILE: pkg/generic/clientMocks_test.go
type MockembeddedClient (line 26) | type MockembeddedClient struct
method EXPECT (line 45) | func (m *MockembeddedClient) EXPECT() *MockembeddedClientMockRecorder {
method Create (line 50) | func (m *MockembeddedClient) Create(ctx context.Context, namespace str...
method Delete (line 64) | func (m *MockembeddedClient) Delete(ctx context.Context, namespace, na...
method DeleteCollection (line 78) | func (m *MockembeddedClient) DeleteCollection(ctx context.Context, nam...
method Get (line 92) | func (m *MockembeddedClient) Get(ctx context.Context, namespace, name ...
method List (line 106) | func (m *MockembeddedClient) List(ctx context.Context, namespace strin...
method Patch (line 120) | func (m *MockembeddedClient) Patch(ctx context.Context, namespace, nam...
method Update (line 139) | func (m *MockembeddedClient) Update(ctx context.Context, namespace str...
method UpdateStatus (line 153) | func (m *MockembeddedClient) UpdateStatus(ctx context.Context, namespa...
method Watch (line 167) | func (m *MockembeddedClient) Watch(ctx context.Context, namespace stri...
method WithImpersonation (line 182) | func (m *MockembeddedClient) WithImpersonation(impersonate rest.Impers...
type MockembeddedClientMockRecorder (line 33) | type MockembeddedClientMockRecorder struct
method Create (line 58) | func (mr *MockembeddedClientMockRecorder) Create(ctx, namespace, obj, ...
method Delete (line 72) | func (mr *MockembeddedClientMockRecorder) Delete(ctx, namespace, name,...
method DeleteCollection (line 86) | func (mr *MockembeddedClientMockRecorder) DeleteCollection(ctx, namesp...
method Get (line 100) | func (mr *MockembeddedClientMockRecorder) Get(ctx, namespace, name, re...
method List (line 114) | func (mr *MockembeddedClientMockRecorder) List(ctx, namespace, result,...
method Patch (line 132) | func (mr *MockembeddedClientMockRecorder) Patch(ctx, namespace, name, ...
method Update (line 147) | func (mr *MockembeddedClientMockRecorder) Update(ctx, namespace, obj, ...
method UpdateStatus (line 161) | func (mr *MockembeddedClientMockRecorder) UpdateStatus(ctx, namespace,...
method Watch (line 176) | func (mr *MockembeddedClientMockRecorder) Watch(ctx, namespace, opts a...
method WithImpersonation (line 191) | func (mr *MockembeddedClientMockRecorder) WithImpersonation(impersonat...
function NewMockembeddedClient (line 38) | func NewMockembeddedClient(ctrl *gomock.Controller) *MockembeddedClient {
FILE: pkg/generic/controller.go
type ControllerMeta (line 24) | type ControllerMeta interface
type RuntimeMetaObject (line 42) | type RuntimeMetaObject interface
type ControllerInterface (line 49) | type ControllerInterface interface
type NonNamespacedControllerInterface (line 70) | type NonNamespacedControllerInterface interface
type ClientInterface (line 91) | type ClientInterface interface
type NonNamespacedClientInterface (line 126) | type NonNamespacedClientInterface interface
type Handler (line 157) | type Handler
type ObjectHandler (line 160) | type ObjectHandler
type Indexer (line 163) | type Indexer
function FromObjectHandlerToHandler (line 166) | func FromObjectHandlerToHandler[T RuntimeMetaObject](sync ObjectHandler[...
type Controller (line 183) | type Controller struct
type NonNamespacedController (line 193) | type NonNamespacedController struct
function NewController (line 198) | func NewController[T RuntimeMetaObject, TList runtime.Object](gvk schema...
method Updater (line 224) | func (c *Controller[T, TList]) Updater() Updater {
method AddGenericHandler (line 236) | func (c *Controller[T, TList]) AddGenericHandler(ctx context.Context, na...
method AddGenericRemoveHandler (line 241) | func (c *Controller[T, TList]) AddGenericRemoveHandler(ctx context.Conte...
method OnChange (line 246) | func (c *Controller[T, TList]) OnChange(ctx context.Context, name string...
method OnRemove (line 251) | func (c *Controller[T, TList]) OnRemove(ctx context.Context, name string...
method Enqueue (line 256) | func (c *Controller[T, TList]) Enqueue(namespace, name string) {
method EnqueueAfter (line 261) | func (c *Controller[T, TList]) EnqueueAfter(namespace, name string, dura...
method Informer (line 266) | func (c *Controller[T, TList]) Informer() cache.SharedIndexInformer {
method GroupVersionKind (line 271) | func (c *Controller[T, TList]) GroupVersionKind() schema.GroupVersionKind {
method Cache (line 276) | func (c *Controller[T, TList]) Cache() CacheInterface[T] {
method Create (line 281) | func (c *Controller[T, TList]) Create(obj T) (T, error) {
method Update (line 287) | func (c *Controller[T, TList]) Update(obj T) (T, error) {
method UpdateStatus (line 294) | func (c *Controller[T, TList]) UpdateStatus(obj T) (T, error) {
method Delete (line 300) | func (c *Controller[T, TList]) Delete(namespace, name string, options *m...
method Get (line 308) | func (c *Controller[T, TList]) Get(namespace, name string, options metav...
method List (line 314) | func (c *Controller[T, TList]) List(namespace string, opts metav1.ListOp...
method Watch (line 320) | func (c *Controller[T, TList]) Watch(namespace string, opts metav1.ListO...
method Patch (line 325) | func (c *Controller[T, TList]) Patch(namespace, name string, pt types.Pa...
method DeleteCollection (line 332) | func (c *Controller[T, TList]) DeleteCollection(namespace string, delete...
method WithImpersonation (line 337) | func (c *Controller[T, TList]) WithImpersonation(impersonate rest.Impers...
function NewNonNamespacedController (line 356) | func NewNonNamespacedController[T RuntimeMetaObject, TList runtime.Objec...
method Enqueue (line 366) | func (c *NonNamespacedController[T, TList]) Enqueue(name string) {
method EnqueueAfter (line 371) | func (c *NonNamespacedController[T, TList]) EnqueueAfter(name string, du...
method Delete (line 376) | func (c *NonNamespacedController[T, TList]) Delete(name string, options ...
method Get (line 381) | func (c *NonNamespacedController[T, TList]) Get(name string, options met...
method List (line 386) | func (c *NonNamespacedController[T, TList]) List(opts metav1.ListOptions...
method Watch (line 391) | func (c *NonNamespacedController[T, TList]) Watch(opts metav1.ListOption...
method Patch (line 396) | func (c *NonNamespacedController[T, TList]) Patch(name string, pt types....
method WithImpersonation (line 401) | func (c *NonNamespacedController[T, TList]) WithImpersonation(impersonat...
method Cache (line 415) | func (c *NonNamespacedController[T, TList]) Cache() NonNamespacedCacheIn...
method DeleteCollection (line 420) | func (c *NonNamespacedController[T, TList]) DeleteCollection(deleteOpts ...
FILE: pkg/generic/controllerFactoryMocks_test.go
type MockSharedControllerFactory (line 27) | type MockSharedControllerFactory struct
method EXPECT (line 46) | func (m *MockSharedControllerFactory) EXPECT() *MockSharedControllerFa...
method ForKind (line 51) | func (m *MockSharedControllerFactory) ForKind(gvk schema.GroupVersionK...
method ForObject (line 66) | func (m *MockSharedControllerFactory) ForObject(obj runtime.Object) (c...
method ForResource (line 81) | func (m *MockSharedControllerFactory) ForResource(gvr schema.GroupVers...
method ForResourceKind (line 95) | func (m *MockSharedControllerFactory) ForResourceKind(gvr schema.Group...
method SharedCacheFactory (line 109) | func (m *MockSharedControllerFactory) SharedCacheFactory() cache.Share...
method Start (line 123) | func (m *MockSharedControllerFactory) Start(ctx context.Context, worke...
type MockSharedControllerFactoryMockRecorder (line 34) | type MockSharedControllerFactoryMockRecorder struct
method ForKind (line 60) | func (mr *MockSharedControllerFactoryMockRecorder) ForKind(gvk any) *g...
method ForObject (line 75) | func (mr *MockSharedControllerFactoryMockRecorder) ForObject(obj any) ...
method ForResource (line 89) | func (mr *MockSharedControllerFactoryMockRecorder) ForResource(gvr, na...
method ForResourceKind (line 103) | func (mr *MockSharedControllerFactoryMockRecorder) ForResourceKind(gvr...
method SharedCacheFactory (line 117) | func (mr *MockSharedControllerFactoryMockRecorder) SharedCacheFactory(...
method Start (line 131) | func (mr *MockSharedControllerFactoryMockRecorder) Start(ctx, workers ...
function NewMockSharedControllerFactory (line 39) | func NewMockSharedControllerFactory(ctrl *gomock.Controller) *MockShared...
type MockSharedController (line 137) | type MockSharedController struct
method EXPECT (line 156) | func (m *MockSharedController) EXPECT() *MockSharedControllerMockRecor...
method Client (line 161) | func (m *MockSharedController) Client() *client.Client {
method Enqueue (line 175) | func (m *MockSharedController) Enqueue(namespace, name string) {
method EnqueueAfter (line 187) | func (m *MockSharedController) EnqueueAfter(namespace, name string, de...
method EnqueueKey (line 199) | func (m *MockSharedController) EnqueueKey(key string) {
method Informer (line 211) | func (m *MockSharedController) Informer() cache0.SharedIndexInformer {
method RegisterHandler (line 225) | func (m *MockSharedController) RegisterHandler(ctx context.Context, na...
method Start (line 237) | func (m *MockSharedController) Start(ctx context.Context, workers int)...
type MockSharedControllerMockRecorder (line 144) | type MockSharedControllerMockRecorder struct
method Client (line 169) | func (mr *MockSharedControllerMockRecorder) Client() *gomock.Call {
method Enqueue (line 181) | func (mr *MockSharedControllerMockRecorder) Enqueue(namespace, name an...
method EnqueueAfter (line 193) | func (mr *MockSharedControllerMockRecorder) EnqueueAfter(namespace, na...
method EnqueueKey (line 205) | func (mr *MockSharedControllerMockRecorder) EnqueueKey(key any) *gomoc...
method Informer (line 219) | func (mr *MockSharedControllerMockRecorder) Informer() *gomock.Call {
method RegisterHandler (line 231) | func (mr *MockSharedControllerMockRecorder) RegisterHandler(ctx, name,...
method Start (line 245) | func (mr *MockSharedControllerMockRecorder) Start(ctx, workers any) *g...
function NewMockSharedController (line 149) | func NewMockSharedController(ctrl *gomock.Controller) *MockSharedControl...
FILE: pkg/generic/controller_test.go
constant globalTestPodName (line 24) | globalTestPodName = "High-Noon-Harry"
constant globalTestNamespace (line 25) | globalTestNamespace = "rodeo"
constant globalTestNodeName (line 26) | globalTestNodeName = "cowboy-server"
function TestController_Get (line 41) | func TestController_Get(parentT *testing.T) {
function TestController_List (line 85) | func TestController_List(parentT *testing.T) {
function TestController_Watch (line 129) | func TestController_Watch(parentT *testing.T) {
function TestController_Patch (line 170) | func TestController_Patch(parentT *testing.T) {
function TestController_Update (line 217) | func TestController_Update(t *testing.T) {
function TestController_UpdateStatus (line 246) | func TestController_UpdateStatus(t *testing.T) {
function TestController_Create (line 274) | func TestController_Create(t *testing.T) {
function TestController_Delete (line 302) | func TestController_Delete(parentT *testing.T) {
function NewTestController (line 336) | func NewTestController(ctrl *gomock.Controller, testClient embeddedClien...
function NewTestNonNamespacedController (line 348) | func NewTestNonNamespacedController(ctrl *gomock.Controller, testClient ...
FILE: pkg/generic/embeddedClient.go
type embeddedClient (line 15) | type embeddedClient interface
FILE: pkg/generic/factory.go
function init (line 21) | func init() {
type Factory (line 26) | type Factory struct
method SetThreadiness (line 63) | func (c *Factory) SetThreadiness(gvk schema.GroupVersionKind, threadin...
method ControllerFactory (line 67) | func (c *Factory) ControllerFactory() controller.SharedControllerFacto...
method setControllerFactoryWithLock (line 73) | func (c *Factory) setControllerFactoryWithLock() error {
method Sync (line 105) | func (c *Factory) Sync(ctx context.Context) error {
method Start (line 120) | func (c *Factory) Start(ctx context.Context, defaultThreadiness int) e...
type FactoryOptions (line 35) | type FactoryOptions struct
function NewFactoryFromConfigWithOptions (line 43) | func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryO...
FILE: pkg/generic/fake/cache.go
type MockCacheInterface (line 22) | type MockCacheInterface struct
type MockCacheInterfaceMockRecorder (line 29) | type MockCacheInterfaceMockRecorder struct
function NewMockCacheInterface (line 34) | func NewMockCacheInterface[T runtime.Object](ctrl *gomock.Controller) *M...
method EXPECT (line 41) | func (m *MockCacheInterface[T]) EXPECT() *MockCacheInterfaceMockRecorder...
method AddIndexer (line 46) | func (m *MockCacheInterface[T]) AddIndexer(indexName string, indexer gen...
method AddIndexer (line 52) | func (mr *MockCacheInterfaceMockRecorder[T]) AddIndexer(indexName, index...
method Get (line 58) | func (m *MockCacheInterface[T]) Get(namespace, name string) (T, error) {
method Get (line 67) | func (mr *MockCacheInterfaceMockRecorder[T]) Get(namespace, name any) *g...
method GetByIndex (line 73) | func (m *MockCacheInterface[T]) GetByIndex(indexName, key string) ([]T, ...
method GetByIndex (line 82) | func (mr *MockCacheInterfaceMockRecorder[T]) GetByIndex(indexName, key a...
method List (line 88) | func (m *MockCacheInterface[T]) List(namespace string, selector labels.S...
method List (line 97) | func (mr *MockCacheInterfaceMockRecorder[T]) List(namespace, selector an...
type MockNonNamespacedCacheInterface (line 103) | type MockNonNamespacedCacheInterface struct
type MockNonNamespacedCacheInterfaceMockRecorder (line 110) | type MockNonNamespacedCacheInterfaceMockRecorder struct
function NewMockNonNamespacedCacheInterface (line 115) | func NewMockNonNamespacedCacheInterface[T runtime.Object](ctrl *gomock.C...
method EXPECT (line 122) | func (m *MockNonNamespacedCacheInterface[T]) EXPECT() *MockNonNamespaced...
method AddIndexer (line 127) | func (m *MockNonNamespacedCacheInterface[T]) AddIndexer(indexName string...
method AddIndexer (line 133) | func (mr *MockNonNamespacedCacheInterfaceMockRecorder[T]) AddIndexer(ind...
method Get (line 139) | func (m *MockNonNamespacedCacheInterface[T]) Get(name string) (T, error) {
method Get (line 148) | func (mr *MockNonNamespacedCacheInterfaceMockRecorder[T]) Get(name any) ...
method GetByIndex (line 154) | func (m *MockNonNamespacedCacheInterface[T]) GetByIndex(indexName, key s...
method GetByIndex (line 163) | func (mr *MockNonNamespacedCacheInterfaceMockRecorder[T]) GetByIndex(ind...
method List (line 169) | func (m *MockNonNamespacedCacheInterface[T]) List(selector labels.Select...
method List (line 178) | func (mr *MockNonNamespacedCacheInterfaceMockRecorder[T]) List(selector ...
FILE: pkg/generic/fake/controller.go
type MockControllerMeta (line 29) | type MockControllerMeta struct
method EXPECT (line 48) | func (m *MockControllerMeta) EXPECT() *MockControllerMetaMockRecorder {
method AddGenericHandler (line 53) | func (m *MockControllerMeta) AddGenericHandler(ctx context.Context, na...
method AddGenericRemoveHandler (line 65) | func (m *MockControllerMeta) AddGenericRemoveHandler(ctx context.Conte...
method GroupVersionKind (line 77) | func (m *MockControllerMeta) GroupVersionKind() schema.GroupVersionKind {
method Informer (line 91) | func (m *MockControllerMeta) Informer() cache.SharedIndexInformer {
method Updater (line 105) | func (m *MockControllerMeta) Updater() generic.Updater {
type MockControllerMetaMockRecorder (line 36) | type MockControllerMetaMockRecorder struct
method AddGenericHandler (line 59) | func (mr *MockControllerMetaMockRecorder) AddGenericHandler(ctx, name,...
method AddGenericRemoveHandler (line 71) | func (mr *MockControllerMetaMockRecorder) AddGenericRemoveHandler(ctx,...
method GroupVersionKind (line 85) | func (mr *MockControllerMetaMockRecorder) GroupVersionKind() *gomock.C...
method Informer (line 99) | func (mr *MockControllerMetaMockRecorder) Informer() *gomock.Call {
method Updater (line 113) | func (mr *MockControllerMetaMockRecorder) Updater() *gomock.Call {
function NewMockControllerMeta (line 41) | func NewMockControllerMeta(ctrl *gomock.Controller) *MockControllerMeta {
type MockRuntimeMetaObject (line 119) | type MockRuntimeMetaObject struct
method EXPECT (line 138) | func (m *MockRuntimeMetaObject) EXPECT() *MockRuntimeMetaObjectMockRec...
method DeepCopyObject (line 143) | func (m *MockRuntimeMetaObject) DeepCopyObject() runtime.Object {
method GetAnnotations (line 157) | func (m *MockRuntimeMetaObject) GetAnnotations() map[string]string {
method GetCreationTimestamp (line 171) | func (m *MockRuntimeMetaObject) GetCreationTimestamp() v1.Time {
method GetDeletionGracePeriodSeconds (line 185) | func (m *MockRuntimeMetaObject) GetDeletionGracePeriodSeconds() *int64 {
method GetDeletionTimestamp (line 199) | func (m *MockRuntimeMetaObject) GetDeletionTimestamp() *v1.Time {
method GetFinalizers (line 213) | func (m *MockRuntimeMetaObject) GetFinalizers() []string {
method GetGenerateName (line 227) | func (m *MockRuntimeMetaObject) GetGenerateName() string {
method GetGeneration (line 241) | func (m *MockRuntimeMetaObject) GetGeneration() int64 {
method GetLabels (line 255) | func (m *MockRuntimeMetaObject) GetLabels() map[string]string {
method GetManagedFields (line 269) | func (m *MockRuntimeMetaObject) GetManagedFields() []v1.ManagedFieldsE...
method GetName (line 283) | func (m *MockRuntimeMetaObject) GetName() string {
method GetNamespace (line 297) | func (m *MockRuntimeMetaObject) GetNamespace() string {
method GetObjectKind (line 311) | func (m *MockRuntimeMetaObject) GetObjectKind() schema.ObjectKind {
method GetOwnerReferences (line 325) | func (m *MockRuntimeMetaObject) GetOwnerReferences() []v1.OwnerReferen...
method GetResourceVersion (line 339) | func (m *MockRuntimeMetaObject) GetResourceVersion() string {
method GetSelfLink (line 353) | func (m *MockRuntimeMetaObject) GetSelfLink() string {
method GetUID (line 367) | func (m *MockRuntimeMetaObject) GetUID() types.UID {
method SetAnnotations (line 381) | func (m *MockRuntimeMetaObject) SetAnnotations(annotations map[string]...
method SetCreationTimestamp (line 393) | func (m *MockRuntimeMetaObject) SetCreationTimestamp(timestamp v1.Time) {
method SetDeletionGracePeriodSeconds (line 405) | func (m *MockRuntimeMetaObject) SetDeletionGracePeriodSeconds(arg0 *in...
method SetDeletionTimestamp (line 417) | func (m *MockRuntimeMetaObject) SetDeletionTimestamp(timestamp *v1.Tim...
method SetFinalizers (line 429) | func (m *MockRuntimeMetaObject) SetFinalizers(finalizers []string) {
method SetGenerateName (line 441) | func (m *MockRuntimeMetaObject) SetGenerateName(name string) {
method SetGeneration (line 453) | func (m *MockRuntimeMetaObject) SetGeneration(generation int64) {
method SetLabels (line 465) | func (m *MockRuntimeMetaObject) SetLabels(labels map[string]string) {
method SetManagedFields (line 477) | func (m *MockRuntimeMetaObject) SetManagedFields(managedFields []v1.Ma...
method SetName (line 489) | func (m *MockRuntimeMetaObject) SetName(name string) {
method SetNamespace (line 501) | func (m *MockRuntimeMetaObject) SetNamespace(namespace string) {
method SetOwnerReferences (line 513) | func (m *MockRuntimeMetaObject) SetOwnerReferences(arg0 []v1.OwnerRefe...
method SetResourceVersion (line 525) | func (m *MockRuntimeMetaObject) SetResourceVersion(version string) {
method SetSelfLink (line 537) | func (m *MockRuntimeMetaObject) SetSelfLink(selfLink string) {
method SetUID (line 549) | func (m *MockRuntimeMetaObject) SetUID(uid types.UID) {
type MockRuntimeMetaObjectMockRecorder (line 126) | type MockRuntimeMetaObjectMockRecorder struct
method DeepCopyObject (line 151) | func (mr *MockRuntimeMetaObjectMockRecorder) DeepCopyObject() *gomock....
method GetAnnotations (line 165) | func (mr *MockRuntimeMetaObjectMockRecorder) GetAnnotations() *gomock....
method GetCreationTimestamp (line 179) | func (mr *MockRuntimeMetaObjectMockRecorder) GetCreationTimestamp() *g...
method GetDeletionGracePeriodSeconds (line 193) | func (mr *MockRuntimeMetaObjectMockRecorder) GetDeletionGracePeriodSec...
method GetDeletionTimestamp (line 207) | func (mr *MockRuntimeMetaObjectMockRecorder) GetDeletionTimestamp() *g...
method GetFinalizers (line 221) | func (mr *MockRuntimeMetaObjectMockRecorder) GetFinalizers() *gomock.C...
method GetGenerateName (line 235) | func (mr *MockRuntimeMetaObjectMockRecorder) GetGenerateName() *gomock...
method GetGeneration (line 249) | func (mr *MockRuntimeMetaObjectMockRecorder) GetGeneration() *gomock.C...
method GetLabels (line 263) | func (mr *MockRuntimeMetaObjectMockRecorder) GetLabels() *gomock.Call {
method GetManagedFields (line 277) | func (mr *MockRuntimeMetaObjectMockRecorder) GetManagedFields() *gomoc...
method GetName (line 291) | func (mr *MockRuntimeMetaObjectMockRecorder) GetName() *gomock.Call {
method GetNamespace (line 305) | func (mr *MockRuntimeMetaObjectMockRecorder) GetNamespace() *gomock.Ca...
method GetObjectKind (line 319) | func (mr *MockRuntimeMetaObjectMockRecorder) GetObjectKind() *gomock.C...
method GetOwnerReferences (line 333) | func (mr *MockRuntimeMetaObjectMockRecorder) GetOwnerReferences() *gom...
method GetResourceVersion (line 347) | func (mr *MockRuntimeMetaObjectMockRecorder) GetResourceVersion() *gom...
method GetSelfLink (line 361) | func (mr *MockRuntimeMetaObjectMockRecorder) GetSelfLink() *gomock.Call {
method GetUID (line 375) | func (mr *MockRuntimeMetaObjectMockRecorder) GetUID() *gomock.Call {
method SetAnnotations (line 387) | func (mr *MockRuntimeMetaObjectMockRecorder) SetAnnotations(annotation...
method SetCreationTimestamp (line 399) | func (mr *MockRuntimeMetaObjectMockRecorder) SetCreationTimestamp(time...
method SetDeletionGracePeriodSeconds (line 411) | func (mr *MockRuntimeMetaObjectMockRecorder) SetDeletionGracePeriodSec...
method SetDeletionTimestamp (line 423) | func (mr *MockRuntimeMetaObjectMockRecorder) SetDeletionTimestamp(time...
method SetFinalizers (line 435) | func (mr *MockRuntimeMetaObjectMockRecorder) SetFinalizers(finalizers ...
method SetGenerateName (line 447) | func (mr *MockRuntimeMetaObjectMockRecorder) SetGenerateName(name any)...
method SetGeneration (line 459) | func (mr *MockRuntimeMetaObjectMockRecorder) SetGeneration(generation ...
method SetLabels (line 471) | func (mr *MockRuntimeMetaObjectMockRecorder) SetLabels(labels any) *go...
method SetManagedFields (line 483) | func (mr *MockRuntimeMetaObjectMockRecorder) SetManagedFields(managedF...
method SetName (line 495) | func (mr *MockRuntimeMetaObjectMockRecorder) SetName(name any) *gomock...
method SetNamespace (line 507) | func (mr *MockRuntimeMetaObjectMockRecorder) SetNamespace(namespace an...
method SetOwnerReferences (line 519) | func (mr *MockRuntimeMetaObjectMockRecorder) SetOwnerReferences(arg0 a...
method SetResourceVersion (line 531) | func (mr *MockRuntimeMetaObjectMockRecorder) SetResourceVersion(versio...
method SetSelfLink (line 543) | func (mr *MockRuntimeMetaObjectMockRecorder) SetSelfLink(selfLink any)...
method SetUID (line 555) | func (mr *MockRuntimeMetaObjectMockRecorder) SetUID(uid any) *gomock.C...
function NewMockRuntimeMetaObject (line 131) | func NewMockRuntimeMetaObject(ctrl *gomock.Controller) *MockRuntimeMetaO...
type MockControllerInterface (line 561) | type MockControllerInterface struct
type MockControllerInterfaceMockRecorder (line 568) | type MockControllerInterfaceMockRecorder struct
function NewMockControllerInterface (line 573) | func NewMockControllerInterface[T generic.RuntimeMetaObject, TList runti...
method EXPECT (line 580) | func (m *MockControllerInterface[T, TList]) EXPECT() *MockControllerInte...
method AddGenericHandler (line 585) | func (m *MockControllerInterface[T, TList]) AddGenericHandler(ctx contex...
method AddGenericHandler (line 591) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) AddGenericHandl...
method AddGenericRemoveHandler (line 597) | func (m *MockControllerInterface[T, TList]) AddGenericRemoveHandler(ctx ...
method AddGenericRemoveHandler (line 603) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) AddGenericRemov...
method Cache (line 609) | func (m *MockControllerInterface[T, TList]) Cache() generic.CacheInterfa...
method Cache (line 617) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Cache() *gomock...
method Create (line 623) | func (m *MockControllerInterface[T, TList]) Create(arg0 T) (T, error) {
method Create (line 632) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Create(arg0 any...
method Delete (line 638) | func (m *MockControllerInterface[T, TList]) Delete(namespace, name strin...
method Delete (line 646) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Delete(namespac...
method DeleteCollection (line 652) | func (m *MockControllerInterface[T, TList]) DeleteCollection(namespace s...
method DeleteCollection (line 660) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) DeleteCollectio...
method Enqueue (line 666) | func (m *MockControllerInterface[T, TList]) Enqueue(namespace, name stri...
method Enqueue (line 672) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Enqueue(namespa...
method EnqueueAfter (line 678) | func (m *MockControllerInterface[T, TList]) EnqueueAfter(namespace, name...
method EnqueueAfter (line 684) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) EnqueueAfter(na...
method Get (line 690) | func (m *MockControllerInterface[T, TList]) Get(namespace, name string, ...
method Get (line 699) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Get(namespace, ...
method GroupVersionKind (line 705) | func (m *MockControllerInterface[T, TList]) GroupVersionKind() schema.Gr...
method GroupVersionKind (line 713) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) GroupVersionKin...
method Informer (line 719) | func (m *MockControllerInterface[T, TList]) Informer() cache.SharedIndex...
method Informer (line 727) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Informer() *gom...
method List (line 733) | func (m *MockControllerInterface[T, TList]) List(namespace string, opts ...
method List (line 742) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) List(namespace,...
method OnChange (line 748) | func (m *MockControllerInterface[T, TList]) OnChange(ctx context.Context...
method OnChange (line 754) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) OnChange(ctx, n...
method OnRemove (line 760) | func (m *MockControllerInterface[T, TList]) OnRemove(ctx context.Context...
method OnRemove (line 766) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) OnRemove(ctx, n...
method Patch (line 772) | func (m *MockControllerInterface[T, TList]) Patch(namespace, name string...
method Patch (line 785) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Patch(namespace...
method Update (line 792) | func (m *MockControllerInterface[T, TList]) Update(arg0 T) (T, error) {
method Update (line 801) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Update(arg0 any...
method UpdateStatus (line 807) | func (m *MockControllerInterface[T, TList]) UpdateStatus(arg0 T) (T, err...
method UpdateStatus (line 816) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) UpdateStatus(ar...
method Updater (line 822) | func (m *MockControllerInterface[T, TList]) Updater() generic.Updater {
method Updater (line 830) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Updater() *gomo...
method Watch (line 836) | func (m *MockControllerInterface[T, TList]) Watch(namespace string, opts...
method Watch (line 845) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) Watch(namespace...
method WithImpersonation (line 851) | func (m *MockControllerInterface[T, TList]) WithImpersonation(impersonat...
method WithImpersonation (line 860) | func (mr *MockControllerInterfaceMockRecorder[T, TList]) WithImpersonati...
type MockNonNamespacedControllerInterface (line 866) | type MockNonNamespacedControllerInterface struct
type MockNonNamespacedControllerInterfaceMockRecorder (line 873) | type MockNonNamespacedControllerInterfaceMockRecorder struct
function NewMockNonNamespacedControllerInterface (line 878) | func NewMockNonNamespacedControllerInterface[T generic.RuntimeMetaObject...
method EXPECT (line 885) | func (m *MockNonNamespacedControllerInterface[T, TList]) EXPECT() *MockN...
method AddGenericHandler (line 890) | func (m *MockNonNamespacedControllerInterface[T, TList]) AddGenericHandl...
method AddGenericHandler (line 896) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Ad...
method AddGenericRemoveHandler (line 902) | func (m *MockNonNamespacedControllerInterface[T, TList]) AddGenericRemov...
method AddGenericRemoveHandler (line 908) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Ad...
method Cache (line 914) | func (m *MockNonNamespacedControllerInterface[T, TList]) Cache() generic...
method Cache (line 922) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Ca...
method Create (line 928) | func (m *MockNonNamespacedControllerInterface[T, TList]) Create(arg0 T) ...
method Create (line 937) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Cr...
method Delete (line 943) | func (m *MockNonNamespacedControllerInterface[T, TList]) Delete(name str...
method Delete (line 951) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) De...
method Enqueue (line 957) | func (m *MockNonNamespacedControllerInterface[T, TList]) Enqueue(name st...
method Enqueue (line 963) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) En...
method EnqueueAfter (line 969) | func (m *MockNonNamespacedControllerInterface[T, TList]) EnqueueAfter(na...
method EnqueueAfter (line 975) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) En...
method Get (line 981) | func (m *MockNonNamespacedControllerInterface[T, TList]) Get(name string...
method Get (line 990) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Ge...
method GroupVersionKind (line 996) | func (m *MockNonNamespacedControllerInterface[T, TList]) GroupVersionKin...
method GroupVersionKind (line 1004) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Gr...
method Informer (line 1010) | func (m *MockNonNamespacedControllerInterface[T, TList]) Informer() cach...
method Informer (line 1018) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) In...
method List (line 1024) | func (m *MockNonNamespacedControllerInterface[T, TList]) List(opts v1.Li...
method List (line 1033) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Li...
method OnChange (line 1039) | func (m *MockNonNamespacedControllerInterface[T, TList]) OnChange(ctx co...
method OnChange (line 1045) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) On...
method OnRemove (line 1051) | func (m *MockNonNamespacedControllerInterface[T, TList]) OnRemove(ctx co...
method OnRemove (line 1057) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) On...
method Patch (line 1063) | func (m *MockNonNamespacedControllerInterface[T, TList]) Patch(name stri...
method Patch (line 1076) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Pa...
method Update (line 1083) | func (m *MockNonNamespacedControllerInterface[T, TList]) Update(arg0 T) ...
method Update (line 1092) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Up...
method UpdateStatus (line 1098) | func (m *MockNonNamespacedControllerInterface[T, TList]) UpdateStatus(ar...
method UpdateStatus (line 1107) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Up...
method Updater (line 1113) | func (m *MockNonNamespacedControllerInterface[T, TList]) Updater() gener...
method Updater (line 1121) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Up...
method Watch (line 1127) | func (m *MockNonNamespacedControllerInterface[T, TList]) Watch(opts v1.L...
method Watch (line 1136) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Wa...
method WithImpersonation (line 1142) | func (m *MockNonNamespacedControllerInterface[T, TList]) WithImpersonati...
method WithImpersonation (line 1151) | func (mr *MockNonNamespacedControllerInterfaceMockRecorder[T, TList]) Wi...
type MockClientInterface (line 1157) | type MockClientInterface struct
type MockClientInterfaceMockRecorder (line 1164) | type MockClientInterfaceMockRecorder struct
function NewMockClientInterface (line 1169) | func NewMockClientInterface[T generic.RuntimeMetaObject, TList runtime.O...
method EXPECT (line 1176) | func (m *MockClientInterface[T, TList]) EXPECT() *MockClientInterfaceMoc...
method Create (line 1181) | func (m *MockClientInterface[T, TList]) Create(arg0 T) (T, error) {
method Create (line 1190) | func (mr *MockClientInterfaceMockRecorder[T, TList]) Create(arg0 any) *g...
method Delete (line 1196) | func (m *MockClientInterface[T, TList]) Delete(namespace, name string, o...
method Delete (line 1204) | func (mr *MockClientInterfaceMockRecorder[T, TList]) Delete(namespace, n...
method DeleteCollection (line 1210) | func (m *MockClientInterface[T, TList]) DeleteCollection(namespace strin...
method DeleteCollection (line 1218) | func (mr *MockClientInterfaceMockRecorder[T, TList]) DeleteCollection(na...
method Get (line 1224) | func (m *MockClientInterface[T, TList]) Get(namespace, name string, opti...
method Get (line 1233) | func (mr *MockClientInterfaceMockRecorder[T, TList]) Get(namespace, name...
method List (line 1239) | func (m *MockClientInterface[T, TList]) List(namespace string, opts v1.L...
method List (line 1248) | func (mr *MockClientInterfaceMockRecorder[T, TList]) List(namespace, opt...
method Patch (line 1254) | func (m *MockClientInterface[T, TList]) Patch(namespace, name string, pt...
method Patch (line 1267) | func (mr *MockClientInterfaceMockRecorder[T, TList]) Patch(namespace, na...
method Update (line 1274) | func (m *MockClientInterface[T, TList]) Update(arg0 T) (T, error) {
method Update (line 1283) | func (mr *MockClientInterfaceMockRecorder[T, TList]) Update(arg0 any) *g...
method UpdateStatus (line 1289) | func (m *MockClientInterface[T, TList]) UpdateStatus(arg0 T) (T, error) {
method UpdateStatus (line 1298) | func (mr *MockClientInterfaceMockRecorder[T, TList]) UpdateStatus(arg0 a...
method Watch (line 1304) | func (m *MockClientInterface[T, TList]) Watch(namespace string, opts v1....
method Watch (line 1313) | func (mr *MockClientInterfaceMockRecorder[T, TList]) Watch(namespace, op...
method WithImpersonation (line 1319) | func (m *MockClientInterface[T, TList]) WithImpersonation(impersonate re...
method WithImpersonation (line 1328) | func (mr *MockClientInterfaceMockRecorder[T, TList]) WithImpersonation(i...
type MockNonNamespacedClientInterface (line 1334) | type MockNonNamespacedClientInterface struct
type MockNonNamespacedClientInterfaceMockRecorder (line 1341) | type MockNonNamespacedClientInterfaceMockRecorder struct
function NewMockNonNamespacedClientInterface (line 1346) | func NewMockNonNamespacedClientInterface[T generic.RuntimeMetaObject, TL...
method EXPECT (line 1353) | func (m *MockNonNamespacedClientInterface[T, TList]) EXPECT() *MockNonNa...
method Create (line 1358) | func (m *MockNonNamespacedClientInterface[T, TList]) Create(arg0 T) (T, ...
method Create (line 1367) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Create...
method Delete (line 1373) | func (m *MockNonNamespacedClientInterface[T, TList]) Delete(name string,...
method Delete (line 1381) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Delete...
method Get (line 1387) | func (m *MockNonNamespacedClientInterface[T, TList]) Get(name string, op...
method Get (line 1396) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Get(na...
method List (line 1402) | func (m *MockNonNamespacedClientInterface[T, TList]) List(opts v1.ListOp...
method List (line 1411) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) List(o...
method Patch (line 1417) | func (m *MockNonNamespacedClientInterface[T, TList]) Patch(name string, ...
method Patch (line 1430) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Patch(...
method Update (line 1437) | func (m *MockNonNamespacedClientInterface[T, TList]) Update(arg0 T) (T, ...
method Update (line 1446) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Update...
method UpdateStatus (line 1452) | func (m *MockNonNamespacedClientInterface[T, TList]) UpdateStatus(arg0 T...
method UpdateStatus (line 1461) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Update...
method Watch (line 1467) | func (m *MockNonNamespacedClientInterface[T, TList]) Watch(opts v1.ListO...
method Watch (line 1476) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) Watch(...
method WithImpersonation (line 1482) | func (m *MockNonNamespacedClientInterface[T, TList]) WithImpersonation(i...
method WithImpersonation (line 1491) | func (mr *MockNonNamespacedClientInterfaceMockRecorder[T, TList]) WithIm...
FILE: pkg/generic/fake/fake_test.go
function TestInterfaceImplementation (line 13) | func TestInterfaceImplementation(t *testing.T) {
FILE: pkg/generic/generating.go
type GeneratingHandlerOptions (line 8) | type GeneratingHandlerOptions struct
function ConfigureApplyForObject (line 17) | func ConfigureApplyForObject(apply apply.Apply, obj metav1.Object, opts ...
FILE: pkg/generic/generating_test.go
function TestUniqueApplyForResourceVersion (line 20) | func TestUniqueApplyForResourceVersion(t *testing.T) {
function setupTestHandler (line 83) | func setupTestHandler(ctrl *gomock.Controller, apply apply.Apply, opts *...
function serviceToEndpoint (line 101) | func serviceToEndpoint(svc *corev1.Service) *corev1.Endpoints {
FILE: pkg/generic/remove.go
type Updater (line 12) | type Updater
type objectLifecycleAdapter (line 14) | type objectLifecycleAdapter struct
method sync (line 29) | func (o *objectLifecycleAdapter) sync(key string, obj runtime.Object) ...
method constructFinalizerKey (line 59) | func (o *objectLifecycleAdapter) constructFinalizerKey() string {
method hasFinalizer (line 63) | func (o *objectLifecycleAdapter) hasFinalizer(obj runtime.Object) bool {
method removeFinalizer (line 80) | func (o *objectLifecycleAdapter) removeFinalizer(obj runtime.Object) (...
method addFinalizer (line 106) | func (o *objectLifecycleAdapter) addFinalizer(obj runtime.Object) (run...
function NewRemoveHandler (line 20) | func NewRemoveHandler(name string, updater Updater, handler Handler) Han...
FILE: pkg/generic/remove_test.go
function Test_objectLifecycleAdapter_sync (line 13) | func Test_objectLifecycleAdapter_sync(t *testing.T) {
FILE: pkg/genericcondition/condition.go
type GenericCondition (line 5) | type GenericCondition struct
FILE: pkg/gvk/detect.go
function Detect (line 10) | func Detect(obj []byte) (schema.GroupVersionKind, bool, error) {
FILE: pkg/gvk/get.go
function Get (line 11) | func Get(obj runtime.Object) (schema.GroupVersionKind, error) {
function Set (line 29) | func Set(objs ...runtime.Object) error {
function setObject (line 38) | func setObject(obj runtime.Object) error {
FILE: pkg/k8scheck/wait.go
function Wait (line 13) | func Wait(ctx context.Context, config rest.Config) error {
FILE: pkg/kstatus/kstatus.go
constant Reconciling (line 8) | Reconciling = condition.Cond("Reconciling")
constant Stalled (line 9) | Stalled = condition.Cond("Stalled")
function SetError (line 12) | func SetError(obj interface{}, message string) {
function SetTransitioning (line 21) | func SetTransitioning(obj interface{}, message string) {
function SetActive (line 30) | func SetActive(obj interface{}) {
FILE: pkg/kubeconfig/loader.go
function GetNonInteractiveClientConfig (line 11) | func GetNonInteractiveClientConfig(kubeConfig string) clientcmd.ClientCo...
function GetNonInteractiveClientConfigWithContext (line 15) | func GetNonInteractiveClientConfigWithContext(kubeConfig, currentContext...
function GetInteractiveClientConfig (line 19) | func GetInteractiveClientConfig(kubeConfig string) clientcmd.ClientConfig {
function GetClientConfigWithContext (line 23) | func GetClientConfigWithContext(kubeConfig, currentContext string, reade...
function GetClientConfig (line 29) | func GetClientConfig(kubeConfig string, reader io.Reader) clientcmd.Clie...
function GetLoadingRules (line 33) | func GetLoadingRules(kubeConfig string) *clientcmd.ClientConfigLoadingRu...
function canRead (line 51) | func canRead(files []string) (result []string) {
FILE: pkg/kv/split.go
function RSplit (line 6) | func RSplit(s, sep string) (string, string) {
function Split (line 14) | func Split(s, sep string) (string, string) {
function SplitLast (line 19) | func SplitLast(s, sep string) (string, string) {
function SplitMap (line 27) | func SplitMap(s, sep string) map[string]string {
function SplitMapFromSlice (line 31) | func SplitMapFromSlice(parts []string) map[string]string {
function safeIndex (line 40) | func safeIndex(parts []string, idx int) string {
FILE: pkg/leader/leader.go
type Callback (line 15) | type Callback
constant devModeEnvKey (line 17) | devModeEnvKey = "CATTLE_DEV_MODE"
constant leaseDurationEnvKey (line 18) | leaseDurationEnvKey = "CATTLE_ELECTION_LEASE_DURATION"
constant renewDeadlineEnvKey (line 19) | renewDeadlineEnvKey = "CATTLE_ELECTION_RENEW_DEADLINE"
constant retryPeriodEnvKey (line 20) | retryPeriodEnvKey = "CATTLE_ELECTION_RETRY_PERIOD"
constant defaultLeaseDuration (line 22) | defaultLeaseDuration = 45 * time.Second
constant defaultRenewDeadline (line 23) | defaultRenewDeadline = 30 * time.Second
constant defaultRetryPeriod (line 24) | defaultRetryPeriod = 2 * time.Second
constant developmentLeaseDuration (line 26) | developmentLeaseDuration = 45 * time.Hour
constant developmentRenewDeadline (line 27) | developmentRenewDeadline = 30 * time.Hour
function RunOrDie (line 29) | func RunOrDie(ctx context.Context, namespace, name string, client kubern...
function run (line 41) | func run(ctx context.Context, namespace, name string, client kubernetes....
function computeConfig (line 94) | func computeConfig(rl resourcelock.Interface, cbs leaderelection.LeaderC...
FILE: pkg/leader/leader_test.go
function Test_computeConfig (line 13) | func Test_computeConfig(t *testing.T) {
FILE: pkg/leader/manager.go
type Manager (line 12) | type Manager struct
method Start (line 31) | func (m *Manager) Start(ctx context.Context) {
method OnLeaderOrDie (line 47) | func (m *Manager) OnLeaderOrDie(name string, f func(ctx context.Contex...
method OnLeader (line 59) | func (m *Manager) OnLeader(f func(ctx context.Context) error) {
function NewManager (line 22) | func NewManager(namespace, name string, k8s kubernetes.Interface) *Manag...
FILE: pkg/merr/error.go
type Errors (line 5) | type Errors
method Err (line 7) | func (e Errors) Err() error {
method Error (line 11) | func (e Errors) Error() string {
function NewErrors (line 23) | func NewErrors(inErrors ...error) error {
FILE: pkg/name/name.go
function GuessPluralName (line 12) | func GuessPluralName(name string) string {
function suffix (line 36) | func suffix(str, end string) bool {
function Limit (line 44) | func Limit(s string, count int) string {
function Hex (line 53) | func Hex(s string, n int) string {
function SafeConcatName (line 61) | func SafeConcatName(name ...string) string {
FILE: pkg/name/name_test.go
constant string32 (line 10) | string32 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
constant string63 (line 11) | string63 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
constant string64 (line 12) | string64 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
function TestGuessPluralName (line 17) | func TestGuessPluralName(t *testing.T) {
function TestLimit (line 78) | func TestLimit(t *testing.T) {
function TestHex (line 139) | func TestHex(t *testing.T) {
function TestSafeConcatName (line 201) | func TestSafeConcatName(t *testing.T) {
FILE: pkg/needacert/needacert.go
constant byServiceIndex (line 37) | byServiceIndex = "byService"
constant bySecretIndex (line 38) | bySecretIndex = "bySecret"
function Register (line 41) | func Register(ctx context.Context,
function serviceSecret (line 89) | func serviceSecret(obj *corev1.Service) ([]string, error) {
type handler (line 99) | type handler struct
method resolveServiceFromSecret (line 72) | func (h *handler) resolveServiceFromSecret(namespace, name string, obj...
method OnMutationWebhookChange (line 142) | func (h *handler) OnMutationWebhookChange(key string, webhook *adminre...
method OnValidatingWebhookChange (line 186) | func (h *handler) OnValidatingWebhookChange(key string, webhook *admin...
method OnService (line 230) | func (h *handler) OnService(key string, service *corev1.Service) (*cor...
method OnCRDChange (line 268) | func (h *handler) OnCRDChange(key string, crd *apiextv1.CustomResource...
method generateSecret (line 301) | func (h *handler) generateSecret(service *corev1.Service) (*corev1.Sec...
method updateSecret (line 364) | func (h *handler) updateSecret(owner runtime.Object, secret *corev1.Se...
method scheduleNextCertCheck (line 383) | func (h *handler) scheduleNextCertCheck(obj metav1.Object, secret *cor...
method createSecret (line 403) | func (h *handler) createSecret(owner runtime.Object, ns, name string, ...
function validatingWebhookServices (line 110) | func validatingWebhookServices(obj *adminregv1.ValidatingWebhookConfigur...
function crdWebhookServices (line 119) | func crdWebhookServices(obj *apiextv1.CustomResourceDefinition) (result ...
function mutatingWebhookServices (line 133) | func mutatingWebhookServices(obj *adminregv1.MutatingWebhookConfiguratio...
function parseCert (line 440) | func parseCert(secret *corev1.Secret) (*x509.Certificate, error) {
FILE: pkg/needacert/needacert_test.go
function TestCreateSecret (line 22) | func TestCreateSecret(t *testing.T) {
function TestUpdateSecret_ExpiredCert_ManyParallel (line 40) | func TestUpdateSecret_ExpiredCert_ManyParallel(t *testing.T) {
function TestGenerateSecret_NoAnnotation (line 85) | func TestGenerateSecret_NoAnnotation(t *testing.T) {
function TestHandler_OnMutationWebhookChange (line 99) | func TestHandler_OnMutationWebhookChange(t *testing.T) {
function TestHandler_OnValidatingWebhookChange_Parallel (line 201) | func TestHandler_OnValidatingWebhookChange_Parallel(t *testing.T) {
function TestHandler_OnMutationWebhookChange_Parallel (line 311) | func TestHandler_OnMutationWebhookChange_Parallel(t *testing.T) {
function TestHandler_OnService_Parallel (line 406) | func TestHandler_OnService_Parallel(t *testing.T) {
function TestHandler_OnCRDChange_Parallel (line 490) | func TestHandler_OnCRDChange_Parallel(t *testing.T) {
function TestHandler_GenerateSecret_Race (line 594) | func TestHandler_GenerateSecret_Race(t *testing.T) {
function TestHandler_GenerateSecret_Race_MultiService (line 657) | func TestHandler_GenerateSecret_Race_MultiService(t *testing.T) {
function TestHandler_Race_Stress (line 722) | func TestHandler_Race_Stress(t *testing.T) {
function TestHandler_ParseCert_CorruptedData (line 845) | func TestHandler_ParseCert_CorruptedData(t *testing.T) {
function TestHandler_GenerateSecret_Race_SharedSecret (line 863) | func TestHandler_GenerateSecret_Race_SharedSecret(t *testing.T) {
function TestHandler_GenerateSecret_StaleCacheAlreadyExists (line 938) | func TestHandler_GenerateSecret_StaleCacheAlreadyExists(t *testing.T) {
function TestHandler_scheduleNextCertCheck (line 1007) | func TestHandler_scheduleNextCertCheck(t *testing.T) {
FILE: pkg/objectset/objectset.go
type ObjectKey (line 18) | type ObjectKey struct
method String (line 30) | func (o ObjectKey) String() string {
function NewObjectKey (line 23) | func NewObjectKey(obj v1.Object) ObjectKey {
type ObjectKeyByGVK (line 37) | type ObjectKeyByGVK
type ObjectByGVK (line 39) | type ObjectByGVK
method Add (line 41) | func (o ObjectByGVK) Add(obj runtime.Object) (schema.GroupVersionKind,...
type ObjectSet (line 66) | type ObjectSet struct
method ObjectsByGVK (line 85) | func (o *ObjectSet) ObjectsByGVK() ObjectByGVK {
method Contains (line 92) | func (o *ObjectSet) Contains(gk schema.GroupKind, key ObjectKey) bool {
method All (line 97) | func (o *ObjectSet) All() []runtime.Object {
method Add (line 101) | func (o *ObjectSet) Add(objs ...runtime.Object) *ObjectSet {
method add (line 108) | func (o *ObjectSet) add(obj runtime.Object) {
method err (line 132) | func (o *ObjectSet) err(err error) error {
method AddErr (line 137) | func (o *ObjectSet) AddErr(err error) {
method Err (line 141) | func (o *ObjectSet) Err() error {
method Len (line 145) | func (o *ObjectSet) Len() int {
method GVKs (line 149) | func (o *ObjectSet) GVKs() []schema.GroupVersionKind {
method GVKOrder (line 153) | func (o *ObjectSet) GVKOrder(known ...schema.GroupVersionKind) []schem...
method Namespaces (line 171) | func (o *ObjectSet) Namespaces() []string {
function NewObjectSet (line 75) | func NewObjectSet(objs ...runtime.Object) *ObjectSet {
type ObjectByKey (line 181) | type ObjectByKey
method Namespaces (line 183) | func (o ObjectByKey) Namespaces() []string {
type ObjectByGK (line 191) | type ObjectByGK
method Add (line 193) | func (o ObjectByGK) Add(obj runtime.Object) (schema.GroupKind, error) {
FILE: pkg/objectset/objectset_test.go
function TestObjectSet_Namespaces (line 11) | func TestObjectSet_Namespaces(t *testing.T) {
function TestObjectByKey_Namespaces (line 86) | func TestObjectByKey_Namespaces(t *testing.T) {
FILE: pkg/patch/apply.go
function Apply (line 12) | func Apply(original, patch []byte) ([]byte, error) {
function applyStrategicMergePatch (line 30) | func applyStrategicMergePatch(original, patch []byte, lookup strategicpa...
function applyMergePatch (line 46) | func applyMergePatch(original, patch []byte) ([]byte, error) {
function applyJSONPatch (line 50) | func applyJSONPatch(original, patch []byte) ([]byte, error) {
FILE: pkg/patch/style.go
type patchCacheEntry (line 19) | type patchCacheEntry struct
function isJSONPatch (line 24) | func isJSONPatch(patch []byte) bool {
function GetPatchStyle (line 29) | func GetPatchStyle(original, patch []byte) (types.PatchType, strategicpa...
function GetMergeStyle (line 43) | func GetMergeStyle(gvk schema.GroupVersionKind) (types.PatchType, strate...
FILE: pkg/randomtoken/token.go
constant characters (line 9) | characters = "bcdfghjklmnpqrstvwxz2456789"
constant tokenLength (line 10) | tokenLength = 54
function Generate (line 15) | func Generate() (string, error) {
FILE: pkg/ratelimit/none.go
type none (line 13) | type none struct
method TryAccept (line 15) | func (*none) TryAccept() bool { return true }
method Stop (line 16) | func (*none) Stop() {}
method Accept (line 17) | func (*none) Accept() {}
method QPS (line 18) | func (*none) QPS() float32 { return 1 }
method Wait (line 19) | func (*none) Wait(_ context.Context) error { return nil }
FILE: pkg/relatedresource/all.go
constant AllKey (line 6) | AllKey = "_all_"
function TriggerAllKey (line 9) | func TriggerAllKey(namespace, name string, obj runtime.Object) ([]Key, e...
FILE: pkg/relatedresource/changeset.go
type Key (line 16) | type Key struct
function NewKey (line 21) | func NewKey(namespace, name string) Key {
function FromString (line 28) | func FromString(key string) Key {
type ControllerWrapper (line 32) | type ControllerWrapper interface
type ClusterScopedEnqueuer (line 37) | type ClusterScopedEnqueuer interface
type Enqueuer (line 41) | type Enqueuer interface
type Resolver (line 45) | type Resolver
function WatchClusterScoped (line 47) | func WatchClusterScoped(ctx context.Context, name string, resolve Resolv...
function Watch (line 51) | func Watch(ctx context.Context, name string, resolve Resolver, enq Enque...
function watch (line 57) | func watch(ctx context.Context, name string, enq Enqueuer, resolve Resol...
type wrapper (line 98) | type wrapper struct
method Enqueue (line 102) | func (w *wrapper) Enqueue(namespace, name string) {
type informerRegisterer (line 107) | type informerRegisterer interface
function addResourceEventHandler (line 112) | func addResourceEventHandler(ctx context.Context, informer informerRegis...
FILE: pkg/relatedresource/changeset_test.go
function Test_addResourceEventHandler (line 13) | func Test_addResourceEventHandler(t *testing.T) {
type handlerRegistration (line 46) | type handlerRegistration struct
method HasSynced (line 48) | func (h handlerRegistration) HasSynced() bool { return true }
type fakeInformer (line 51) | type fakeInformer struct
method AddEventHandler (line 57) | func (informer *fakeInformer) AddEventHandler(handler cache.ResourceEv...
method RemoveEventHandler (line 65) | func (informer *fakeInformer) RemoveEventHandler(handlerReg cache.Reso...
method add (line 78) | func (informer *fakeInformer) add(obj runtime.Object) {
method waitUntilDeleted (line 84) | func (informer *fakeInformer) waitUntilDeleted(handler cache.ResourceE...
function slicesIndex (line 96) | func slicesIndex[S ~[]E, E comparable](s S, v E) int {
function deleteIndex (line 105) | func deleteIndex[S ~[]E, E any](s S, i int) S {
FILE: pkg/relatedresource/owner.go
function OwnerResolver (line 10) | func OwnerResolver(namespaced bool, apiVersion, kind string) Resolver {
FILE: pkg/resolvehome/main.go
function Resolve (line 13) | func Resolve(s string) (string, error) {
FILE: pkg/schemas/definition/definition.go
function IsMapType (line 9) | func IsMapType(fieldType string) bool {
function IsArrayType (line 13) | func IsArrayType(fieldType string) bool {
function IsReferenceType (line 17) | func IsReferenceType(fieldType string) bool {
function HasReferenceType (line 21) | func HasReferenceType(fieldType string) bool {
function SubType (line 25) | func SubType(fieldType string) string {
function GetType (line 34) | func GetType(data map[string]interface{}) string {
FILE: pkg/schemas/mapper.go
type Mapper (line 10) | type Mapper interface
type Mappers (line 16) | type Mappers
method FromInternal (line 18) | func (m Mappers) FromInternal(data data.Object) {
method ToInternal (line 24) | func (m Mappers) ToInternal(data data.Object) error {
method ModifySchema (line 32) | func (m Mappers) ModifySchema(schema *Schema, schemas *Schemas) error {
type typeMapper (line 41) | type typeMapper struct
method FromInternal (line 50) | func (t *typeMapper) FromInternal(data data.Object) {
method ToInternal (line 86) | func (t *typeMapper) ToInternal(data data.Object) error {
method ModifySchema (line 118) | func (t *typeMapper) ModifySchema(schema *Schema, schemas *Schemas) er...
function addError (line 79) | func addError(errors []error, err error) []error {
FILE: pkg/schemas/mappers/access.go
type Access (line 10) | type Access struct
method FromInternal (line 15) | func (e Access) FromInternal(data data.Object) {
method ToInternal (line 18) | func (e Access) ToInternal(data data.Object) error {
method ModifySchema (line 22) | func (e Access) ModifySchema(schema *types.Schema, schemas *types.Sche...
FILE: pkg/schemas/mappers/alias.go
type AliasField (line 8) | type AliasField struct
method FromInternal (line 20) | func (d AliasField) FromInternal(data data.Object) {
method ToInternal (line 23) | func (d AliasField) ToInternal(data data.Object) error {
method ModifySchema (line 33) | func (d AliasField) ModifySchema(schema *types.Schema, schemas *types....
function NewAlias (line 13) | func NewAlias(field string, names ...string) types.Mapper {
FILE: pkg/schemas/mappers/check.go
function ValidateField (line 9) | func ValidateField(field string, schema *types.Schema) error {
FILE: pkg/schemas/mappers/condition.go
type Condition (line 7) | type Condition struct
method FromInternal (line 13) | func (m Condition) FromInternal(data map[string]interface{}) {
method ToInternal (line 19) | func (m Condition) ToInternal(data map[string]interface{}) error {
method ModifySchema (line 26) | func (m Condition) ModifySchema(s *types.Schema, schemas *types.Schema...
FILE: pkg/schemas/mappers/copy.go
type Copy (line 9) | type Copy struct
method FromInternal (line 13) | func (c Copy) FromInternal(data map[string]interface{}) {
method ToInternal (line 23) | func (c Copy) ToInternal(data map[string]interface{}) error {
method ModifySchema (line 36) | func (c Copy) ModifySchema(s *types.Schema, schemas *types.Schemas) er...
FILE: pkg/schemas/mappers/default.go
type DefaultMapper (line 8) | type DefaultMapper struct
method FromInternal (line 12) | func (d DefaultMapper) FromInternal(data data.Object) {
method ToInternal (line 15) | func (d DefaultMapper) ToInternal(data data.Object) error {
method ModifySchema (line 19) | func (d DefaultMapper) ModifySchema(schema *types.Schema, schemas *typ...
FILE: pkg/schemas/mappers/drop.go
type Drop (line 10) | type Drop struct
method FromInternal (line 15) | func (d Drop) FromInternal(data data.Object) {
method ToInternal (line 19) | func (d Drop) ToInternal(data data.Object) error {
method ModifySchema (line 23) | func (d Drop) ModifySchema(schema *types.Schema, schemas *types.Schema...
FILE: pkg/schemas/mappers/embed.go
type Embed (line 10) | type Embed struct
method FromInternal (line 20) | func (e *Embed) FromInternal(data data.Object) {
method ToInternal (line 30) | func (e *Embed) ToInternal(data data.Object) error {
method ModifySchema (line 53) | func (e *Embed) ModifySchema(schema *types.Schema, schemas *types.Sche...
FILE: pkg/schemas/mappers/empty.go
type EmptyMapper (line 8) | type EmptyMapper struct
method FromInternal (line 11) | func (e *EmptyMapper) FromInternal(data data.Object) {
method ToInternal (line 14) | func (e *EmptyMapper) ToInternal(data data.Object) error {
method ModifySchema (line 18) | func (e *EmptyMapper) ModifySchema(schema *schemas.Schema, schemas *sc...
FILE: pkg/schemas/mappers/enum.go
type Enum (line 13) | type Enum struct
method FromInternal (line 43) | func (d *Enum) FromInternal(data data.Object) {
method ToInternal (line 46) | func (d *Enum) ToInternal(data data.Object) error {
function NewEnum (line 18) | func NewEnum(field string, vals ...string) schemas.Mapper {
function normalize (line 37) | func normalize(v string) string {
FILE: pkg/schemas/mappers/exists.go
type Exists (line 8) | type Exists struct
method FromInternal (line 14) | func (m *Exists) FromInternal(data data.Object) {
method ToInternal (line 20) | func (m *Exists) ToInternal(data data.Object) error {
method ModifySchema (line 27) | func (m *Exists) ModifySchema(s *types.Schema, schemas *types.Schemas)...
FILE: pkg/schemas/mappers/json_keys.go
type JSONKeys (line 9) | type JSONKeys struct
method FromInternal (line 12) | func (d JSONKeys) FromInternal(data data.Object) {
method ToInternal (line 15) | func (d JSONKeys) ToInternal(data data.Object) error {
method ModifySchema (line 26) | func (d JSONKeys) ModifySchema(schema *types.Schema, schemas *types.Sc...
FILE: pkg/schemas/mappers/metadata.go
function NewMetadataMapper (line 7) | func NewMetadataMapper() types.Mapper {
FILE: pkg/schemas/mappers/move.go
type Move (line 13) | type Move struct
method FromInternal (line 20) | func (m Move) FromInternal(d data.Object) {
method ToInternal (line 26) | func (m Move) ToInternal(d data.Object) error {
method ModifySchema (line 33) | func (m Move) ModifySchema(s *types.Schema, schemas *types.Schemas) er...
function getField (line 70) | func getField(schema *types.Schema, schemas *types.Schemas, target strin...
FILE: pkg/schemas/mappers/set_value.go
type SetValue (line 8) | type SetValue struct
method FromInternal (line 14) | func (d SetValue) FromInternal(data data.Object) {
method ToInternal (line 20) | func (d SetValue) ToInternal(data data.Object) error {
method ModifySchema (line 27) | func (d SetValue) ModifySchema(schema *types.Schema, schemas *types.Sc...
FILE: pkg/schemas/mappers/slice_to_map.go
type SliceToMap (line 11) | type SliceToMap struct
method FromInternal (line 16) | func (s SliceToMap) FromInternal(data data.Object) {
method ToInternal (line 31) | func (s SliceToMap) ToInternal(data data.Object) error {
method ModifySchema (line 52) | func (s SliceToMap) ModifySchema(schema *types.Schema, schemas *types....
FILE: pkg/schemas/openapi/generate.go
function MustGenerate (line 14) | func MustGenerate(obj interface{}) *v1.JSONSchemaProps {
function ToOpenAPIFromStruct (line 25) | func ToOpenAPIFromStruct(obj interface{}) (*v1.JSONSchemaProps, error) {
function ToOpenAPI (line 35) | func ToOpenAPI(name string, schemas *types.Schemas) (*v1.JSONSchemaProps...
function populateField (line 52) | func populateField(fieldJSP *v1.JSONSchemaProps, f *types.Field) error {
function typeToProps (line 104) | func typeToProps(typeName string, schemas *types.Schemas, inflight map[s...
function schemaToProps (line 156) | func schemaToProps(schema *types.Schema, schemas *types.Schemas, infligh...
function typeAndSchema (line 192) | func typeAndSchema(typeName string, schemas *types.Schemas) (string, str...
FILE: pkg/schemas/reflection.go
method TypeName (line 21) | func (s *Schemas) TypeName(name string, obj interface{}) *Schemas {
method getTypeName (line 26) | func (s *Schemas) getTypeName(t reflect.Type) string {
method SchemaFor (line 33) | func (s *Schemas) SchemaFor(t reflect.Type) *Schema {
method AddMapperForType (line 38) | func (s *Schemas) AddMapperForType(obj interface{}, mapper ...Mapper) *S...
method MustImport (line 51) | func (s *Schemas) MustImport(obj interface{}, externalOverrides ...inter...
method MustImportAndCustomize (line 62) | func (s *Schemas) MustImportAndCustomize(obj interface{}, f func(*Schema...
function getType (line 67) | func getType(obj interface{}) reflect.Type {
method Import (line 79) | func (s *Schemas) Import(obj interface{}, externalOverrides ...interface...
method newSchemaFromType (line 89) | func (s *Schemas) newSchemaFromType(t reflect.Type, typeName string) (*S...
method MustCustomizeType (line 111) | func (s *Schemas) MustCustomizeType(obj interface{}, f func(*Schema)) *S...
method assignMappers (line 123) | func (s *Schemas) assignMappers(schema *Schema) error {
function canList (line 155) | func canList(schema *Schema) bool {
method importType (line 159) | func (s *Schemas) importType(t reflect.Type, overrides ...reflect.Type) ...
function jsonName (line 193) | func jsonName(f reflect.StructField) string {
function k8sType (line 197) | func k8sType(field reflect.StructField) bool {
function k8sObject (line 202) | func k8sObject(field reflect.StructField) bool {
method readFields (line 207) | func (s *Schemas) readFields(schema *Schema, t reflect.Type) error {
method processFieldsMappers (line 336) | func (s *Schemas) processFieldsMappers(t reflect.Type, fieldName string,...
function applyTag (line 363) | func applyTag(structField *reflect.StructField, field *Field) error {
function toInt (line 425) | func toInt(value string, structField *reflect.StructField) (*int64, erro...
function split (line 433) | func split(input string) []string {
function getKeyValue (line 447) | func getKeyValue(input string) (string, string) {
function deRef (line 460) | func deRef(p reflect.Type) reflect.Type {
method determineSchemaType (line 467) | func (s *Schemas) determineSchemaType(t reflect.Type) (string, error) {
FILE: pkg/schemas/schemas.go
type SchemasInitFunc (line 14) | type SchemasInitFunc
type MapperFactory (line 16) | type MapperFactory
type FieldMapperFactory (line 18) | type FieldMapperFactory
type Schemas (line 20) | type Schemas struct
method Init (line 60) | func (s *Schemas) Init(initFunc SchemasInitFunc) *Schemas {
method MustAddSchemas (line 64) | func (s *Schemas) MustAddSchemas(schema *Schemas) *Schemas {
method AddSchemas (line 72) | func (s *Schemas) AddSchemas(schema *Schemas) (*Schemas, error) {
method RemoveSchema (line 82) | func (s *Schemas) RemoveSchema(schema Schema) *Schemas {
method doRemoveSchema (line 88) | func (s *Schemas) doRemoveSchema(schema Schema) *Schemas {
method MustAddSchema (line 93) | func (s *Schemas) MustAddSchema(schema Schema) *Schemas {
method AddSchema (line 101) | func (s *Schemas) AddSchema(schema Schema) error {
method doAddSchema (line 107) | func (s *Schemas) doAddSchema(schema Schema) error {
method setupDefaults (line 123) | func (s *Schemas) setupDefaults(schema *Schema) (err error) {
method AddFieldMapper (line 143) | func (s *Schemas) AddFieldMapper(name string, factory FieldMapperFacto...
method AddMapper (line 151) | func (s *Schemas) AddMapper(schemaID string, mapper Mapper) *Schemas {
method Schemas (line 156) | func (s *Schemas) Schemas() []*Schema {
method SchemasByID (line 160) | func (s *Schemas) SchemasByID() map[string]*Schema {
method mapper (line 164) | func (s *Schemas) mapper(schemaID string) []Mapper {
method Schema (line 168) | func (s *Schemas) Schema(name string) *Schema {
method doSchema (line 172) | func (s *Schemas) doSchema(name string, lock bool) *Schema {
function EmptySchemas (line 33) | func EmptySchemas() *Schemas {
function NewSchemas (line 38) | func NewSchemas(schemas ...*Schemas) (*Schemas, error) {
method MustCustomizeField (line 193) | func (s *Schema) MustCustomizeField(name string, f func(f Field) Field) ...
FILE: pkg/schemas/types.go
type Schema (line 7) | type Schema struct
method DeepCopy (line 27) | func (s *Schema) DeepCopy() *Schema {
function SetHasObservedGeneration (line 83) | func SetHasObservedGeneration(s *Schema, value bool) {
function HasObservedGeneration (line 93) | func HasObservedGeneration(s *Schema) bool {
type Field (line 100) | type Field struct
type Action (line 119) | type Action struct
type ResourcePermissions (line 124) | type ResourcePermissions
type ResourceVerbs (line 126) | type ResourceVerbs
FILE: pkg/schemas/validation/error.go
type ErrorCode (line 40) | type ErrorCode struct
method Error (line 45) | func (e ErrorCode) Error() string {
FILE: pkg/schemas/validation/validation.go
function CheckFieldCriteria (line 17) | func CheckFieldCriteria(fieldName string, field schemas.Field, value int...
function ConvertSimple (line 89) | func ConvertSimple(fieldType string, value interface{}) (interface{}, er...
FILE: pkg/schemes/all.go
function Register (line 13) | func Register(addToScheme func(*runtime.Scheme) error) error {
function AddToScheme (line 18) | func AddToScheme(scheme *runtime.Scheme) error {
FILE: pkg/seen/strings.go
type Seen (line 5) | type Seen interface
function New (line 9) | func New() Seen {
type strings (line 15) | type strings struct
method String (line 19) | func (s strings) String(value string) bool {
FILE: pkg/signals/signal.go
function SetupSignalHandler (line 32) | func SetupSignalHandler() <-chan struct{} {
function SetupSignalContext (line 39) | func SetupSignalContext() context.Context {
function RequestShutdown (line 60) | func RequestShutdown() bool {
FILE: pkg/slice/contains.go
function ContainsString (line 3) | func ContainsString(slice []string, item string) bool {
function StringsEqual (line 12) | func StringsEqual(left, right []string) bool {
FILE: pkg/start/all.go
type Starter (line 9) | type Starter interface
function All (line 14) | func All(ctx context.Context, threadiness int, starters ...Starter) error {
function Sync (line 21) | func Sync(ctx context.Context, starters ...Starter) error {
function Start (line 33) | func Start(ctx context.Context, threadiness int, starters ...Starter) er...
FILE: pkg/stringset/stringset.go
type Set (line 8) | type Set struct
method Add (line 12) | func (s *Set) Add(ss ...string) {
method Delete (line 21) | func (s *Set) Delete(ss ...string) {
method Has (line 30) | func (s *Set) Has(ss string) bool {
method Len (line 38) | func (s *Set) Len() int {
method Values (line 42) | func (s *Set) Values() []string {
FILE: pkg/stringset/stringset_test.go
function stringPtr (line 9) | func stringPtr(s string) *string {
function Test_Set (line 13) | func Test_Set(t *testing.T) {
FILE: pkg/summary/capi_cluster_test.go
function TestIsCAPICluster (line 10) | func TestIsCAPICluster(t *testing.T) {
function makeClusterObj (line 80) | func makeClusterObj(desiredReplicas, replicas, readyReplicas, availableR...
function TestCheckCAPIClusterTransitioning (line 107) | func TestCheckCAPIClusterTransitioning(t *testing.T) {
function TestCheckTransitioning_CAPIClusterDispatch (line 560) | func TestCheckTransitioning_CAPIClusterDispatch(t *testing.T) {
FILE: pkg/summary/capi_machine_test.go
function TestIsCAPIMachine (line 10) | func TestIsCAPIMachine(t *testing.T) {
function TestParseMessage (line 70) | func TestParseMessage(t *testing.T) {
function TestCheckCAPIMachineTransitioning (line 166) | func TestCheckCAPIMachineTransitioning(t *testing.T) {
function TestCheckTransitioning_CAPIMachineDispatch (line 514) | func TestCheckTransitioning_CAPIMachineDispatch(t *testing.T) {
function TestCheckTransitioning_NonCAPIMachineUnchanged (line 547) | func TestCheckTransitioning_NonCAPIMachineUnchanged(t *testing.T) {
FILE: pkg/summary/capi_machineset_test.go
function TestIsCAPIMachineSet (line 10) | func TestIsCAPIMachineSet(t *testing.T) {
function makeMachineSetObj (line 72) | func makeMachineSetObj(specReplicas, statusReplicas, readyReplicas int64...
function makeMachineDeploymentObj (line 93) | func makeMachineDeploymentObj(specReplicas, statusReplicas, readyReplica...
function TestCheckCAPIMachineSetAndDeploymentTransitioning (line 115) | func TestCheckCAPIMachineSetAndDeploymentTransitioning(t *testing.T) {
function TestIsCAPIMachineDeployment (line 576) | func TestIsCAPIMachineDeployment(t *testing.T) {
function TestCheckTransitioning_CAPIMachineDeploymentDispatch (line 640) | func TestCheckTransitioning_CAPIMachineDeploymentDispatch(t *testing.T) {
FILE: pkg/summary/cattletypes.go
function checkCattleReady (line 9) | func checkCattleReady(obj data.Object, condition []Condition, summary Su...
function checkCattleTypes (line 23) | func checkCattleTypes(obj data.Object, condition []Condition, summary Su...
function checkRelease (line 27) | func checkRelease(obj data.Object, _ []Condition, summary Summary) Summa...
FILE: pkg/summary/cattletypes_test.go
function TestCheckRelease (line 10) | func TestCheckRelease(t *testing.T) {
FILE: pkg/summary/client/interface.go
type Interface (line 12) | type Interface interface
type ExtendedInterface (line 16) | type ExtendedInterface interface
type ResourceInterface (line 21) | type ResourceInterface interface
type NamespaceableResourceInterface (line 26) | type NamespaceableResourceInterface interface
FILE: pkg/summary/client/options.go
type Options (line 7) | type Options struct
FILE: pkg/summary/client/simple.go
type summaryClient (line 15) | type summaryClient struct
method Resource (line 36) | func (c *summaryClient) Resource(resource schema.GroupVersionResource)...
method ResourceWithOptions (line 40) | func (c *summaryClient) ResourceWithOptions(resource schema.GroupVersi...
function NewForDynamicClient (line 21) | func NewForDynamicClient(client dynamic.Interface) Interface {
function NewForExtendedDynamicClient (line 25) | func NewForExtendedDynamicClient(client dynamic.Interface) ExtendedInter...
type summaryResourceClient (line 29) | type summaryResourceClient struct
method Namespace (line 51) | func (c *summaryResourceClient) Namespace(ns string) ResourceInterface {
method List (line 57) | func (c *summaryResourceClient) List(ctx context.Context, opts metav1....
method Watch (line 91) | func (c *summaryResourceClient) Watch(ctx context.Context, opts metav1...
type watcher (line 125) | type watcher struct
method ResultChan (line 130) | func (w watcher) ResultChan() <-chan watch.Event {
function generateSummarizeOpts (line 134) | func generateSummarizeOpts(schema *schemas.Schema) *summary.SummarizeOpt...
FILE: pkg/summary/condition.go
function GetUnstructuredConditions (line 12) | func GetUnstructuredConditions(obj map[string]interface{}) []Condition {
function getRawConditions (line 16) | func getRawConditions(obj data.Object) []data.Object {
function getAnnotationConditions (line 33) | func getAnnotationConditions(obj data.Object) []data.Object {
function getConditions (line 51) | func getConditions(obj data.Object) (result []Condition) {
type Condition (line 58) | type Condition struct
method Type (line 73) | func (c Condition) Type() string {
method Status (line 77) | func (c Condition) Status() string {
method Reason (line 81) | func (c Condition) Reason() string {
method Message (line 85) | func (c Condition) Message() string {
method Equals (line 89) | func (c Condition) Equals(other Condition) bool {
function NewCondition (line 62) | func NewCondition(conditionType, status, reason, message string) Conditi...
function NormalizeConditions (line 96) | func NormalizeConditions(runtimeObj runtime.Object) {
function normalizeAndSetConditions (line 113) | func normalizeAndSetConditions(obj data.Object, conditions []data.Object...
FILE: pkg/summary/condition_test.go
function TestGetRawConditions (line 11) | func TestGetRawConditions(t *testing.T) {
function TestGetAnnotationConditions (line 180) | func TestGetAnnotationConditions(t *testing.T) {
function TestNormalizeConditions (line 309) | func TestNormalizeConditions(t *testing.T) {
function TestNormalizeConditionsNonUnstructured (line 459) | func TestNormalizeConditionsNonUnstructured(t *testing.T) {
FILE: pkg/summary/coretypes.go
function checkHasPodTemplate (line 9) | func checkHasPodTemplate(obj data.Object, condition []Condition, summary...
function checkHasPodSelector (line 27) | func checkHasPodSelector(obj data.Object, condition []Condition, summary...
function checkPod (line 72) | func checkPod(obj data.Object, condition []Condition, summary Summary) S...
function checkPodTemplate (line 82) | func checkPodTemplate(obj data.Object, condition []Condition, summary Su...
function checkPodPullSecret (line 91) | func checkPodPullSecret(obj data.Object, _ []Condition, summary Summary)...
function checkPodProjectedVolume (line 105) | func checkPodProjectedVolume(obj data.Object, _ []Condition, summary Sum...
function addEnvRef (line 129) | func addEnvRef(summary Summary, names map[string]bool, obj data.Object, ...
function checkPodConfigMaps (line 162) | func checkPodConfigMaps(obj data.Object, _ []Condition, summary Summary)...
function checkPodSecrets (line 181) | func checkPodSecrets(obj data.Object, _ []Condition, summary Summary) Su...
function checkPodServiceAccount (line 200) | func checkPodServiceAccount(obj data.Object, _ []Condition, summary Summ...
FILE: pkg/summary/gvk.go
type conditionTypeStatusJSON (line 33) | type conditionTypeStatusJSON struct
type conditionStatusErrorJSON (line 38) | type conditionStatusErrorJSON struct
type ConditionTypeStatusErrorMapping (line 43) | type ConditionTypeStatusErrorMapping
method MarshalJSON (line 45) | func (m ConditionTypeStatusErrorMapping) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 60) | func (m ConditionTypeStatusErrorMapping) UnmarshalJSON(data []byte) er...
FILE: pkg/summary/gvk_test.go
function TestConditionalTypeStatusErrorMapping_MarshalJSON (line 13) | func TestConditionalTypeStatusErrorMapping_MarshalJSON(t *testing.T) {
function TestConditionalTypeStatusErrorMapping_UnmarshalJSON (line 95) | func TestConditionalTypeStatusErrorMapping_UnmarshalJSON(t *testing.T) {
FILE: pkg/summary/informer/informer.go
function NewSummarySharedInformerFactory (line 36) | func NewSummarySharedInformerFactory(client client.Interface, defaultRes...
function NewFilteredSummarySharedInformerFactory (line 42) | func NewFilteredSummarySharedInformerFactory(client client.Interface, de...
type summarySharedInformerFactory (line 53) | type summarySharedInformerFactory struct
method ForResource (line 68) | func (f *summarySharedInformerFactory) ForResource(gvr schema.GroupVer...
method Start (line 85) | func (f *summarySharedInformerFactory) Start(stopCh <-chan struct{}) {
method WaitForCacheSync (line 98) | func (f *summarySharedInformerFactory) WaitForCacheSync(stopCh <-chan ...
function NewFilteredSummaryInformerWithOptions (line 119) | func NewFilteredSummaryInformerWithOptions(
function NewFilteredSummaryInformer (line 154) | func NewFilteredSummaryInformer(client client.Interface, gvr schema.Grou...
type summaryInformer (line 180) | type summaryInformer struct
method Informer (line 187) | func (d *summaryInformer) Informer() cache.SharedIndexInformer {
method Lister (line 191) | func (d *summaryInformer) Lister() cache.GenericLister {
FILE: pkg/summary/informer/informer_test.go
type mockClient (line 18) | type mockClient struct
method Resource (line 23) | func (m *mockClient) Resource(resource schema.GroupVersionResource) cl...
method ResourceWithOptions (line 27) | func (m *mockClient) ResourceWithOptions(resource schema.GroupVersionR...
method Namespace (line 31) | func (m *mockClient) Namespace(string) client.ResourceInterface {
method List (line 35) | func (m *mockClient) List(ctx context.Context, opts metav1.ListOptions...
method Watch (line 46) | func (m *mockClient) Watch(ctx context.Context, opts metav1.ListOption...
type mockClientUnsupported (line 53) | type mockClientUnsupported struct
method IsWatchListSemanticsUnSupported (line 57) | func (m *mockClientUnsupported) IsWatchListSemanticsUnSupported() bool {
type mockClientSupported (line 61) | type mockClientSupported struct
method IsWatchListSemanticsUnSupported (line 65) | func (m *mockClientSupported) IsWatchListSemanticsUnSupported() bool {
function TestNewFilteredSummaryInformer_WatchListSupport (line 69) | func TestNewFilteredSummaryInformer_WatchListSupport(t *testing.T) {
function TestNewFilteredSummaryInformerWithOptions_WatchListSupport (line 159) | func TestNewFilteredSummaryInformerWithOptions_WatchListSupport(t *testi...
FILE: pkg/summary/informer/interface.go
type SummarySharedInformerFactory (line 26) | type SummarySharedInformerFactory interface
type TweakListOptionsFunc (line 34) | type TweakListOptionsFunc
FILE: pkg/summary/informer/watchlist.go
type listWatcherWithWatchListSemanticsWrapper (line 9) | type listWatcherWithWatchListSemanticsWrapper struct
method IsWatchListSemanticsUnSupported (line 24) | func (lw *listWatcherWithWatchListSemanticsWrapper) IsWatchListSemanti...
function toListWatcherWithWatchListSemantics (line 32) | func toListWatcherWithWatchListSemantics(lw *cache.ListWatch, client any...
type unSupportedWatchListSemantics (line 39) | type unSupportedWatchListSemantics interface
function doesClientNotSupportWatchListSemantics (line 48) | func doesClientNotSupportWatchListSemantics(client any) bool {
FILE: pkg/summary/lister/interface.go
type Lister (line 25) | type Lister interface
type NamespaceLister (line 35) | type NamespaceLister interface
FILE: pkg/summary/lister/lister.go
type summaryLister (line 31) | type summaryLister struct
method List (line 42) | func (l *summaryLister) List(selector labels.Selector) (ret []*summary...
method Get (line 50) | func (l *summaryLister) Get(name string) (*summary.SummarizedObject, e...
method Namespace (line 62) | func (l *summaryLister) Namespace(namespace string) NamespaceLister {
function New (line 37) | func New(indexer cache.Indexer, gvr schema.GroupVersionResource) Lister {
type summaryNamespaceLister (line 67) | type summaryNamespaceLister struct
method List (line 74) | func (l *summaryNamespaceLister) List(selector labels.Selector) (ret [...
method Get (line 82) | func (l *summaryNamespaceLister) Get(name string) (*summary.Summarized...
FILE: pkg/summary/lister/shim.go
type summaryListerShim (line 29) | type summaryListerShim struct
method List (line 40) | func (s *summaryListerShim) List(selector labels.Selector) (ret []runt...
method Get (line 54) | func (s *summaryListerShim) Get(name string) (runtime.Object, error) {
method ByNamespace (line 58) | func (s *summaryListerShim) ByNamespace(namespace string) cache.Generi...
function NewRuntimeObjectShim (line 35) | func NewRuntimeObjectShim(lister Lister) cache.GenericLister {
type summaryNamespaceListerShim (line 66) | type summaryNamespaceListerShim struct
method List (line 71) | func (ns *summaryNamespaceListerShim) List(selector labels.Selector) (...
method Get (line 85) | func (ns *summaryNamespaceListerShim) Get(name string) (runtime.Object...
FILE: pkg/summary/summarized.go
type SummarizedObject (line 9) | type SummarizedObject struct
method DeepCopyInto (line 79) | func (in *SummarizedObject) DeepCopyInto(out *SummarizedObject) {
method DeepCopy (line 86) | func (in *SummarizedObject) DeepCopy() *SummarizedObject {
method DeepCopyObject (line 95) | func (in *SummarizedObject) DeepCopyObject() runtime.Object {
type SummarizedObjectList (line 14) | type SummarizedObjectList struct
method DeepCopyInto (line 50) | func (in *SummarizedObjectList) DeepCopyInto(out *SummarizedObjectList) {
method DeepCopy (line 63) | func (in *SummarizedObjectList) DeepCopy() *SummarizedObjectList {
method DeepCopyObject (line 72) | func (in *SummarizedObjectList) DeepCopyObject() runtime.Object {
function Summarized (line 20) | func Summarized(u runtime.Object) *SummarizedObject {
function SummarizedWithOptions (line 24) | func SummarizedWithOptions(u runtime.Object, opts *SummarizeOptions) *Su...
FILE: pkg/summary/summarizers.go
constant kindSep (line 23) | kindSep = ", Kind="
constant reason (line 24) | reason = "%REASON%"
constant checkGVKErrorMappingEnvVar (line 25) | checkGVKErrorMappingEnvVar = "CATTLE_WRANGLER_CHECK_GVK_ERROR_MAPPING"
type Summarizer (line 134) | type Summarizer
function init (line 136) | func init() {
function initializeCheckErrors (line 166) | func initializeCheckErrors() {
function checkGeneration (line 215) | func checkGeneration(obj data.Object, _ []Condition, summary Summary) Su...
function checkOwner (line 243) | func checkOwner(obj data.Object, conditions []Condition, summary Summary...
function checkStatusSummary (line 265) | func checkStatusSummary(obj data.Object, _ []Condition, summary Summary)...
function checkStandard (line 291) | func checkStandard(obj data.Object, _ []Condition, summary Summary) Summ...
function checkErrors (line 327) | func checkErrors(data data.Object, conditions []Condition, summary Summa...
function checkTransitioning (line 362) | func checkTransitioning(obj data.Object, conditions []Condition, summary...
function checkCAPIMachineTransitioning (line 396) | func checkCAPIMachineTransitioning(conditions []Condition, summary Summa...
function checkCAPIMachineSetAndDeploymentTransitioning (line 510) | func checkCAPIMachineSetAndDeploymentTransitioning(obj data.Object, cond...
function checkCAPIClusterTransitioning (line 614) | func checkCAPIClusterTransitioning(obj data.Object, conditions []Conditi...
function checkGenericTransitioning (line 735) | func checkGenericTransitioning(_ data.Object, conditions []Condition, su...
function checkActive (line 816) | func checkActive(obj data.Object, _ []Condition, summary Summary) Summary {
function checkPhase (line 831) | func checkPhase(obj data.Object, _ []Condition, summary Summary) Summary {
function checkInitializing (line 845) | func checkInitializing(obj data.Object, conditions []Condition, summary ...
function checkRemoving (line 860) | func checkRemoving(obj data.Object, conditions []Condition, summary Summ...
function checkLoadBalancer (line 899) | func checkLoadBalancer(obj data.Object, _ []Condition, summary Summary) ...
function isKind (line 915) | func isKind(obj data.Object, kind string, apiGroups ...string) bool {
function checkApplyOwned (line 948) | func checkApplyOwned(obj data.Object, conditions []Condition, summary Su...
function isCAPIMachine (line 981) | func isCAPIMachine(obj data.Object) bool {
function isCAPIMachineSet (line 987) | func isCAPIMachineSet(obj data.Object) bool {
function isCAPIMachineDeployment (line 993) | func isCAPIMachineDeployment(obj data.Object) bool {
function isCAPICluster (line 999) | func isCAPICluster(obj data.Object) bool {
function parseMessage (line 1020) | func parseMessage(message string) (detail, prefix string) {
function nestedInt64 (line 1075) | func nestedInt64(obj data.Object, fields ...string) (int64, bool, error) {
FILE: pkg/summary/summarizers_test.go
function TestCheckErrors (line 11) | func TestCheckErrors(t *testing.T) {
function TestCheckGeneration (line 368) | func TestCheckGeneration(t *testing.T) {
FILE: pkg/summary/summary.go
type Summary (line 13) | type Summary struct
method String (line 38) | func (s Summary) String() string {
method IsReady (line 61) | func (s Summary) IsReady() bool {
method DeepCopy (line 65) | func (s *Summary) DeepCopy() *Summary {
method DeepCopyInto (line 70) | func (s *Summary) DeepCopyInto(v *Summary) {
type SummarizeOptions (line 23) | type SummarizeOptions struct
type Relationship (line 27) | type Relationship struct
function dedupMessage (line 74) | func dedupMessage(messages []string) []string {
function Summarize (line 93) | func Summarize(runtimeObj runtime.Object) Summary {
function SummarizeWithOptions (line 97) | func SummarizeWithOptions(runtimeObj runtime.Object, opts *SummarizeOpti...
FILE: pkg/ticker/ticker.go
function Context (line 8) | func Context(ctx context.Context, duration time.Duration) <-chan time.Ti...
FILE: pkg/trigger/evalall.go
type AllHandler (line 18) | type AllHandler
type Controller (line 20) | type Controller interface
type Trigger (line 26) | type Trigger interface
type trigger (line 32) | type trigger struct
method Key (line 44) | func (e *trigger) Key() relatedresource.Key {
method Trigger (line 51) | func (e *trigger) Trigger() {
method OnTrigger (line 55) | func (e *trigger) OnTrigger(ctx context.Context, name string, handler ...
function New (line 37) | func New(controller Controller) Trigger {
FILE: pkg/unstructured/unstructured.go
function ToUnstructured (line 9) | func ToUnstructured(obj runtime.Object) (*unstructured.Unstructured, err...
FILE: pkg/webhook/match.go
type RouteMatch (line 9) | type RouteMatch struct
method admit (line 23) | func (r *RouteMatch) admit(response *Response, request *Request) error {
method matches (line 30) | func (r *RouteMatch) matches(req *v1.AdmissionRequest) bool {
method getObjType (line 51) | func (r *RouteMatch) getObjType() runtime.Object {
method DryRun (line 78) | func (r *RouteMatch) DryRun(dryRun bool) *RouteMatch { r.dryRun = &dry...
method Group (line 81) | func (r *RouteMatch) Group(group string) *RouteMatch { r.group = group...
method HandleFunc (line 84) | func (r *RouteMatch) HandleFunc(handler HandlerFunc) *RouteMatch { r.h...
method Handle (line 87) | func (r *RouteMatch) Handle(handler Handler) *RouteMatch { r.handler =...
method Kind (line 90) | func (r *RouteMatch) Kind(kind string) *RouteMatch { r.kind = kind; re...
method Name (line 93) | func (r *RouteMatch) Name(name string) *RouteMatch { r.name = name; re...
method Namespace (line 96) | func (r *RouteMatch) Namespace(namespace string) *RouteMatch { r.names...
method Operation (line 99) | func (r *RouteMatch) Operation(operation v1.Operation) *RouteMatch { r...
method Resource (line 102) | func (r *RouteMatch) Resource(resource string) *RouteMatch { r.resourc...
method SubResource (line 105) | func (r *RouteMatch) SubResource(sr string) *RouteMatch { r.subResourc...
method Type (line 108) | func (r *RouteMatch) Type(objType runtime.Object) *RouteMatch { r.objT...
method Version (line 111) | func (r *RouteMatch) Version(version string) *RouteMatch { r.version =...
function checkString (line 58) | func checkString(expected, actual string) bool {
function checkBool (line 65) | func checkBool(expected, actual *bool) bool {
method DryRun (line 116) | func (r *Router) DryRun(dryRun bool) *RouteMatch { return r.next().DryRu...
method Group (line 119) | func (r *Router) Group(group string) *RouteMatch { return r.next().Group...
method HandleFunc (line 122) | func (r *Router) HandleFunc(hf HandlerFunc) *RouteMatch { return r.next(...
method Handle (line 125) | func (r *Router) Handle(handler Handler) *RouteMatch { return r.next().H...
method Kind (line 128) | func (r *Router) Kind(kind string) *RouteMatch { return r.next().Kind(ki...
method Name (line 131) | func (r *Router) Name(name string) *RouteMatch { return r.next().Name(na...
method Namespace (line 134) | func (r *Router) Namespace(namespace string) *RouteMatch { return r.next...
method Operation (line 137) | func (r *Router) Operation(operation v1.Operation) *RouteMatch { return ...
method Resource (line 140) | func (r *Router) Resource(resource string) *RouteMatch { return r.next()...
method SubResource (line 143) | func (r *Router) SubResource(subResource string) *RouteMatch {
method Type (line 148) | func (r *Router) Type(objType runtime.Object) *RouteMatch { return r.nex...
method Version (line 151) | func (r *Router) Version(version string) *RouteMatch { return r.next().V...
FILE: pkg/webhook/router.go
function NewRouter (line 24) | func NewRouter() *Router {
type Router (line 29) | type Router struct
method sendError (line 33) | func (r *Router) sendError(rw http.ResponseWriter, review *v1.Admissio...
method ServeHTTP (line 52) | func (r *Router) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
method admit (line 81) | func (r *Router) admit(response *Response, request *v1.AdmissionReques...
method next (line 96) | func (r *Router) next() *RouteMatch {
function writeResponse (line 43) | func writeResponse(rw http.ResponseWriter, review *v1.AdmissionReview) {
type Request (line 103) | type Request struct
method DecodeOldObject (line 112) | func (r *Request) DecodeOldObject() (runtime.Object, error) {
method DecodeObject (line 120) | func (r *Request) DecodeObject() (runtime.Object, error) {
type Response (line 127) | type Response struct
method CreatePatch (line 133) | func (r *Response) CreatePatch(request *Request, newObj runtime.Object...
type Handler (line 155) | type Handler interface
type HandlerFunc (line 160) | type HandlerFunc
method Admit (line 163) | func (h HandlerFunc) Admit(resp *Response, req *Request) error {
function resourceString (line 168) | func resourceString(ns, name string) string {
FILE: pkg/yaml/objects_test.go
type JSONstruct (line 10) | type JSONstruct struct
type EmbeddedStruct (line 18) | type EmbeddedStruct struct
type CustomStruct (line 21) | type CustomStruct struct
method UnmarshalJSON (line 26) | func (c *CustomStruct) UnmarshalJSON(data []byte) error {
FILE: pkg/yaml/yaml.go
constant buffSize (line 31) | buffSize = 4096
function Unmarshal (line 36) | func Unmarshal(data []byte, v interface{}) error {
function UnmarshalWithJSONDecoder (line 44) | func UnmarshalWithJSONDecoder[T any](yamlReader io.Reader) ([]T, error) {
function ToObjects (line 84) | func ToObjects(in io.Reader) ([]runtime.Object, error) {
function toObjects (line 107) | func toObjects(bytes []byte) ([]runtime.Object, error) {
function Export (line 138) | func Export(objects ...runtime.Object) ([]byte, error) {
function CleanObjectForExport (line 164) | func CleanObjectForExport(obj runtime.Object) (runtime.Object, error) {
function CleanAnnotationsForExport (line 227) | func CleanAnnotationsForExport(annotations map[string]string) map[string...
function cleanMap (line 247) | func cleanMap(annoLabels map[string]string) {
function ToBytes (line 257) | func ToBytes(objects []runtime.Object) ([]byte, error) {
FILE: pkg/yaml/yaml_test.go
function TestUnmarshalWithJSONDecoder_deployment (line 11) | func TestUnmarshalWithJSONDecoder_deployment(t *testing.T) {
function TestUnmarshalWithJSONDecoder_jsonSruct (line 101) | func TestUnmarshalWithJSONDecoder_jsonSruct(t *testing.T) {
Condensed preview — 237 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,056K chars).
[
{
"path": ".github/renovate.json",
"chars": 551,
"preview": "{\n \"extends\": [\n \"github>rancher/renovate-config#release\"\n ],\n \"baseBranchPatterns\": [\n \"main\",\n \"release/v2"
},
{
"path": ".github/workflows/ci.yaml",
"chars": 1547,
"preview": "name: Wrangler CI\n\non:\n push:\n pull_request:\n tags:\n - v*\n branches:\n - 'release/*'\n - 'main'\n\njo"
},
{
"path": ".github/workflows/fossa.yml",
"chars": 1020,
"preview": "name: FOSSA Scanning\n\non:\n push:\n branches: [\"main\", \"master\", \"release/**\"]\n workflow_dispatch:\n\npermissions:\n co"
},
{
"path": ".github/workflows/release.yaml",
"chars": 702,
"preview": "name: Release\n\non:\n push:\n tags:\n - v*\n\njobs:\n release:\n runs-on: ubuntu-latest\n permissions:\n cont"
},
{
"path": ".github/workflows/renovate-vault.yml",
"chars": 855,
"preview": "name: Renovate\non:\n workflow_dispatch:\n inputs:\n logLevel:\n description: \"Override default log level\"\n "
},
{
"path": ".gitignore",
"chars": 422,
"preview": "/.dapper\n/bin\n/dist\n/build\n*.swp\n/.trash-cache\n/trash.lock\n/.idea\n/package/rancher\n/package/agent\n/tests/MANIFEST\n/tests"
},
{
"path": ".golangci.json",
"chars": 3565,
"preview": "{\n \"formatters\": {\n \"enable\": [\n \"gofmt\",\n \"goimports\"\n ],\n \"exclusions\": "
},
{
"path": "CODEOWNERS",
"chars": 38,
"preview": "* @rancher/rancher-squad-frameworks\n"
},
{
"path": "LICENSE",
"chars": 10175,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "Makefile",
"chars": 116,
"preview": "all: generate validate build\n\ngenerate:\n\tgo generate\n\nvalidate:\n\tgo fmt ./...\n\tgo vet ./...\n\nbuild:\n\tgo build ./...\n"
},
{
"path": "README.md",
"chars": 18981,
"preview": "# Wrangler\n\nMost people writing controllers are a bit lost as they find that there is nothing in Kubernetes that is like"
},
{
"path": "VERSION.md",
"chars": 1388,
"preview": "Each wrangler major version supports a range of Kubernetes minor versions. The range supported by each major release lin"
},
{
"path": "codegen.go",
"chars": 224,
"preview": "//go:generate /bin/rm -rf pkg/generated\n//go:generate go run pkg/codegen/main.go\n\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nvar ("
},
{
"path": "go.mod",
"chars": 4487,
"preview": "module github.com/rancher/wrangler/v3\n\ngo 1.25.0\n\nrequire (\n\tgithub.com/evanphx/json-patch v5.9.11+incompatible\n\tgithub."
},
{
"path": "go.sum",
"chars": 25864,
"preview": "cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY=\ncel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX"
},
{
"path": "pkg/apply/apply.go",
"chars": 8573,
"preview": "package apply\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"sync\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/apply/injectors\"\n\t\"github.com/ra"
},
{
"path": "pkg/apply/client_factory.go",
"chars": 405,
"preview": "package apply\n\nimport (\n\t\"k8s.io/apimachinery/pkg/runtime/schema\"\n\t\"k8s.io/client-go/dynamic\"\n\t\"k8s.io/client-go/rest\"\n)"
},
{
"path": "pkg/apply/desiredset.go",
"chars": 7078,
"preview": "package apply\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/apply/injectors\"\n\t\"github.com/"
},
{
"path": "pkg/apply/desiredset_apply.go",
"chars": 6366,
"preview": "package apply\n\nimport (\n\t\"crypto/sha1\"\n\t\"encoding/hex\"\n\t\"errors\"\n\t\"fmt\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus\"\n\n"
},
{
"path": "pkg/apply/desiredset_compare.go",
"chars": 11307,
"preview": "package apply\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"strings\"\n\t\"sync\"\n\n\tjson"
},
{
"path": "pkg/apply/desiredset_compare_test.go",
"chars": 1085,
"preview": "package apply\n\nimport (\n\t\"bytes\"\n\t\"testing\"\n)\n\nfunc TestCompressAndEncode(t *testing.T) {\n\ttestCases := []struct {\n\t\tnam"
},
{
"path": "pkg/apply/desiredset_crud.go",
"chars": 1864,
"preview": "package apply\n\nimport (\n\t\"bytes\"\n\n\tv1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t\"k8s.io/apimachinery/pkg/apis/meta/v1/unst"
},
{
"path": "pkg/apply/desiredset_owner.go",
"chars": 3755,
"preview": "package apply\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/gvk\"\n\n\t\"github.com/rancher/wra"
},
{
"path": "pkg/apply/desiredset_process.go",
"chars": 14403,
"preview": "package apply\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"sort\"\n\t\"sync\"\n\n\tgvk2 \"github.com/rancher/wrangler/v3/pkg/gvk\"\n\t\"gi"
},
{
"path": "pkg/apply/desiredset_process_test.go",
"chars": 7565,
"preview": "package apply\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/objectset\"\n\n\t\"g"
},
{
"path": "pkg/apply/fake/apply.go",
"chars": 2822,
"preview": "package fake\n\nimport (\n\t\"context\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/apply\"\n\t\"github.com/rancher/wrangler/v3/pkg/appl"
},
{
"path": "pkg/apply/injectors/registry.go",
"chars": 427,
"preview": "package injectors\n\nimport \"k8s.io/apimachinery/pkg/runtime\"\n\nvar (\n\tinjectors = map[string]ConfigInjector{}\n\torder ["
},
{
"path": "pkg/apply/reconcilers.go",
"chars": 3948,
"preview": "package apply\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"reflect\"\n\n\tappsv1 \"k8s.io/api/apps/v1\"\n\tbatchv1 \"k8s.io/api/batch/v1\"\n"
},
{
"path": "pkg/broadcast/generic.go",
"chars": 1304,
"preview": "package broadcast\n\nimport (\n\t\"context\"\n\t\"sync\"\n)\n\ntype ConnectFunc func() (chan interface{}, error)\n\ntype Broadcaster st"
},
{
"path": "pkg/cleanup/cleanup.go",
"chars": 491,
"preview": "package cleanup\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\nfunc Cleanup(path string) error {\n\treturn filepath"
},
{
"path": "pkg/clients/clients.go",
"chars": 5838,
"preview": "package clients\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\t\"github.com/rancher/lasso/pkg/controller\"\n\t\"github.com/rancher/lasso/pkg/"
},
{
"path": "pkg/codegen/main.go",
"chars": 2698,
"preview": "package main\n\nimport (\n\tcontrollergen \"github.com/rancher/wrangler/v3/pkg/controller-gen\"\n\t\"github.com/rancher/wrangler/"
},
{
"path": "pkg/condition/condition.go",
"chars": 5857,
"preview": "package condition\n\nimport (\n\t\"reflect\"\n\t\"time\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/generic\"\n\t\"github.com/sirupsen/logr"
},
{
"path": "pkg/controller-gen/OWNERS",
"chars": 147,
"preview": "# See the OWNERS docs at https://go.k8s.io/owners\n\napprovers:\n- lavalamp\n- wojtek-t\n- caesarxuchao\nreviewers:\n- lavalamp"
},
{
"path": "pkg/controller-gen/README.md",
"chars": 260,
"preview": "See [generating-clientset.md](https://git.k8s.io/community/contributors/devel/sig-api-machinery/generating-clientset.md)"
},
{
"path": "pkg/controller-gen/args/args.go",
"chars": 1579,
"preview": "package args\n\nimport (\n\t\"k8s.io/apimachinery/pkg/runtime/schema\"\n\t\"k8s.io/gengo/v2/types\"\n)\n\ntype CustomArgs struct {\n\t/"
},
{
"path": "pkg/controller-gen/args/groupversion.go",
"chars": 3133,
"preview": "package args\n\nimport (\n\tgotypes \"go/types\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"golang.org/x/tools/go/packages\"\n\t\"golang.org"
},
{
"path": "pkg/controller-gen/args/groupversion_test.go",
"chars": 158,
"preview": "package args\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"testing\"\n)\n\nfunc TestScan(t *testing.T) {\n\tcwd, _ := os.Getwd()\n\tfmt.Println(cwd)\n"
},
{
"path": "pkg/controller-gen/args/testdata/test.go",
"chars": 187,
"preview": "package testdata\n\nimport (\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n)\n\ntype SomeStruct struct {\n\tmetav1.TypeMeta "
},
{
"path": "pkg/controller-gen/generators/client_generator.go",
"chars": 4934,
"preview": "/*\nCopyright 2015 The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not u"
},
{
"path": "pkg/controller-gen/generators/factory_go.go",
"chars": 2398,
"preview": "package generators\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"k8s.io/gengo/v2/g"
},
{
"path": "pkg/controller-gen/generators/group_interface_go.go",
"chars": 2227,
"preview": "package generators\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"k8s.io/gengo/v2/g"
},
{
"path": "pkg/controller-gen/generators/group_version_interface_go.go",
"chars": 2864,
"preview": "package generators\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"k8s.io"
},
{
"path": "pkg/controller-gen/generators/list_type_go.go",
"chars": 1507,
"preview": "package generators\n\nimport (\n\t\"io\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"k8s.io/apimachinery/pkg/"
},
{
"path": "pkg/controller-gen/generators/register_group_go.go",
"chars": 803,
"preview": "package generators\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"k8s.io/gengo"
},
{
"path": "pkg/controller-gen/generators/register_group_version_go.go",
"chars": 2936,
"preview": "package generators\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"github"
},
{
"path": "pkg/controller-gen/generators/target.go",
"chars": 586,
"preview": "package generators\n\nimport (\n\t\"path/filepath\"\n\t\"strings\"\n\n\targs \"github.com/rancher/wrangler/v3/pkg/controller-gen/args\""
},
{
"path": "pkg/controller-gen/generators/type_go.go",
"chars": 8372,
"preview": "package generators\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/controller-gen/args\"\n\t\"k8s.io"
},
{
"path": "pkg/controller-gen/generators/util.go",
"chars": 1649,
"preview": "package generators\n\nimport (\n\t\"strings\"\n\n\t\"k8s.io/code-generator/cmd/client-gen/generators/util\"\n\t\"k8s.io/gengo/v2/namer"
},
{
"path": "pkg/controller-gen/main.go",
"chars": 14169,
"preview": "package controllergen\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"k8s.io/gengo/args\"\n\t\"k8s.io/ge"
},
{
"path": "pkg/crd/crd.go",
"chars": 5230,
"preview": "// Package crd handles the dynamic creation and modification of CustomResourceDefinitions.\npackage crd\n\nimport (\n\t\"conte"
},
{
"path": "pkg/crd/crd_test.go",
"chars": 20325,
"preview": "package crd\n\n//go:generate mockgen --build_flags=--mod=mod -package crd -destination ./mockCRDClient_test.go \"k8s.io/api"
},
{
"path": "pkg/crd/init.go",
"chars": 16714,
"preview": "package crd\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/"
},
{
"path": "pkg/crd/mockCRDClient_test.go",
"chars": 10054,
"preview": "// Code generated by MockGen. DO NOT EDIT.\n// Source: k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/type"
},
{
"path": "pkg/crd/print.go",
"chars": 1161,
"preview": "package crd\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/yaml\"\n\t\"k8s.io/apima"
},
{
"path": "pkg/data/convert/convert.go",
"chars": 5890,
"preview": "package convert\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\t\"unicode\"\n\n\t\"golang."
},
{
"path": "pkg/data/convert/convert_test.go",
"chars": 713,
"preview": "package convert\n\nimport (\n\t\"testing\"\n)\n\ntype data struct {\n\tTTLMillis int `json:\"ttl\"`\n}\n\nfunc TestJSON(t *testing.T) {\n"
},
{
"path": "pkg/data/data.go",
"chars": 1300,
"preview": "package data\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n)\n\ntype List []map[string]interface{}\n\ntype Ob"
},
{
"path": "pkg/data/merge.go",
"chars": 1430,
"preview": "package data\n\nfunc MergeMaps(base, overlay map[string]interface{}) map[string]interface{} {\n\tresult := map[string]interf"
},
{
"path": "pkg/data/values.go",
"chars": 3677,
"preview": "// Package data contains functions for working with unstructured values like []interface or map[string]interface{}.\n// I"
},
{
"path": "pkg/data/values_test.go",
"chars": 5806,
"preview": "package data\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestGetValueFromAny(t *testing.T) {\n\tt."
},
{
"path": "pkg/generated/controllers/admissionregistration.k8s.io/factory.go",
"chars": 1972,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/admissionregistration.k8s.io/interface.go",
"chars": 1157,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/admissionregistration.k8s.io/v1/interface.go",
"chars": 2064,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/admissionregistration.k8s.io/v1/mutatingwebhookconfiguration.go",
"chars": 1513,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/admissionregistration.k8s.io/v1/validatingwebhookconfiguration.go",
"chars": 1541,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiextensions.k8s.io/factory.go",
"chars": 1956,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiextensions.k8s.io/interface.go",
"chars": 1141,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiextensions.k8s.io/v1/customresourcedefinition.go",
"chars": 8216,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiextensions.k8s.io/v1/interface.go",
"chars": 1579,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiregistration.k8s.io/factory.go",
"chars": 1960,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiregistration.k8s.io/interface.go",
"chars": 1145,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiregistration.k8s.io/v1/apiservice.go",
"chars": 7366,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apiregistration.k8s.io/v1/interface.go",
"chars": 1463,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apps/factory.go",
"chars": 1938,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apps/interface.go",
"chars": 1116,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apps/v1/daemonset.go",
"chars": 7227,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apps/v1/deployment.go",
"chars": 7295,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apps/v1/interface.go",
"chars": 1956,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/apps/v1/statefulset.go",
"chars": 7363,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/batch/factory.go",
"chars": 1940,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/batch/interface.go",
"chars": 1118,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/batch/v1/interface.go",
"chars": 1352,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/batch/v1/job.go",
"chars": 6820,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/coordination.k8s.io/factory.go",
"chars": 1954,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/coordination.k8s.io/interface.go",
"chars": 1139,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/coordination.k8s.io/v1/interface.go",
"chars": 1389,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/coordination.k8s.io/v1/lease.go",
"chars": 1143,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/factory.go",
"chars": 1938,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/interface.go",
"chars": 1116,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/configmap.go",
"chars": 1191,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/endpoints.go",
"chars": 1191,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/event.go",
"chars": 1135,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/interface.go",
"chars": 4642,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/limitrange.go",
"chars": 1205,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/namespace.go",
"chars": 7266,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/node.go",
"chars": 6926,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/persistentvolume.go",
"chars": 7742,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/persistentvolumeclaim.go",
"chars": 8043,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/pod.go",
"chars": 6819,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/resourcequota.go",
"chars": 7499,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/secret.go",
"chars": 1149,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/service.go",
"chars": 7091,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/core/v1/serviceaccount.go",
"chars": 1261,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/discovery/factory.go",
"chars": 1948,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/discovery/interface.go",
"chars": 1126,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/discovery/v1/endpointslice.go",
"chars": 1252,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/discovery/v1/interface.go",
"chars": 1447,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/extensions/factory.go",
"chars": 1950,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/extensions/interface.go",
"chars": 1163,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/extensions/v1beta1/ingress.go",
"chars": 7217,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/extensions/v1beta1/interface.go",
"chars": 1430,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/networking.k8s.io/factory.go",
"chars": 1950,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/networking.k8s.io/interface.go",
"chars": 1135,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/networking.k8s.io/v1/interface.go",
"chars": 1450,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/networking.k8s.io/v1/networkpolicy.go",
"chars": 1253,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/factory.go",
"chars": 1938,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/interface.go",
"chars": 1116,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/v1/clusterrole.go",
"chars": 1258,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/v1/clusterrolebinding.go",
"chars": 1356,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/v1/interface.go",
"chars": 2361,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/v1/role.go",
"chars": 1121,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/rbac/v1/rolebinding.go",
"chars": 1219,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/storage/factory.go",
"chars": 1944,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/storage/interface.go",
"chars": 1122,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/storage/v1/interface.go",
"chars": 1443,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generated/controllers/storage/v1/storageclass.go",
"chars": 1275,
"preview": "/*\nCopyright The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use th"
},
{
"path": "pkg/generic/cache.go",
"chars": 4739,
"preview": "package generic\n\nimport (\n\t\"fmt\"\n\n\t\"k8s.io/apimachinery/pkg/api/errors\"\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t"
},
{
"path": "pkg/generic/cache_test.go",
"chars": 2518,
"preview": "package generic\n\nimport (\n\t\"testing\"\n\n\tv1 \"k8s.io/api/core/v1\"\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t\"k8s.io/c"
},
{
"path": "pkg/generic/clientMocks_test.go",
"chars": 7872,
"preview": "// Code generated by MockGen. DO NOT EDIT.\n// Source: ./embeddedClient.go\n//\n// Generated by this command:\n//\n//\tmockgen"
},
{
"path": "pkg/generic/controller.go",
"chars": 18213,
"preview": "// Package generic provides generic types and implementations for Controllers, Clients, and Caches.\npackage generic\n\nimp"
},
{
"path": "pkg/generic/controllerFactoryMocks_test.go",
"chars": 9609,
"preview": "// Code generated by MockGen. DO NOT EDIT.\n// Source: github.com/rancher/lasso/pkg/controller (interfaces: SharedControl"
},
{
"path": "pkg/generic/controller_test.go",
"chars": 16756,
"preview": "// Mocks for this test are generated with the following command.\n//go:generate sh -c \"rm -f *Mocks_test.go\"\n//go:generat"
},
{
"path": "pkg/generic/embeddedClient.go",
"chars": 1550,
"preview": "package generic\n\nimport (\n\t\"context\"\n\n\t\"github.com/rancher/lasso/pkg/client\"\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/"
},
{
"path": "pkg/generic/factory.go",
"chars": 3207,
"preview": "package generic\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/rancher/lasso/pkg/log\"\n\t\"github.com/sirupsen/l"
},
{
"path": "pkg/generic/fake/README.md",
"chars": 2731,
"preview": "# Generic Controller, Client, and Cache Mocks\n\nThis package leverages https://github.com/golang/mock for using generic m"
},
{
"path": "pkg/generic/fake/cache.go",
"chars": 6723,
"preview": "// Code generated by MockGen. DO NOT EDIT.\n// Source: ../cache.go\n//\n// Generated by this command:\n//\n//\tmockgen -packag"
},
{
"path": "pkg/generic/fake/controller.go",
"chars": 61345,
"preview": "// Code generated by MockGen. DO NOT EDIT.\n// Source: ../controller.go\n//\n// Generated by this command:\n//\n//\tmockgen -p"
},
{
"path": "pkg/generic/fake/fake_test.go",
"chars": 1183,
"preview": "package fake_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/generic\"\n\t\"github.com/rancher/wrangler/v3/p"
},
{
"path": "pkg/generic/fake/generate.go",
"chars": 364,
"preview": "package fake\n\n//go:generate bash -c \"tmp=$(mktemp); cp ../controller.go $DOLLAR{tmp} && sed -e 's#^\\\\t*comparable$DOLLAR"
},
{
"path": "pkg/generic/generating.go",
"chars": 1009,
"preview": "package generic\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/apply\"\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n)\n\n"
},
{
"path": "pkg/generic/generating_test.go",
"chars": 3538,
"preview": "package generic_test\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/generic\"\n\t\"go.uber.org/mock/g"
},
{
"path": "pkg/generic/remove.go",
"chars": 2331,
"preview": "package generic\n\nimport (\n\t\"k8s.io/apimachinery/pkg/api/meta\"\n\t\"k8s.io/apimachinery/pkg/runtime\"\n)\n\nvar (\n\tfinalizerKey "
},
{
"path": "pkg/generic/remove_test.go",
"chars": 2975,
"preview": "package generic\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\t\"time\"\n\n\tcorev1 \"k8s.io/api/core/v1\"\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/"
},
{
"path": "pkg/genericcondition/condition.go",
"chars": 691,
"preview": "package genericcondition\n\nimport v1 \"k8s.io/api/core/v1\"\n\ntype GenericCondition struct {\n\t// Type of cluster condition.\n"
},
{
"path": "pkg/gvk/detect.go",
"chars": 467,
"preview": "package gvk\n\nimport (\n\t\"encoding/json\"\n\n\tv1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t\"k8s.io/apimachinery/pkg/runtime/sch"
},
{
"path": "pkg/gvk/get.go",
"chars": 1133,
"preview": "package gvk\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/schemes\"\n\t\"k8s.io/apimachinery/pkg/runtime\"\n\t\"k8s.io/"
},
{
"path": "pkg/k8scheck/wait.go",
"chars": 569,
"preview": "package k8scheck\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"k8s.io/client-go/kubernetes\"\n\t\"k8s"
},
{
"path": "pkg/kstatus/kstatus.go",
"chars": 860,
"preview": "package kstatus\n\nimport \"github.com/rancher/wrangler/v3/pkg/condition\"\n\n// Conditions read by the kstatus package\n\nconst"
},
{
"path": "pkg/kubeconfig/loader.go",
"chars": 1809,
"preview": "package kubeconfig\n\nimport (\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"k8s.io/client-go/tools/clientcmd\"\n)\n\nfunc GetNonInteractive"
},
{
"path": "pkg/kv/split.go",
"chars": 1055,
"preview": "package kv\n\nimport \"strings\"\n\n// Like split but if there is only one item return \"\", item\nfunc RSplit(s, sep string) (st"
},
{
"path": "pkg/leader/leader.go",
"chars": 3869,
"preview": "package leader\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"k8s.io/client-go/kubernetes\"\n\t"
},
{
"path": "pkg/leader/leader_test.go",
"chars": 3678,
"preview": "package leader\n\nimport (\n\t\"os\"\n\t\"reflect\"\n\t\"testing\"\n\t\"time\"\n\n\t\"k8s.io/client-go/tools/leaderelection\"\n\t\"k8s.io/client-g"
},
{
"path": "pkg/leader/manager.go",
"chars": 1511,
"preview": "package leader\n\nimport (\n\t\"context\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"k8s.io/client-go/kubernetes\"\n)\n\ntyp"
},
{
"path": "pkg/merr/error.go",
"chars": 569,
"preview": "package merr\n\nimport \"bytes\"\n\ntype Errors []error\n\nfunc (e Errors) Err() error {\n\treturn NewErrors(e...)\n}\n\nfunc (e Erro"
},
{
"path": "pkg/name/name.go",
"chars": 2133,
"preview": "package name\n\nimport (\n\t\"crypto/md5\"\n\t\"crypto/sha256\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"strings\"\n)\n\n// GuessPluralName attempts t"
},
{
"path": "pkg/name/name_test.go",
"chars": 5281,
"preview": "package name\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\nconst (\n\tstring32 = \"aaaaaaaaaaaaaaaaaaaaaaa"
},
{
"path": "pkg/needacert/needacert.go",
"chars": 14156,
"preview": "package needacert\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"fmt\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/mob"
},
{
"path": "pkg/needacert/needacert_test.go",
"chars": 33203,
"preview": "package needacert\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"math\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/generic/fak"
},
{
"path": "pkg/objectset/objectset.go",
"chars": 4340,
"preview": "package objectset\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/gvk\"\n\t\"github.com/rancher/wr"
},
{
"path": "pkg/objectset/objectset_test.go",
"chars": 3504,
"preview": "package objectset\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"k8s.io/apimachinery/pkg/runtime\"\n\t\"k8s.i"
},
{
"path": "pkg/patch/apply.go",
"chars": 1467,
"preview": "package patch\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\tjsonpatch \"github.com/evanphx/json-patch\"\n\t\"k8s.io/apimachinery/pkg/ty"
},
{
"path": "pkg/patch/style.go",
"chars": 1851,
"preview": "package patch\n\nimport (\n\t\"sync\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/gvk\"\n\t\"k8s.io/apimachinery/pkg/runtime\"\n\t\"k8s.io/a"
},
{
"path": "pkg/randomtoken/token.go",
"chars": 436,
"preview": "package randomtoken\n\nimport (\n\t\"crypto/rand\"\n\t\"math/big\"\n)\n\nconst (\n\tcharacters = \"bcdfghjklmnpqrstvwxz2456789\"\n\ttokenL"
},
{
"path": "pkg/ratelimit/none.go",
"chars": 420,
"preview": "package ratelimit\n\nimport (\n\t\"context\"\n\n\t\"k8s.io/client-go/util/flowcontrol\"\n)\n\nvar (\n\tNone = flowcontrol.RateLimiter((*"
},
{
"path": "pkg/relatedresource/all.go",
"chars": 263,
"preview": "package relatedresource\n\nimport \"k8s.io/apimachinery/pkg/runtime\"\n\nconst (\n\tAllKey = \"_all_\"\n)\n\nfunc TriggerAllKey(names"
},
{
"path": "pkg/relatedresource/changeset.go",
"chars": 3090,
"preview": "package relatedresource\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\t\"github.com/sirupsen/logrus\"\n\t\"k8s.io/apimachinery/pkg/api/meta\"\n"
},
{
"path": "pkg/relatedresource/changeset_test.go",
"chars": 2775,
"preview": "package relatedresource\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"testing\"\n\t\"time\"\n\n\t\"k8s.io/apimachinery/pkg/runtime\"\n\t\"k8s.io/clie"
},
{
"path": "pkg/relatedresource/owner.go",
"chars": 939,
"preview": "package relatedresource\n\nimport (\n\t\"k8s.io/apimachinery/pkg/api/meta\"\n\t\"k8s.io/apimachinery/pkg/runtime\"\n)\n\n// OwnerReso"
},
{
"path": "pkg/resolvehome/main.go",
"chars": 406,
"preview": "package resolvehome\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\nvar (\n\thomes = []string{\"$HOME\", \"${HOME}\", \"~\"}\n)\n\nfunc Resolv"
},
{
"path": "pkg/schemas/definition/definition.go",
"chars": 860,
"preview": "package definition\n\nimport (\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n)\n\nfunc IsMapType(fieldType "
},
{
"path": "pkg/schemas/mapper.go",
"chars": 3525,
"preview": "package schemas\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n"
},
{
"path": "pkg/schemas/mappers/access.go",
"chars": 793,
"preview": "package mappers\n\nimport (\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/"
},
{
"path": "pkg/schemas/mappers/alias.go",
"chars": 751,
"preview": "package mappers\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\""
},
{
"path": "pkg/schemas/mappers/check.go",
"chars": 290,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\"\n)\n\nfunc ValidateField(field string"
},
{
"path": "pkg/schemas/mappers/condition.go",
"chars": 570,
"preview": "package mappers\n\nimport (\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\"\n)\n\ntype Condition struct {\n\tField string\n"
},
{
"path": "pkg/schemas/mappers/copy.go",
"chars": 703,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\"\n)\n\ntype Copy struct {\n\tFrom, To st"
},
{
"path": "pkg/schemas/mappers/default.go",
"chars": 470,
"preview": "package mappers\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\""
},
{
"path": "pkg/schemas/mappers/drop.go",
"chars": 618,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/"
},
{
"path": "pkg/schemas/mappers/embed.go",
"chars": 2061,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/"
},
{
"path": "pkg/schemas/mappers/empty.go",
"chars": 386,
"preview": "package mappers\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\t\"github.com/rancher/wrangler/v3/pkg/schemas\"\n)\n\nty"
},
{
"path": "pkg/schemas/mappers/enum.go",
"chars": 1053,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\t\"github.com/rancher/wrangler/v3"
},
{
"path": "pkg/schemas/mappers/exists.go",
"chars": 628,
"preview": "package mappers\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\""
},
{
"path": "pkg/schemas/mappers/json_keys.go",
"chars": 564,
"preview": "package mappers\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n"
},
{
"path": "pkg/schemas/mappers/metadata.go",
"chars": 799,
"preview": "package mappers\n\nimport (\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\"\n)\n\nfunc NewMetadataMapper() types.Mapper {"
},
{
"path": "pkg/schemas/mappers/move.go",
"chars": 2294,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\t\"github.com/rancher/wrangler/v3"
},
{
"path": "pkg/schemas/mappers/set_value.go",
"chars": 638,
"preview": "package mappers\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas\""
},
{
"path": "pkg/schemas/mappers/slice_to_map.go",
"chars": 1551,
"preview": "package mappers\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data\"\n\ttypes \"github.com/rancher/wrangler/v3/pkg/"
},
{
"path": "pkg/schemas/openapi/generate.go",
"chars": 5371,
"preview": "package openapi\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"sort\"\n\t\"strings\"\n\n\ttypes \"github.com/rancher/wrangler/v3/pkg/schemas"
},
{
"path": "pkg/schemas/reflection.go",
"chars": 11915,
"preview": "package schemas\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n\t\""
},
{
"path": "pkg/schemas/schemas.go",
"chars": 4254,
"preview": "package schemas\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n\t\"git"
},
{
"path": "pkg/schemas/types.go",
"chars": 3739,
"preview": "package schemas\n\nimport (\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n)\n\ntype Schema struct {\n\tID "
},
{
"path": "pkg/schemas/validation/error.go",
"chars": 1616,
"preview": "package validation\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n)\n\nvar (\n\tUnauthorized = ErrorCode{\"Unauthorized\", 401}\n\tPermissionDen"
},
{
"path": "pkg/schemas/validation/validation.go",
"chars": 3154,
"preview": "package validation\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/rancher/wrangler/v3/pkg/data/convert\"\n\t\"github.co"
},
{
"path": "pkg/schemes/all.go",
"chars": 445,
"preview": "package schemes\n\nimport (\n\t\"github.com/rancher/lasso/pkg/scheme\"\n\t\"k8s.io/apimachinery/pkg/runtime\"\n)\n\nvar (\n\tAll "
},
{
"path": "pkg/seen/strings.go",
"chars": 333,
"preview": "package seen\n\nimport \"k8s.io/apimachinery/pkg/util/sets\"\n\ntype Seen interface {\n\tString(value string) bool\n}\n\nfunc New()"
},
{
"path": "pkg/signals/signal.go",
"chars": 2162,
"preview": "/*\nCopyright 2017 The Kubernetes Authors.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not us"
},
{
"path": "pkg/signals/signal_posix.go",
"chars": 722,
"preview": "//go:build !windows\n// +build !windows\n\n/*\nCopyright 2017 The Kubernetes Authors.\n\nLicensed under the Apache License, Ve"
},
{
"path": "pkg/signals/signal_windows.go",
"chars": 654,
"preview": "/*\nCopyright 2017 The Kubernetes Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not u"
},
{
"path": "pkg/slice/contains.go",
"chars": 348,
"preview": "package slice\n\nfunc ContainsString(slice []string, item string) bool {\n\tfor _, j := range slice {\n\t\tif j == item {\n\t\t\tre"
}
]
// ... and 37 more files (download for full content)
About this extraction
This page contains the full source code of the rancher/wrangler GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 237 files (933.1 KB), approximately 262.3k tokens, and a symbol index with 1854 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.