├── .github └── workflows │ └── schema-update.yaml ├── .gitignore ├── LICENSE ├── Makefile ├── OWNERS ├── README.md ├── addtoscheme_apps_v1alpha1.go ├── addtoscheme_apps_v1beta1.go ├── addtoscheme_policy_v1alpha1.go ├── apis.go ├── apps ├── pub │ ├── doc.go │ ├── inplace_update.go │ ├── launch_priority.go │ ├── lifecycle.go │ ├── openapi_generated.go │ ├── pod_readiness_gate.go │ ├── pod_unavailable_label.go │ ├── update_priority.go │ └── zz_generated.deepcopy.go ├── v1alpha1 │ ├── advancedcronjob_types.go │ ├── broadcastjob_types.go │ ├── cloneset_types.go │ ├── containerrecreaterequest_types.go │ ├── daemonset_types.go │ ├── doc.go │ ├── ephemeraljob_types.go │ ├── groupversion_info.go │ ├── imagelistpulljob_types.go │ ├── imagepulljob_types.go │ ├── node_pod_probe_types.go │ ├── nodeimage_types.go │ ├── openapi_generated.go │ ├── persistent_pod_state_types.go │ ├── pod_probe_marker_types.go │ ├── resourcedistribution_types.go │ ├── sandboxconfig_types.go │ ├── scatter_strategy.go │ ├── sidecarset_types.go │ ├── statefulset_types.go │ ├── uniteddeployment_types.go │ ├── well_know_annotations.go │ ├── well_known_labels.go │ ├── workloadspread_types.go │ └── zz_generated.deepcopy.go └── v1beta1 │ ├── doc.go │ ├── groupversion_info.go │ ├── openapi_generated.go │ ├── statefulset_types.go │ └── zz_generated.deepcopy.go ├── client ├── clientset │ └── versioned │ │ ├── clientset.go │ │ ├── fake │ │ ├── clientset_generated.go │ │ ├── doc.go │ │ └── register.go │ │ ├── scheme │ │ ├── doc.go │ │ └── register.go │ │ └── typed │ │ ├── apps │ │ ├── v1alpha1 │ │ │ ├── advancedcronjob.go │ │ │ ├── apps_client.go │ │ │ ├── broadcastjob.go │ │ │ ├── cloneset.go │ │ │ ├── containerrecreaterequest.go │ │ │ ├── daemonset.go │ │ │ ├── doc.go │ │ │ ├── ephemeraljob.go │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_advancedcronjob.go │ │ │ │ ├── fake_apps_client.go │ │ │ │ ├── fake_broadcastjob.go │ │ │ │ ├── fake_cloneset.go │ │ │ │ ├── fake_containerrecreaterequest.go │ │ │ │ ├── fake_daemonset.go │ │ │ │ ├── fake_ephemeraljob.go │ │ │ │ ├── fake_imagelistpulljob.go │ │ │ │ ├── fake_imagepulljob.go │ │ │ │ ├── fake_nodeimage.go │ │ │ │ ├── fake_nodepodprobe.go │ │ │ │ ├── fake_persistentpodstate.go │ │ │ │ ├── fake_podprobemarker.go │ │ │ │ ├── fake_resourcedistribution.go │ │ │ │ ├── fake_sidecarset.go │ │ │ │ ├── fake_statefulset.go │ │ │ │ ├── fake_uniteddeployment.go │ │ │ │ └── fake_workloadspread.go │ │ │ ├── generated_expansion.go │ │ │ ├── imagelistpulljob.go │ │ │ ├── imagepulljob.go │ │ │ ├── nodeimage.go │ │ │ ├── nodepodprobe.go │ │ │ ├── persistentpodstate.go │ │ │ ├── podprobemarker.go │ │ │ ├── resourcedistribution.go │ │ │ ├── sidecarset.go │ │ │ ├── statefulset.go │ │ │ ├── uniteddeployment.go │ │ │ └── workloadspread.go │ │ └── v1beta1 │ │ │ ├── apps_client.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_apps_client.go │ │ │ └── fake_statefulset.go │ │ │ ├── generated_expansion.go │ │ │ └── statefulset.go │ │ └── policy │ │ └── v1alpha1 │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_podunavailablebudget.go │ │ └── fake_policy_client.go │ │ ├── generated_expansion.go │ │ ├── podunavailablebudget.go │ │ └── policy_client.go ├── informers │ └── externalversions │ │ ├── apps │ │ ├── interface.go │ │ ├── v1alpha1 │ │ │ ├── advancedcronjob.go │ │ │ ├── broadcastjob.go │ │ │ ├── cloneset.go │ │ │ ├── containerrecreaterequest.go │ │ │ ├── daemonset.go │ │ │ ├── ephemeraljob.go │ │ │ ├── imagelistpulljob.go │ │ │ ├── imagepulljob.go │ │ │ ├── interface.go │ │ │ ├── nodeimage.go │ │ │ ├── nodepodprobe.go │ │ │ ├── persistentpodstate.go │ │ │ ├── podprobemarker.go │ │ │ ├── resourcedistribution.go │ │ │ ├── sidecarset.go │ │ │ ├── statefulset.go │ │ │ ├── uniteddeployment.go │ │ │ └── workloadspread.go │ │ └── v1beta1 │ │ │ ├── interface.go │ │ │ └── statefulset.go │ │ ├── factory.go │ │ ├── generic.go │ │ ├── internalinterfaces │ │ └── factory_interfaces.go │ │ └── policy │ │ ├── interface.go │ │ └── v1alpha1 │ │ ├── interface.go │ │ └── podunavailablebudget.go └── listers │ ├── apps │ ├── v1alpha1 │ │ ├── advancedcronjob.go │ │ ├── broadcastjob.go │ │ ├── cloneset.go │ │ ├── containerrecreaterequest.go │ │ ├── daemonset.go │ │ ├── ephemeraljob.go │ │ ├── expansion_generated.go │ │ ├── imagelistpulljob.go │ │ ├── imagepulljob.go │ │ ├── nodeimage.go │ │ ├── nodepodprobe.go │ │ ├── persistentpodstate.go │ │ ├── podprobemarker.go │ │ ├── resourcedistribution.go │ │ ├── sidecarset.go │ │ ├── statefulset.go │ │ ├── uniteddeployment.go │ │ └── workloadspread.go │ └── v1beta1 │ │ ├── expansion_generated.go │ │ └── statefulset.go │ └── policy │ └── v1alpha1 │ ├── expansion_generated.go │ └── podunavailablebudget.go ├── cmd └── gen-schema │ ├── README.md │ └── main.go ├── examples └── create-update-delete-cloneset │ ├── README.md │ ├── go.mod │ ├── go.sum │ └── main.go ├── go.mod ├── go.sum ├── hack ├── boilerplate.go.txt ├── generate_client.sh ├── generate_openapi.sh └── tool.go ├── pkg ├── apis │ ├── openapi_generated.go │ └── violation_exceptions.list └── kruise │ ├── openapi_generated.go │ └── violation_exceptions.list ├── policy └── v1alpha1 │ ├── doc.go │ ├── groupversion_info.go │ ├── podunavailablebudget_types.go │ ├── resources_deletion_protection.go │ └── zz_generated.deepcopy.go ├── schema ├── openkruise_all_k8s_kustomize_schema.json └── openkruise_kruise_kustomize_schema.json ├── test └── kustomize │ ├── kruise │ ├── advancedcronjob │ │ ├── advancedcronjob.yaml │ │ ├── expected.yaml │ │ └── kustomization.yaml │ ├── advanceddaemonset │ │ ├── advanceddaemonset.yaml │ │ ├── expected.yaml │ │ └── kustomization.yaml │ ├── advancedstatefulset │ │ ├── advancedstatefulset.yaml │ │ ├── expected.yaml │ │ └── kustomization.yaml │ ├── broadcastjob │ │ ├── broadcastjob.yaml │ │ ├── expected.yaml │ │ └── kustomization.yaml │ ├── cloneset │ │ ├── cloneset.yaml │ │ ├── expected.yaml │ │ └── kustomization.yaml │ ├── ephemeraljob │ │ ├── ephemeraljob.yaml │ │ ├── expected.yaml │ │ └── kustomization.yaml │ ├── pod_probe_marker │ │ ├── expected.yaml │ │ ├── kustomization.yaml │ │ └── pod_probe_marker.yaml │ ├── sidecarset │ │ ├── expected.yaml │ │ ├── kustomization.yaml │ │ └── sidecarset.yaml │ ├── uniteddeployment │ │ ├── expected.yaml │ │ ├── kustomization.yaml │ │ └── uniteddeployment.yaml │ └── workloadspread │ │ ├── expected.yaml │ │ ├── kustomization.yaml │ │ └── workloadspread.yaml │ └── test.sh └── utils ├── configuration └── types.go └── scheme └── scheme.go /.github/workflows/schema-update.yaml: -------------------------------------------------------------------------------- 1 | name: Update schema files when api changes 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - 'apps/**' 9 | - 'policy/**' 10 | - 'rollouts/**' 11 | 12 | jobs: 13 | update-schemas: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Set up Go 17 | uses: actions/setup-go@v2 18 | with: 19 | go-version: 1.19 20 | - name: Checkout 21 | uses: actions/checkout@v2 22 | with: 23 | ref: ${{ github.head_ref }} 24 | - name: Update Schema 25 | run: | 26 | go mod tidy 27 | make gen-openapi-schema 28 | - uses: stefanzweifel/git-auto-commit-action@v4 29 | with: 30 | commit_message: Updated OpenAPI schema files -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | /bin/ 8 | 9 | # Test binary, built with `go test -c` 10 | *.test 11 | 12 | # Output of the go coverage tool, specifically when used with LiteIDE 13 | *.out 14 | 15 | # Dependency directories (remove the comment below to include it) 16 | vendor/ 17 | 18 | .idea/ 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CURRENT_DIR=$(shell pwd) 2 | # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) 3 | ifeq (,$(shell go env GOBIN)) 4 | GOBIN=$(shell go env GOPATH)/bin 5 | else 6 | GOBIN=$(shell go env GOBIN) 7 | endif 8 | 9 | # Run go vet against code 10 | vet: 11 | go vet ./... 12 | 13 | # Generate code 14 | generate: controller-gen 15 | #$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." 16 | @hack/generate_client.sh 17 | 18 | CONTROLLER_GEN = $(shell pwd)/bin/controller-gen 19 | controller-gen: ## Download controller-gen locally if necessary. 20 | ifeq ("$(shell $(CONTROLLER_GEN) --version 2> /dev/null)", "Version: v0.16.5") 21 | else 22 | rm -rf $(CONTROLLER_GEN) 23 | $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5) 24 | endif 25 | 26 | OPENAPI_GEN = $(shell pwd)/bin/openapi-gen 27 | module=$(shell go list -f '{{.Module}}' k8s.io/kube-openapi/cmd/openapi-gen | awk '{print $$1}') 28 | module_version=$(shell go list -m $(module) | awk '{print $$NF}' | head -1) 29 | openapi-gen: ## Download openapi-gen locally if necessary. 30 | ifeq ("$(shell command -v $(OPENAPI_GEN) 2> /dev/null)", "") 31 | $(call go-get-tool,$(OPENAPI_GEN),k8s.io/kube-openapi/cmd/openapi-gen@$(module_version)) 32 | else 33 | @echo "openapi-gen is already installed." 34 | endif 35 | 36 | # go-get-tool will 'go get' any package $2 and install it to $1. 37 | PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) 38 | define go-get-tool 39 | @[ -f $(1) ] || { \ 40 | set -e ;\ 41 | TMP_DIR=$$(mktemp -d) ;\ 42 | cd $$TMP_DIR ;\ 43 | go mod init tmp ;\ 44 | echo "Downloading $(2)" ;\ 45 | GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ 46 | rm -rf $$TMP_DIR ;\ 47 | } 48 | endef 49 | 50 | .PHONY: gen-schema-only 51 | gen-schema-only: 52 | go run cmd/gen-schema/main.go 53 | 54 | .PHONY: gen-openapi-schema 55 | gen-openapi-schema: gen-all-openapi 56 | go run cmd/gen-schema/main.go 57 | 58 | .PHONY: gen-all-openapi 59 | @hack/generate_openapi.sh 60 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | approvers: 2 | - FillZpp 3 | - furykerry 4 | reviewers: 5 | - FillZpp 6 | - furykerry 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kruise-api 2 | 3 | Schema of the API types that are served by Kruise. 4 | 5 | ## Purpose 6 | 7 | This library is the canonical location of the Kruise API definition and client. 8 | 9 | We recommend using the go types in this repo. You may serialize them directly to JSON. 10 | 11 | ## What's included 12 | * The `client` package contains the clientset to access Kruise API. 13 | * The `apps` and `policy` packages contain api definition in go 14 | * The `schema` directory contains corresponding openapi schema of kruise source 15 | 16 | ## Versioning 17 | For each `v1.x.y` Kruise release, the corresponding kruise-api will `v1.x.z`. 18 | 19 | Bugfixes in kruise-api will result in the patch version (third digit `z`) changing. PRs that are cherry-picked into an older Kruise release branch will result in an update to the corresponding branch in client-go, with a corresponding new tag changing the patch version. 20 | 21 | ## Where does it come from? 22 | 23 | `kruise-api` is synced from [https://github.com/openkruise/kruise/tree/master/apis](https://github.com/openkruise/kruise/tree/master/apis). 24 | Code changes are made in that location, merged into `openkruise/kruise` and later synced here. 25 | 26 | 27 | ### How to get it 28 | 29 | To get the latest version, use go1.16+ and fetch using the `go get` command. For example: 30 | 31 | ``` 32 | go get github.com/openkruise/kruise-api@latest 33 | ``` 34 | 35 | To get a specific version, use go1.11+ and fetch the desired version using the `go get` command. For example: 36 | 37 | ``` 38 | go get github.com/openkruise/kruise-api@v1.6.0 39 | ``` 40 | 41 | ### How to use it 42 | 43 | please refer to the [example](examples/create-update-delete-cloneset) 44 | 45 | ## Things you should NOT do 46 | 47 | [https://github.com/openkruise/kruise/tree/master/apis](https://github.com/openkruise/kruise/tree/master/apis) is synced to here. 48 | All changes must be made in the former. The latter is read-only. 49 | 50 | -------------------------------------------------------------------------------- /addtoscheme_apps_v1alpha1.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apis 18 | 19 | import ( 20 | "github.com/openkruise/kruise-api/apps/v1alpha1" 21 | ) 22 | 23 | func init() { 24 | // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back 25 | AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) 26 | } 27 | -------------------------------------------------------------------------------- /addtoscheme_apps_v1beta1.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apis 18 | 19 | import ( 20 | "github.com/openkruise/kruise-api/apps/v1beta1" 21 | ) 22 | 23 | func init() { 24 | // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back 25 | AddToSchemes = append(AddToSchemes, v1beta1.SchemeBuilder.AddToScheme) 26 | } 27 | -------------------------------------------------------------------------------- /addtoscheme_policy_v1alpha1.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apis 18 | 19 | import ( 20 | "github.com/openkruise/kruise-api/policy/v1alpha1" 21 | ) 22 | 23 | func init() { 24 | // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back 25 | AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) 26 | } 27 | -------------------------------------------------------------------------------- /apis.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package apis 18 | 19 | import ( 20 | "k8s.io/apimachinery/pkg/runtime" 21 | ) 22 | 23 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 24 | var AddToSchemes runtime.SchemeBuilder 25 | 26 | // AddToScheme adds all Resources to the Scheme 27 | func AddToScheme(s *runtime.Scheme) error { 28 | return AddToSchemes.AddToScheme(s) 29 | } 30 | -------------------------------------------------------------------------------- /apps/pub/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +kubebuilder:object:generate=true 19 | package pub 20 | -------------------------------------------------------------------------------- /apps/pub/launch_priority.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pub 18 | 19 | const ( 20 | // ContainerLaunchPriorityEnvName is the env name that users have to define in pod container 21 | // to identity the launch priority of this container. 22 | ContainerLaunchPriorityEnvName = "KRUISE_CONTAINER_PRIORITY" 23 | // ContainerLaunchBarrierEnvName is the env name that Kruise webhook will inject into containers 24 | // if the pod have configured launch priority. 25 | ContainerLaunchBarrierEnvName = "KRUISE_CONTAINER_BARRIER" 26 | 27 | // ContainerLaunchPriorityKey is the annotation key that users could define in pod annotation 28 | // to make containers in pod launched by ordinal. 29 | ContainerLaunchPriorityKey = "apps.kruise.io/container-launch-priority" 30 | // ContainerLaunchOrdered is the annotation value that indicates containers in pod should be launched by ordinal. 31 | ContainerLaunchOrdered = "Ordered" 32 | 33 | // ContainerLaunchPriorityCompletedKey is the annotation indicates the pod has all its priorities 34 | // patched into its barrier configmap. 35 | ContainerLaunchPriorityCompletedKey = "apps.kruise.io/container-launch-priority-completed" 36 | ) 37 | -------------------------------------------------------------------------------- /apps/pub/lifecycle.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pub 18 | 19 | const ( 20 | LifecycleStateKey = "lifecycle.apps.kruise.io/state" 21 | LifecycleTimestampKey = "lifecycle.apps.kruise.io/timestamp" 22 | 23 | // LifecycleStatePreparingNormal means the Pod is created but unavailable. 24 | // It will translate to Normal state if Lifecycle.PreNormal is hooked. 25 | LifecycleStatePreparingNormal LifecycleStateType = "PreparingNormal" 26 | // LifecycleStateNormal is a necessary condition for Pod to be available. 27 | LifecycleStateNormal LifecycleStateType = "Normal" 28 | // LifecycleStatePreparingUpdate means pod is being prepared to update. 29 | // It will translate to Updating state if Lifecycle.InPlaceUpdate is Not hooked. 30 | LifecycleStatePreparingUpdate LifecycleStateType = "PreparingUpdate" 31 | // LifecycleStateUpdating means the Pod is being updated. 32 | // It will translate to Updated state if the in-place update of the Pod is done. 33 | LifecycleStateUpdating LifecycleStateType = "Updating" 34 | // LifecycleStateUpdated means the Pod is updated, but unavailable. 35 | // It will translate to Normal state if Lifecycle.InPlaceUpdate is hooked. 36 | LifecycleStateUpdated LifecycleStateType = "Updated" 37 | // LifecycleStatePreparingDelete means the Pod is prepared to delete. 38 | // The Pod will be deleted by workload if Lifecycle.PreDelete is Not hooked. 39 | LifecycleStatePreparingDelete LifecycleStateType = "PreparingDelete" 40 | ) 41 | 42 | type LifecycleStateType string 43 | 44 | // Lifecycle contains the hooks for Pod lifecycle. 45 | type Lifecycle struct { 46 | // PreDelete is the hook before Pod to be deleted. 47 | PreDelete *LifecycleHook `json:"preDelete,omitempty"` 48 | // InPlaceUpdate is the hook before Pod to update and after Pod has been updated. 49 | InPlaceUpdate *LifecycleHook `json:"inPlaceUpdate,omitempty"` 50 | // PreNormal is the hook after Pod to be created and ready to be Normal. 51 | PreNormal *LifecycleHook `json:"preNormal,omitempty"` 52 | } 53 | 54 | type LifecycleHook struct { 55 | LabelsHandler map[string]string `json:"labelsHandler,omitempty"` 56 | FinalizersHandler []string `json:"finalizersHandler,omitempty"` 57 | // MarkPodNotReady = true means: 58 | // - Pod will be set to 'NotReady' at preparingDelete/preparingUpdate state. 59 | // - Pod will be restored to 'Ready' at Updated state if it was set to 'NotReady' at preparingUpdate state. 60 | // Currently, MarkPodNotReady only takes effect on InPlaceUpdate & PreDelete hook. 61 | // Default to false. 62 | MarkPodNotReady bool `json:"markPodNotReady,omitempty"` 63 | } 64 | -------------------------------------------------------------------------------- /apps/pub/pod_readiness_gate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pub 18 | 19 | import v1 "k8s.io/api/core/v1" 20 | 21 | const ( 22 | // KruisePodReadyConditionType can support multiple writers, such as: 23 | // - ContainerRecreateRequest; 24 | // - Workload controller, including CloneSet, Advanced StatefulSet, Advanced Daemonset. 25 | // 26 | // If its corresponding condition status was set to "False" by multiple writers, 27 | // the condition status will be considered as "True" only when all these writers 28 | // set it to "True". 29 | KruisePodReadyConditionType v1.PodConditionType = "KruisePodReady" 30 | ) 31 | -------------------------------------------------------------------------------- /apps/pub/pod_unavailable_label.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pub 18 | 19 | import ( 20 | "strings" 21 | ) 22 | 23 | const ( 24 | // PubUnavailablePodLabelPrefix indicates if the pod has this label, both kruise workload and 25 | // pub will determine that the pod is unavailable, even if pod.status.ready=true. 26 | // Main users non-destructive offline and other scenarios 27 | PubUnavailablePodLabelPrefix = "unavailable-pod.kruise.io/" 28 | ) 29 | 30 | func HasUnavailableLabel(labels map[string]string) bool { 31 | if len(labels) == 0 { 32 | return false 33 | } 34 | for key := range labels { 35 | if strings.HasPrefix(key, PubUnavailablePodLabelPrefix) { 36 | return true 37 | } 38 | } 39 | return false 40 | } 41 | -------------------------------------------------------------------------------- /apps/pub/update_priority.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pub 18 | 19 | import ( 20 | "fmt" 21 | 22 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 | ) 24 | 25 | // UpdatePriorityStrategy is the strategy to define priority for pods update. 26 | // Only one of orderPriority and weightPriority can be set. 27 | type UpdatePriorityStrategy struct { 28 | // Order priority terms, pods will be sorted by the value of orderedKey. 29 | // For example: 30 | // ``` 31 | // orderPriority: 32 | // - orderedKey: key1 33 | // - orderedKey: key2 34 | // ``` 35 | // First, all pods which have key1 in labels will be sorted by the value of key1. 36 | // Then, the left pods which have no key1 but have key2 in labels will be sorted by 37 | // the value of key2 and put behind those pods have key1. 38 | OrderPriority []UpdatePriorityOrderTerm `json:"orderPriority,omitempty"` 39 | // Weight priority terms, pods will be sorted by the sum of all terms weight. 40 | WeightPriority []UpdatePriorityWeightTerm `json:"weightPriority,omitempty"` 41 | } 42 | 43 | // UpdatePriorityOrderTerm defines order priority. 44 | type UpdatePriorityOrderTerm struct { 45 | // Calculate priority by value of this key. 46 | // Values of this key, will be sorted by GetInt(val). GetInt method will find the last int in value, 47 | // such as getting 5 in value '5', getting 10 in value 'sts-10'. 48 | OrderedKey string `json:"orderedKey"` 49 | } 50 | 51 | // UpdatePriorityWeightTerm defines weight priority. 52 | type UpdatePriorityWeightTerm struct { 53 | // Weight associated with matching the corresponding matchExpressions, in the range 1-100. 54 | Weight int32 `json:"weight"` 55 | // MatchSelector is used to select by pod's labels. 56 | MatchSelector metav1.LabelSelector `json:"matchSelector"` 57 | } 58 | 59 | // FieldsValidation checks invalid fields in UpdatePriorityStrategy. 60 | func (strategy *UpdatePriorityStrategy) FieldsValidation() error { 61 | if strategy == nil { 62 | return nil 63 | } 64 | 65 | if len(strategy.WeightPriority) > 0 && len(strategy.OrderPriority) > 0 { 66 | return fmt.Errorf("only one of weightPriority and orderPriority can be used") 67 | } 68 | 69 | for _, w := range strategy.WeightPriority { 70 | if w.Weight < 0 || w.Weight > 100 { 71 | return fmt.Errorf("weight must be valid number in the range 1-100") 72 | } 73 | if w.MatchSelector.Size() == 0 { 74 | return fmt.Errorf("selector can not be empty") 75 | } 76 | if _, err := metav1.LabelSelectorAsSelector(&w.MatchSelector); err != nil { 77 | return fmt.Errorf("invalid selector %v", err) 78 | } 79 | } 80 | 81 | for _, o := range strategy.OrderPriority { 82 | if len(o.OrderedKey) == 0 { 83 | return fmt.Errorf("order key can not be empty") 84 | } 85 | } 86 | 87 | return nil 88 | } 89 | -------------------------------------------------------------------------------- /apps/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +groupName=apps.kruise.io 19 | package v1alpha1 20 | -------------------------------------------------------------------------------- /apps/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group 18 | // +kubebuilder:object:generate=true 19 | // +groupName=apps.kruise.io 20 | package v1alpha1 21 | 22 | import ( 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | "github.com/openkruise/kruise-api/utils/scheme" 25 | ) 26 | 27 | var ( 28 | // GroupVersion is group version used to register these objects 29 | GroupVersion = schema.GroupVersion{Group: "apps.kruise.io", Version: "v1alpha1"} 30 | 31 | SchemeGroupVersion = GroupVersion 32 | 33 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 34 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 35 | 36 | // AddToScheme adds the types in this group-version to the given scheme. 37 | AddToScheme = SchemeBuilder.AddToScheme 38 | ) 39 | 40 | // Resource is required by pkg/client/listers/... 41 | func Resource(resource string) schema.GroupResource { 42 | return SchemeGroupVersion.WithResource(resource).GroupResource() 43 | } 44 | -------------------------------------------------------------------------------- /apps/v1alpha1/sandboxconfig_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | // SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs 20 | type SandboxConfig struct { 21 | // +optional 22 | Labels map[string]string `json:"labels,omitempty"` 23 | // +optional 24 | Annotations map[string]string `json:"annotations,omitempty"` 25 | } 26 | -------------------------------------------------------------------------------- /apps/v1alpha1/scatter_strategy.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import "fmt" 20 | 21 | // UpdateScatterStrategy defines a map for label key-value. Pods matches the key-value will be scattered when update. 22 | // 23 | // Example1: [{"Key": "labelA", "Value": "AAA"}] 24 | // It means all pods with label labelA=AAA will be scattered when update. 25 | // 26 | // Example2: [{"Key": "labelA", "Value": "AAA"}, {"Key": "labelB", "Value": "BBB"}] 27 | // Controller will calculate the two sums of pods with labelA=AAA and with labelB=BBB, 28 | // pods with the label that has bigger amount will be scattered first, then pods with the other label will be scattered. 29 | type UpdateScatterStrategy []UpdateScatterTerm 30 | 31 | type UpdateScatterTerm struct { 32 | Key string `json:"key"` 33 | Value string `json:"value"` 34 | } 35 | 36 | // FieldsValidation checks invalid fields in UpdateScatterStrategy. 37 | func (strategy UpdateScatterStrategy) FieldsValidation() error { 38 | if len(strategy) == 0 { 39 | return nil 40 | } 41 | 42 | m := make(map[string]struct{}, len(strategy)) 43 | for _, term := range strategy { 44 | if term.Key == "" { 45 | return fmt.Errorf("key should not be empty") 46 | } 47 | id := term.Key + ":" + term.Value 48 | if _, ok := m[id]; !ok { 49 | m[id] = struct{}{} 50 | } else { 51 | return fmt.Errorf("duplicated key=%v value=%v", term.Key, term.Value) 52 | } 53 | } 54 | 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /apps/v1alpha1/well_know_annotations.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | const ( 4 | // AnnotationUsingEnhancedLiveness indicates that the enhanced liveness probe of pod is enabled. 5 | AnnotationUsingEnhancedLiveness = "apps.kruise.io/using-enhanced-liveness" 6 | // AnnotationUsingEnhancedLiveness indicates the backup probe (json types) of the pod native container livnessprobe configuration. 7 | AnnotationNativeContainerProbeContext = "apps.kruise.io/container-probe-context" 8 | ) 9 | -------------------------------------------------------------------------------- /apps/v1alpha1/well_known_labels.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | const ( 4 | // ControllerRevisionHashLabelKey is used to record the controller revision of current resource. 5 | ControllerRevisionHashLabelKey = "apps.kruise.io/controller-revision-hash" 6 | 7 | // SubSetNameLabelKey is used to record the name of current subset. 8 | SubSetNameLabelKey = "apps.kruise.io/subset-name" 9 | 10 | // SpecifiedDeleteKey indicates this object should be deleted, and the value could be the deletion option. 11 | SpecifiedDeleteKey = "apps.kruise.io/specified-delete" 12 | 13 | // ImagePreDownloadCreatedKey indicates the images of this revision have been pre-downloaded 14 | ImagePreDownloadCreatedKey = "apps.kruise.io/pre-predownload-created" 15 | 16 | // ImagePreDownloadIgnoredKey indicates the images of this revision have been ignored to pre-download 17 | ImagePreDownloadIgnoredKey = "apps.kruise.io/image-predownload-ignored" 18 | // AnnotationSubsetPatchKey indicates the patch for every subset 19 | AnnotationSubsetPatchKey = "apps.kruise.io/subset-patch" 20 | ) 21 | 22 | // Sidecar container environment variable definitions which are used to enable SidecarTerminator to take effect on the sidecar container. 23 | const ( 24 | // KruiseTerminateSidecarEnv is an env name, which represents a switch to enable sidecar terminator. 25 | // The corresponding value is "true", which means apply a crr to kill sidecar using kruise-daemon. 26 | KruiseTerminateSidecarEnv = "KRUISE_TERMINATE_SIDECAR_WHEN_JOB_EXIT" 27 | 28 | // KruiseTerminateSidecarWithImageEnv is an env name, which refers to an image that will replace the original image 29 | // using in-place update strategy to kill sidecar. This image must be given if you want to use in-place update 30 | // strategy to terminate sidecar containers. 31 | KruiseTerminateSidecarWithImageEnv = "KRUISE_TERMINATE_SIDECAR_WHEN_JOB_EXIT_WITH_IMAGE" 32 | ) 33 | -------------------------------------------------------------------------------- /apps/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +groupName=apps.kruise.io 19 | package v1beta1 20 | -------------------------------------------------------------------------------- /apps/v1beta1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1beta1 contains API Schema definitions for the apps v1beta1 API group 18 | // +kubebuilder:object:generate=true 19 | // +groupName=apps.kruise.io 20 | package v1beta1 21 | 22 | import ( 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | "github.com/openkruise/kruise-api/utils/scheme" 25 | ) 26 | 27 | var ( 28 | // GroupVersion is group version used to register these objects 29 | GroupVersion = schema.GroupVersion{Group: "apps.kruise.io", Version: "v1beta1"} 30 | 31 | SchemeGroupVersion = GroupVersion 32 | 33 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 34 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 35 | 36 | // AddToScheme adds the types in this group-version to the given scheme. 37 | AddToScheme = SchemeBuilder.AddToScheme 38 | ) 39 | 40 | // Resource is required by pkg/client/listers/... 41 | func Resource(resource string) schema.GroupResource { 42 | return SchemeGroupVersion.WithResource(resource).GroupResource() 43 | } 44 | -------------------------------------------------------------------------------- /client/clientset/versioned/fake/clientset_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | clientset "github.com/openkruise/kruise-api/client/clientset/versioned" 23 | appsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1alpha1" 24 | fakeappsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1alpha1/fake" 25 | appsv1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1" 26 | fakeappsv1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1/fake" 27 | policyv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/policy/v1alpha1" 28 | fakepolicyv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/policy/v1alpha1/fake" 29 | "k8s.io/apimachinery/pkg/runtime" 30 | "k8s.io/apimachinery/pkg/watch" 31 | "k8s.io/client-go/discovery" 32 | fakediscovery "k8s.io/client-go/discovery/fake" 33 | "k8s.io/client-go/testing" 34 | ) 35 | 36 | // NewSimpleClientset returns a clientset that will respond with the provided objects. 37 | // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 38 | // without applying any validations and/or defaults. It shouldn't be considered a replacement 39 | // for a real clientset and is mostly useful in simple unit tests. 40 | func NewSimpleClientset(objects ...runtime.Object) *Clientset { 41 | o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 42 | for _, obj := range objects { 43 | if err := o.Add(obj); err != nil { 44 | panic(err) 45 | } 46 | } 47 | 48 | cs := &Clientset{tracker: o} 49 | cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 50 | cs.AddReactor("*", "*", testing.ObjectReaction(o)) 51 | cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 52 | gvr := action.GetResource() 53 | ns := action.GetNamespace() 54 | watch, err := o.Watch(gvr, ns) 55 | if err != nil { 56 | return false, nil, err 57 | } 58 | return true, watch, nil 59 | }) 60 | 61 | return cs 62 | } 63 | 64 | // Clientset implements clientset.Interface. Meant to be embedded into a 65 | // struct to get a default implementation. This makes faking out just the method 66 | // you want to test easier. 67 | type Clientset struct { 68 | testing.Fake 69 | discovery *fakediscovery.FakeDiscovery 70 | tracker testing.ObjectTracker 71 | } 72 | 73 | func (c *Clientset) Discovery() discovery.DiscoveryInterface { 74 | return c.discovery 75 | } 76 | 77 | func (c *Clientset) Tracker() testing.ObjectTracker { 78 | return c.tracker 79 | } 80 | 81 | var ( 82 | _ clientset.Interface = &Clientset{} 83 | _ testing.FakeClient = &Clientset{} 84 | ) 85 | 86 | // AppsV1alpha1 retrieves the AppsV1alpha1Client 87 | func (c *Clientset) AppsV1alpha1() appsv1alpha1.AppsV1alpha1Interface { 88 | return &fakeappsv1alpha1.FakeAppsV1alpha1{Fake: &c.Fake} 89 | } 90 | 91 | // AppsV1beta1 retrieves the AppsV1beta1Client 92 | func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface { 93 | return &fakeappsv1beta1.FakeAppsV1beta1{Fake: &c.Fake} 94 | } 95 | 96 | // PolicyV1alpha1 retrieves the PolicyV1alpha1Client 97 | func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface { 98 | return &fakepolicyv1alpha1.FakePolicyV1alpha1{Fake: &c.Fake} 99 | } 100 | -------------------------------------------------------------------------------- /client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | appsv1beta1 "github.com/openkruise/kruise-api/apps/v1beta1" 24 | policyv1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var scheme = runtime.NewScheme() 33 | var codecs = serializer.NewCodecFactory(scheme) 34 | 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | appsv1alpha1.AddToScheme, 37 | appsv1beta1.AddToScheme, 38 | policyv1alpha1.AddToScheme, 39 | } 40 | 41 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 42 | // of clientsets, like in: 43 | // 44 | // import ( 45 | // "k8s.io/client-go/kubernetes" 46 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 47 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 48 | // ) 49 | // 50 | // kclientset, _ := kubernetes.NewForConfig(c) 51 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 52 | // 53 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 54 | // correctly. 55 | var AddToScheme = localSchemeBuilder.AddToScheme 56 | 57 | func init() { 58 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 59 | utilruntime.Must(AddToScheme(scheme)) 60 | } 61 | -------------------------------------------------------------------------------- /client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package scheme 20 | 21 | import ( 22 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | appsv1beta1 "github.com/openkruise/kruise-api/apps/v1beta1" 24 | policyv1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var Scheme = runtime.NewScheme() 33 | var Codecs = serializer.NewCodecFactory(Scheme) 34 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | appsv1alpha1.AddToScheme, 37 | appsv1beta1.AddToScheme, 38 | policyv1alpha1.AddToScheme, 39 | } 40 | 41 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 42 | // of clientsets, like in: 43 | // 44 | // import ( 45 | // "k8s.io/client-go/kubernetes" 46 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 47 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 48 | // ) 49 | // 50 | // kclientset, _ := kubernetes.NewForConfig(c) 51 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 52 | // 53 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 54 | // correctly. 55 | var AddToScheme = localSchemeBuilder.AddToScheme 56 | 57 | func init() { 58 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 59 | utilruntime.Must(AddToScheme(Scheme)) 60 | } 61 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1alpha1 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1alpha1/fake/fake_apps_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1alpha1" 23 | rest "k8s.io/client-go/rest" 24 | testing "k8s.io/client-go/testing" 25 | ) 26 | 27 | type FakeAppsV1alpha1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeAppsV1alpha1) AdvancedCronJobs(namespace string) v1alpha1.AdvancedCronJobInterface { 32 | return &FakeAdvancedCronJobs{c, namespace} 33 | } 34 | 35 | func (c *FakeAppsV1alpha1) BroadcastJobs(namespace string) v1alpha1.BroadcastJobInterface { 36 | return &FakeBroadcastJobs{c, namespace} 37 | } 38 | 39 | func (c *FakeAppsV1alpha1) CloneSets(namespace string) v1alpha1.CloneSetInterface { 40 | return &FakeCloneSets{c, namespace} 41 | } 42 | 43 | func (c *FakeAppsV1alpha1) ContainerRecreateRequests(namespace string) v1alpha1.ContainerRecreateRequestInterface { 44 | return &FakeContainerRecreateRequests{c, namespace} 45 | } 46 | 47 | func (c *FakeAppsV1alpha1) DaemonSets(namespace string) v1alpha1.DaemonSetInterface { 48 | return &FakeDaemonSets{c, namespace} 49 | } 50 | 51 | func (c *FakeAppsV1alpha1) EphemeralJobs(namespace string) v1alpha1.EphemeralJobInterface { 52 | return &FakeEphemeralJobs{c, namespace} 53 | } 54 | 55 | func (c *FakeAppsV1alpha1) ImageListPullJobs(namespace string) v1alpha1.ImageListPullJobInterface { 56 | return &FakeImageListPullJobs{c, namespace} 57 | } 58 | 59 | func (c *FakeAppsV1alpha1) ImagePullJobs(namespace string) v1alpha1.ImagePullJobInterface { 60 | return &FakeImagePullJobs{c, namespace} 61 | } 62 | 63 | func (c *FakeAppsV1alpha1) NodeImages() v1alpha1.NodeImageInterface { 64 | return &FakeNodeImages{c} 65 | } 66 | 67 | func (c *FakeAppsV1alpha1) NodePodProbes() v1alpha1.NodePodProbeInterface { 68 | return &FakeNodePodProbes{c} 69 | } 70 | 71 | func (c *FakeAppsV1alpha1) PersistentPodStates(namespace string) v1alpha1.PersistentPodStateInterface { 72 | return &FakePersistentPodStates{c, namespace} 73 | } 74 | 75 | func (c *FakeAppsV1alpha1) PodProbeMarkers(namespace string) v1alpha1.PodProbeMarkerInterface { 76 | return &FakePodProbeMarkers{c, namespace} 77 | } 78 | 79 | func (c *FakeAppsV1alpha1) ResourceDistributions() v1alpha1.ResourceDistributionInterface { 80 | return &FakeResourceDistributions{c} 81 | } 82 | 83 | func (c *FakeAppsV1alpha1) SidecarSets() v1alpha1.SidecarSetInterface { 84 | return &FakeSidecarSets{c} 85 | } 86 | 87 | func (c *FakeAppsV1alpha1) StatefulSets(namespace string) v1alpha1.StatefulSetInterface { 88 | return &FakeStatefulSets{c, namespace} 89 | } 90 | 91 | func (c *FakeAppsV1alpha1) UnitedDeployments(namespace string) v1alpha1.UnitedDeploymentInterface { 92 | return &FakeUnitedDeployments{c, namespace} 93 | } 94 | 95 | func (c *FakeAppsV1alpha1) WorkloadSpreads(namespace string) v1alpha1.WorkloadSpreadInterface { 96 | return &FakeWorkloadSpreads{c, namespace} 97 | } 98 | 99 | // RESTClient returns a RESTClient that is used to communicate 100 | // with API server by this client implementation. 101 | func (c *FakeAppsV1alpha1) RESTClient() rest.Interface { 102 | var ret *rest.RESTClient 103 | return ret 104 | } 105 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | type AdvancedCronJobExpansion interface{} 22 | 23 | type BroadcastJobExpansion interface{} 24 | 25 | type CloneSetExpansion interface{} 26 | 27 | type ContainerRecreateRequestExpansion interface{} 28 | 29 | type DaemonSetExpansion interface{} 30 | 31 | type EphemeralJobExpansion interface{} 32 | 33 | type ImageListPullJobExpansion interface{} 34 | 35 | type ImagePullJobExpansion interface{} 36 | 37 | type NodeImageExpansion interface{} 38 | 39 | type NodePodProbeExpansion interface{} 40 | 41 | type PersistentPodStateExpansion interface{} 42 | 43 | type PodProbeMarkerExpansion interface{} 44 | 45 | type ResourceDistributionExpansion interface{} 46 | 47 | type SidecarSetExpansion interface{} 48 | 49 | type StatefulSetExpansion interface{} 50 | 51 | type UnitedDeploymentExpansion interface{} 52 | 53 | type WorkloadSpreadExpansion interface{} 54 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1beta1/apps_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | import ( 22 | "net/http" 23 | 24 | v1beta1 "github.com/openkruise/kruise-api/apps/v1beta1" 25 | "github.com/openkruise/kruise-api/client/clientset/versioned/scheme" 26 | rest "k8s.io/client-go/rest" 27 | ) 28 | 29 | type AppsV1beta1Interface interface { 30 | RESTClient() rest.Interface 31 | StatefulSetsGetter 32 | } 33 | 34 | // AppsV1beta1Client is used to interact with features provided by the apps.kruise.io group. 35 | type AppsV1beta1Client struct { 36 | restClient rest.Interface 37 | } 38 | 39 | func (c *AppsV1beta1Client) StatefulSets(namespace string) StatefulSetInterface { 40 | return newStatefulSets(c, namespace) 41 | } 42 | 43 | // NewForConfig creates a new AppsV1beta1Client for the given config. 44 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 45 | // where httpClient was generated with rest.HTTPClientFor(c). 46 | func NewForConfig(c *rest.Config) (*AppsV1beta1Client, error) { 47 | config := *c 48 | if err := setConfigDefaults(&config); err != nil { 49 | return nil, err 50 | } 51 | httpClient, err := rest.HTTPClientFor(&config) 52 | if err != nil { 53 | return nil, err 54 | } 55 | return NewForConfigAndClient(&config, httpClient) 56 | } 57 | 58 | // NewForConfigAndClient creates a new AppsV1beta1Client for the given config and http client. 59 | // Note the http client provided takes precedence over the configured transport values. 60 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AppsV1beta1Client, error) { 61 | config := *c 62 | if err := setConfigDefaults(&config); err != nil { 63 | return nil, err 64 | } 65 | client, err := rest.RESTClientForConfigAndClient(&config, h) 66 | if err != nil { 67 | return nil, err 68 | } 69 | return &AppsV1beta1Client{client}, nil 70 | } 71 | 72 | // NewForConfigOrDie creates a new AppsV1beta1Client for the given config and 73 | // panics if there is an error in the config. 74 | func NewForConfigOrDie(c *rest.Config) *AppsV1beta1Client { 75 | client, err := NewForConfig(c) 76 | if err != nil { 77 | panic(err) 78 | } 79 | return client 80 | } 81 | 82 | // New creates a new AppsV1beta1Client for the given RESTClient. 83 | func New(c rest.Interface) *AppsV1beta1Client { 84 | return &AppsV1beta1Client{c} 85 | } 86 | 87 | func setConfigDefaults(config *rest.Config) error { 88 | gv := v1beta1.SchemeGroupVersion 89 | config.GroupVersion = &gv 90 | config.APIPath = "/apis" 91 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 92 | 93 | if config.UserAgent == "" { 94 | config.UserAgent = rest.DefaultKubernetesUserAgent() 95 | } 96 | 97 | return nil 98 | } 99 | 100 | // RESTClient returns a RESTClient that is used to communicate 101 | // with API server by this client implementation. 102 | func (c *AppsV1beta1Client) RESTClient() rest.Interface { 103 | if c == nil { 104 | return nil 105 | } 106 | return c.restClient 107 | } 108 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1beta1 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1beta1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1beta1/fake/fake_apps_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | v1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1" 23 | rest "k8s.io/client-go/rest" 24 | testing "k8s.io/client-go/testing" 25 | ) 26 | 27 | type FakeAppsV1beta1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface { 32 | return &FakeStatefulSets{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeAppsV1beta1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/apps/v1beta1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | type StatefulSetExpansion interface{} 22 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/policy/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1alpha1 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/policy/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/policy/v1alpha1/fake/fake_policy_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/policy/v1alpha1" 23 | rest "k8s.io/client-go/rest" 24 | testing "k8s.io/client-go/testing" 25 | ) 26 | 27 | type FakePolicyV1alpha1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakePolicyV1alpha1) PodUnavailableBudgets(namespace string) v1alpha1.PodUnavailableBudgetInterface { 32 | return &FakePodUnavailableBudgets{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakePolicyV1alpha1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/policy/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | type PodUnavailableBudgetExpansion interface{} 22 | -------------------------------------------------------------------------------- /client/clientset/versioned/typed/policy/v1alpha1/policy_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "net/http" 23 | 24 | "github.com/openkruise/kruise-api/client/clientset/versioned/scheme" 25 | v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1" 26 | rest "k8s.io/client-go/rest" 27 | ) 28 | 29 | type PolicyV1alpha1Interface interface { 30 | RESTClient() rest.Interface 31 | PodUnavailableBudgetsGetter 32 | } 33 | 34 | // PolicyV1alpha1Client is used to interact with features provided by the policy.kruise.io group. 35 | type PolicyV1alpha1Client struct { 36 | restClient rest.Interface 37 | } 38 | 39 | func (c *PolicyV1alpha1Client) PodUnavailableBudgets(namespace string) PodUnavailableBudgetInterface { 40 | return newPodUnavailableBudgets(c, namespace) 41 | } 42 | 43 | // NewForConfig creates a new PolicyV1alpha1Client for the given config. 44 | // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), 45 | // where httpClient was generated with rest.HTTPClientFor(c). 46 | func NewForConfig(c *rest.Config) (*PolicyV1alpha1Client, error) { 47 | config := *c 48 | if err := setConfigDefaults(&config); err != nil { 49 | return nil, err 50 | } 51 | httpClient, err := rest.HTTPClientFor(&config) 52 | if err != nil { 53 | return nil, err 54 | } 55 | return NewForConfigAndClient(&config, httpClient) 56 | } 57 | 58 | // NewForConfigAndClient creates a new PolicyV1alpha1Client for the given config and http client. 59 | // Note the http client provided takes precedence over the configured transport values. 60 | func NewForConfigAndClient(c *rest.Config, h *http.Client) (*PolicyV1alpha1Client, error) { 61 | config := *c 62 | if err := setConfigDefaults(&config); err != nil { 63 | return nil, err 64 | } 65 | client, err := rest.RESTClientForConfigAndClient(&config, h) 66 | if err != nil { 67 | return nil, err 68 | } 69 | return &PolicyV1alpha1Client{client}, nil 70 | } 71 | 72 | // NewForConfigOrDie creates a new PolicyV1alpha1Client for the given config and 73 | // panics if there is an error in the config. 74 | func NewForConfigOrDie(c *rest.Config) *PolicyV1alpha1Client { 75 | client, err := NewForConfig(c) 76 | if err != nil { 77 | panic(err) 78 | } 79 | return client 80 | } 81 | 82 | // New creates a new PolicyV1alpha1Client for the given RESTClient. 83 | func New(c rest.Interface) *PolicyV1alpha1Client { 84 | return &PolicyV1alpha1Client{c} 85 | } 86 | 87 | func setConfigDefaults(config *rest.Config) error { 88 | gv := v1alpha1.SchemeGroupVersion 89 | config.GroupVersion = &gv 90 | config.APIPath = "/apis" 91 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 92 | 93 | if config.UserAgent == "" { 94 | config.UserAgent = rest.DefaultKubernetesUserAgent() 95 | } 96 | 97 | return nil 98 | } 99 | 100 | // RESTClient returns a RESTClient that is used to communicate 101 | // with API server by this client implementation. 102 | func (c *PolicyV1alpha1Client) RESTClient() rest.Interface { 103 | if c == nil { 104 | return nil 105 | } 106 | return c.restClient 107 | } 108 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package apps 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/client/informers/externalversions/apps/v1alpha1" 23 | v1beta1 "github.com/openkruise/kruise-api/client/informers/externalversions/apps/v1beta1" 24 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 25 | ) 26 | 27 | // Interface provides access to each of this group's versions. 28 | type Interface interface { 29 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 30 | V1alpha1() v1alpha1.Interface 31 | // V1beta1 provides access to shared informers for resources in V1beta1. 32 | V1beta1() v1beta1.Interface 33 | } 34 | 35 | type group struct { 36 | factory internalinterfaces.SharedInformerFactory 37 | namespace string 38 | tweakListOptions internalinterfaces.TweakListOptionsFunc 39 | } 40 | 41 | // New returns a new Interface. 42 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 43 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 44 | } 45 | 46 | // V1alpha1 returns a new v1alpha1.Interface. 47 | func (g *group) V1alpha1() v1alpha1.Interface { 48 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 49 | } 50 | 51 | // V1beta1 returns a new v1beta1.Interface. 52 | func (g *group) V1beta1() v1beta1.Interface { 53 | return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) 54 | } 55 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/advancedcronjob.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // AdvancedCronJobInformer provides access to a shared informer and lister for 36 | // AdvancedCronJobs. 37 | type AdvancedCronJobInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.AdvancedCronJobLister 40 | } 41 | 42 | type advancedCronJobInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewAdvancedCronJobInformer constructs a new informer for AdvancedCronJob type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewAdvancedCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredAdvancedCronJobInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredAdvancedCronJobInformer constructs a new informer for AdvancedCronJob type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredAdvancedCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().AdvancedCronJobs(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().AdvancedCronJobs(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.AdvancedCronJob{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *advancedCronJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredAdvancedCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *advancedCronJobInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.AdvancedCronJob{}, f.defaultInformer) 86 | } 87 | 88 | func (f *advancedCronJobInformer) Lister() v1alpha1.AdvancedCronJobLister { 89 | return v1alpha1.NewAdvancedCronJobLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/broadcastjob.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // BroadcastJobInformer provides access to a shared informer and lister for 36 | // BroadcastJobs. 37 | type BroadcastJobInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.BroadcastJobLister 40 | } 41 | 42 | type broadcastJobInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewBroadcastJobInformer constructs a new informer for BroadcastJob type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewBroadcastJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredBroadcastJobInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredBroadcastJobInformer constructs a new informer for BroadcastJob type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredBroadcastJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().BroadcastJobs(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().BroadcastJobs(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.BroadcastJob{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *broadcastJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredBroadcastJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *broadcastJobInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.BroadcastJob{}, f.defaultInformer) 86 | } 87 | 88 | func (f *broadcastJobInformer) Lister() v1alpha1.BroadcastJobLister { 89 | return v1alpha1.NewBroadcastJobLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/cloneset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // CloneSetInformer provides access to a shared informer and lister for 36 | // CloneSets. 37 | type CloneSetInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.CloneSetLister 40 | } 41 | 42 | type cloneSetInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewCloneSetInformer constructs a new informer for CloneSet type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewCloneSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredCloneSetInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredCloneSetInformer constructs a new informer for CloneSet type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredCloneSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().CloneSets(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().CloneSets(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.CloneSet{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *cloneSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredCloneSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *cloneSetInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.CloneSet{}, f.defaultInformer) 86 | } 87 | 88 | func (f *cloneSetInformer) Lister() v1alpha1.CloneSetLister { 89 | return v1alpha1.NewCloneSetLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/daemonset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // DaemonSetInformer provides access to a shared informer and lister for 36 | // DaemonSets. 37 | type DaemonSetInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.DaemonSetLister 40 | } 41 | 42 | type daemonSetInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewDaemonSetInformer constructs a new informer for DaemonSet type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredDaemonSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().DaemonSets(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().DaemonSets(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.DaemonSet{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *daemonSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.DaemonSet{}, f.defaultInformer) 86 | } 87 | 88 | func (f *daemonSetInformer) Lister() v1alpha1.DaemonSetLister { 89 | return v1alpha1.NewDaemonSetLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/ephemeraljob.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // EphemeralJobInformer provides access to a shared informer and lister for 36 | // EphemeralJobs. 37 | type EphemeralJobInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.EphemeralJobLister 40 | } 41 | 42 | type ephemeralJobInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewEphemeralJobInformer constructs a new informer for EphemeralJob type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewEphemeralJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredEphemeralJobInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredEphemeralJobInformer constructs a new informer for EphemeralJob type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredEphemeralJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().EphemeralJobs(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().EphemeralJobs(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.EphemeralJob{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *ephemeralJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredEphemeralJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *ephemeralJobInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.EphemeralJob{}, f.defaultInformer) 86 | } 87 | 88 | func (f *ephemeralJobInformer) Lister() v1alpha1.EphemeralJobLister { 89 | return v1alpha1.NewEphemeralJobLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/imagepulljob.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // ImagePullJobInformer provides access to a shared informer and lister for 36 | // ImagePullJobs. 37 | type ImagePullJobInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.ImagePullJobLister 40 | } 41 | 42 | type imagePullJobInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewImagePullJobInformer constructs a new informer for ImagePullJob type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewImagePullJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredImagePullJobInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredImagePullJobInformer constructs a new informer for ImagePullJob type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredImagePullJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().ImagePullJobs(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().ImagePullJobs(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.ImagePullJob{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *imagePullJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredImagePullJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *imagePullJobInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.ImagePullJob{}, f.defaultInformer) 86 | } 87 | 88 | func (f *imagePullJobInformer) Lister() v1alpha1.ImagePullJobLister { 89 | return v1alpha1.NewImagePullJobLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/nodeimage.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // NodeImageInformer provides access to a shared informer and lister for 36 | // NodeImages. 37 | type NodeImageInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.NodeImageLister 40 | } 41 | 42 | type nodeImageInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | } 46 | 47 | // NewNodeImageInformer constructs a new informer for NodeImage type. 48 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 49 | // one. This reduces memory footprint and number of connections to the server. 50 | func NewNodeImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 51 | return NewFilteredNodeImageInformer(client, resyncPeriod, indexers, nil) 52 | } 53 | 54 | // NewFilteredNodeImageInformer constructs a new informer for NodeImage type. 55 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 56 | // one. This reduces memory footprint and number of connections to the server. 57 | func NewFilteredNodeImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 58 | return cache.NewSharedIndexInformer( 59 | &cache.ListWatch{ 60 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 61 | if tweakListOptions != nil { 62 | tweakListOptions(&options) 63 | } 64 | return client.AppsV1alpha1().NodeImages().List(context.TODO(), options) 65 | }, 66 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 67 | if tweakListOptions != nil { 68 | tweakListOptions(&options) 69 | } 70 | return client.AppsV1alpha1().NodeImages().Watch(context.TODO(), options) 71 | }, 72 | }, 73 | &appsv1alpha1.NodeImage{}, 74 | resyncPeriod, 75 | indexers, 76 | ) 77 | } 78 | 79 | func (f *nodeImageInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 80 | return NewFilteredNodeImageInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 81 | } 82 | 83 | func (f *nodeImageInformer) Informer() cache.SharedIndexInformer { 84 | return f.factory.InformerFor(&appsv1alpha1.NodeImage{}, f.defaultInformer) 85 | } 86 | 87 | func (f *nodeImageInformer) Lister() v1alpha1.NodeImageLister { 88 | return v1alpha1.NewNodeImageLister(f.Informer().GetIndexer()) 89 | } 90 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/nodepodprobe.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // NodePodProbeInformer provides access to a shared informer and lister for 36 | // NodePodProbes. 37 | type NodePodProbeInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.NodePodProbeLister 40 | } 41 | 42 | type nodePodProbeInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | } 46 | 47 | // NewNodePodProbeInformer constructs a new informer for NodePodProbe type. 48 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 49 | // one. This reduces memory footprint and number of connections to the server. 50 | func NewNodePodProbeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 51 | return NewFilteredNodePodProbeInformer(client, resyncPeriod, indexers, nil) 52 | } 53 | 54 | // NewFilteredNodePodProbeInformer constructs a new informer for NodePodProbe type. 55 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 56 | // one. This reduces memory footprint and number of connections to the server. 57 | func NewFilteredNodePodProbeInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 58 | return cache.NewSharedIndexInformer( 59 | &cache.ListWatch{ 60 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 61 | if tweakListOptions != nil { 62 | tweakListOptions(&options) 63 | } 64 | return client.AppsV1alpha1().NodePodProbes().List(context.TODO(), options) 65 | }, 66 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 67 | if tweakListOptions != nil { 68 | tweakListOptions(&options) 69 | } 70 | return client.AppsV1alpha1().NodePodProbes().Watch(context.TODO(), options) 71 | }, 72 | }, 73 | &appsv1alpha1.NodePodProbe{}, 74 | resyncPeriod, 75 | indexers, 76 | ) 77 | } 78 | 79 | func (f *nodePodProbeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 80 | return NewFilteredNodePodProbeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 81 | } 82 | 83 | func (f *nodePodProbeInformer) Informer() cache.SharedIndexInformer { 84 | return f.factory.InformerFor(&appsv1alpha1.NodePodProbe{}, f.defaultInformer) 85 | } 86 | 87 | func (f *nodePodProbeInformer) Lister() v1alpha1.NodePodProbeLister { 88 | return v1alpha1.NewNodePodProbeLister(f.Informer().GetIndexer()) 89 | } 90 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/podprobemarker.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // PodProbeMarkerInformer provides access to a shared informer and lister for 36 | // PodProbeMarkers. 37 | type PodProbeMarkerInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.PodProbeMarkerLister 40 | } 41 | 42 | type podProbeMarkerInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewPodProbeMarkerInformer constructs a new informer for PodProbeMarker type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewPodProbeMarkerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredPodProbeMarkerInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredPodProbeMarkerInformer constructs a new informer for PodProbeMarker type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredPodProbeMarkerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().PodProbeMarkers(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().PodProbeMarkers(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.PodProbeMarker{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *podProbeMarkerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredPodProbeMarkerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *podProbeMarkerInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.PodProbeMarker{}, f.defaultInformer) 86 | } 87 | 88 | func (f *podProbeMarkerInformer) Lister() v1alpha1.PodProbeMarkerLister { 89 | return v1alpha1.NewPodProbeMarkerLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/sidecarset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // SidecarSetInformer provides access to a shared informer and lister for 36 | // SidecarSets. 37 | type SidecarSetInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.SidecarSetLister 40 | } 41 | 42 | type sidecarSetInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | } 46 | 47 | // NewSidecarSetInformer constructs a new informer for SidecarSet type. 48 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 49 | // one. This reduces memory footprint and number of connections to the server. 50 | func NewSidecarSetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 51 | return NewFilteredSidecarSetInformer(client, resyncPeriod, indexers, nil) 52 | } 53 | 54 | // NewFilteredSidecarSetInformer constructs a new informer for SidecarSet type. 55 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 56 | // one. This reduces memory footprint and number of connections to the server. 57 | func NewFilteredSidecarSetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 58 | return cache.NewSharedIndexInformer( 59 | &cache.ListWatch{ 60 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 61 | if tweakListOptions != nil { 62 | tweakListOptions(&options) 63 | } 64 | return client.AppsV1alpha1().SidecarSets().List(context.TODO(), options) 65 | }, 66 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 67 | if tweakListOptions != nil { 68 | tweakListOptions(&options) 69 | } 70 | return client.AppsV1alpha1().SidecarSets().Watch(context.TODO(), options) 71 | }, 72 | }, 73 | &appsv1alpha1.SidecarSet{}, 74 | resyncPeriod, 75 | indexers, 76 | ) 77 | } 78 | 79 | func (f *sidecarSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 80 | return NewFilteredSidecarSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 81 | } 82 | 83 | func (f *sidecarSetInformer) Informer() cache.SharedIndexInformer { 84 | return f.factory.InformerFor(&appsv1alpha1.SidecarSet{}, f.defaultInformer) 85 | } 86 | 87 | func (f *sidecarSetInformer) Lister() v1alpha1.SidecarSetLister { 88 | return v1alpha1.NewSidecarSetLister(f.Informer().GetIndexer()) 89 | } 90 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/statefulset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // StatefulSetInformer provides access to a shared informer and lister for 36 | // StatefulSets. 37 | type StatefulSetInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.StatefulSetLister 40 | } 41 | 42 | type statefulSetInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewStatefulSetInformer constructs a new informer for StatefulSet type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().StatefulSets(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().StatefulSets(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.StatefulSet{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *statefulSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.StatefulSet{}, f.defaultInformer) 86 | } 87 | 88 | func (f *statefulSetInformer) Lister() v1alpha1.StatefulSetLister { 89 | return v1alpha1.NewStatefulSetLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1alpha1/workloadspread.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1alpha1 "github.com/openkruise/kruise-api/client/listers/apps/v1alpha1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // WorkloadSpreadInformer provides access to a shared informer and lister for 36 | // WorkloadSpreads. 37 | type WorkloadSpreadInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1alpha1.WorkloadSpreadLister 40 | } 41 | 42 | type workloadSpreadInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewWorkloadSpreadInformer constructs a new informer for WorkloadSpread type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewWorkloadSpreadInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredWorkloadSpreadInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredWorkloadSpreadInformer constructs a new informer for WorkloadSpread type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredWorkloadSpreadInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1alpha1().WorkloadSpreads(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1alpha1().WorkloadSpreads(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1alpha1.WorkloadSpread{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *workloadSpreadInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredWorkloadSpreadInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *workloadSpreadInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1alpha1.WorkloadSpread{}, f.defaultInformer) 86 | } 87 | 88 | func (f *workloadSpreadInformer) Lister() v1alpha1.WorkloadSpreadLister { 89 | return v1alpha1.NewWorkloadSpreadLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1beta1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | import ( 22 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // StatefulSets returns a StatefulSetInformer. 28 | StatefulSets() StatefulSetInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // StatefulSets returns a StatefulSetInformer. 43 | func (v *version) StatefulSets() StatefulSetInformer { 44 | return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /client/informers/externalversions/apps/v1beta1/statefulset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | import ( 22 | "context" 23 | time "time" 24 | 25 | appsv1beta1 "github.com/openkruise/kruise-api/apps/v1beta1" 26 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 27 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 28 | v1beta1 "github.com/openkruise/kruise-api/client/listers/apps/v1beta1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | runtime "k8s.io/apimachinery/pkg/runtime" 31 | watch "k8s.io/apimachinery/pkg/watch" 32 | cache "k8s.io/client-go/tools/cache" 33 | ) 34 | 35 | // StatefulSetInformer provides access to a shared informer and lister for 36 | // StatefulSets. 37 | type StatefulSetInformer interface { 38 | Informer() cache.SharedIndexInformer 39 | Lister() v1beta1.StatefulSetLister 40 | } 41 | 42 | type statefulSetInformer struct { 43 | factory internalinterfaces.SharedInformerFactory 44 | tweakListOptions internalinterfaces.TweakListOptionsFunc 45 | namespace string 46 | } 47 | 48 | // NewStatefulSetInformer constructs a new informer for StatefulSet type. 49 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 50 | // one. This reduces memory footprint and number of connections to the server. 51 | func NewStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 52 | return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) 53 | } 54 | 55 | // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. 56 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 57 | // one. This reduces memory footprint and number of connections to the server. 58 | func NewFilteredStatefulSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 59 | return cache.NewSharedIndexInformer( 60 | &cache.ListWatch{ 61 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 62 | if tweakListOptions != nil { 63 | tweakListOptions(&options) 64 | } 65 | return client.AppsV1beta1().StatefulSets(namespace).List(context.TODO(), options) 66 | }, 67 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 68 | if tweakListOptions != nil { 69 | tweakListOptions(&options) 70 | } 71 | return client.AppsV1beta1().StatefulSets(namespace).Watch(context.TODO(), options) 72 | }, 73 | }, 74 | &appsv1beta1.StatefulSet{}, 75 | resyncPeriod, 76 | indexers, 77 | ) 78 | } 79 | 80 | func (f *statefulSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 81 | return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 82 | } 83 | 84 | func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { 85 | return f.factory.InformerFor(&appsv1beta1.StatefulSet{}, f.defaultInformer) 86 | } 87 | 88 | func (f *statefulSetInformer) Lister() v1beta1.StatefulSetLister { 89 | return v1beta1.NewStatefulSetLister(f.Informer().GetIndexer()) 90 | } 91 | -------------------------------------------------------------------------------- /client/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | versioned "github.com/openkruise/kruise-api/client/clientset/versioned" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | cache "k8s.io/client-go/tools/cache" 28 | ) 29 | 30 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /client/informers/externalversions/policy/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package policy 20 | 21 | import ( 22 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 23 | v1alpha1 "github.com/openkruise/kruise-api/client/informers/externalversions/policy/v1alpha1" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 29 | V1alpha1() v1alpha1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1alpha1 returns a new v1alpha1.Interface. 44 | func (g *group) V1alpha1() v1alpha1.Interface { 45 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /client/informers/externalversions/policy/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | internalinterfaces "github.com/openkruise/kruise-api/client/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // PodUnavailableBudgets returns a PodUnavailableBudgetInformer. 28 | PodUnavailableBudgets() PodUnavailableBudgetInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // PodUnavailableBudgets returns a PodUnavailableBudgetInformer. 43 | func (v *version) PodUnavailableBudgets() PodUnavailableBudgetInformer { 44 | return &podUnavailableBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/broadcastjob.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // BroadcastJobLister helps list BroadcastJobs. 29 | // All objects returned here must be treated as read-only. 30 | type BroadcastJobLister interface { 31 | // List lists all BroadcastJobs in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.BroadcastJob, err error) 34 | // BroadcastJobs returns an object that can list and get BroadcastJobs. 35 | BroadcastJobs(namespace string) BroadcastJobNamespaceLister 36 | BroadcastJobListerExpansion 37 | } 38 | 39 | // broadcastJobLister implements the BroadcastJobLister interface. 40 | type broadcastJobLister struct { 41 | indexer cache.Indexer 42 | } 43 | 44 | // NewBroadcastJobLister returns a new BroadcastJobLister. 45 | func NewBroadcastJobLister(indexer cache.Indexer) BroadcastJobLister { 46 | return &broadcastJobLister{indexer: indexer} 47 | } 48 | 49 | // List lists all BroadcastJobs in the indexer. 50 | func (s *broadcastJobLister) List(selector labels.Selector) (ret []*v1alpha1.BroadcastJob, err error) { 51 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 52 | ret = append(ret, m.(*v1alpha1.BroadcastJob)) 53 | }) 54 | return ret, err 55 | } 56 | 57 | // BroadcastJobs returns an object that can list and get BroadcastJobs. 58 | func (s *broadcastJobLister) BroadcastJobs(namespace string) BroadcastJobNamespaceLister { 59 | return broadcastJobNamespaceLister{indexer: s.indexer, namespace: namespace} 60 | } 61 | 62 | // BroadcastJobNamespaceLister helps list and get BroadcastJobs. 63 | // All objects returned here must be treated as read-only. 64 | type BroadcastJobNamespaceLister interface { 65 | // List lists all BroadcastJobs in the indexer for a given namespace. 66 | // Objects returned here must be treated as read-only. 67 | List(selector labels.Selector) (ret []*v1alpha1.BroadcastJob, err error) 68 | // Get retrieves the BroadcastJob from the indexer for a given namespace and name. 69 | // Objects returned here must be treated as read-only. 70 | Get(name string) (*v1alpha1.BroadcastJob, error) 71 | BroadcastJobNamespaceListerExpansion 72 | } 73 | 74 | // broadcastJobNamespaceLister implements the BroadcastJobNamespaceLister 75 | // interface. 76 | type broadcastJobNamespaceLister struct { 77 | indexer cache.Indexer 78 | namespace string 79 | } 80 | 81 | // List lists all BroadcastJobs in the indexer for a given namespace. 82 | func (s broadcastJobNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.BroadcastJob, err error) { 83 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 84 | ret = append(ret, m.(*v1alpha1.BroadcastJob)) 85 | }) 86 | return ret, err 87 | } 88 | 89 | // Get retrieves the BroadcastJob from the indexer for a given namespace and name. 90 | func (s broadcastJobNamespaceLister) Get(name string) (*v1alpha1.BroadcastJob, error) { 91 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 92 | if err != nil { 93 | return nil, err 94 | } 95 | if !exists { 96 | return nil, errors.NewNotFound(v1alpha1.Resource("broadcastjob"), name) 97 | } 98 | return obj.(*v1alpha1.BroadcastJob), nil 99 | } 100 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/cloneset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // CloneSetLister helps list CloneSets. 29 | // All objects returned here must be treated as read-only. 30 | type CloneSetLister interface { 31 | // List lists all CloneSets in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.CloneSet, err error) 34 | // CloneSets returns an object that can list and get CloneSets. 35 | CloneSets(namespace string) CloneSetNamespaceLister 36 | CloneSetListerExpansion 37 | } 38 | 39 | // cloneSetLister implements the CloneSetLister interface. 40 | type cloneSetLister struct { 41 | indexer cache.Indexer 42 | } 43 | 44 | // NewCloneSetLister returns a new CloneSetLister. 45 | func NewCloneSetLister(indexer cache.Indexer) CloneSetLister { 46 | return &cloneSetLister{indexer: indexer} 47 | } 48 | 49 | // List lists all CloneSets in the indexer. 50 | func (s *cloneSetLister) List(selector labels.Selector) (ret []*v1alpha1.CloneSet, err error) { 51 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 52 | ret = append(ret, m.(*v1alpha1.CloneSet)) 53 | }) 54 | return ret, err 55 | } 56 | 57 | // CloneSets returns an object that can list and get CloneSets. 58 | func (s *cloneSetLister) CloneSets(namespace string) CloneSetNamespaceLister { 59 | return cloneSetNamespaceLister{indexer: s.indexer, namespace: namespace} 60 | } 61 | 62 | // CloneSetNamespaceLister helps list and get CloneSets. 63 | // All objects returned here must be treated as read-only. 64 | type CloneSetNamespaceLister interface { 65 | // List lists all CloneSets in the indexer for a given namespace. 66 | // Objects returned here must be treated as read-only. 67 | List(selector labels.Selector) (ret []*v1alpha1.CloneSet, err error) 68 | // Get retrieves the CloneSet from the indexer for a given namespace and name. 69 | // Objects returned here must be treated as read-only. 70 | Get(name string) (*v1alpha1.CloneSet, error) 71 | CloneSetNamespaceListerExpansion 72 | } 73 | 74 | // cloneSetNamespaceLister implements the CloneSetNamespaceLister 75 | // interface. 76 | type cloneSetNamespaceLister struct { 77 | indexer cache.Indexer 78 | namespace string 79 | } 80 | 81 | // List lists all CloneSets in the indexer for a given namespace. 82 | func (s cloneSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CloneSet, err error) { 83 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 84 | ret = append(ret, m.(*v1alpha1.CloneSet)) 85 | }) 86 | return ret, err 87 | } 88 | 89 | // Get retrieves the CloneSet from the indexer for a given namespace and name. 90 | func (s cloneSetNamespaceLister) Get(name string) (*v1alpha1.CloneSet, error) { 91 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 92 | if err != nil { 93 | return nil, err 94 | } 95 | if !exists { 96 | return nil, errors.NewNotFound(v1alpha1.Resource("cloneset"), name) 97 | } 98 | return obj.(*v1alpha1.CloneSet), nil 99 | } 100 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/daemonset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // DaemonSetLister helps list DaemonSets. 29 | // All objects returned here must be treated as read-only. 30 | type DaemonSetLister interface { 31 | // List lists all DaemonSets in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.DaemonSet, err error) 34 | // DaemonSets returns an object that can list and get DaemonSets. 35 | DaemonSets(namespace string) DaemonSetNamespaceLister 36 | DaemonSetListerExpansion 37 | } 38 | 39 | // daemonSetLister implements the DaemonSetLister interface. 40 | type daemonSetLister struct { 41 | indexer cache.Indexer 42 | } 43 | 44 | // NewDaemonSetLister returns a new DaemonSetLister. 45 | func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { 46 | return &daemonSetLister{indexer: indexer} 47 | } 48 | 49 | // List lists all DaemonSets in the indexer. 50 | func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1alpha1.DaemonSet, err error) { 51 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 52 | ret = append(ret, m.(*v1alpha1.DaemonSet)) 53 | }) 54 | return ret, err 55 | } 56 | 57 | // DaemonSets returns an object that can list and get DaemonSets. 58 | func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { 59 | return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} 60 | } 61 | 62 | // DaemonSetNamespaceLister helps list and get DaemonSets. 63 | // All objects returned here must be treated as read-only. 64 | type DaemonSetNamespaceLister interface { 65 | // List lists all DaemonSets in the indexer for a given namespace. 66 | // Objects returned here must be treated as read-only. 67 | List(selector labels.Selector) (ret []*v1alpha1.DaemonSet, err error) 68 | // Get retrieves the DaemonSet from the indexer for a given namespace and name. 69 | // Objects returned here must be treated as read-only. 70 | Get(name string) (*v1alpha1.DaemonSet, error) 71 | DaemonSetNamespaceListerExpansion 72 | } 73 | 74 | // daemonSetNamespaceLister implements the DaemonSetNamespaceLister 75 | // interface. 76 | type daemonSetNamespaceLister struct { 77 | indexer cache.Indexer 78 | namespace string 79 | } 80 | 81 | // List lists all DaemonSets in the indexer for a given namespace. 82 | func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.DaemonSet, err error) { 83 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 84 | ret = append(ret, m.(*v1alpha1.DaemonSet)) 85 | }) 86 | return ret, err 87 | } 88 | 89 | // Get retrieves the DaemonSet from the indexer for a given namespace and name. 90 | func (s daemonSetNamespaceLister) Get(name string) (*v1alpha1.DaemonSet, error) { 91 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 92 | if err != nil { 93 | return nil, err 94 | } 95 | if !exists { 96 | return nil, errors.NewNotFound(v1alpha1.Resource("daemonset"), name) 97 | } 98 | return obj.(*v1alpha1.DaemonSet), nil 99 | } 100 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/ephemeraljob.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // EphemeralJobLister helps list EphemeralJobs. 29 | // All objects returned here must be treated as read-only. 30 | type EphemeralJobLister interface { 31 | // List lists all EphemeralJobs in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.EphemeralJob, err error) 34 | // EphemeralJobs returns an object that can list and get EphemeralJobs. 35 | EphemeralJobs(namespace string) EphemeralJobNamespaceLister 36 | EphemeralJobListerExpansion 37 | } 38 | 39 | // ephemeralJobLister implements the EphemeralJobLister interface. 40 | type ephemeralJobLister struct { 41 | indexer cache.Indexer 42 | } 43 | 44 | // NewEphemeralJobLister returns a new EphemeralJobLister. 45 | func NewEphemeralJobLister(indexer cache.Indexer) EphemeralJobLister { 46 | return &ephemeralJobLister{indexer: indexer} 47 | } 48 | 49 | // List lists all EphemeralJobs in the indexer. 50 | func (s *ephemeralJobLister) List(selector labels.Selector) (ret []*v1alpha1.EphemeralJob, err error) { 51 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 52 | ret = append(ret, m.(*v1alpha1.EphemeralJob)) 53 | }) 54 | return ret, err 55 | } 56 | 57 | // EphemeralJobs returns an object that can list and get EphemeralJobs. 58 | func (s *ephemeralJobLister) EphemeralJobs(namespace string) EphemeralJobNamespaceLister { 59 | return ephemeralJobNamespaceLister{indexer: s.indexer, namespace: namespace} 60 | } 61 | 62 | // EphemeralJobNamespaceLister helps list and get EphemeralJobs. 63 | // All objects returned here must be treated as read-only. 64 | type EphemeralJobNamespaceLister interface { 65 | // List lists all EphemeralJobs in the indexer for a given namespace. 66 | // Objects returned here must be treated as read-only. 67 | List(selector labels.Selector) (ret []*v1alpha1.EphemeralJob, err error) 68 | // Get retrieves the EphemeralJob from the indexer for a given namespace and name. 69 | // Objects returned here must be treated as read-only. 70 | Get(name string) (*v1alpha1.EphemeralJob, error) 71 | EphemeralJobNamespaceListerExpansion 72 | } 73 | 74 | // ephemeralJobNamespaceLister implements the EphemeralJobNamespaceLister 75 | // interface. 76 | type ephemeralJobNamespaceLister struct { 77 | indexer cache.Indexer 78 | namespace string 79 | } 80 | 81 | // List lists all EphemeralJobs in the indexer for a given namespace. 82 | func (s ephemeralJobNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EphemeralJob, err error) { 83 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 84 | ret = append(ret, m.(*v1alpha1.EphemeralJob)) 85 | }) 86 | return ret, err 87 | } 88 | 89 | // Get retrieves the EphemeralJob from the indexer for a given namespace and name. 90 | func (s ephemeralJobNamespaceLister) Get(name string) (*v1alpha1.EphemeralJob, error) { 91 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 92 | if err != nil { 93 | return nil, err 94 | } 95 | if !exists { 96 | return nil, errors.NewNotFound(v1alpha1.Resource("ephemeraljob"), name) 97 | } 98 | return obj.(*v1alpha1.EphemeralJob), nil 99 | } 100 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/nodeimage.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // NodeImageLister helps list NodeImages. 29 | // All objects returned here must be treated as read-only. 30 | type NodeImageLister interface { 31 | // List lists all NodeImages in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.NodeImage, err error) 34 | // Get retrieves the NodeImage from the index for a given name. 35 | // Objects returned here must be treated as read-only. 36 | Get(name string) (*v1alpha1.NodeImage, error) 37 | NodeImageListerExpansion 38 | } 39 | 40 | // nodeImageLister implements the NodeImageLister interface. 41 | type nodeImageLister struct { 42 | indexer cache.Indexer 43 | } 44 | 45 | // NewNodeImageLister returns a new NodeImageLister. 46 | func NewNodeImageLister(indexer cache.Indexer) NodeImageLister { 47 | return &nodeImageLister{indexer: indexer} 48 | } 49 | 50 | // List lists all NodeImages in the indexer. 51 | func (s *nodeImageLister) List(selector labels.Selector) (ret []*v1alpha1.NodeImage, err error) { 52 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 53 | ret = append(ret, m.(*v1alpha1.NodeImage)) 54 | }) 55 | return ret, err 56 | } 57 | 58 | // Get retrieves the NodeImage from the index for a given name. 59 | func (s *nodeImageLister) Get(name string) (*v1alpha1.NodeImage, error) { 60 | obj, exists, err := s.indexer.GetByKey(name) 61 | if err != nil { 62 | return nil, err 63 | } 64 | if !exists { 65 | return nil, errors.NewNotFound(v1alpha1.Resource("nodeimage"), name) 66 | } 67 | return obj.(*v1alpha1.NodeImage), nil 68 | } 69 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/nodepodprobe.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // NodePodProbeLister helps list NodePodProbes. 29 | // All objects returned here must be treated as read-only. 30 | type NodePodProbeLister interface { 31 | // List lists all NodePodProbes in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.NodePodProbe, err error) 34 | // Get retrieves the NodePodProbe from the index for a given name. 35 | // Objects returned here must be treated as read-only. 36 | Get(name string) (*v1alpha1.NodePodProbe, error) 37 | NodePodProbeListerExpansion 38 | } 39 | 40 | // nodePodProbeLister implements the NodePodProbeLister interface. 41 | type nodePodProbeLister struct { 42 | indexer cache.Indexer 43 | } 44 | 45 | // NewNodePodProbeLister returns a new NodePodProbeLister. 46 | func NewNodePodProbeLister(indexer cache.Indexer) NodePodProbeLister { 47 | return &nodePodProbeLister{indexer: indexer} 48 | } 49 | 50 | // List lists all NodePodProbes in the indexer. 51 | func (s *nodePodProbeLister) List(selector labels.Selector) (ret []*v1alpha1.NodePodProbe, err error) { 52 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 53 | ret = append(ret, m.(*v1alpha1.NodePodProbe)) 54 | }) 55 | return ret, err 56 | } 57 | 58 | // Get retrieves the NodePodProbe from the index for a given name. 59 | func (s *nodePodProbeLister) Get(name string) (*v1alpha1.NodePodProbe, error) { 60 | obj, exists, err := s.indexer.GetByKey(name) 61 | if err != nil { 62 | return nil, err 63 | } 64 | if !exists { 65 | return nil, errors.NewNotFound(v1alpha1.Resource("nodepodprobe"), name) 66 | } 67 | return obj.(*v1alpha1.NodePodProbe), nil 68 | } 69 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/resourcedistribution.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // ResourceDistributionLister helps list ResourceDistributions. 29 | // All objects returned here must be treated as read-only. 30 | type ResourceDistributionLister interface { 31 | // List lists all ResourceDistributions in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.ResourceDistribution, err error) 34 | // Get retrieves the ResourceDistribution from the index for a given name. 35 | // Objects returned here must be treated as read-only. 36 | Get(name string) (*v1alpha1.ResourceDistribution, error) 37 | ResourceDistributionListerExpansion 38 | } 39 | 40 | // resourceDistributionLister implements the ResourceDistributionLister interface. 41 | type resourceDistributionLister struct { 42 | indexer cache.Indexer 43 | } 44 | 45 | // NewResourceDistributionLister returns a new ResourceDistributionLister. 46 | func NewResourceDistributionLister(indexer cache.Indexer) ResourceDistributionLister { 47 | return &resourceDistributionLister{indexer: indexer} 48 | } 49 | 50 | // List lists all ResourceDistributions in the indexer. 51 | func (s *resourceDistributionLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceDistribution, err error) { 52 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 53 | ret = append(ret, m.(*v1alpha1.ResourceDistribution)) 54 | }) 55 | return ret, err 56 | } 57 | 58 | // Get retrieves the ResourceDistribution from the index for a given name. 59 | func (s *resourceDistributionLister) Get(name string) (*v1alpha1.ResourceDistribution, error) { 60 | obj, exists, err := s.indexer.GetByKey(name) 61 | if err != nil { 62 | return nil, err 63 | } 64 | if !exists { 65 | return nil, errors.NewNotFound(v1alpha1.Resource("resourcedistribution"), name) 66 | } 67 | return obj.(*v1alpha1.ResourceDistribution), nil 68 | } 69 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/sidecarset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // SidecarSetLister helps list SidecarSets. 29 | // All objects returned here must be treated as read-only. 30 | type SidecarSetLister interface { 31 | // List lists all SidecarSets in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.SidecarSet, err error) 34 | // Get retrieves the SidecarSet from the index for a given name. 35 | // Objects returned here must be treated as read-only. 36 | Get(name string) (*v1alpha1.SidecarSet, error) 37 | SidecarSetListerExpansion 38 | } 39 | 40 | // sidecarSetLister implements the SidecarSetLister interface. 41 | type sidecarSetLister struct { 42 | indexer cache.Indexer 43 | } 44 | 45 | // NewSidecarSetLister returns a new SidecarSetLister. 46 | func NewSidecarSetLister(indexer cache.Indexer) SidecarSetLister { 47 | return &sidecarSetLister{indexer: indexer} 48 | } 49 | 50 | // List lists all SidecarSets in the indexer. 51 | func (s *sidecarSetLister) List(selector labels.Selector) (ret []*v1alpha1.SidecarSet, err error) { 52 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 53 | ret = append(ret, m.(*v1alpha1.SidecarSet)) 54 | }) 55 | return ret, err 56 | } 57 | 58 | // Get retrieves the SidecarSet from the index for a given name. 59 | func (s *sidecarSetLister) Get(name string) (*v1alpha1.SidecarSet, error) { 60 | obj, exists, err := s.indexer.GetByKey(name) 61 | if err != nil { 62 | return nil, err 63 | } 64 | if !exists { 65 | return nil, errors.NewNotFound(v1alpha1.Resource("sidecarset"), name) 66 | } 67 | return obj.(*v1alpha1.SidecarSet), nil 68 | } 69 | -------------------------------------------------------------------------------- /client/listers/apps/v1alpha1/statefulset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import ( 22 | v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // StatefulSetLister helps list StatefulSets. 29 | // All objects returned here must be treated as read-only. 30 | type StatefulSetLister interface { 31 | // List lists all StatefulSets in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1alpha1.StatefulSet, err error) 34 | // StatefulSets returns an object that can list and get StatefulSets. 35 | StatefulSets(namespace string) StatefulSetNamespaceLister 36 | StatefulSetListerExpansion 37 | } 38 | 39 | // statefulSetLister implements the StatefulSetLister interface. 40 | type statefulSetLister struct { 41 | indexer cache.Indexer 42 | } 43 | 44 | // NewStatefulSetLister returns a new StatefulSetLister. 45 | func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { 46 | return &statefulSetLister{indexer: indexer} 47 | } 48 | 49 | // List lists all StatefulSets in the indexer. 50 | func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1alpha1.StatefulSet, err error) { 51 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 52 | ret = append(ret, m.(*v1alpha1.StatefulSet)) 53 | }) 54 | return ret, err 55 | } 56 | 57 | // StatefulSets returns an object that can list and get StatefulSets. 58 | func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { 59 | return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} 60 | } 61 | 62 | // StatefulSetNamespaceLister helps list and get StatefulSets. 63 | // All objects returned here must be treated as read-only. 64 | type StatefulSetNamespaceLister interface { 65 | // List lists all StatefulSets in the indexer for a given namespace. 66 | // Objects returned here must be treated as read-only. 67 | List(selector labels.Selector) (ret []*v1alpha1.StatefulSet, err error) 68 | // Get retrieves the StatefulSet from the indexer for a given namespace and name. 69 | // Objects returned here must be treated as read-only. 70 | Get(name string) (*v1alpha1.StatefulSet, error) 71 | StatefulSetNamespaceListerExpansion 72 | } 73 | 74 | // statefulSetNamespaceLister implements the StatefulSetNamespaceLister 75 | // interface. 76 | type statefulSetNamespaceLister struct { 77 | indexer cache.Indexer 78 | namespace string 79 | } 80 | 81 | // List lists all StatefulSets in the indexer for a given namespace. 82 | func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.StatefulSet, err error) { 83 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 84 | ret = append(ret, m.(*v1alpha1.StatefulSet)) 85 | }) 86 | return ret, err 87 | } 88 | 89 | // Get retrieves the StatefulSet from the indexer for a given namespace and name. 90 | func (s statefulSetNamespaceLister) Get(name string) (*v1alpha1.StatefulSet, error) { 91 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 92 | if err != nil { 93 | return nil, err 94 | } 95 | if !exists { 96 | return nil, errors.NewNotFound(v1alpha1.Resource("statefulset"), name) 97 | } 98 | return obj.(*v1alpha1.StatefulSet), nil 99 | } 100 | -------------------------------------------------------------------------------- /client/listers/apps/v1beta1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | // StatefulSetListerExpansion allows custom methods to be added to 22 | // StatefulSetLister. 23 | type StatefulSetListerExpansion interface{} 24 | 25 | // StatefulSetNamespaceListerExpansion allows custom methods to be added to 26 | // StatefulSetNamespaceLister. 27 | type StatefulSetNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /client/listers/apps/v1beta1/statefulset.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1beta1 20 | 21 | import ( 22 | v1beta1 "github.com/openkruise/kruise-api/apps/v1beta1" 23 | "k8s.io/apimachinery/pkg/api/errors" 24 | "k8s.io/apimachinery/pkg/labels" 25 | "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // StatefulSetLister helps list StatefulSets. 29 | // All objects returned here must be treated as read-only. 30 | type StatefulSetLister interface { 31 | // List lists all StatefulSets in the indexer. 32 | // Objects returned here must be treated as read-only. 33 | List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) 34 | // StatefulSets returns an object that can list and get StatefulSets. 35 | StatefulSets(namespace string) StatefulSetNamespaceLister 36 | StatefulSetListerExpansion 37 | } 38 | 39 | // statefulSetLister implements the StatefulSetLister interface. 40 | type statefulSetLister struct { 41 | indexer cache.Indexer 42 | } 43 | 44 | // NewStatefulSetLister returns a new StatefulSetLister. 45 | func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { 46 | return &statefulSetLister{indexer: indexer} 47 | } 48 | 49 | // List lists all StatefulSets in the indexer. 50 | func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) { 51 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 52 | ret = append(ret, m.(*v1beta1.StatefulSet)) 53 | }) 54 | return ret, err 55 | } 56 | 57 | // StatefulSets returns an object that can list and get StatefulSets. 58 | func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { 59 | return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} 60 | } 61 | 62 | // StatefulSetNamespaceLister helps list and get StatefulSets. 63 | // All objects returned here must be treated as read-only. 64 | type StatefulSetNamespaceLister interface { 65 | // List lists all StatefulSets in the indexer for a given namespace. 66 | // Objects returned here must be treated as read-only. 67 | List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) 68 | // Get retrieves the StatefulSet from the indexer for a given namespace and name. 69 | // Objects returned here must be treated as read-only. 70 | Get(name string) (*v1beta1.StatefulSet, error) 71 | StatefulSetNamespaceListerExpansion 72 | } 73 | 74 | // statefulSetNamespaceLister implements the StatefulSetNamespaceLister 75 | // interface. 76 | type statefulSetNamespaceLister struct { 77 | indexer cache.Indexer 78 | namespace string 79 | } 80 | 81 | // List lists all StatefulSets in the indexer for a given namespace. 82 | func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) { 83 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 84 | ret = append(ret, m.(*v1beta1.StatefulSet)) 85 | }) 86 | return ret, err 87 | } 88 | 89 | // Get retrieves the StatefulSet from the indexer for a given namespace and name. 90 | func (s statefulSetNamespaceLister) Get(name string) (*v1beta1.StatefulSet, error) { 91 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 92 | if err != nil { 93 | return nil, err 94 | } 95 | if !exists { 96 | return nil, errors.NewNotFound(v1beta1.Resource("statefulset"), name) 97 | } 98 | return obj.(*v1beta1.StatefulSet), nil 99 | } 100 | -------------------------------------------------------------------------------- /client/listers/policy/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | // PodUnavailableBudgetListerExpansion allows custom methods to be added to 22 | // PodUnavailableBudgetLister. 23 | type PodUnavailableBudgetListerExpansion interface{} 24 | 25 | // PodUnavailableBudgetNamespaceListerExpansion allows custom methods to be added to 26 | // PodUnavailableBudgetNamespaceLister. 27 | type PodUnavailableBudgetNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /cmd/gen-schema/README.md: -------------------------------------------------------------------------------- 1 | ## gen-schema 2 | ### Description 3 | This dictionary contains a tool that generates a kustomize schema file 4 | for native kubernetes resources plus projects under the openkrusie name including kruise and rollouts. 5 | 6 | The purpose of the kustomize schema file is to be able to use Policy Merge Patch (SMP) 7 | on any array type field within an environment variable or resource definition 8 | when using kustomize to deploy CRDs in openkruise. 9 | ### How to run 10 | To generate the schema, run the following command in the project root directory: 11 | ``` 12 | make gen-openapi-schema 13 | ``` 14 | the schema will be generated in the `schema` folder. 15 | 16 | ### How to use 17 | In your kustomization.yaml file add a config block like: 18 | 19 | ``` 20 | openapi: 21 | path: https://raw.githubusercontent.com/openkruise/kruise-api/main/schema/openkruise_all_k8s_kustomize_schema.json 22 | ``` 23 | 24 | you can find examples in `test` folder. 25 | 26 | ### How to upgrade the schema 27 | When there are some new CRDs or updated CRD fields in openkruise, 28 | some new fields of array types may need to support SMP. 29 | You can simply upgrade schema in the following steps: 30 | 31 | #### 1. Check field and add annotations 32 | Firstly, determine whether the newly added field is of array type. 33 | Then, combined with the usage scenario, determine if there is a requirement 34 | for merging the field based on a unique **key**. 35 | 36 | Then, add annotations to the specified field in the CRD definition file as follows: 37 | ``` 38 | // +patchMergeKey=name 39 | // +patchStrategy=merge 40 | InitContainers []SidecarContainer `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name"` 41 | ``` 42 | 43 | #### 2. Run command to generate schema 44 | ``` 45 | make gen-openapi-schema 46 | ``` 47 | 48 | ### Related discussions and issues 49 | 1. [Why include native resources definition info the schema file?](https://github.com/argoproj/argo-rollouts/issues/1730) 50 | 2. [Kustomize build not honoring the retainKeys patchStrategy](https://github.com/kubernetes-sigs/kustomize/issues/3981) 51 | 3. [Reason for Error `API rule violation: list_type_missing`](https://github.com/kubernetes/kube-openapi/issues/175#issuecomment-546504117) 52 | -------------------------------------------------------------------------------- /examples/create-update-delete-cloneset/README.md: -------------------------------------------------------------------------------- 1 | # Create CloneSet 2 | 3 | This example program demonstrates the fundamental operations for managing on 4 | [CloneSet][1] resources, such as `Create`, `List`, `Update` and `Delete`. 5 | 6 | You can adopt the source code from this example to write programs that manage 7 | other types of resources through the Kubernetes API. 8 | 9 | ## Running this example 10 | 11 | Make sure you have a Kubernetes cluster with kruise-manager installed and `kubectl` is configured: 12 | 13 | kubectl get nodes 14 | 15 | Compile this example on your workstation: 16 | 17 | ``` 18 | cd create-update-delete-cloneset 19 | go build -o ./app 20 | ``` 21 | 22 | Now, run this application on your workstation with your local kubeconfig file: 23 | 24 | ``` 25 | ./app 26 | # or specify a kubeconfig file with flag 27 | ./app -kubeconfig=$HOME/.kube/config 28 | ``` 29 | 30 | Running this command will execute the following operations on your cluster: 31 | 32 | 1. **Create CloneSet:** This will create a 2 replica CloneSet. Verify with 33 | `kubectl get pods` and `kubectl get cloneset`. 34 | 2. **Update CloneSet:** This will update the CloneSet resource created in 35 | previous step by setting the replica count to 1 and changing the container 36 | image to `nginx:1.13`. You are encouraged to inspect the retry loop that 37 | handles conflicts. Verify the new replica count and container image with 38 | `kubectl describe cloneset demo`. 39 | 3. **List CloneSet:** This will retrieve CloneSet in the `default` 40 | namespace and print their names and replica counts. 41 | 4. **Delete CloneSet:** This will delete the CloneSet object and its 42 | dependent pod resource. Verify with `kubectl get cloneset`. 43 | 44 | Each step is separated by an interactive prompt. You must hit the 45 | Return key to proceed to the next step. You can use these prompts as 46 | a break to take time to run `kubectl` and inspect the result of the operations 47 | executed. 48 | 49 | You should see an output like the following: 50 | 51 | ``` 52 | Created cloneset "demo-cloneset". 53 | -> Press Return key to continue. 54 | 55 | Updating cloneset... 56 | Updated cloneset... 57 | -> Press Return key to continue. 58 | 59 | Listing clonesets in namespace "default": 60 | * demo-cloneset (1 replicas) 61 | -> Press Return key to continue. 62 | 63 | Deleting cloneset... 64 | Deleted cloneset. 65 | ``` 66 | 67 | 68 | ## Cleanup 69 | 70 | Successfully running this program will clean the created artifacts. If you 71 | terminate the program without completing, you can clean up the created 72 | deployment with: 73 | 74 | kubectl delete cloneset demo-cloneset 75 | 76 | ## Troubleshooting 77 | 78 | [1]: https://openkruise.io/docs/user-manuals/cloneset 79 | -------------------------------------------------------------------------------- /examples/create-update-delete-cloneset/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/openkruise/kruise-api/examples 2 | 3 | go 1.22.0 4 | 5 | toolchain go1.22.4 6 | 7 | require ( 8 | github.com/openkruise/kruise-api v1.8.0 9 | k8s.io/api v0.30.10 10 | k8s.io/apimachinery v0.30.10 11 | k8s.io/client-go v0.30.10 12 | ) 13 | 14 | require ( 15 | github.com/davecgh/go-spew v1.1.1 // indirect 16 | github.com/emicklei/go-restful/v3 v3.11.0 // indirect 17 | github.com/go-logr/logr v1.4.2 // indirect 18 | github.com/go-openapi/jsonpointer v0.19.6 // indirect 19 | github.com/go-openapi/jsonreference v0.20.2 // indirect 20 | github.com/go-openapi/swag v0.22.3 // indirect 21 | github.com/gogo/protobuf v1.3.2 // indirect 22 | github.com/golang/protobuf v1.5.4 // indirect 23 | github.com/google/gnostic-models v0.6.8 // indirect 24 | github.com/google/gofuzz v1.2.0 // indirect 25 | github.com/google/uuid v1.6.0 // indirect 26 | github.com/imdario/mergo v0.3.12 // indirect 27 | github.com/josharian/intern v1.0.0 // indirect 28 | github.com/json-iterator/go v1.1.12 // indirect 29 | github.com/mailru/easyjson v0.7.7 // indirect 30 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 31 | github.com/modern-go/reflect2 v1.0.2 // indirect 32 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 33 | github.com/spf13/pflag v1.0.5 // indirect 34 | golang.org/x/net v0.24.0 // indirect 35 | golang.org/x/oauth2 v0.17.0 // indirect 36 | golang.org/x/sys v0.19.0 // indirect 37 | golang.org/x/term v0.19.0 // indirect 38 | golang.org/x/text v0.14.0 // indirect 39 | golang.org/x/time v0.3.0 // indirect 40 | google.golang.org/appengine v1.6.8 // indirect 41 | google.golang.org/protobuf v1.33.0 // indirect 42 | gopkg.in/inf.v0 v0.9.1 // indirect 43 | gopkg.in/yaml.v2 v2.4.0 // indirect 44 | gopkg.in/yaml.v3 v3.0.1 // indirect 45 | k8s.io/klog/v2 v2.120.1 // indirect 46 | k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect 47 | k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect 48 | sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect 49 | sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect 50 | sigs.k8s.io/yaml v1.4.0 // indirect 51 | ) 52 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/openkruise/kruise-api 2 | 3 | go 1.22.0 4 | 5 | require ( 6 | github.com/blang/semver/v4 v4.0.0 7 | github.com/go-bindata/go-bindata v3.1.2+incompatible 8 | k8s.io/api v0.30.10 9 | k8s.io/apimachinery v0.30.10 10 | k8s.io/client-go v0.30.10 11 | k8s.io/code-generator v0.30.10 12 | k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 13 | ) 14 | 15 | require ( 16 | github.com/davecgh/go-spew v1.1.1 // indirect 17 | github.com/emicklei/go-restful/v3 v3.11.0 // indirect 18 | github.com/evanphx/json-patch v5.6.0+incompatible // indirect 19 | github.com/go-logr/logr v1.4.2 // indirect 20 | github.com/go-openapi/jsonpointer v0.19.6 // indirect 21 | github.com/go-openapi/jsonreference v0.20.2 // indirect 22 | github.com/go-openapi/swag v0.22.3 // indirect 23 | github.com/gogo/protobuf v1.3.2 // indirect 24 | github.com/golang/protobuf v1.5.4 // indirect 25 | github.com/google/gnostic-models v0.6.8 // indirect 26 | github.com/google/go-cmp v0.6.0 // indirect 27 | github.com/google/gofuzz v1.2.0 // indirect 28 | github.com/google/uuid v1.6.0 // indirect 29 | github.com/josharian/intern v1.0.0 // indirect 30 | github.com/json-iterator/go v1.1.12 // indirect 31 | github.com/mailru/easyjson v0.7.7 // indirect 32 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 33 | github.com/modern-go/reflect2 v1.0.2 // indirect 34 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 35 | github.com/onsi/ginkgo/v2 v2.17.1 // indirect 36 | github.com/onsi/gomega v1.32.0 // indirect 37 | github.com/pkg/errors v0.9.1 // indirect 38 | github.com/spf13/pflag v1.0.5 // indirect 39 | golang.org/x/mod v0.17.0 // indirect 40 | golang.org/x/net v0.24.0 // indirect 41 | golang.org/x/oauth2 v0.17.0 // indirect 42 | golang.org/x/sync v0.7.0 // indirect 43 | golang.org/x/sys v0.19.0 // indirect 44 | golang.org/x/term v0.19.0 // indirect 45 | golang.org/x/text v0.14.0 // indirect 46 | golang.org/x/time v0.3.0 // indirect 47 | golang.org/x/tools v0.20.0 // indirect 48 | google.golang.org/appengine v1.6.8 // indirect 49 | google.golang.org/protobuf v1.33.0 // indirect 50 | gopkg.in/inf.v0 v0.9.1 // indirect 51 | gopkg.in/yaml.v2 v2.4.0 // indirect 52 | gopkg.in/yaml.v3 v3.0.1 // indirect 53 | k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect 54 | k8s.io/klog/v2 v2.120.1 // indirect 55 | k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect 56 | sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect 57 | sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect 58 | sigs.k8s.io/yaml v1.4.0 // indirect 59 | ) 60 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | -------------------------------------------------------------------------------- /hack/generate_client.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | go mod vendor 4 | retVal=$? 5 | if [ $retVal -ne 0 ]; then 6 | exit $retVal 7 | fi 8 | 9 | set -e 10 | TMP_DIR=$(mktemp -d) 11 | mkdir -p "${TMP_DIR}"/src/github.com/openkruise/kruise-api 12 | cp -r ./{apps,policy,hack,utils,vendor,go.mod,.git} "${TMP_DIR}"/src/github.com/openkruise/kruise-api/ 13 | 14 | chmod +x "${TMP_DIR}"/src/github.com/openkruise/kruise-api/vendor/k8s.io/code-generator/generate-internal-groups.sh 15 | echo "tmp_dir: ${TMP_DIR}" 16 | 17 | SCRIPT_ROOT="${TMP_DIR}"/src/github.com/openkruise/kruise-api 18 | CODEGEN_PKG=${CODEGEN_PKG:-"${SCRIPT_ROOT}/vendor/k8s.io/code-generator"} 19 | 20 | echo "source ${CODEGEN_PKG}/kube_codegen.sh" 21 | source "${CODEGEN_PKG}/kube_codegen.sh" 22 | 23 | echo "gen_helpers" 24 | GOPATH=${TMP_DIR} GO111MODULE=off kube::codegen::gen_helpers \ 25 | --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ 26 | "${SCRIPT_ROOT}" 27 | 28 | echo "gen_client" 29 | GOPATH=${TMP_DIR} GO111MODULE=off kube::codegen::gen_client \ 30 | --with-watch \ 31 | --output-dir "${SCRIPT_ROOT}/client" \ 32 | --output-pkg "github.com/openkruise/kruise-api/client" \ 33 | --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ 34 | "${SCRIPT_ROOT}" 35 | 36 | mkdir -p ./client 37 | rm -rf ./client/{clientset,informers,listers} 38 | mv "${TMP_DIR}"/src/github.com/openkruise/kruise-api/client/* ./client/ 39 | -------------------------------------------------------------------------------- /hack/generate_openapi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | go mod vendor 4 | retVal=$? 5 | if [ $retVal -ne 0 ]; then 6 | exit $retVal 7 | fi 8 | 9 | set -e 10 | TMP_DIR=$(mktemp -d) 11 | mkdir -p "${TMP_DIR}"/src/github.com/openkruise/kruise-api 12 | cp -r ./{apps,policy,hack,utils,vendor,go.mod,.git} "${TMP_DIR}"/src/github.com/openkruise/kruise-api/ 13 | echo "tmp_dir: ${TMP_DIR}" 14 | SCRIPT_ROOT="${TMP_DIR}"/src/github.com/openkruise/kruise-api 15 | CODEGEN_PKG=${CODEGEN_PKG:-"${SCRIPT_ROOT}/vendor/k8s.io/code-generator"} 16 | source "${CODEGEN_PKG}/kube_codegen.sh" 17 | 18 | echo "gen_openapi" 19 | report_filename="./violation_exceptions.list" 20 | 21 | (cd "${TMP_DIR}"/src/github.com/openkruise/kruise-api; \ 22 | GOPATH=${TMP_DIR} kube::codegen::gen_openapi \ 23 | --output-dir "${SCRIPT_ROOT}/pkg/kruise" \ 24 | --output-pkg "github.com/openkruise/kruise-api/pkg/kruise" \ 25 | --extra-pkgs "github.com/openkruise/kruise-api/policy/v1alpha1" \ 26 | --report-filename "${report_filename}" \ 27 | --update-report \ 28 | --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ 29 | "${SCRIPT_ROOT}/apps" 30 | ) 31 | 32 | (cd "${TMP_DIR}"/src/github.com/openkruise/kruise-api; \ 33 | GOPATH=${TMP_DIR} kube::codegen::gen_openapi \ 34 | --output-dir "${SCRIPT_ROOT}/pkg/apis" \ 35 | --output-pkg "github.com/openkruise/kruise-api/pkg/apis" \ 36 | --extra-pkgs "github.com/openkruise/kruise-api/policy/v1alpha1" \ 37 | --extra-pkgs "k8s.io/api/autoscaling/v1" \ 38 | --extra-pkgs "k8s.io/api/batch/v1" \ 39 | --extra-pkgs "k8s.io/api/certificates/v1" \ 40 | --extra-pkgs "k8s.io/api/core/v1" \ 41 | --extra-pkgs "k8s.io/api/networking/v1" \ 42 | --extra-pkgs "k8s.io/api/policy/v1" \ 43 | --extra-pkgs "k8s.io/api/rbac/v1" \ 44 | --extra-pkgs "k8s.io/api/storage/v1" \ 45 | --report-filename "${report_filename}" \ 46 | --update-report \ 47 | --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \ 48 | "${SCRIPT_ROOT}/apps" 49 | ) 50 | 51 | cp -f "${TMP_DIR}"/src/github.com/openkruise/kruise-api/pkg/kruise/zz_generated.openapi.go ./pkg/kruise/openapi_generated.go 52 | cp -f "${TMP_DIR}"/src/github.com/openkruise/kruise-api/pkg/apis/zz_generated.openapi.go ./pkg/apis/openapi_generated.go 53 | rm -rf vendor 54 | rm -rf ${TMP_DIR} 55 | -------------------------------------------------------------------------------- /hack/tool.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | /* 5 | Copyright 2020 The Kruise Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | // This package imports things required by build scripts, to force `go mod` to see them as dependencies 21 | package hack 22 | 23 | import ( 24 | _ "github.com/go-bindata/go-bindata/go-bindata" 25 | _ "k8s.io/code-generator" 26 | _ "k8s.io/kube-openapi/cmd/openapi-gen" 27 | ) 28 | -------------------------------------------------------------------------------- /policy/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +groupName=policy.kruise.io 19 | package v1alpha1 20 | -------------------------------------------------------------------------------- /policy/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains API Schema definitions for the policy v1alpha1 API group 18 | // +kubebuilder:object:generate=true 19 | // +groupName=policy.kruise.io 20 | package v1alpha1 21 | 22 | import ( 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | "github.com/openkruise/kruise-api/utils/scheme" 25 | ) 26 | 27 | var ( 28 | // GroupVersion is group version used to register these objects 29 | GroupVersion = schema.GroupVersion{Group: "policy.kruise.io", Version: "v1alpha1"} 30 | 31 | SchemeGroupVersion = GroupVersion 32 | 33 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 34 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 35 | 36 | // AddToScheme adds the types in this group-version to the given scheme. 37 | AddToScheme = SchemeBuilder.AddToScheme 38 | ) 39 | 40 | // Resource is required by pkg/client/listers/... 41 | func Resource(resource string) schema.GroupResource { 42 | return SchemeGroupVersion.WithResource(resource).GroupResource() 43 | } 44 | -------------------------------------------------------------------------------- /policy/v1alpha1/resources_deletion_protection.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | const ( 20 | // DeletionProtectionKey is a key in object labels and its value can be Always and Cascading. 21 | // Currently supports Namespace, CustomResourcesDefinition, Deployment, StatefulSet, ReplicaSet, CloneSet, Advanced StatefulSet, UnitedDeployment. 22 | DeletionProtectionKey = "policy.kruise.io/delete-protection" 23 | 24 | // DeletionProtectionTypeAlways indicates this object will always be forbidden to be deleted, unless the label is removed. 25 | DeletionProtectionTypeAlways = "Always" 26 | // DeletionProtectionTypeCascading indicates this object will be forbidden to be deleted, if it has active resources owned. 27 | DeletionProtectionTypeCascading = "Cascading" 28 | ) 29 | -------------------------------------------------------------------------------- /test/kustomize/kruise/advancedcronjob/advancedcronjob.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: AdvancedCronJob 3 | metadata: 4 | name: acj-test 5 | spec: 6 | schedule: "*/1 * * * *" 7 | template: 8 | broadcastJobTemplate: 9 | spec: 10 | template: 11 | spec: 12 | initContainers: 13 | - name: job-1 14 | image: alpine:3.11 15 | command: 16 | - 'sh' 17 | - '-c' 18 | - > 19 | for i in 1 2 3; 20 | do 21 | echo "job-1 `date`"; 22 | sleep 1s; 23 | done; 24 | echo code > /srv/input/code 25 | volumeMounts: 26 | - mountPath: /srv/input/ 27 | name: input 28 | volumes: 29 | - name: input 30 | emptyDir: {} 31 | completionPolicy: 32 | type: Always 33 | ttlSecondsAfterFinished: 30 -------------------------------------------------------------------------------- /test/kustomize/kruise/advancedcronjob/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: AdvancedCronJob 3 | metadata: 4 | name: acj-test 5 | spec: 6 | schedule: '*/1 * * * *' 7 | template: 8 | broadcastJobTemplate: 9 | spec: 10 | template: 11 | spec: 12 | completionPolicy: 13 | ttlSecondsAfterFinished: 30 14 | type: Always 15 | initContainers: 16 | - command: 17 | - sh 18 | - -c 19 | - | 20 | for i in 1 2 3; do 21 | 22 | echo "job-1 `date`"; 23 | sleep 1s; 24 | done; echo code > /srv/input/code 25 | image: alpine:3:12 26 | name: job-1 27 | volumeMounts: 28 | - mountPath: /srv/input/ 29 | name: input 30 | - command: 31 | - sh 32 | - -c 33 | - | 34 | for i in 1 2 3; do 35 | 36 | echo "job-2 `date`"; 37 | sleep 1s; 38 | done; cat /srv/input/code && echo artifact > /srv/input/output/artifact 39 | image: alpine:3.11 40 | name: job-2 41 | volumeMounts: 42 | - mountPath: /srv/input/ 43 | name: input 44 | - mountPath: /srv/input/output/ 45 | name: output 46 | volumes: 47 | - emptyDir: {} 48 | name: output 49 | - emptyDir: {} 50 | name: input 51 | -------------------------------------------------------------------------------- /test/kustomize/kruise/advancedcronjob/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - advancedcronjob.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: AdvancedCronJob 14 | metadata: 15 | name: acj-test 16 | spec: 17 | template: 18 | broadcastJobTemplate: 19 | spec: 20 | template: 21 | spec: 22 | initContainers: 23 | - name: job-1 24 | image: alpine:3:12 25 | - name: job-2 26 | image: alpine:3.11 27 | command: 28 | - 'sh' 29 | - '-c' 30 | - > 31 | for i in 1 2 3; 32 | do 33 | echo "job-2 `date`"; 34 | sleep 1s; 35 | done; 36 | cat /srv/input/code && 37 | echo artifact > /srv/input/output/artifact 38 | volumeMounts: 39 | - mountPath: /srv/input/ 40 | name: input 41 | - mountPath: /srv/input/output/ 42 | name: output 43 | volumes: 44 | - name: output 45 | emptyDir: {} 46 | -------------------------------------------------------------------------------- /test/kustomize/kruise/advanceddaemonset/advanceddaemonset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: DaemonSet 3 | metadata: 4 | name: ads-test 5 | spec: 6 | minReadySeconds: 15 7 | selector: 8 | matchLabels: 9 | name: fluentd-elasticsearch 10 | updateStrategy: 11 | type: RollingUpdate 12 | rollingUpdate: 13 | maxUnavailable: 0 14 | maxSurge: 100% 15 | partition: 0 16 | template: 17 | metadata: 18 | labels: 19 | name: fluentd-elasticsearch 20 | spec: 21 | tolerations: 22 | - key: node-role.kubernetes.io/master 23 | effect: NoSchedule 24 | containers: 25 | - name: fluentd-elasticsearch 26 | image: quay.io/fluentd_elasticsearch/fluentd:v2.6.0 27 | volumeMounts: 28 | - name: varlog 29 | mountPath: /var/log 30 | - name: varlibdockercontainers 31 | mountPath: /var/lib/docker/containers 32 | readOnly: true 33 | terminationGracePeriodSeconds: 30 34 | volumes: 35 | - name: varlog 36 | hostPath: 37 | path: /var/log 38 | - name: varlibdockercontainers 39 | hostPath: 40 | path: /var/lib/docker/containers -------------------------------------------------------------------------------- /test/kustomize/kruise/advanceddaemonset/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: DaemonSet 3 | metadata: 4 | name: ads-test 5 | spec: 6 | minReadySeconds: 15 7 | selector: 8 | matchLabels: 9 | name: fluentd-elasticsearch 10 | template: 11 | metadata: 12 | labels: 13 | name: fluentd-elasticsearch 14 | spec: 15 | containers: 16 | - image: quay.io/fluentd_elasticsearch/fluentd:v2.6.0 17 | name: fluentd-elasticsearch 18 | volumeMounts: 19 | - mountPath: /var/log2 20 | name: log-volume2 21 | - mountPath: /var/log 22 | name: varlog 23 | - mountPath: /var/lib/docker/containers 24 | name: varlibdockercontainers 25 | readOnly: true 26 | - image: busybox:1.28 27 | name: test 28 | terminationGracePeriodSeconds: 30 29 | tolerations: 30 | - effect: NoSchedule 31 | key: node-role.kubernetes.io/master 32 | volumes: 33 | - emptyDir: {} 34 | name: log-volume2 35 | - hostPath: 36 | path: /var/log 37 | name: varlog 38 | - hostPath: 39 | path: /var/lib/docker/containers 40 | name: varlibdockercontainers 41 | updateStrategy: 42 | rollingUpdate: 43 | maxSurge: 100% 44 | maxUnavailable: 0 45 | partition: 0 46 | type: RollingUpdate 47 | -------------------------------------------------------------------------------- /test/kustomize/kruise/advanceddaemonset/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - advanceddaemonset.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: DaemonSet 14 | metadata: 15 | name: ads-test 16 | spec: 17 | template: 18 | spec: 19 | containers: 20 | - name: fluentd-elasticsearch 21 | volumeMounts: 22 | - name: log-volume2 23 | mountPath: /var/log2 24 | - name: test 25 | image: busybox:1.28 26 | volumes: 27 | - name: log-volume2 28 | emptyDir: {} 29 | -------------------------------------------------------------------------------- /test/kustomize/kruise/advancedstatefulset/advancedstatefulset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1beta1 2 | kind: StatefulSet 3 | metadata: 4 | name: sample 5 | spec: 6 | replicas: 3 7 | serviceName: fake-service 8 | selector: 9 | matchLabels: 10 | app: sample 11 | template: 12 | metadata: 13 | labels: 14 | app: sample 15 | spec: 16 | readinessGates: 17 | # A new condition that ensures the pod remains at NotReady state while the in-place update is happening 18 | - conditionType: InPlaceUpdateReady 19 | containers: 20 | - name: main 21 | image: nginx:alpine 22 | volumeMounts: 23 | - name: log-volume1 24 | mountPath: /var/log 25 | volumes: 26 | - name: log-volume1 27 | emptyDir: {} 28 | podManagementPolicy: Parallel # allow parallel updates, works together with maxUnavailable 29 | updateStrategy: 30 | type: RollingUpdate 31 | rollingUpdate: 32 | # Do in-place update if possible, currently only image update is supported for in-place update 33 | podUpdatePolicy: InPlaceIfPossible 34 | # Allow parallel updates with max number of unavailable instances equals to 2 35 | maxUnavailable: 2 -------------------------------------------------------------------------------- /test/kustomize/kruise/advancedstatefulset/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1beta1 2 | kind: StatefulSet 3 | metadata: 4 | name: sample 5 | spec: 6 | podManagementPolicy: Parallel 7 | replicas: 3 8 | selector: 9 | matchLabels: 10 | app: sample 11 | serviceName: fake-service 12 | template: 13 | metadata: 14 | labels: 15 | app: sample 16 | spec: 17 | containers: 18 | - image: nginx:alpine 19 | name: main 20 | volumeMounts: 21 | - mountPath: /var/log2 22 | name: log-volume2 23 | - mountPath: /var/log 24 | name: log-volume1 25 | - image: busybox:1.28 26 | name: test 27 | readinessGates: 28 | - conditionType: InPlaceUpdateReady 29 | volumes: 30 | - emptyDir: {} 31 | name: log-volume2 32 | - emptyDir: {} 33 | name: log-volume1 34 | updateStrategy: 35 | rollingUpdate: 36 | maxUnavailable: 2 37 | podUpdatePolicy: InPlaceIfPossible 38 | type: RollingUpdate 39 | -------------------------------------------------------------------------------- /test/kustomize/kruise/advancedstatefulset/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - advancedstatefulset.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1beta1 13 | kind: StatefulSet 14 | metadata: 15 | name: sample 16 | spec: 17 | template: 18 | spec: 19 | containers: 20 | - name: main 21 | image: nginx:alpine 22 | volumeMounts: 23 | - name: log-volume2 24 | mountPath: /var/log2 25 | - name: test 26 | image: busybox:1.28 27 | volumes: 28 | - name: log-volume2 29 | emptyDir: {} 30 | -------------------------------------------------------------------------------- /test/kustomize/kruise/broadcastjob/broadcastjob.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: BroadcastJob 3 | metadata: 4 | name: broadcastjob-test 5 | spec: 6 | template: 7 | spec: 8 | initContainers: 9 | - name: job-1 10 | image: alpine:3.11 11 | command: 12 | - 'sh' 13 | - '-c' 14 | - > 15 | for i in 1 2 3; 16 | do 17 | echo "job-1 `date`"; 18 | sleep 1s; 19 | done; 20 | echo code > /srv/input/code 21 | volumeMounts: 22 | - mountPath: /srv/input/ 23 | name: input 24 | volumes: 25 | - name: input 26 | emptyDir: {} 27 | completionPolicy: 28 | type: Always 29 | ttlSecondsAfterFinished: 30 30 | -------------------------------------------------------------------------------- /test/kustomize/kruise/broadcastjob/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: BroadcastJob 3 | metadata: 4 | name: broadcastjob-test 5 | spec: 6 | completionPolicy: 7 | ttlSecondsAfterFinished: 30 8 | type: Always 9 | template: 10 | spec: 11 | initContainers: 12 | - command: 13 | - sh 14 | - -c 15 | - | 16 | for i in 1 2 3; do 17 | 18 | echo "job-1 `date`"; 19 | sleep 1s; 20 | done; echo code > /srv/input/code 21 | image: alpine:3:12 22 | name: job-1 23 | volumeMounts: 24 | - mountPath: /srv/input/ 25 | name: input 26 | - command: 27 | - sh 28 | - -c 29 | - | 30 | for i in 1 2 3; do 31 | 32 | echo "job-2 `date`"; 33 | sleep 1s; 34 | done; cat /srv/input/code && echo artifact > /srv/input/output/artifact 35 | image: alpine:3.11 36 | name: job-2 37 | volumeMounts: 38 | - mountPath: /srv/input/ 39 | name: input 40 | - mountPath: /srv/input/output/ 41 | name: output 42 | volumes: 43 | - emptyDir: {} 44 | name: output 45 | - emptyDir: {} 46 | name: input 47 | -------------------------------------------------------------------------------- /test/kustomize/kruise/broadcastjob/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - broadcastjob.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: BroadcastJob 14 | metadata: 15 | name: broadcastjob-test 16 | spec: 17 | template: 18 | spec: 19 | initContainers: 20 | - name: job-1 21 | image: alpine:3:12 22 | - name: job-2 23 | image: alpine:3.11 24 | command: 25 | - 'sh' 26 | - '-c' 27 | - > 28 | for i in 1 2 3; 29 | do 30 | echo "job-2 `date`"; 31 | sleep 1s; 32 | done; 33 | cat /srv/input/code && 34 | echo artifact > /srv/input/output/artifact 35 | volumeMounts: 36 | - mountPath: /srv/input/ 37 | name: input 38 | - mountPath: /srv/input/output/ 39 | name: output 40 | volumes: 41 | - name: output 42 | emptyDir: {} 43 | -------------------------------------------------------------------------------- /test/kustomize/kruise/cloneset/cloneset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: CloneSet 3 | metadata: 4 | labels: 5 | app: sample 6 | name: sample-data 7 | spec: 8 | replicas: 5 9 | selector: 10 | matchLabels: 11 | app: sample 12 | template: 13 | metadata: 14 | labels: 15 | app: sample 16 | spec: 17 | containers: 18 | - name: nginx 19 | image: nginx:alpine 20 | volumeMounts: 21 | - name: data-vol 22 | mountPath: /usr/share/nginx/html 23 | - name: busybox 24 | image: busybox 25 | volumeClaimTemplates: 26 | - metadata: 27 | name: data-vol 28 | spec: 29 | accessModes: [ "ReadWriteOnce" ] 30 | resources: 31 | requests: 32 | storage: 20Gi -------------------------------------------------------------------------------- /test/kustomize/kruise/cloneset/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: CloneSet 3 | metadata: 4 | labels: 5 | app: sample 6 | name: sample-data 7 | spec: 8 | replicas: 5 9 | selector: 10 | matchLabels: 11 | app: sample 12 | template: 13 | metadata: 14 | labels: 15 | app: sample 16 | spec: 17 | containers: 18 | - image: nginx:mainline 19 | name: nginx 20 | volumeMounts: 21 | - mountPath: /var/log 22 | name: log-volume 23 | - mountPath: /usr/share/nginx/html 24 | name: data-vol 25 | - command: 26 | - sleep 27 | - 999d 28 | image: busybox:1.28 29 | name: test 30 | - image: busybox 31 | name: busybox 32 | volumeClaimTemplates: 33 | - metadata: 34 | name: data-vol 35 | spec: 36 | accessModes: 37 | - ReadWriteOnce 38 | resources: 39 | requests: 40 | storage: 20Gi 41 | - metadata: 42 | name: log-volume 43 | spec: 44 | accessModes: 45 | - ReadWriteOnce 46 | resources: 47 | requests: 48 | storage: 20Gi 49 | -------------------------------------------------------------------------------- /test/kustomize/kruise/cloneset/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - cloneset.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: CloneSet 14 | metadata: 15 | name: sample-data 16 | spec: 17 | template: 18 | spec: 19 | containers: 20 | - name: nginx 21 | image: nginx:mainline 22 | volumeMounts: 23 | - name: log-volume 24 | mountPath: /var/log 25 | - name: test 26 | image: busybox:1.28 27 | command: ["sleep", "999d"] 28 | volumeClaimTemplates: 29 | - metadata: 30 | name: data-vol 31 | spec: 32 | accessModes: [ "ReadWriteOnce" ] 33 | resources: 34 | requests: 35 | storage: 20Gi 36 | - metadata: 37 | name: log-volume 38 | spec: 39 | accessModes: [ "ReadWriteOnce" ] 40 | resources: 41 | requests: 42 | storage: 20Gi -------------------------------------------------------------------------------- /test/kustomize/kruise/ephemeraljob/ephemeraljob.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: EphemeralJob 3 | metadata: 4 | name: hello-world-ephemeral-job 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: helloworld 9 | replicas: 4 10 | ttlSecondsAfterCreated: 1800 11 | parallelism: 1 12 | template: 13 | ephemeralContainers: 14 | - image: busybox:latest 15 | imagePullPolicy: IfNotPresent 16 | terminationMessagePolicy: File 17 | targetContainerName: helloworld 18 | name: helloworld-ec 19 | command: 20 | - pidof 21 | - helloworld 22 | tty: true 23 | stdin: true -------------------------------------------------------------------------------- /test/kustomize/kruise/ephemeraljob/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: EphemeralJob 3 | metadata: 4 | name: hello-world-ephemeral-job 5 | spec: 6 | parallelism: 1 7 | replicas: 2 8 | selector: 9 | matchLabels: 10 | app: helloworld 11 | template: 12 | ephemeralContainers: 13 | - command: 14 | - pidof 15 | - test 16 | image: busybox:v1.16 17 | imagePullPolicy: IfNotPresent 18 | name: test-ec 19 | stdin: true 20 | targetContainerName: test 21 | terminationMessagePolicy: File 22 | tty: true 23 | - command: 24 | - pidof 25 | - helloworld 26 | image: busybox:latest 27 | imagePullPolicy: IfNotPresent 28 | name: helloworld-ec 29 | stdin: true 30 | targetContainerName: helloworld 31 | terminationMessagePolicy: File 32 | tty: true 33 | ttlSecondsAfterCreated: 1800 34 | -------------------------------------------------------------------------------- /test/kustomize/kruise/ephemeraljob/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ephemeraljob.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: EphemeralJob 14 | metadata: 15 | name: hello-world-ephemeral-job 16 | spec: 17 | replicas: 2 18 | template: 19 | ephemeralContainers: 20 | - image: busybox:v1.16 21 | imagePullPolicy: IfNotPresent 22 | terminationMessagePolicy: File 23 | targetContainerName: test 24 | name: test-ec 25 | command: 26 | - pidof 27 | - test 28 | tty: true 29 | stdin: true 30 | -------------------------------------------------------------------------------- /test/kustomize/kruise/pod_probe_marker/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: PodProbeMarker 3 | metadata: 4 | name: game-server-probe 5 | namespace: ns 6 | spec: 7 | probes: 8 | - containerName: game-server 9 | markerPolicy: 10 | - annotations: 11 | controller.kubernetes.io/pod-deletion-cost: "-10" 12 | labels: 13 | gameserver-idle: "true" 14 | state: Succeeded 15 | - annotations: 16 | controller.kubernetes.io/pod-deletion-cost: "10" 17 | labels: 18 | gameserver-idle: "false" 19 | state: Failed 20 | name: Idle 21 | podConditionType: game.io/idle 22 | probe: 23 | exec: /home/game/idle.sh 24 | failureThreshold: 3 25 | initialDelaySeconds: 10 26 | periodSeconds: 10 27 | successThreshold: 1 28 | timeoutSeconds: 3 29 | selector: 30 | matchLabels: 31 | app: game-server 32 | -------------------------------------------------------------------------------- /test/kustomize/kruise/pod_probe_marker/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - pod_probe_marker.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: PodProbeMarker 14 | metadata: 15 | name: game-server-probe 16 | namespace: ns 17 | spec: 18 | probes: 19 | - name: Idle 20 | markerPolicy: 21 | - state: Succeeded 22 | annotations: 23 | controller.kubernetes.io/pod-deletion-cost: '-10' 24 | - state: Failed 25 | labels: 26 | gameserver-idle: 'false' 27 | annotations: 28 | controller.kubernetes.io/pod-deletion-cost: '10' 29 | podConditionType: game.io/idle 30 | -------------------------------------------------------------------------------- /test/kustomize/kruise/pod_probe_marker/pod_probe_marker.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: PodProbeMarker 3 | metadata: 4 | name: game-server-probe 5 | namespace: ns 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: game-server 10 | probes: 11 | - name: Idle 12 | containerName: game-server 13 | probe: 14 | exec: /home/game/idle.sh 15 | initialDelaySeconds: 10 16 | timeoutSeconds: 3 17 | periodSeconds: 10 18 | successThreshold: 1 19 | failureThreshold: 3 20 | markerPolicy: 21 | - state: Succeeded 22 | labels: 23 | gameserver-idle: 'true' 24 | annotations: 25 | controller.kubernetes.io/pod-deletion-cost: '-5' 26 | podConditionType: game.io/idle -------------------------------------------------------------------------------- /test/kustomize/kruise/sidecarset/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: SidecarSet 3 | metadata: 4 | name: test-sidecarset 5 | spec: 6 | containers: 7 | - command: 8 | - sleep 9 | - 101d 10 | image: centos:6.8 11 | name: sidecar1 12 | volumeMounts: 13 | - mountPath: /var/log2 14 | name: log-volume2 15 | - mountPath: /var/log 16 | name: log-volume1 17 | - command: 18 | - sleep 19 | - 102d 20 | image: centos:6.9 21 | name: sidecar3 22 | volumeMounts: 23 | - mountPath: /var/log 24 | name: log-volume3 25 | - command: 26 | - sleep 27 | - 999d 28 | image: centos:6.8 29 | name: sidecar2 30 | volumeMounts: 31 | - mountPath: /var/log 32 | name: log-volume2 33 | selector: 34 | matchLabels: 35 | app: nginx 36 | updateStrategy: 37 | maxUnavailable: 1 38 | type: RollingUpdate 39 | volumes: 40 | - emptyDir: {} 41 | hostPath: 42 | path: /var/log 43 | name: log-volume1 44 | - emptyDir: {} 45 | name: log-volume3 46 | - emptyDir: {} 47 | name: log-volume2 48 | -------------------------------------------------------------------------------- /test/kustomize/kruise/sidecarset/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - sidecarset.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: SidecarSet 14 | metadata: 15 | name: test-sidecarset 16 | spec: 17 | containers: 18 | - name: sidecar1 19 | image: centos:6.8 20 | command: ["sleep", "101d"] 21 | volumeMounts: 22 | - name: log-volume2 23 | mountPath: /var/log2 24 | - name: sidecar3 25 | image: centos:6.9 26 | command: ["sleep", "102d"] 27 | volumeMounts: 28 | - name: log-volume3 29 | mountPath: /var/log 30 | volumes: 31 | - name: log-volume1 32 | hostPath: 33 | path: /var/log 34 | - name: log-volume3 35 | emptyDir: {} -------------------------------------------------------------------------------- /test/kustomize/kruise/sidecarset/sidecarset.yaml: -------------------------------------------------------------------------------- 1 | # this yaml is only used to test kustomize smp 2 | apiVersion: apps.kruise.io/v1alpha1 3 | kind: SidecarSet 4 | metadata: 5 | name: test-sidecarset 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: nginx 10 | updateStrategy: 11 | type: RollingUpdate 12 | maxUnavailable: 1 13 | containers: 14 | - name: sidecar1 15 | image: centos:6.7 16 | command: ["sleep", "999d"] # do nothing at all 17 | volumeMounts: 18 | - name: log-volume1 19 | mountPath: /var/log 20 | - name: sidecar2 21 | image: centos:6.8 22 | command: ["sleep", "999d"] # do nothing at all 23 | volumeMounts: 24 | - name: log-volume2 25 | mountPath: /var/log 26 | volumes: # this field will be merged into pod.spec.volumes 27 | - name: log-volume1 28 | emptyDir: {} 29 | - name: log-volume2 30 | emptyDir: {} -------------------------------------------------------------------------------- /test/kustomize/kruise/uniteddeployment/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: UnitedDeployment 3 | metadata: 4 | name: sample-ud 5 | spec: 6 | replicas: 6 7 | revisionHistoryLimit: 10 8 | selector: 9 | matchLabels: 10 | app: sample 11 | template: 12 | statefulSetTemplate: 13 | metadata: 14 | labels: 15 | app: sample 16 | spec: 17 | selector: 18 | matchLabels: 19 | app: sample 20 | template: 21 | metadata: 22 | labels: 23 | app: sample 24 | spec: 25 | containers: 26 | - image: busybox:latest 27 | name: busybox 28 | - image: nginx:alpine 29 | name: nginx 30 | topology: 31 | subsets: 32 | - name: subset-a 33 | nodeSelectorTerm: 34 | matchExpressions: 35 | - key: node 36 | operator: In 37 | values: 38 | - zone-a 39 | replicas: 1 40 | - name: subset-b 41 | nodeSelectorTerm: 42 | matchExpressions: 43 | - key: node 44 | operator: In 45 | values: 46 | - zone-b 47 | replicas: 50% 48 | - name: subset-c 49 | nodeSelectorTerm: 50 | matchExpressions: 51 | - key: node 52 | operator: In 53 | values: 54 | - zone-c 55 | updateStrategy: 56 | manualUpdate: 57 | partitions: 58 | subset-a: 0 59 | subset-b: 0 60 | subset-c: 0 61 | type: Manual 62 | -------------------------------------------------------------------------------- /test/kustomize/kruise/uniteddeployment/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - uniteddeployment.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: UnitedDeployment 14 | metadata: 15 | name: sample-ud 16 | spec: 17 | template: 18 | statefulSetTemplate: 19 | spec: 20 | template: 21 | spec: 22 | containers: 23 | - name: busybox 24 | image: busybox:latest 25 | 26 | topology: 27 | subsets: 28 | - name: subset-a 29 | replicas: 1 30 | - name: subset-b 31 | replicas: 50% 32 | - name: subset-c 33 | nodeSelectorTerm: 34 | matchExpressions: 35 | - key: node 36 | operator: In 37 | values: 38 | - zone-c 39 | updateStrategy: 40 | manualUpdate: 41 | partitions: 42 | subset-c: 0 -------------------------------------------------------------------------------- /test/kustomize/kruise/uniteddeployment/uniteddeployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: UnitedDeployment 3 | metadata: 4 | name: sample-ud 5 | spec: 6 | replicas: 6 7 | revisionHistoryLimit: 10 8 | selector: 9 | matchLabels: 10 | app: sample 11 | template: 12 | # statefulSetTemplate or advancedStatefulSetTemplate or cloneSetTemplate or deploymentTemplate 13 | statefulSetTemplate: 14 | metadata: 15 | labels: 16 | app: sample 17 | spec: 18 | selector: 19 | matchLabels: 20 | app: sample 21 | template: 22 | metadata: 23 | labels: 24 | app: sample 25 | spec: 26 | containers: 27 | - name: nginx 28 | image: nginx:alpine 29 | topology: 30 | subsets: 31 | - name: subset-a 32 | nodeSelectorTerm: 33 | matchExpressions: 34 | - key: node 35 | operator: In 36 | values: 37 | - zone-a 38 | replicas: 50% 39 | - name: subset-b 40 | nodeSelectorTerm: 41 | matchExpressions: 42 | - key: node 43 | operator: In 44 | values: 45 | - zone-b 46 | replicas: 50% 47 | updateStrategy: 48 | manualUpdate: 49 | partitions: 50 | subset-a: 0 51 | subset-b: 0 52 | type: Manual -------------------------------------------------------------------------------- /test/kustomize/kruise/workloadspread/expected.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: WorkloadSpread 3 | metadata: 4 | name: workloadspread-demo 5 | spec: 6 | scheduleStrategy: 7 | adaptive: 8 | rescheduleCriticalSeconds: 30 9 | type: Adaptive | Fixed 10 | subsets: 11 | - name: subset-b 12 | requiredNodeSelectorTerm: 13 | matchExpressions: 14 | - key: topology.kubernetes.io/zone 15 | operator: In 16 | values: 17 | - zone-b 18 | - maxReplicas: 3 19 | name: subset-a 20 | patch: 21 | metadata: 22 | labels: 23 | xxx-specific-label: xxx 24 | preferredNodeSelectorTerms: 25 | - matchExpressions: 26 | - key: another-node-label-key 27 | operator: In 28 | values: 29 | - another-node-label-value 30 | preference: null 31 | weight: 1 32 | requiredNodeSelectorTerm: 33 | matchExpressions: 34 | - key: topology.kubernetes.io/zone 35 | operator: In 36 | values: 37 | - zone-a 38 | tolertions: [] 39 | targetRef: 40 | apiVersion: apps/v1 | apps.kruise.io/v1alpha1 41 | kind: Deployment | CloneSet 42 | name: workload-test 43 | -------------------------------------------------------------------------------- /test/kustomize/kruise/workloadspread/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - workloadspread.yaml 6 | 7 | openapi: 8 | path: ../../../../schema/openkruise_all_k8s_kustomize_schema.json 9 | 10 | patchesStrategicMerge: 11 | - |- 12 | apiVersion: apps.kruise.io/v1alpha1 13 | kind: WorkloadSpread 14 | metadata: 15 | name: workloadspread-demo 16 | spec: 17 | subsets: 18 | - name: subset-b 19 | requiredNodeSelectorTerm: 20 | matchExpressions: 21 | - key: topology.kubernetes.io/zone 22 | operator: In 23 | values: 24 | - zone-b -------------------------------------------------------------------------------- /test/kustomize/kruise/workloadspread/workloadspread.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps.kruise.io/v1alpha1 2 | kind: WorkloadSpread 3 | metadata: 4 | name: workloadspread-demo 5 | spec: 6 | targetRef: 7 | apiVersion: apps/v1 | apps.kruise.io/v1alpha1 8 | kind: Deployment | CloneSet 9 | name: workload-test 10 | subsets: 11 | - name: subset-a 12 | requiredNodeSelectorTerm: 13 | matchExpressions: 14 | - key: topology.kubernetes.io/zone 15 | operator: In 16 | values: 17 | - zone-a 18 | preferredNodeSelectorTerms: 19 | - weight: 1 20 | preference: 21 | matchExpressions: 22 | - key: another-node-label-key 23 | operator: In 24 | values: 25 | - another-node-label-value 26 | maxReplicas: 3 27 | tolertions: [] 28 | patch: 29 | metadata: 30 | labels: 31 | xxx-specific-label: xxx 32 | scheduleStrategy: 33 | type: Adaptive | Fixed 34 | adaptive: 35 | rescheduleCriticalSeconds: 30 -------------------------------------------------------------------------------- /test/kustomize/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | for i in `ls ${DIR}/*/*/kustomization.yaml`; do 6 | dir_name=$(dirname $i) 7 | diff_out=$(diff ${dir_name}/expected.yaml <(kustomize build ${dir_name} --load-restrictor=LoadRestrictionsNone)) 8 | if [[ $? -ne 0 ]]; then 9 | echo "${i} had unexpected diff:" 10 | echo "${diff_out}" 11 | exit 1 12 | fi 13 | done -------------------------------------------------------------------------------- /utils/configuration/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Kruise Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package configuration 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | const ( 22 | // kruise configmap name 23 | KruiseConfigurationName = "kruise-configuration" 24 | 25 | SidecarSetPatchPodMetadataWhiteListKey = "SidecarSet_PatchPodMetadata_WhiteList" 26 | ) 27 | 28 | type SidecarSetPatchMetadataWhiteList struct { 29 | Rules []SidecarSetPatchMetadataWhiteRule `json:"rules"` 30 | } 31 | 32 | type SidecarSetPatchMetadataWhiteRule struct { 33 | // selector sidecarSet against labels 34 | // If selector is nil, assume that the rules should apply for every sidecarSets 35 | Selector *metav1.LabelSelector `json:"selector,omitempty"` 36 | // Support for regular expressions 37 | AllowedAnnotationKeyExprs []string `json:"allowedAnnotationKeyExprs"` 38 | } 39 | -------------------------------------------------------------------------------- /utils/scheme/scheme.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package scheme 18 | 19 | import ( 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 | "k8s.io/apimachinery/pkg/runtime" 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | ) 24 | 25 | // Builder builds a new Scheme for mapping go types to Kubernetes GroupVersionKinds. 26 | type Builder struct { 27 | GroupVersion schema.GroupVersion 28 | runtime.SchemeBuilder 29 | } 30 | 31 | // Register adds one or objects to the SchemeBuilder so they can be added to a Scheme. Register mutates bld. 32 | func (bld *Builder) Register(object ...runtime.Object) *Builder { 33 | bld.SchemeBuilder.Register(func(scheme *runtime.Scheme) error { 34 | scheme.AddKnownTypes(bld.GroupVersion, object...) 35 | metav1.AddToGroupVersion(scheme, bld.GroupVersion) 36 | return nil 37 | }) 38 | return bld 39 | } 40 | 41 | // RegisterAll registers all types from the Builder argument. RegisterAll mutates bld. 42 | func (bld *Builder) RegisterAll(b *Builder) *Builder { 43 | bld.SchemeBuilder = append(bld.SchemeBuilder, b.SchemeBuilder...) 44 | return bld 45 | } 46 | 47 | // AddToScheme adds all registered types to s. 48 | func (bld *Builder) AddToScheme(s *runtime.Scheme) error { 49 | return bld.SchemeBuilder.AddToScheme(s) 50 | } 51 | 52 | // Build returns a new Scheme containing the registered types. 53 | func (bld *Builder) Build() (*runtime.Scheme, error) { 54 | s := runtime.NewScheme() 55 | return s, bld.AddToScheme(s) 56 | } 57 | --------------------------------------------------------------------------------