Compare commits

...

18 Commits

Author SHA1 Message Date
Zhen Zhang 09b60c9cd2
update sample to use 1.8 apie (#26)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2025-04-02 14:23:36 +08:00
Zhen Zhang 8f1a2ead57
update to kruise 1.8.0 (#25)
Signed-off-by: furykerry <shouchen.zz@alibaba-inc.com>
2025-02-18 19:34:46 +08:00
Zhen Zhang aa204718cc
remove kruise repo dependency (#24)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2024-09-26 15:14:01 +08:00
Zhen Zhang 7e4db51c55
update kruise dependency to 1.7 (#23)
Signed-off-by: Zhen Zhang <furykerry@gmail.com>
2024-09-04 11:06:58 +08:00
Zhen Zhang bc7731fc53
sync kruise v1.6.1 (#22)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2024-03-22 14:05:26 +08:00
Zhen Zhang 3aaf0eafa4
fix openapi schema generation problem (#21)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2024-01-31 09:40:39 +08:00
Zhen Zhang e960de5653
remote rollout api & client from the repo (#20)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2024-01-29 17:10:37 +08:00
berg fb3acc0764
sync kruise 1.5.0 apis (#19) 2023-10-16 16:31:38 +08:00
y-ykcir fba43ee6a7
feat: add merge annotations for kruise crds and schema generator (#18)
generate openapi file for kruise crds

feat: generate kustomzie schema json automatically

add simple test for kruise crds

Add merge annotations and descriptions for rollout crds

generate openapi file for other crds

feat: generate other kustomzie schema json automatically

Add tests for k8s native fields and crd fields

add README file



enhancement: increase test coverage



enhancement: cover more commonly used crd tests



update merge annotation for kruise apis



update git action1



align with annotations in kruise

Signed-off-by: ricky <yricky509@gmail.com>
2023-09-29 16:26:23 +08:00
liheng.zms 6c60af6bb6 sync kruise(1.4.0) rollout(0.3.0) types
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
2023-03-22 20:15:38 +08:00
berg 0631c9ba99
sync kruise-apis from master (#14) 2023-01-11 10:22:28 +08:00
berg fb1ef753d3
add kruise v1.3.0 apis (#13)
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>

Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
2022-09-28 10:51:57 +08:00
FillZpp d1805e94da Add OWNERS
Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
2022-08-30 11:57:14 +08:00
liheng.zms 948d93f287 rollout v0.2.0
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
2022-08-30 11:56:17 +08:00
FillZpp 1d1061813c Fetch master
Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
2022-07-27 19:16:52 +08:00
FillZpp 07ee4e21e0 Fetch master
Signed-off-by: FillZpp <FillZpp.pub@gmail.com>
2022-05-24 11:19:08 +08:00
Zhen Zhang 7d8f48620c
Merge pull request #9 from veophi/master
CloneSet status add ExpectedUpdatedReplicas field
2022-04-24 15:36:43 +08:00
veophi 1131cf93cc Fetch Master
Signed-off-by: veophi <vec.g.sun@gmail.com>
2022-04-24 13:59:30 +08:00
202 changed files with 87217 additions and 978 deletions

30
.github/workflows/schema-update.yaml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Update schema files when api changes
on:
push:
branches:
- master
paths:
- 'apps/**'
- 'policy/**'
- 'rollouts/**'
jobs:
update-schemas:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Update Schema
run: |
go mod tidy
make gen-openapi-schema
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Updated OpenAPI schema files

View File

@ -1,3 +1,4 @@
CURRENT_DIR=$(shell pwd)
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN)) ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin GOBIN=$(shell go env GOPATH)/bin
@ -11,16 +12,30 @@ vet:
# Generate code # Generate code
generate: controller-gen generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." #$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
@hack/generate_client.sh @hack/generate_client.sh
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen-0.7 CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary. controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool-with-alias,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0,controller-gen) ifeq ("$(shell $(CONTROLLER_GEN) --version 2> /dev/null)", "Version: v0.16.5")
else
rm -rf $(CONTROLLER_GEN)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5)
endif
OPENAPI_GEN = $(shell pwd)/bin/openapi-gen
module=$(shell go list -f '{{.Module}}' k8s.io/kube-openapi/cmd/openapi-gen | awk '{print $$1}')
module_version=$(shell go list -m $(module) | awk '{print $$NF}' | head -1)
openapi-gen: ## Download openapi-gen locally if necessary.
ifeq ("$(shell command -v $(OPENAPI_GEN) 2> /dev/null)", "")
$(call go-get-tool,$(OPENAPI_GEN),k8s.io/kube-openapi/cmd/openapi-gen@$(module_version))
else
@echo "openapi-gen is already installed."
endif
# go-get-tool will 'go get' any package $2 and install it to $1. # go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool-with-alias define go-get-tool
@[ -f $(1) ] || { \ @[ -f $(1) ] || { \
set -e ;\ set -e ;\
TMP_DIR=$$(mktemp -d) ;\ TMP_DIR=$$(mktemp -d) ;\
@ -29,6 +44,16 @@ go mod init tmp ;\
echo "Downloading $(2)" ;\ echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\ rm -rf $$TMP_DIR ;\
mv $(PROJECT_DIR)/bin/$(3) $(1);\
} }
endef endef
.PHONY: gen-schema-only
gen-schema-only:
go run cmd/gen-schema/main.go
.PHONY: gen-openapi-schema
gen-openapi-schema: gen-all-openapi
go run cmd/gen-schema/main.go
.PHONY: gen-all-openapi
@hack/generate_openapi.sh

6
OWNERS Normal file
View File

@ -0,0 +1,6 @@
approvers:
- FillZpp
- furykerry
reviewers:
- FillZpp
- furykerry

View File

@ -4,22 +4,44 @@ Schema of the API types that are served by Kruise.
## Purpose ## Purpose
This library is the canonical location of the Kruise API definition. This library is the canonical location of the Kruise API definition and client.
We recommend using the go types in this repo. You may serialize them directly to JSON. We recommend using the go types in this repo. You may serialize them directly to JSON.
## Compatibility matrix ## What's included
* The `client` package contains the clientset to access Kruise API.
* The `apps` and `policy` packages contain api definition in go
* The `schema` directory contains corresponding openapi schema of kruise source
| Kubernetes Version in your Project | Import Kruise-api < v0.10 | Import Kruise-api >= v0.10 | ## Versioning
|------------------------------------|----------------------------|----------------------------| For each `v1.x.y` Kruise release, the corresponding kruise-api will `v1.x.z`.
| < 1.18 | v0.x.y (x <= 9) | v0.x.y-legacy (x >= 10) |
| >= 1.18 | v0.x.y-1.18 (7 <= x <= 9) | v0.x.y (x >= 10) | 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.
## Where does it come from? ## Where does it come from?
`kruise-api` is synced from [https://github.com/openkruise/kruise/tree/master/apis](https://github.com/openkruise/kruise/tree/master/apis). `kruise-api` is synced from [https://github.com/openkruise/kruise/tree/master/apis](https://github.com/openkruise/kruise/tree/master/apis).
Code changes are made in that location, merged into `openkruise/kruise` and later synced here. Code changes are made in that location, merged into `openkruise/kruise` and later synced here.
### How to get it
To get the latest version, use go1.16+ and fetch using the `go get` command. For example:
```
go get github.com/openkruise/kruise-api@latest
```
To get a specific version, use go1.11+ and fetch the desired version using the `go get` command. For example:
```
go get github.com/openkruise/kruise-api@v1.6.0
```
### How to use it
please refer to the [example](examples/create-update-delete-cloneset)
## Things you should NOT do ## Things you should NOT do
[https://github.com/openkruise/kruise/tree/master/apis](https://github.com/openkruise/kruise/tree/master/apis) is synced to here. [https://github.com/openkruise/kruise/tree/master/apis](https://github.com/openkruise/kruise/tree/master/apis) is synced to here.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2019 The Kruise Authors. Copyright 2021 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,18 +0,0 @@
/*
Copyright 2019 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package apps contains apps API versions
package apps

View File

@ -33,10 +33,14 @@ const (
// InPlaceUpdateStateKey records the state of inplace-update. // InPlaceUpdateStateKey records the state of inplace-update.
// The value of annotation is InPlaceUpdateState. // The value of annotation is InPlaceUpdateState.
InPlaceUpdateStateKey string = "apps.kruise.io/inplace-update-state" InPlaceUpdateStateKey string = "apps.kruise.io/inplace-update-state"
// TODO: will be removed since v1.0.0
InPlaceUpdateStateKeyOld string = "inplace-update-state"
// InPlaceUpdateGraceKey records the spec that Pod should be updated when // InPlaceUpdateGraceKey records the spec that Pod should be updated when
// grace period ends. // grace period ends.
InPlaceUpdateGraceKey string = "apps.kruise.io/inplace-update-grace" InPlaceUpdateGraceKey string = "apps.kruise.io/inplace-update-grace"
// TODO: will be removed since v1.0.0
InPlaceUpdateGraceKeyOld string = "inplace-update-grace"
// RuntimeContainerMetaKey is a key in pod annotations. Kruise-daemon should report the // RuntimeContainerMetaKey is a key in pod annotations. Kruise-daemon should report the
// states of runtime containers into its value, which is a structure JSON of RuntimeContainerMetaSet type. // states of runtime containers into its value, which is a structure JSON of RuntimeContainerMetaSet type.
@ -58,12 +62,21 @@ type InPlaceUpdateState struct {
// UpdateEnvFromMetadata indicates there are envs from annotations/labels that should be in-place update. // UpdateEnvFromMetadata indicates there are envs from annotations/labels that should be in-place update.
UpdateEnvFromMetadata bool `json:"updateEnvFromMetadata,omitempty"` UpdateEnvFromMetadata bool `json:"updateEnvFromMetadata,omitempty"`
// UpdateResources indicates there are resources that should be in-place update.
UpdateResources bool `json:"updateResources,omitempty"`
// UpdateImages indicates there are images that should be in-place update.
UpdateImages bool `json:"updateImages,omitempty"`
// NextContainerImages is the containers with lower priority that waiting for in-place update images in next batch. // NextContainerImages is the containers with lower priority that waiting for in-place update images in next batch.
NextContainerImages map[string]string `json:"nextContainerImages,omitempty"` NextContainerImages map[string]string `json:"nextContainerImages,omitempty"`
// NextContainerRefMetadata is the containers with lower priority that waiting for in-place update labels/annotations in next batch. // NextContainerRefMetadata is the containers with lower priority that waiting for in-place update labels/annotations in next batch.
NextContainerRefMetadata map[string]metav1.ObjectMeta `json:"nextContainerRefMetadata,omitempty"` NextContainerRefMetadata map[string]metav1.ObjectMeta `json:"nextContainerRefMetadata,omitempty"`
// NextContainerResources is the containers with lower priority that waiting for in-place update resources in next batch.
NextContainerResources map[string]v1.ResourceRequirements `json:"nextContainerResources,omitempty"`
// PreCheckBeforeNext is the pre-check that must pass before the next containers can be in-place update. // PreCheckBeforeNext is the pre-check that must pass before the next containers can be in-place update.
PreCheckBeforeNext *InPlaceUpdatePreCheckBeforeNext `json:"preCheckBeforeNext,omitempty"` PreCheckBeforeNext *InPlaceUpdatePreCheckBeforeNext `json:"preCheckBeforeNext,omitempty"`
@ -97,6 +110,27 @@ type InPlaceUpdateStrategy struct {
GracePeriodSeconds int32 `json:"gracePeriodSeconds,omitempty"` GracePeriodSeconds int32 `json:"gracePeriodSeconds,omitempty"`
} }
func GetInPlaceUpdateState(obj metav1.Object) (string, bool) {
if v, ok := obj.GetAnnotations()[InPlaceUpdateStateKey]; ok {
return v, ok
}
v, ok := obj.GetAnnotations()[InPlaceUpdateStateKeyOld]
return v, ok
}
func GetInPlaceUpdateGrace(obj metav1.Object) (string, bool) {
if v, ok := obj.GetAnnotations()[InPlaceUpdateGraceKey]; ok {
return v, ok
}
v, ok := obj.GetAnnotations()[InPlaceUpdateGraceKeyOld]
return v, ok
}
func RemoveInPlaceUpdateGrace(obj metav1.Object) {
delete(obj.GetAnnotations(), InPlaceUpdateGraceKey)
delete(obj.GetAnnotations(), InPlaceUpdateGraceKeyOld)
}
// RuntimeContainerMetaSet contains all the containers' meta of the Pod. // RuntimeContainerMetaSet contains all the containers' meta of the Pod.
type RuntimeContainerMetaSet struct { type RuntimeContainerMetaSet struct {
Containers []RuntimeContainerMeta `json:"containers"` Containers []RuntimeContainerMeta `json:"containers"`
@ -115,6 +149,10 @@ type RuntimeContainerHashes struct {
// PlainHash is the hash that directly calculated from pod.spec.container[x]. // PlainHash is the hash that directly calculated from pod.spec.container[x].
// Usually it is calculated by Kubelet and will be in annotation of each runtime container. // Usually it is calculated by Kubelet and will be in annotation of each runtime container.
PlainHash uint64 `json:"plainHash"` PlainHash uint64 `json:"plainHash"`
// PlainHashWithoutResources is the hash that directly calculated from pod.spec.container[x]
// over fields with Resources field zero'd out.
// Usually it is calculated by Kubelet and will be in annotation of each runtime container.
PlainHashWithoutResources uint64 `json:"plainHashWithoutResources"`
// ExtractedEnvFromMetadataHash is the hash that calculated from pod.spec.container[x], // ExtractedEnvFromMetadataHash is the hash that calculated from pod.spec.container[x],
// whose envs from annotations/labels have already been extracted to the real values. // whose envs from annotations/labels have already been extracted to the real values.
ExtractedEnvFromMetadataHash uint64 `json:"extractedEnvFromMetadataHash,omitempty"` ExtractedEnvFromMetadataHash uint64 `json:"extractedEnvFromMetadataHash,omitempty"`

View File

@ -0,0 +1,36 @@
/*
Copyright 2021 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package pub
const (
// ContainerLaunchPriorityEnvName is the env name that users have to define in pod container
// to identity the launch priority of this container.
ContainerLaunchPriorityEnvName = "KRUISE_CONTAINER_PRIORITY"
// ContainerLaunchBarrierEnvName is the env name that Kruise webhook will inject into containers
// if the pod have configured launch priority.
ContainerLaunchBarrierEnvName = "KRUISE_CONTAINER_BARRIER"
// ContainerLaunchPriorityKey is the annotation key that users could define in pod annotation
// to make containers in pod launched by ordinal.
ContainerLaunchPriorityKey = "apps.kruise.io/container-launch-priority"
// ContainerLaunchOrdered is the annotation value that indicates containers in pod should be launched by ordinal.
ContainerLaunchOrdered = "Ordered"
// ContainerLaunchPriorityCompletedKey is the annotation indicates the pod has all its priorities
// patched into its barrier configmap.
ContainerLaunchPriorityCompletedKey = "apps.kruise.io/container-launch-priority-completed"
)

View File

@ -20,10 +20,22 @@ const (
LifecycleStateKey = "lifecycle.apps.kruise.io/state" LifecycleStateKey = "lifecycle.apps.kruise.io/state"
LifecycleTimestampKey = "lifecycle.apps.kruise.io/timestamp" LifecycleTimestampKey = "lifecycle.apps.kruise.io/timestamp"
// LifecycleStatePreparingNormal means the Pod is created but unavailable.
// It will translate to Normal state if Lifecycle.PreNormal is hooked.
LifecycleStatePreparingNormal LifecycleStateType = "PreparingNormal"
// LifecycleStateNormal is a necessary condition for Pod to be available.
LifecycleStateNormal LifecycleStateType = "Normal" LifecycleStateNormal LifecycleStateType = "Normal"
// LifecycleStatePreparingUpdate means pod is being prepared to update.
// It will translate to Updating state if Lifecycle.InPlaceUpdate is Not hooked.
LifecycleStatePreparingUpdate LifecycleStateType = "PreparingUpdate" LifecycleStatePreparingUpdate LifecycleStateType = "PreparingUpdate"
// LifecycleStateUpdating means the Pod is being updated.
// It will translate to Updated state if the in-place update of the Pod is done.
LifecycleStateUpdating LifecycleStateType = "Updating" LifecycleStateUpdating LifecycleStateType = "Updating"
// LifecycleStateUpdated means the Pod is updated, but unavailable.
// It will translate to Normal state if Lifecycle.InPlaceUpdate is hooked.
LifecycleStateUpdated LifecycleStateType = "Updated" LifecycleStateUpdated LifecycleStateType = "Updated"
// LifecycleStatePreparingDelete means the Pod is prepared to delete.
// The Pod will be deleted by workload if Lifecycle.PreDelete is Not hooked.
LifecycleStatePreparingDelete LifecycleStateType = "PreparingDelete" LifecycleStatePreparingDelete LifecycleStateType = "PreparingDelete"
) )
@ -35,9 +47,17 @@ type Lifecycle struct {
PreDelete *LifecycleHook `json:"preDelete,omitempty"` PreDelete *LifecycleHook `json:"preDelete,omitempty"`
// InPlaceUpdate is the hook before Pod to update and after Pod has been updated. // InPlaceUpdate is the hook before Pod to update and after Pod has been updated.
InPlaceUpdate *LifecycleHook `json:"inPlaceUpdate,omitempty"` InPlaceUpdate *LifecycleHook `json:"inPlaceUpdate,omitempty"`
// PreNormal is the hook after Pod to be created and ready to be Normal.
PreNormal *LifecycleHook `json:"preNormal,omitempty"`
} }
type LifecycleHook struct { type LifecycleHook struct {
LabelsHandler map[string]string `json:"labelsHandler,omitempty"` LabelsHandler map[string]string `json:"labelsHandler,omitempty"`
FinalizersHandler []string `json:"finalizersHandler,omitempty"` FinalizersHandler []string `json:"finalizersHandler,omitempty"`
// MarkPodNotReady = true means:
// - Pod will be set to 'NotReady' at preparingDelete/preparingUpdate state.
// - Pod will be restored to 'Ready' at Updated state if it was set to 'NotReady' at preparingUpdate state.
// Currently, MarkPodNotReady only takes effect on InPlaceUpdate & PreDelete hook.
// Default to false.
MarkPodNotReady bool `json:"markPodNotReady,omitempty"`
} }

View File

@ -0,0 +1,532 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2021 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package pub
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateContainerBatch": schema_kruise_apis_apps_pub_InPlaceUpdateContainerBatch(ref),
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateContainerStatus": schema_kruise_apis_apps_pub_InPlaceUpdateContainerStatus(ref),
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdatePreCheckBeforeNext": schema_kruise_apis_apps_pub_InPlaceUpdatePreCheckBeforeNext(ref),
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateState": schema_kruise_apis_apps_pub_InPlaceUpdateState(ref),
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateStrategy": schema_kruise_apis_apps_pub_InPlaceUpdateStrategy(ref),
"github.com/openkruise/kruise-api/apps/pub.Lifecycle": schema_kruise_apis_apps_pub_Lifecycle(ref),
"github.com/openkruise/kruise-api/apps/pub.LifecycleHook": schema_kruise_apis_apps_pub_LifecycleHook(ref),
"github.com/openkruise/kruise-api/apps/pub.RuntimeContainerHashes": schema_kruise_apis_apps_pub_RuntimeContainerHashes(ref),
"github.com/openkruise/kruise-api/apps/pub.RuntimeContainerMeta": schema_kruise_apis_apps_pub_RuntimeContainerMeta(ref),
"github.com/openkruise/kruise-api/apps/pub.RuntimeContainerMetaSet": schema_kruise_apis_apps_pub_RuntimeContainerMetaSet(ref),
"github.com/openkruise/kruise-api/apps/pub.UpdatePriorityOrderTerm": schema_kruise_apis_apps_pub_UpdatePriorityOrderTerm(ref),
"github.com/openkruise/kruise-api/apps/pub.UpdatePriorityStrategy": schema_kruise_apis_apps_pub_UpdatePriorityStrategy(ref),
"github.com/openkruise/kruise-api/apps/pub.UpdatePriorityWeightTerm": schema_kruise_apis_apps_pub_UpdatePriorityWeightTerm(ref),
}
}
func schema_kruise_apis_apps_pub_InPlaceUpdateContainerBatch(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdateContainerBatch indicates the timestamp and containers for a batch update",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"timestamp": {
SchemaProps: spec.SchemaProps{
Description: "Timestamp is the time for this update batch",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"containers": {
SchemaProps: spec.SchemaProps{
Description: "Containers is the name list of containers for this update batch",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
Required: []string{"timestamp", "containers"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_kruise_apis_apps_pub_InPlaceUpdateContainerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdateContainerStatus records the statuses of the container that are mainly used to determine whether the InPlaceUpdate is completed.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"imageID": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_kruise_apis_apps_pub_InPlaceUpdatePreCheckBeforeNext(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdatePreCheckBeforeNext contains the pre-check that must pass before the next containers can be in-place update.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"containersRequiredReady": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
},
},
}
}
func schema_kruise_apis_apps_pub_InPlaceUpdateState(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdateState records latest inplace-update state, including old statuses of containers.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"revision": {
SchemaProps: spec.SchemaProps{
Description: "Revision is the updated revision hash.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"updateTimestamp": {
SchemaProps: spec.SchemaProps{
Description: "UpdateTimestamp is the start time when the in-place update happens.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"lastContainerStatuses": {
SchemaProps: spec.SchemaProps{
Description: "LastContainerStatuses records the before-in-place-update container statuses. It is a map from ContainerName to InPlaceUpdateContainerStatus",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateContainerStatus"),
},
},
},
},
},
"updateEnvFromMetadata": {
SchemaProps: spec.SchemaProps{
Description: "UpdateEnvFromMetadata indicates there are envs from annotations/labels that should be in-place update.",
Type: []string{"boolean"},
Format: "",
},
},
"nextContainerImages": {
SchemaProps: spec.SchemaProps{
Description: "NextContainerImages is the containers with lower priority that waiting for in-place update images in next batch.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"nextContainerRefMetadata": {
SchemaProps: spec.SchemaProps{
Description: "NextContainerRefMetadata is the containers with lower priority that waiting for in-place update labels/annotations in next batch.",
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
},
},
},
"preCheckBeforeNext": {
SchemaProps: spec.SchemaProps{
Description: "PreCheckBeforeNext is the pre-check that must pass before the next containers can be in-place update.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.InPlaceUpdatePreCheckBeforeNext"),
},
},
"containerBatchesRecord": {
SchemaProps: spec.SchemaProps{
Description: "ContainerBatchesRecord records the update batches that have patched in this revision.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateContainerBatch"),
},
},
},
},
},
},
Required: []string{"revision", "updateTimestamp", "lastContainerStatuses"},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateContainerBatch", "github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateContainerStatus", "github.com/openkruise/kruise-api/apps/pub.InPlaceUpdatePreCheckBeforeNext", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_kruise_apis_apps_pub_InPlaceUpdateStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdateStrategy defines the strategies for in-place update.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"gracePeriodSeconds": {
SchemaProps: spec.SchemaProps{
Description: "GracePeriodSeconds is the timespan between set Pod status to not-ready and update images in Pod spec when in-place update a Pod.",
Type: []string{"integer"},
Format: "int32",
},
},
},
},
},
}
}
func schema_kruise_apis_apps_pub_Lifecycle(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Lifecycle contains the hooks for Pod lifecycle.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"preDelete": {
SchemaProps: spec.SchemaProps{
Description: "PreDelete is the hook before Pod to be deleted.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.LifecycleHook"),
},
},
"inPlaceUpdate": {
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdate is the hook before Pod to update and after Pod has been updated.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.LifecycleHook"),
},
},
"preNormal": {
SchemaProps: spec.SchemaProps{
Description: "PreNormal is the hook after Pod to be created and ready to be Normal.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.LifecycleHook"),
},
},
},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.LifecycleHook"},
}
}
func schema_kruise_apis_apps_pub_LifecycleHook(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"labelsHandler": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
AdditionalProperties: &spec.SchemaOrBool{
Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"finalizersHandler": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"markPodNotReady": {
SchemaProps: spec.SchemaProps{
Description: "MarkPodNotReady = true means: - Pod will be set to 'NotReady' at preparingDelete/preparingUpdate state. - Pod will be restored to 'Ready' at Updated state if it was set to 'NotReady' at preparingUpdate state. Currently, MarkPodNotReady only takes effect on InPlaceUpdate & PreDelete hook. Default to false.",
Type: []string{"boolean"},
Format: "",
},
},
},
},
},
}
}
func schema_kruise_apis_apps_pub_RuntimeContainerHashes(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RuntimeContainerHashes contains the hashes of such container.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"plainHash": {
SchemaProps: spec.SchemaProps{
Description: "PlainHash is the hash that directly calculated from pod.spec.container[x]. Usually it is calculated by Kubelet and will be in annotation of each runtime container.",
Default: 0,
Type: []string{"integer"},
Format: "int64",
},
},
"extractedEnvFromMetadataHash": {
SchemaProps: spec.SchemaProps{
Description: "ExtractedEnvFromMetadataHash is the hash that calculated from pod.spec.container[x], whose envs from annotations/labels have already been extracted to the real values.",
Type: []string{"integer"},
Format: "int64",
},
},
},
Required: []string{"plainHash"},
},
},
}
}
func schema_kruise_apis_apps_pub_RuntimeContainerMeta(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RuntimeContainerMeta contains the meta data of a runtime container.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"name": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"containerID": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"restartCount": {
SchemaProps: spec.SchemaProps{
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"hashes": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/pub.RuntimeContainerHashes"),
},
},
},
Required: []string{"name", "containerID", "restartCount", "hashes"},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.RuntimeContainerHashes"},
}
}
func schema_kruise_apis_apps_pub_RuntimeContainerMetaSet(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RuntimeContainerMetaSet contains all the containers' meta of the Pod.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"containers": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/pub.RuntimeContainerMeta"),
},
},
},
},
},
},
Required: []string{"containers"},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.RuntimeContainerMeta"},
}
}
func schema_kruise_apis_apps_pub_UpdatePriorityOrderTerm(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "UpdatePriorityOrderTerm defines order priority.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"orderedKey": {
SchemaProps: spec.SchemaProps{
Description: "Calculate priority by value of this key. Values of this key, will be sorted by GetInt(val). GetInt method will find the last int in value, such as getting 5 in value '5', getting 10 in value 'sts-10'.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"orderedKey"},
},
},
}
}
func schema_kruise_apis_apps_pub_UpdatePriorityStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "UpdatePriorityStrategy is the strategy to define priority for pods update. Only one of orderPriority and weightPriority can be set.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"orderPriority": {
SchemaProps: spec.SchemaProps{
Description: "Order priority terms, pods will be sorted by the value of orderedKey. For example: ``` orderPriority: - orderedKey: key1 - orderedKey: key2 ``` First, all pods which have key1 in labels will be sorted by the value of key1. Then, the left pods which have no key1 but have key2 in labels will be sorted by the value of key2 and put behind those pods have key1.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/pub.UpdatePriorityOrderTerm"),
},
},
},
},
},
"weightPriority": {
SchemaProps: spec.SchemaProps{
Description: "Weight priority terms, pods will be sorted by the sum of all terms weight.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/pub.UpdatePriorityWeightTerm"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.UpdatePriorityOrderTerm", "github.com/openkruise/kruise-api/apps/pub.UpdatePriorityWeightTerm"},
}
}
func schema_kruise_apis_apps_pub_UpdatePriorityWeightTerm(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "UpdatePriorityWeightTerm defines weight priority.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"weight": {
SchemaProps: spec.SchemaProps{
Description: "Weight associated with matching the corresponding matchExpressions, in the range 1-100.",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"matchSelector": {
SchemaProps: spec.SchemaProps{
Description: "MatchSelector is used to select by pod's labels.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
},
Required: []string{"weight", "matchSelector"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}

View File

@ -19,5 +19,12 @@ package pub
import v1 "k8s.io/api/core/v1" import v1 "k8s.io/api/core/v1"
const ( const (
// KruisePodReadyConditionType can support multiple writers, such as:
// - ContainerRecreateRequest;
// - Workload controller, including CloneSet, Advanced StatefulSet, Advanced Daemonset.
//
// If its corresponding condition status was set to "False" by multiple writers,
// the condition status will be considered as "True" only when all these writers
// set it to "True".
KruisePodReadyConditionType v1.PodConditionType = "KruisePodReady" KruisePodReadyConditionType v1.PodConditionType = "KruisePodReady"
) )

View File

@ -0,0 +1,40 @@
/*
Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package pub
import (
"strings"
)
const (
// PubUnavailablePodLabelPrefix indicates if the pod has this label, both kruise workload and
// pub will determine that the pod is unavailable, even if pod.status.ready=true.
// Main users non-destructive offline and other scenarios
PubUnavailablePodLabelPrefix = "unavailable-pod.kruise.io/"
)
func HasUnavailableLabel(labels map[string]string) bool {
if len(labels) == 0 {
return false
}
for key := range labels {
if strings.HasPrefix(key, PubUnavailablePodLabelPrefix) {
return true
}
}
return false
}

View File

@ -40,7 +40,7 @@ type UpdatePriorityStrategy struct {
WeightPriority []UpdatePriorityWeightTerm `json:"weightPriority,omitempty"` WeightPriority []UpdatePriorityWeightTerm `json:"weightPriority,omitempty"`
} }
// UpdatePriorityOrder defines order priority. // UpdatePriorityOrderTerm defines order priority.
type UpdatePriorityOrderTerm struct { type UpdatePriorityOrderTerm struct {
// Calculate priority by value of this key. // Calculate priority by value of this key.
// Values of this key, will be sorted by GetInt(val). GetInt method will find the last int in value, // Values of this key, will be sorted by GetInt(val). GetInt method will find the last int in value,

View File

@ -1,5 +1,4 @@
//go:build !ignore_autogenerated //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/* /*
Copyright 2021 The Kruise Authors. Copyright 2021 The Kruise Authors.
@ -22,6 +21,7 @@ limitations under the License.
package pub package pub
import ( import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -106,6 +106,13 @@ func (in *InPlaceUpdateState) DeepCopyInto(out *InPlaceUpdateState) {
(*out)[key] = *val.DeepCopy() (*out)[key] = *val.DeepCopy()
} }
} }
if in.NextContainerResources != nil {
in, out := &in.NextContainerResources, &out.NextContainerResources
*out = make(map[string]corev1.ResourceRequirements, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
}
if in.PreCheckBeforeNext != nil { if in.PreCheckBeforeNext != nil {
in, out := &in.PreCheckBeforeNext, &out.PreCheckBeforeNext in, out := &in.PreCheckBeforeNext, &out.PreCheckBeforeNext
*out = new(InPlaceUpdatePreCheckBeforeNext) *out = new(InPlaceUpdatePreCheckBeforeNext)
@ -158,6 +165,11 @@ func (in *Lifecycle) DeepCopyInto(out *Lifecycle) {
*out = new(LifecycleHook) *out = new(LifecycleHook)
(*in).DeepCopyInto(*out) (*in).DeepCopyInto(*out)
} }
if in.PreNormal != nil {
in, out := &in.PreNormal, &out.PreNormal
*out = new(LifecycleHook)
(*in).DeepCopyInto(*out)
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Lifecycle. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Lifecycle.

View File

@ -17,7 +17,7 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
batchv1beta1 "k8s.io/api/batch/v1beta1" batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -31,7 +31,10 @@ type AdvancedCronJobSpec struct {
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
// +kubebuilder:validation:Minimum=0 // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
// If not specified, this will default to the time zone of the kruise-controller-manager process.
// +optional
TimeZone *string `json:"timeZone,omitempty" protobuf:"bytes,8,opt,name=timeZone"`
// Optional deadline in seconds for starting the job if it misses scheduled // Optional deadline in seconds for starting the job if it misses scheduled
// time for any reason. Missed jobs executions will be counted as failed ones. // time for any reason. Missed jobs executions will be counted as failed ones.
@ -50,15 +53,11 @@ type AdvancedCronJobSpec struct {
// +optional // +optional
Paused *bool `json:"paused,omitempty" protobuf:"bytes,4,opt,name=paused"` Paused *bool `json:"paused,omitempty" protobuf:"bytes,4,opt,name=paused"`
// +kubebuilder:validation:Minimum=0
// The number of successful finished jobs to retain. // The number of successful finished jobs to retain.
// This is a pointer to distinguish between explicit zero and not specified. // This is a pointer to distinguish between explicit zero and not specified.
// +optional // +optional
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty" protobuf:"varint,5,opt,name=successfulJobsHistoryLimit"` SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty" protobuf:"varint,5,opt,name=successfulJobsHistoryLimit"`
// +kubebuilder:validation:Minimum=0
// The number of failed finished jobs to retain. // The number of failed finished jobs to retain.
// This is a pointer to distinguish between explicit zero and not specified. // This is a pointer to distinguish between explicit zero and not specified.
// +optional // +optional
@ -73,7 +72,7 @@ type CronJobTemplate struct {
// +optional // +optional
// +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless // +kubebuilder:validation:Schemaless
JobTemplate *batchv1beta1.JobTemplateSpec `json:"jobTemplate,omitempty" protobuf:"bytes,1,opt,name=jobTemplate"` JobTemplate *batchv1.JobTemplateSpec `json:"jobTemplate,omitempty" protobuf:"bytes,1,opt,name=jobTemplate"`
// Specifies the broadcastjob that will be created when executing a BroadcastCronJob. // Specifies the broadcastjob that will be created when executing a BroadcastCronJob.
// +optional // +optional

View File

@ -37,7 +37,7 @@ type BroadcastJobSpec struct {
Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"` Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"`
// CompletionPolicy indicates the completion policy of the job. // CompletionPolicy indicates the completion policy of the job.
// Default is Always CompletionPolicyType // Default is Always CompletionPolicyType.
// +optional // +optional
CompletionPolicy CompletionPolicy `json:"completionPolicy" protobuf:"bytes,3,opt,name=completionPolicy"` CompletionPolicy CompletionPolicy `json:"completionPolicy" protobuf:"bytes,3,opt,name=completionPolicy"`
@ -52,8 +52,8 @@ type BroadcastJobSpec struct {
// CompletionPolicy indicates the completion policy for the job // CompletionPolicy indicates the completion policy for the job
type CompletionPolicy struct { type CompletionPolicy struct {
// Type indicates the type of the CompletionPolicy // Type indicates the type of the CompletionPolicy.
// Default is Always // Default is Always.
Type CompletionPolicyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=CompletionPolicyType"` Type CompletionPolicyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=CompletionPolicyType"`
// ActiveDeadlineSeconds specifies the duration in seconds relative to the startTime that the job may be active // ActiveDeadlineSeconds specifies the duration in seconds relative to the startTime that the job may be active
@ -83,8 +83,8 @@ const (
// Always means the job will eventually finish on these conditions: // Always means the job will eventually finish on these conditions:
// 1) after all pods on the desired nodes are completed (regardless succeeded or failed), // 1) after all pods on the desired nodes are completed (regardless succeeded or failed),
// 2) exceeds ActiveDeadlineSeconds, // 2) exceeds ActiveDeadlineSeconds,
// 3) exceeds BackoffLimit. // 3) exceeds RestartLimit.
// This is the default CompletionPolicyType // This is the default CompletionPolicyType.
Always CompletionPolicyType = "Always" Always CompletionPolicyType = "Always"
// Never means the job will be kept alive after all pods on the desired nodes are completed. // Never means the job will be kept alive after all pods on the desired nodes are completed.
@ -153,6 +153,7 @@ const (
// FailurePolicy indicates the behavior of the job, when failed pod is found. // FailurePolicy indicates the behavior of the job, when failed pod is found.
type FailurePolicy struct { type FailurePolicy struct {
// Type indicates the type of FailurePolicyType. // Type indicates the type of FailurePolicyType.
// Default is FailurePolicyTypeFailFast.
Type FailurePolicyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=FailurePolicyType"` Type FailurePolicyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=FailurePolicyType"`
// RestartLimit specifies the number of retries before marking the pod failed. // RestartLimit specifies the number of retries before marking the pod failed.
@ -167,9 +168,10 @@ const (
FailurePolicyTypeContinue FailurePolicyType = "Continue" FailurePolicyTypeContinue FailurePolicyType = "Continue"
// FailurePolicyTypeFailFast means the job will be failed, when failed pod is found. // FailurePolicyTypeFailFast means the job will be failed, when failed pod is found.
// This is the default FailurePolicyType.
FailurePolicyTypeFailFast FailurePolicyType = "FailFast" FailurePolicyTypeFailFast FailurePolicyType = "FailFast"
// FailurePolicyTypePause means the the job will be paused, when failed pod is found. // FailurePolicyTypePause means the job will be paused, when failed pod is found.
FailurePolicyTypePause FailurePolicyType = "Pause" FailurePolicyTypePause FailurePolicyType = "Pause"
) )
@ -185,7 +187,7 @@ const (
JobComplete JobConditionType = "Complete" JobComplete JobConditionType = "Complete"
// JobFailed means the job has failed its execution. A failed job means the job has either exceeded the // JobFailed means the job has failed its execution. A failed job means the job has either exceeded the
// ActiveDeadlineSeconds limit, or the aggregated number of container restarts for all pods have exceeded the BackoffLimit. // ActiveDeadlineSeconds limit, or the aggregated number of container restarts for all pods have exceeded the RestartLimit.
JobFailed JobConditionType = "Failed" JobFailed JobConditionType = "Failed"
) )

View File

@ -17,10 +17,11 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
appspub "github.com/openkruise/kruise-api/apps/pub"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
appspub "github.com/openkruise/kruise-api/apps/pub"
) )
const ( const (
@ -30,6 +31,10 @@ const (
// DefaultCloneSetMaxUnavailable is the default value of maxUnavailable for CloneSet update strategy. // DefaultCloneSetMaxUnavailable is the default value of maxUnavailable for CloneSet update strategy.
DefaultCloneSetMaxUnavailable = "20%" DefaultCloneSetMaxUnavailable = "20%"
// CloneSetScalingExcludePreparingDeleteKey is the label key that enables scalingExcludePreparingDelete
// only for this CloneSet, which means it will calculate scale number excluding Pods in PreparingDelete state.
CloneSetScalingExcludePreparingDeleteKey = "apps.kruise.io/cloneset-scaling-exclude-preparing-delete"
) )
// CloneSetSpec defines the desired state of CloneSet // CloneSetSpec defines the desired state of CloneSet
@ -75,7 +80,7 @@ type CloneSetSpec struct {
// Defaults to 0 (pod will be considered available as soon as it is ready) // Defaults to 0 (pod will be considered available as soon as it is ready)
MinReadySeconds int32 `json:"minReadySeconds,omitempty"` MinReadySeconds int32 `json:"minReadySeconds,omitempty"`
// Lifecycle defines the lifecycle hooks for Pods pre-delete, in-place update. // Lifecycle defines the lifecycle hooks for Pods pre-available(pre-normal), pre-delete, in-place update.
Lifecycle *appspub.Lifecycle `json:"lifecycle,omitempty"` Lifecycle *appspub.Lifecycle `json:"lifecycle,omitempty"`
} }
@ -89,6 +94,10 @@ type CloneSetScaleStrategy struct {
// The scale will fail if the number of unavailable pods were greater than this MaxUnavailable at scaling up. // The scale will fail if the number of unavailable pods were greater than this MaxUnavailable at scaling up.
// MaxUnavailable works only when scaling up. // MaxUnavailable works only when scaling up.
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
// Indicate if cloneSet will reuse already existed pvc to
// rebuild a new pod
DisablePVCReuse bool `json:"disablePVCReuse,omitempty"`
} }
// CloneSetUpdateStrategy defines strategies for pods update. // CloneSetUpdateStrategy defines strategies for pods update.
@ -168,6 +177,16 @@ type CloneSetStatus struct {
// indicated by updateRevision and have a Ready Condition. // indicated by updateRevision and have a Ready Condition.
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas"` UpdatedReadyReplicas int32 `json:"updatedReadyReplicas"`
// UpdatedAvailableReplicas is the number of Pods created by the CloneSet controller from the CloneSet version
// indicated by updateRevision and have a Ready Condition for at least minReadySeconds.
// Notice: when enable InPlaceWorkloadVerticalScaling, pod during resource resizing will also be unavailable.
// This means these pod will be counted in maxUnavailable.
UpdatedAvailableReplicas int32 `json:"updatedAvailableReplicas,omitempty"`
// ExpectedUpdatedReplicas is the number of Pods that should be updated by CloneSet controller.
// This field is calculated via Replicas - Partition.
ExpectedUpdatedReplicas int32 `json:"expectedUpdatedReplicas,omitempty"`
// UpdateRevision, if not empty, indicates the latest revision of the CloneSet. // UpdateRevision, if not empty, indicates the latest revision of the CloneSet.
UpdateRevision string `json:"updateRevision,omitempty"` UpdateRevision string `json:"updateRevision,omitempty"`
@ -221,6 +240,7 @@ type CloneSetCondition struct {
// +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods." // +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods."
// +kubebuilder:printcolumn:name="UPDATED",type="integer",JSONPath=".status.updatedReplicas",description="The number of pods updated." // +kubebuilder:printcolumn:name="UPDATED",type="integer",JSONPath=".status.updatedReplicas",description="The number of pods updated."
// +kubebuilder:printcolumn:name="UPDATED_READY",type="integer",JSONPath=".status.updatedReadyReplicas",description="The number of pods updated and ready." // +kubebuilder:printcolumn:name="UPDATED_READY",type="integer",JSONPath=".status.updatedReadyReplicas",description="The number of pods updated and ready."
// +kubebuilder:printcolumn:name="UPDATED_AVAILABLE",type="integer",JSONPath=".status.updatedAvailableReplicas",description="The number of pods updated and available."
// +kubebuilder:printcolumn:name="READY",type="integer",JSONPath=".status.readyReplicas",description="The number of pods ready." // +kubebuilder:printcolumn:name="READY",type="integer",JSONPath=".status.readyReplicas",description="The number of pods ready."
// +kubebuilder:printcolumn:name="TOTAL",type="integer",JSONPath=".status.replicas",description="The number of currently all pods." // +kubebuilder:printcolumn:name="TOTAL",type="integer",JSONPath=".status.replicas",description="The number of currently all pods."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC."

View File

@ -22,8 +22,6 @@ import (
) )
const ( const (
// [Immutable] Pod name of this ContainerRecreateRequest.
ContainerRecreateRequestPodNameKey = "crr.apps.kruise.io/pod-name"
// [Immutable] Pod UID of this ContainerRecreateRequest. // [Immutable] Pod UID of this ContainerRecreateRequest.
ContainerRecreateRequestPodUIDKey = "crr.apps.kruise.io/pod-uid" ContainerRecreateRequestPodUIDKey = "crr.apps.kruise.io/pod-uid"
// [Immutable] Node name of this ContainerRecreateRequest. // [Immutable] Node name of this ContainerRecreateRequest.
@ -46,7 +44,9 @@ type ContainerRecreateRequestSpec struct {
// PodName is name of the Pod that owns the recreated containers. // PodName is name of the Pod that owns the recreated containers.
PodName string `json:"podName"` PodName string `json:"podName"`
// Containers contains the containers that need to recreate in the Pod. // Containers contains the containers that need to recreate in the Pod.
Containers []ContainerRecreateRequestContainer `json:"containers"` // +patchMergeKey=name
// +patchStrategy=merge
Containers []ContainerRecreateRequestContainer `json:"containers" patchStrategy:"merge" patchMergeKey:"name"`
// Strategy defines strategies for containers recreation. // Strategy defines strategies for containers recreation.
Strategy *ContainerRecreateRequestStrategy `json:"strategy,omitempty"` Strategy *ContainerRecreateRequestStrategy `json:"strategy,omitempty"`
// ActiveDeadlineSeconds is the deadline duration of this ContainerRecreateRequest. // ActiveDeadlineSeconds is the deadline duration of this ContainerRecreateRequest.
@ -108,6 +108,8 @@ type ContainerRecreateRequestStrategy struct {
FailurePolicy ContainerRecreateRequestFailurePolicyType `json:"failurePolicy,omitempty"` FailurePolicy ContainerRecreateRequestFailurePolicyType `json:"failurePolicy,omitempty"`
// OrderedRecreate indicates whether to recreate the next container only if the previous one has recreated completely. // OrderedRecreate indicates whether to recreate the next container only if the previous one has recreated completely.
OrderedRecreate bool `json:"orderedRecreate,omitempty"` OrderedRecreate bool `json:"orderedRecreate,omitempty"`
// ForceRecreate indicates whether to force kill the container even if the previous container is starting.
ForceRecreate bool `json:"forceRecreate,omitempty"`
// TerminationGracePeriodSeconds is the optional duration in seconds to wait the container terminating gracefully. // TerminationGracePeriodSeconds is the optional duration in seconds to wait the container terminating gracefully.
// Value must be non-negative integer. The value zero indicates delete immediately. // Value must be non-negative integer. The value zero indicates delete immediately.
// If this value is nil, we will use pod.Spec.TerminationGracePeriodSeconds as default value. // If this value is nil, we will use pod.Spec.TerminationGracePeriodSeconds as default value.
@ -160,6 +162,8 @@ type ContainerRecreateRequestContainerRecreateState struct {
Phase ContainerRecreateRequestPhase `json:"phase"` Phase ContainerRecreateRequestPhase `json:"phase"`
// A human readable message indicating details about this state. // A human readable message indicating details about this state.
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
// Containers are killed by kruise daemon
IsKilled bool `json:"isKilled,omitempty"`
} }
// ContainerRecreateRequestSyncContainerStatus only uses in the annotation `crr.apps.kruise.io/sync-container-statuses`. // ContainerRecreateRequestSyncContainerStatus only uses in the annotation `crr.apps.kruise.io/sync-container-statuses`.

View File

@ -17,11 +17,12 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
appspub "github.com/openkruise/kruise-api/apps/pub"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
appspub "github.com/openkruise/kruise-api/apps/pub"
) )
// DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet. // DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.
@ -91,7 +92,7 @@ type RollingUpdateDaemonSet struct {
// pod is available (Ready for at least minReadySeconds) the old DaemonSet pod // pod is available (Ready for at least minReadySeconds) the old DaemonSet pod
// on that node is marked deleted. If the old pod becomes unavailable for any // on that node is marked deleted. If the old pod becomes unavailable for any
// reason (Ready transitions to false, is evicted, or is drained) an updated // reason (Ready transitions to false, is evicted, or is drained) an updated
// pod is immediatedly created on that node without considering surge limits. // pod is immediately created on that node without considering surge limits.
// Allowing surge implies the possibility that the resources consumed by the // Allowing surge implies the possibility that the resources consumed by the
// daemonset on any given node can double if the readiness check fails, and // daemonset on any given node can double if the readiness check fails, and
// so resource intensive daemonsets should take into account that they may // so resource intensive daemonsets should take into account that they may
@ -228,9 +229,11 @@ type DaemonSetStatus struct {
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=daemon;ads // +kubebuilder:resource:shortName=daemon;ads
// +kubebuilder:printcolumn:name="DesiredNumber",type="integer",JSONPath=".status.desiredNumberScheduled",description="The desired number of pods." // +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".status.desiredNumberScheduled",description="The desired number of pods."
// +kubebuilder:printcolumn:name="CurrentNumber",type="integer",JSONPath=".status.currentNumberScheduled",description="The current number of pods." // +kubebuilder:printcolumn:name="CURRENT",type="integer",JSONPath=".status.currentNumberScheduled",description="The current number of pods."
// +kubebuilder:printcolumn:name="UpdatedNumberScheduled",type="integer",JSONPath=".status.updatedNumberScheduled",description="The updated number of pods." // +kubebuilder:printcolumn:name="READY",type="integer",JSONPath=".status.numberReady",description="The ready number of pods."
// +kubebuilder:printcolumn:name="UP-TO-DATE",type="integer",JSONPath=".status.updatedNumberScheduled",description="The updated number of pods."
// +kubebuilder:printcolumn:name="AVAILABLE",type="integer",JSONPath=".status.numberAvailable",description="The updated number of pods."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC."
// +kubebuilder:printcolumn:name="CONTAINERS",type="string",priority=1,JSONPath=".spec.template.spec.containers[*].name",description="The containers of currently daemonset." // +kubebuilder:printcolumn:name="CONTAINERS",type="string",priority=1,JSONPath=".spec.template.spec.containers[*].name",description="The containers of currently daemonset."
// +kubebuilder:printcolumn:name="IMAGES",type="string",priority=1,JSONPath=".spec.template.spec.containers[*].image",description="The images of currently advanced daemonset." // +kubebuilder:printcolumn:name="IMAGES",type="string",priority=1,JSONPath=".spec.template.spec.containers[*].image",description="The images of currently advanced daemonset."

View File

@ -25,7 +25,6 @@ import (
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
const ( const (
EphemeralContainerCreateByJob = "apps.kruise.io/ephemeraljob"
EphemeralContainerEnvKey = "KRUISE_EJOB_ID" EphemeralContainerEnvKey = "KRUISE_EJOB_ID"
) )
@ -38,7 +37,7 @@ type EphemeralJobSpec struct {
// Replicas indicates a part of the quantity from matched pods by selector. // Replicas indicates a part of the quantity from matched pods by selector.
// Usually it is used for gray scale working. // Usually it is used for gray scale working.
// if Replicas exceeded the matched number by selector, replicas will not work. // if Replicas exceeded the matched number by selector or not be set, replicas will not work.
Replicas *int32 `json:"replicas,omitempty"` Replicas *int32 `json:"replicas,omitempty"`
// Parallelism specifies the maximum desired number of pods which matches running ephemeral containers. // Parallelism specifies the maximum desired number of pods which matches running ephemeral containers.
@ -76,7 +75,9 @@ type EphemeralContainerTemplateSpec struct {
// EphemeralContainers defines ephemeral container list in match pods. // EphemeralContainers defines ephemeral container list in match pods.
// +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless // +kubebuilder:validation:Schemaless
EphemeralContainers []v1.EphemeralContainer `json:"ephemeralContainers"` // +patchMergeKey=name
// +patchStrategy=merge
EphemeralContainers []v1.EphemeralContainer `json:"ephemeralContainers" patchStrategy:"merge" patchMergeKey:"name"`
} }
// EphemeralJobStatus defines the observed state of EphemeralJob // EphemeralJobStatus defines the observed state of EphemeralJob

View File

@ -20,8 +20,8 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"github.com/openkruise/kruise-api/utils/scheme"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"github.com/openkruise/kruise-api/utils/scheme"
) )
var ( var (

View File

@ -0,0 +1,109 @@
/*
Copyright 2023 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ImageListPullJobSpec defines the desired state of ImageListPullJob
type ImageListPullJobSpec struct {
// Images is the image list to be pulled by the job
Images []string `json:"images"`
ImagePullJobTemplate `json:",inline"`
}
// ImageListPullJobStatus defines the observed state of ImageListPullJob
type ImageListPullJobStatus struct {
// Represents time when the job was acknowledged by the job controller.
// It is not guaranteed to be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// +optional
StartTime *metav1.Time `json:"startTime,omitempty"`
// Represents time when the all the image pull job was completed. It is not guaranteed to
// be set in happens-before order across separate operations.
// It is represented in RFC3339 form and is in UTC.
// +optional
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
// The desired number of ImagePullJobs, this is typically equal to the number of len(spec.Images).
Desired int32 `json:"desired"`
// The number of running ImagePullJobs which are acknowledged by the imagepulljob controller.
// +optional
Active int32 `json:"active"`
// The number of ImagePullJobs which are finished
// +optional
Completed int32 `json:"completed"`
// The number of image pull job which are finished and status.Succeeded==status.Desired.
// +optional
Succeeded int32 `json:"succeeded"`
// The status of ImagePullJob which has the failed nodes(status.Failed>0) .
// +optional
FailedImageStatuses []*FailedImageStatus `json:"failedImageStatuses,omitempty"`
}
// FailedImageStatus the state of ImagePullJob which has the failed nodes(status.Failed>0)
type FailedImageStatus struct {
// The name of ImagePullJob which has the failed nodes(status.Failed>0)
// +optional
ImagePullJob string `json:"imagePullJob,omitempty"`
// Name of the image
// +optional
Name string `json:"name,omitempty"`
// The text prompt for job running status.
// +optional
Message string `json:"message,omitempty"`
}
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="TOTAL",type="integer",JSONPath=".status.desired",description="Number of image pull job"
// +kubebuilder:printcolumn:name="SUCCEEDED",type="integer",JSONPath=".status.succeeded",description="Number of image pull job succeeded"
// +kubebuilder:printcolumn:name="COMPLETED",type="integer",JSONPath=".status.completed",description="Number of ImagePullJobs which are finished"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC."
// ImageListPullJob is the Schema for the imagelistpulljobs API
type ImageListPullJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ImageListPullJobSpec `json:"spec,omitempty"`
Status ImageListPullJobStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// ImageListPullJobList contains a list of ImageListPullJob
type ImageListPullJobList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ImageListPullJob `json:"items"`
}
func init() {
SchemeBuilder.Register(&ImageListPullJob{}, &ImageListPullJobList{})
}

View File

@ -27,10 +27,25 @@ const (
ImagePreDownloadMinUpdatedReadyPods = "apps.kruise.io/image-predownload-min-updated-ready-pods" ImagePreDownloadMinUpdatedReadyPods = "apps.kruise.io/image-predownload-min-updated-ready-pods"
) )
// ImagePullPolicy describes a policy for if/when to pull a container image
// +enum
type ImagePullPolicy string
const (
// PullAlways means that kruise-daemon always attempts to pull the latest image.
PullAlways ImagePullPolicy = "Always"
// PullIfNotPresent means that kruise-daemon pulls if the image isn't present on disk.
PullIfNotPresent ImagePullPolicy = "IfNotPresent"
)
// ImagePullJobSpec defines the desired state of ImagePullJob // ImagePullJobSpec defines the desired state of ImagePullJob
type ImagePullJobSpec struct { type ImagePullJobSpec struct {
// Image is the image to be pulled by the job // Image is the image to be pulled by the job
Image string `json:"image"` Image string `json:"image"`
ImagePullJobTemplate `json:",inline"`
}
type ImagePullJobTemplate struct {
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling the image. // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling the image.
// If specified, these secrets will be passed to individual puller implementations for them to use. For example, // If specified, these secrets will be passed to individual puller implementations for them to use. For example,
@ -61,6 +76,15 @@ type ImagePullJobSpec struct {
// CompletionPolicy indicates the completion policy of the job. // CompletionPolicy indicates the completion policy of the job.
// Default is Always CompletionPolicyType. // Default is Always CompletionPolicyType.
CompletionPolicy CompletionPolicy `json:"completionPolicy"` CompletionPolicy CompletionPolicy `json:"completionPolicy"`
// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
// +optional
SandboxConfig *SandboxConfig `json:"sandboxConfig,omitempty"`
// Image pull policy.
// One of Always, IfNotPresent. Defaults to IfNotPresent.
// +optional
ImagePullPolicy ImagePullPolicy `json:"imagePullPolicy,omitempty"`
} }
// ImagePullJobPodSelector is a selector over pods // ImagePullJobPodSelector is a selector over pods

View File

@ -0,0 +1,129 @@
/*
Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless persistent by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NodePodProbeSpec defines the desired state of NodePodProbe
type NodePodProbeSpec struct {
PodProbes []PodProbe `json:"podProbes,omitempty"`
}
type PodProbe struct {
// pod name
Name string `json:"name"`
// pod namespace
Namespace string `json:"namespace"`
// pod uid
UID string `json:"uid"`
// pod ip
IP string `json:"IP"`
// Custom container probe, supports Exec, Tcp, and returns the result to Pod yaml
Probes []ContainerProbe `json:"probes,omitempty"`
}
type ContainerProbe struct {
// Name is podProbeMarker.Name#probe.Name
Name string `json:"name"`
// container name
ContainerName string `json:"containerName"`
// container probe spec
Probe ContainerProbeSpec `json:"probe"`
}
type NodePodProbeStatus struct {
// pod probe results
PodProbeStatuses []PodProbeStatus `json:"podProbeStatuses,omitempty"`
}
type PodProbeStatus struct {
// pod name
Name string `json:"name"`
// pod namespace
Namespace string `json:"namespace"`
// pod uid
UID string `json:"uid"`
// pod probe result
ProbeStates []ContainerProbeState `json:"probeStates,omitempty"`
}
type ContainerProbeState struct {
// Name is podProbeMarker.Name#probe.Name
Name string `json:"name"`
// container probe exec state, True or False
State ProbeState `json:"state"`
// Last time we probed the condition.
// +optional
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
// Last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
// If Status=True, Message records the return result of Probe.
// If Status=False, Message records Probe's error message
Message string `json:"message,omitempty"`
}
type ProbeState string
const (
ProbeSucceeded ProbeState = "Succeeded"
ProbeFailed ProbeState = "Failed"
ProbeUnknown ProbeState = "Unknown"
)
func (p ProbeState) IsEqualPodConditionStatus(status corev1.ConditionStatus) bool {
switch status {
case corev1.ConditionTrue:
return p == ProbeSucceeded
case corev1.ConditionFalse:
return p == ProbeFailed
default:
return p == ProbeUnknown
}
}
// +genclient
// +genclient:nonNamespaced
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:subresource:status
// NodePodProbe is the Schema for the NodePodProbe API
type NodePodProbe struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NodePodProbeSpec `json:"spec,omitempty"`
Status NodePodProbeStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// NodePodProbeList contains a list of NodePodProbe
type NodePodProbeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NodePodProbe `json:"items"`
}
func init() {
SchemeBuilder.Register(&NodePodProbe{}, &NodePodProbeList{})
}

View File

@ -38,6 +38,10 @@ type ImageSpec struct {
// Tags is a list of versions of this image // Tags is a list of versions of this image
Tags []ImageTagSpec `json:"tags"` Tags []ImageTagSpec `json:"tags"`
// SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
// +optional
SandboxConfig *SandboxConfig `json:"sandboxConfig,omitempty"`
} }
// ReferenceObject comprises a resource name, with a mandatory namespace, // ReferenceObject comprises a resource name, with a mandatory namespace,
@ -76,6 +80,11 @@ type ImageTagSpec struct {
// Value must be treated as opaque by clients and . // Value must be treated as opaque by clients and .
// +optional // +optional
Version int64 `json:"version,omitempty"` Version int64 `json:"version,omitempty"`
// Image pull policy.
// One of Always, IfNotPresent. Defaults to IfNotPresent.
// +optional
ImagePullPolicy ImagePullPolicy `json:"imagePullPolicy,omitempty"`
} }
// ImageTagPullPolicy defines the policy of the pulling task // ImageTagPullPolicy defines the policy of the pulling task
@ -144,7 +153,7 @@ type ImageTagStatus struct {
// Represents the image pulling task phase. // Represents the image pulling task phase.
Phase ImagePullPhase `json:"phase"` Phase ImagePullPhase `json:"phase"`
// Represents the pulling progress of this tag, which is beetween 0-100. There is no guarantee // Represents the pulling progress of this tag, which is between 0-100. There is no guarantee
// of monotonic consistency, and it may be a rollback due to retry during pulling. // of monotonic consistency, and it may be a rollback due to retry during pulling.
Progress int32 `json:"progress,omitempty"` Progress int32 `json:"progress,omitempty"`
@ -168,7 +177,7 @@ type ImageTagStatus struct {
// +optional // +optional
ImageID string `json:"imageID,omitempty"` ImageID string `json:"imageID,omitempty"`
// Represents the summary informations of this node // Represents the summary information of this node
// +optional // +optional
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,133 @@
/*
Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless persistent by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are persistent. Any new fields you add must have json tags for the fields to be serialized.
const (
// AnnotationAutoGeneratePersistentPodState indicates kruise will auto generate PersistentPodState object
// Need to work with AnnotationRequiredPersistentTopology and AnnotationPreferredPersistentTopology
AnnotationAutoGeneratePersistentPodState = "kruise.io/auto-generate-persistent-pod-state"
// AnnotationRequiredPersistentTopology Pod rebuilt topology required for node labels
// for example kruise.io/required-persistent-topology: topology.kubernetes.io/zone[,xxx]
// optional
AnnotationRequiredPersistentTopology = "kruise.io/required-persistent-topology"
// AnnotationPreferredPersistentTopology Pod rebuilt topology preferred for node labels and default with 100 weight
// for example kruise.io/preferred-persistent-topology: kubernetes.io/hostname[,xxx]
// optional
AnnotationPreferredPersistentTopology = "kruise.io/preferred-persistent-topology"
// AnnotationPersistentPodAnnotations Pod needs persistent annotations
// for example kruise.io/persistent-pod-annotations: cni.projectcalico.org/podIP[,xxx]
// optional
AnnotationPersistentPodAnnotations = "kruise.io/persistent-pod-annotations"
)
// PersistentPodStateSpec defines the desired state of PersistentPodState
type PersistentPodStateSpec struct {
// TargetReference contains enough information to let you identify an workload for PersistentPodState
// Selector and TargetReference are mutually exclusive, TargetReference is priority to take effect
// current only support StatefulSet
TargetReference TargetReference `json:"targetRef"`
// Persist the annotations information of the pods that need to be saved
PersistentPodAnnotations []PersistentPodAnnotation `json:"persistentPodAnnotations,omitempty"`
// Pod rebuilt topology required for node labels
// for example kubernetes.io/hostname, failure-domain.beta.kubernetes.io/zone
RequiredPersistentTopology *NodeTopologyTerm `json:"requiredPersistentTopology,omitempty"`
// Pod rebuilt topology preferred for node labels, with xx weight
// for example kubernetes.io/hostname, failure-domain.beta.kubernetes.io/zone
PreferredPersistentTopology []PreferredTopologyTerm `json:"preferredPersistentTopology,omitempty"`
// PersistentPodStateRetentionPolicy describes the policy used for PodState.
// The default policy of 'WhenScaled' causes when scale down statefulSet, deleting it.
// +optional
PersistentPodStateRetentionPolicy PersistentPodStateRetentionPolicyType `json:"persistentPodStateRetentionPolicy,omitempty"`
}
type PreferredTopologyTerm struct {
Weight int32 `json:"weight"`
Preference NodeTopologyTerm `json:"preference"`
}
type NodeTopologyTerm struct {
// A list of node selector requirements by node's labels.
NodeTopologyKeys []string `json:"nodeTopologyKeys"`
}
type PersistentPodAnnotation struct {
Key string `json:"key"`
}
type PersistentPodStateRetentionPolicyType string
const (
// PersistentPodStateRetentionPolicyWhenScaled specifies when scale down statefulSet, deleting podState record.
PersistentPodStateRetentionPolicyWhenScaled = "WhenScaled"
// PersistentPodStateRetentionPolicyWhenDeleted specifies when delete statefulSet, deleting podState record.
PersistentPodStateRetentionPolicyWhenDeleted = "WhenDeleted"
)
type PersistentPodStateStatus struct {
// observedGeneration is the most recent generation observed for this PersistentPodState. It corresponds to the
// PersistentPodState's generation, which is updated on mutation by the API Server.
ObservedGeneration int64 `json:"observedGeneration"`
// When the pod is ready, record some status information of the pod, such as: labels, annotations, topologies, etc.
// map[string]PodState -> map[Pod.Name]PodState
PodStates map[string]PodState `json:"podStates,omitempty"`
}
type PodState struct {
// pod.spec.nodeName
NodeName string `json:"nodeName,omitempty"`
// node topology labels key=value
// for example kubernetes.io/hostname=node-1
NodeTopologyLabels map[string]string `json:"nodeTopologyLabels,omitempty"`
// pod persistent annotations
Annotations map[string]string `json:"annotations,omitempty"`
}
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// PersistentPodState is the Schema for the PersistentPodState API
type PersistentPodState struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PersistentPodStateSpec `json:"spec,omitempty"`
Status PersistentPodStateStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// PersistentPodStateList contains a list of PersistentPodState
type PersistentPodStateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PersistentPodState `json:"items"`
}
func init() {
SchemeBuilder.Register(&PersistentPodState{}, &PersistentPodStateList{})
}

View File

@ -0,0 +1,132 @@
/*
Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless persistent by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// PodProbeMarkerAnnotationKey records the Probe Spec, mainly used for serverless Pod scenarios, as follows:
// annotations:
// kruise.io/podprobe: |
// [
// {
// "containerName": "minecraft",
// "name": "healthy",
// "podConditionType": "game.kruise.io/healthy",
// "probe": {
// "exec": {
// "command": [
// "bash",
// "/data/probe.sh"
// ]
// }
// }
// }
// ]
PodProbeMarkerAnnotationKey = "kruise.io/podprobe"
// PodProbeMarkerListAnnotationKey records the injected PodProbeMarker Name List
// example: kruise.io/podprobemarker-list="probe-marker-1,probe-marker-2"
PodProbeMarkerListAnnotationKey = "kruise.io/podprobemarker-list"
)
// PodProbeMarkerSpec defines the desired state of PodProbeMarker
type PodProbeMarkerSpec struct {
// Selector is a label query over pods that should exec custom probe
// It must match the pod template's labels.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
Selector *metav1.LabelSelector `json:"selector"`
// Custom container probe, current only support Exec().
// Probe Result will record in Pod.Status.Conditions, and condition.type=probe.name.
// condition.status=True indicates probe success
// condition.status=False indicates probe fails
// +patchMergeKey=name
// +patchStrategy=merge
Probes []PodContainerProbe `json:"probes" patchStrategy:"merge" patchMergeKey:"name"`
}
type PodContainerProbe struct {
// probe name, unique within the Pod(Even between different containers, they cannot be the same)
Name string `json:"name"`
// container name
ContainerName string `json:"containerName"`
// container probe spec
Probe ContainerProbeSpec `json:"probe"`
// According to the execution result of ContainerProbe, perform specific actions,
// such as: patch Pod labels, annotations, ReadinessGate Condition
// It cannot be null at the same time as PodConditionType.
// +patchMergeKey=state
// +patchStrategy=merge
MarkerPolicy []ProbeMarkerPolicy `json:"markerPolicy,omitempty" patchStrategy:"merge" patchMergeKey:"state"`
// If it is not empty, the Probe execution result will be recorded on the Pod condition.
// It cannot be null at the same time as MarkerPolicy.
// For example PodConditionType=game.kruise.io/healthy, pod.status.condition.type = game.kruise.io/healthy.
// When probe is Succeeded, pod.status.condition.status = True. Otherwise, when the probe fails to execute, pod.status.condition.status = False.
PodConditionType string `json:"podConditionType,omitempty"`
}
type ContainerProbeSpec struct {
v1.Probe `json:",inline"`
}
type ProbeMarkerPolicy struct {
// probe status, True or False
// For example: State=Succeeded, annotations[controller.kubernetes.io/pod-deletion-cost] = '10'.
// State=Failed, annotations[controller.kubernetes.io/pod-deletion-cost] = '-10'.
// In addition, if State=Failed is not defined, Exec execution fails, and the annotations[controller.kubernetes.io/pod-deletion-cost] will be Deleted
State ProbeState `json:"state"`
// Patch Labels pod.labels
Labels map[string]string `json:"labels,omitempty"`
// Patch annotations pod.annotations
Annotations map[string]string `json:"annotations,omitempty"`
}
type PodProbeMarkerStatus struct {
// observedGeneration is the most recent generation observed for this PodProbeMarker. It corresponds to the
// PodProbeMarker's generation, which is updated on mutation by the API Server.
ObservedGeneration int64 `json:"observedGeneration"`
// matched Pods
MatchedPods int64 `json:"matchedPods,omitempty"`
}
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// PodProbeMarker is the Schema for the PodProbeMarker API
type PodProbeMarker struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PodProbeMarkerSpec `json:"spec,omitempty"`
Status PodProbeMarkerStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// PodProbeMarkerList contains a list of PodProbeMarker
type PodProbeMarkerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PodProbeMarker `json:"items"`
}
func init() {
SchemeBuilder.Register(&PodProbeMarker{}, &PodProbeMarkerList{})
}

View File

@ -69,8 +69,10 @@ type ResourceDistributionTargetNamespaces struct {
Pattern string `json:"pattern,omitempty"` Pattern string `json:"pattern,omitempty"`
*/ */
// +patchMergeKey=name
// +patchStrategy=merge
// +optional // +optional
List []ResourceDistributionNamespace `json:"list,omitempty"` List []ResourceDistributionNamespace `json:"list,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
} }
// ResourceDistributionNamespace contains a namespace name // ResourceDistributionNamespace contains a namespace name

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2023 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -14,7 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// Code generated by client-gen. DO NOT EDIT. package v1alpha1
// This package has the automatically generated clientset. // SandboxConfig support attach metadata in PullImage CRI interface during ImagePulljobs
package versioned type SandboxConfig struct {
// +optional
Labels map[string]string `json:"labels,omitempty"`
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
}

View File

@ -17,11 +17,22 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
appspub "github.com/openkruise/kruise-api/apps/pub"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
) )
const (
// SidecarSetCustomVersionLabel is designed to record and label the controllerRevision of sidecarSet.
// This label will be passed from SidecarSet to its corresponding ControllerRevision, users can use
// this label to selector the ControllerRevision they want.
// For example, users can update the label from "version-1" to "version-2" when they upgrade the
// sidecarSet to "version-2", and they write the "version-2" to InjectionStrategy.Revision.CustomVersion
// when they decided to promote the "version-2", to avoid some risks about gray deployment of SidecarSet.
SidecarSetCustomVersionLabel = "apps.kruise.io/sidecarset-custom-version"
)
// SidecarSetSpec defines the desired state of SidecarSet // SidecarSetSpec defines the desired state of SidecarSet
type SidecarSetSpec struct { type SidecarSetSpec struct {
// selector is a label query over pods that should be injected // selector is a label query over pods that should be injected
@ -31,18 +42,28 @@ type SidecarSetSpec struct {
// otherwise, match pods in all namespaces(in cluster) // otherwise, match pods in all namespaces(in cluster)
Namespace string `json:"namespace,omitempty"` Namespace string `json:"namespace,omitempty"`
// NamespaceSelector select which namespaces to inject sidecar containers.
// Default to the empty LabelSelector, which matches everything.
NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`
// InitContainers is the list of init containers to be injected into the selected pod // InitContainers is the list of init containers to be injected into the selected pod
// We will inject those containers by their name in ascending order // We will inject those containers by their name in ascending order
// We only inject init containers when a new pod is created, it does not apply to any existing pod // We only inject init containers when a new pod is created, it does not apply to any existing pod
InitContainers []SidecarContainer `json:"initContainers,omitempty"` // +patchMergeKey=name
// +patchStrategy=merge
InitContainers []SidecarContainer `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// Containers is the list of sidecar containers to be injected into the selected pod // Containers is the list of sidecar containers to be injected into the selected pod
Containers []SidecarContainer `json:"containers,omitempty"` // +patchMergeKey=name
// +patchStrategy=merge
Containers []SidecarContainer `json:"containers,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// List of volumes that can be mounted by sidecar containers // List of volumes that can be mounted by sidecar containers
// +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless // +kubebuilder:validation:Schemaless
Volumes []corev1.Volume `json:"volumes,omitempty"` // +patchMergeKey=name
// +patchStrategy=merge
Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// The sidecarset updateStrategy to use to replace existing pods with new ones. // The sidecarset updateStrategy to use to replace existing pods with new ones.
UpdateStrategy SidecarSetUpdateStrategy `json:"updateStrategy,omitempty"` UpdateStrategy SidecarSetUpdateStrategy `json:"updateStrategy,omitempty"`
@ -51,13 +72,49 @@ type SidecarSetSpec struct {
InjectionStrategy SidecarSetInjectionStrategy `json:"injectionStrategy,omitempty"` InjectionStrategy SidecarSetInjectionStrategy `json:"injectionStrategy,omitempty"`
// List of the names of secrets required by pulling sidecar container images // List of the names of secrets required by pulling sidecar container images
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` // +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// RevisionHistoryLimit indicates the maximum quantity of stored revisions about the SidecarSet. // RevisionHistoryLimit indicates the maximum quantity of stored revisions about the SidecarSet.
// default value is 10 // default value is 10
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
// SidecarSet support to inject & in-place update metadata in pod.
PatchPodMetadata []SidecarSetPatchPodMetadata `json:"patchPodMetadata,omitempty"`
} }
type SidecarSetPatchPodMetadata struct {
// annotations
Annotations map[string]string `json:"annotations,omitempty"`
// labels map[string]string `json:"labels,omitempty"`
// patch pod metadata policy, Default is "Retain"
PatchPolicy SidecarSetPatchPolicyType `json:"patchPolicy,omitempty"`
}
type SidecarSetPatchPolicyType string
var (
// SidecarSetRetainPatchPolicy indicates if PatchPodFields conflicts with Pod,
// will ignore PatchPodFields, and retain the corresponding fields of pods.
// SidecarSet webhook cannot allow the conflict of PatchPodFields between SidecarSets under this policy type.
// Note: Retain is only supported for injection, and the Metadata will not be updated when upgrading the Sidecar Container in-place.
SidecarSetRetainPatchPolicy SidecarSetPatchPolicyType = "Retain"
// SidecarSetOverwritePatchPolicy indicates if PatchPodFields conflicts with Pod,
// SidecarSet will apply PatchPodFields to overwrite the corresponding fields of pods.
// SidecarSet webhook cannot allow the conflict of PatchPodFields between SidecarSets under this policy type.
// Overwrite support to inject and in-place metadata.
SidecarSetOverwritePatchPolicy SidecarSetPatchPolicyType = "Overwrite"
// SidecarSetMergePatchJsonPatchPolicy indicate that sidecarSet use application/merge-patch+json to patch annotation value,
// for example, A patch annotation[oom-score] = '{"log-agent": 1}' and B patch annotation[oom-score] = '{"envoy": 2}'
// result pod annotation[oom-score] = '{"log-agent": 1, "envoy": 2}'
// MergePatchJson support to inject and in-place metadata.
SidecarSetMergePatchJsonPatchPolicy SidecarSetPatchPolicyType = "MergePatchJson"
)
// SidecarContainer defines the container of Sidecar // SidecarContainer defines the container of Sidecar
type SidecarContainer struct { type SidecarContainer struct {
// +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:pruning:PreserveUnknownFields
@ -142,8 +199,45 @@ type SidecarSetInjectionStrategy struct {
// but the injected sidecar container remains updating and running. // but the injected sidecar container remains updating and running.
// default is false // default is false
Paused bool `json:"paused,omitempty"` Paused bool `json:"paused,omitempty"`
// Revision can help users rolling update SidecarSet safely. If users set
// this filed, SidecarSet will try to inject specific revision according to
// different policies.
Revision *SidecarSetInjectRevision `json:"revision,omitempty"`
} }
type SidecarSetInjectRevision struct {
// CustomVersion corresponds to label 'apps.kruise.io/sidecarset-custom-version' of (History) SidecarSet.
// SidecarSet will select the specific ControllerRevision via this CustomVersion, and then restore the
// history SidecarSet to inject specific version of the sidecar to pods.
// + optional
CustomVersion *string `json:"customVersion,omitempty"`
// RevisionName corresponds to a specific ControllerRevision name of SidecarSet that you want to inject to Pods.
// + optional
RevisionName *string `json:"revisionName,omitempty"`
// Policy describes the behavior of revision injection.
// +kubebuilder:validation:Enum=Always;Partial;
// +kubebuilder:default=Always
Policy SidecarSetInjectRevisionPolicy `json:"policy,omitempty"`
}
type SidecarSetInjectRevisionPolicy string
const (
// AlwaysSidecarSetInjectRevisionPolicy means the SidecarSet will always inject
// the specific revision to Pods when pod creating, except matching UpdateStrategy.Selector.
AlwaysSidecarSetInjectRevisionPolicy SidecarSetInjectRevisionPolicy = "Always"
// PartialSidecarSetInjectRevisionPolicy means the SidecarSet will inject the specific or the latest revision according to UpdateStrategy.
//
// If UpdateStrategy.Pause is not true, only when a newly created Pod is **not** selected by the Selector explicitly
// configured in `UpdateStrategy` will it be injected with the specified version of the Sidecar.
// Under all other conditions, newly created Pods have a probability of being injected with the latest Sidecar,
// where the probability is `1 - UpdateStrategy.Partition`.
// If `Partition` is not a percentage or is not configured, its value is considered to be 0%.
PartialSidecarSetInjectRevisionPolicy SidecarSetInjectRevisionPolicy = "Partial"
)
// SidecarSetUpdateStrategy indicates the strategy that the SidecarSet // SidecarSetUpdateStrategy indicates the strategy that the SidecarSet
// controller will use to perform updates. It includes any additional parameters // controller will use to perform updates. It includes any additional parameters
// necessary to perform the update for the indicated strategy. // necessary to perform the update for the indicated strategy.
@ -155,11 +249,15 @@ type SidecarSetUpdateStrategy struct {
Type SidecarSetUpdateStrategyType `json:"type,omitempty"` Type SidecarSetUpdateStrategyType `json:"type,omitempty"`
// Paused indicates that the SidecarSet is paused to update the injected pods, // Paused indicates that the SidecarSet is paused to update the injected pods,
// but it don't affect the webhook inject sidecar container into the newly created pods. // For the impact on the injection behavior for newly created Pods, please refer to the comments of Selector.
// default is false
Paused bool `json:"paused,omitempty"` Paused bool `json:"paused,omitempty"`
// If selector is not nil, this upgrade will only update the selected pods. // If selector is not nil, this upgrade will only update the selected pods.
//
// Starting from Kruise 1.8.0, the updateStrategy.Selector affects the version of the Sidecar container
// injected into newly created Pods by a SidecarSet configured with an injectionStrategy.
// In most cases, all newly created Pods are injected with the specified Sidecar version as configured in injectionStrategy.revision,
// which is consistent with previous versions.
Selector *metav1.LabelSelector `json:"selector,omitempty"` Selector *metav1.LabelSelector `json:"selector,omitempty"`
// Partition is the desired number of pods in old revisions. It means when partition // Partition is the desired number of pods in old revisions. It means when partition
@ -174,7 +272,9 @@ type SidecarSetUpdateStrategy struct {
// This cannot be 0. // This cannot be 0.
// Default value is 1. // Default value is 1.
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
// Priorities are the rules for calculating the priority of updating pods.
// Each pod to be updated, will pass through these terms and get a sum of weights.
PriorityStrategy *appspub.UpdatePriorityStrategy `json:"priorityStrategy,omitempty"`
// ScatterStrategy defines the scatter rules to make pods been scattered when update. // ScatterStrategy defines the scatter rules to make pods been scattered when update.
// This will avoid pods with the same key-value to be updated in one batch. // This will avoid pods with the same key-value to be updated in one batch.
// - Note that pods will be scattered after priority sort. So, although priority strategy and scatter strategy can be applied together, we suggest to use either one of them. // - Note that pods will be scattered after priority sort. So, although priority strategy and scatter strategy can be applied together, we suggest to use either one of them.

View File

@ -17,10 +17,13 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"time"
"github.com/openkruise/kruise-api/apps/v1beta1" "github.com/openkruise/kruise-api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
) )
@ -159,8 +162,14 @@ type ManualUpdate struct {
type Topology struct { type Topology struct {
// Contains the details of each subset. Each element in this array represents one subset // Contains the details of each subset. Each element in this array represents one subset
// which will be provisioned and managed by UnitedDeployment. // which will be provisioned and managed by UnitedDeployment.
// +patchMergeKey=name
// +patchStrategy=merge
// +optional // +optional
Subsets []Subset `json:"subsets,omitempty"` Subsets []Subset `json:"subsets,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// ScheduleStrategy indicates the strategy the UnitedDeployment used to preform the schedule between each of subsets.
// +optional
ScheduleStrategy UnitedDeploymentScheduleStrategy `json:"scheduleStrategy,omitempty"`
} }
// Subset defines the detail of a subset. // Subset defines the detail of a subset.
@ -185,8 +194,96 @@ type Subset struct {
// percentage like '10%', which means 10% of UnitedDeployment replicas of pods will be distributed // percentage like '10%', which means 10% of UnitedDeployment replicas of pods will be distributed
// under this subset. If nil, the number of replicas in this subset is determined by controller. // under this subset. If nil, the number of replicas in this subset is determined by controller.
// Controller will try to keep all the subsets with nil replicas have average pods. // Controller will try to keep all the subsets with nil replicas have average pods.
// Replicas and MinReplicas/MaxReplicas are mutually exclusive in a UnitedDeployment.
// +optional // +optional
Replicas *intstr.IntOrString `json:"replicas,omitempty"` Replicas *intstr.IntOrString `json:"replicas,omitempty"`
// Indicates the lower bounded replicas of the subset.
// MinReplicas must be more than or equal to 0 if it is set.
// Controller will prioritize satisfy minReplicas for each subset
// according to the order of Topology.Subsets.
// Defaults to 0.
// +optional
MinReplicas *intstr.IntOrString `json:"minReplicas,omitempty"`
// Indicates the upper bounded replicas of the subset.
// MaxReplicas must be more than or equal to MinReplicas.
// MaxReplicas == nil means no limitation.
// Please ensure that at least one subset has empty MaxReplicas(no limitation) to avoid stuck scaling.
// Defaults to nil.
// +optional
MaxReplicas *intstr.IntOrString `json:"maxReplicas,omitempty"`
// Patch indicates patching to the templateSpec.
// Patch takes precedence over other fields
// If the Patch also modifies the Replicas, NodeSelectorTerm or Tolerations, use value in the Patch
// +optional
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless
Patch runtime.RawExtension `json:"patch,omitempty"`
}
// UnitedDeploymentScheduleStrategyType is a string enumeration type that enumerates
// all possible schedule strategies for the UnitedDeployment controller.
// +kubebuilder:validation:Enum=Adaptive;Fixed;""
type UnitedDeploymentScheduleStrategyType string
const (
// AdaptiveUnitedDeploymentScheduleStrategyType represents that when a pod is stuck in the pending status and cannot
// be scheduled, allow it to be rescheduled to another subset.
AdaptiveUnitedDeploymentScheduleStrategyType UnitedDeploymentScheduleStrategyType = "Adaptive"
// FixedUnitedDeploymentScheduleStrategyType represents that pods are strictly scheduled to the selected subset
// even if scheduling fail.
FixedUnitedDeploymentScheduleStrategyType UnitedDeploymentScheduleStrategyType = "Fixed"
)
const (
DefaultRescheduleCriticalDuration = 30 * time.Second
DefaultUnschedulableStatusLastDuration = 300 * time.Second
)
// AdaptiveUnitedDeploymentStrategy is used to communicate parameters when Type is AdaptiveUnitedDeploymentScheduleStrategyType.
type AdaptiveUnitedDeploymentStrategy struct {
// RescheduleCriticalSeconds indicates how long controller will reschedule a schedule failed Pod to the subset that has
// redundant capacity after the subset where the Pod lives. If a Pod was scheduled failed and still in an unschedulabe status
// over RescheduleCriticalSeconds duration, the controller will reschedule it to a suitable subset. Default is 30 seconds.
// +optional
RescheduleCriticalSeconds *int32 `json:"rescheduleCriticalSeconds,omitempty"`
// UnschedulableLastSeconds is used to set the number of seconds for a Subset to recover from an unschedulable state,
// with a default value of 300 seconds.
// +optional
UnschedulableLastSeconds *int32 `json:"unschedulableLastSeconds,omitempty"`
}
// UnitedDeploymentScheduleStrategy defines the schedule performance of UnitedDeployment.
type UnitedDeploymentScheduleStrategy struct {
// Type indicates the type of the UnitedDeploymentScheduleStrategy.
// Default is Fixed
// +optional
Type UnitedDeploymentScheduleStrategyType `json:"type,omitempty"`
// Adaptive is used to communicate parameters when Type is AdaptiveUnitedDeploymentScheduleStrategyType.
// +optional
Adaptive *AdaptiveUnitedDeploymentStrategy `json:"adaptive,omitempty"`
}
func (s *UnitedDeploymentScheduleStrategy) IsAdaptive() bool {
return s.Type == AdaptiveUnitedDeploymentScheduleStrategyType
}
func (s *UnitedDeploymentScheduleStrategy) GetRescheduleCriticalDuration() time.Duration {
if s.Adaptive == nil || s.Adaptive.RescheduleCriticalSeconds == nil {
return DefaultRescheduleCriticalDuration
}
return time.Duration(*s.Adaptive.RescheduleCriticalSeconds) * time.Second
}
func (s *UnitedDeploymentScheduleStrategy) GetUnschedulableLastDuration() time.Duration {
if s.Adaptive == nil || s.Adaptive.UnschedulableLastSeconds == nil {
return DefaultUnschedulableStatusLastDuration
}
return time.Duration(*s.Adaptive.UnschedulableLastSeconds) * time.Second
} }
// UnitedDeploymentStatus defines the observed state of UnitedDeployment. // UnitedDeploymentStatus defines the observed state of UnitedDeployment.
@ -223,6 +320,8 @@ type UnitedDeploymentStatus struct {
// +optional // +optional
SubsetReplicas map[string]int32 `json:"subsetReplicas,omitempty"` SubsetReplicas map[string]int32 `json:"subsetReplicas,omitempty"`
// Record the conditions of each subset.
SubsetStatuses []UnitedDeploymentSubsetStatus `json:"subsetStatuses,omitempty"`
// Represents the latest available observations of a UnitedDeployment's current state. // Represents the latest available observations of a UnitedDeployment's current state.
// +optional // +optional
Conditions []UnitedDeploymentCondition `json:"conditions,omitempty"` Conditions []UnitedDeploymentCondition `json:"conditions,omitempty"`
@ -230,6 +329,26 @@ type UnitedDeploymentStatus struct {
// Records the information of update progress. // Records the information of update progress.
// +optional // +optional
UpdateStatus *UpdateStatus `json:"updateStatus,omitempty"` UpdateStatus *UpdateStatus `json:"updateStatus,omitempty"`
// LabelSelector is label selectors for query over pods that should match the replica count used by HPA.
LabelSelector string `json:"labelSelector,omitempty"`
}
func (s *UnitedDeploymentStatus) GetSubsetStatus(subset string) *UnitedDeploymentSubsetStatus {
for i, subsetStatus := range s.SubsetStatuses {
if subsetStatus.Name == subset {
return &s.SubsetStatuses[i]
}
}
return nil
}
func (u *UnitedDeployment) InitSubsetStatuses() {
for _, subset := range u.Spec.Topology.Subsets {
if u.Status.GetSubsetStatus(subset.Name) == nil {
u.Status.SubsetStatuses = append(u.Status.SubsetStatuses, UnitedDeploymentSubsetStatus{Name: subset.Name})
}
}
} }
// UnitedDeploymentCondition describes current state of a UnitedDeployment. // UnitedDeploymentCondition describes current state of a UnitedDeployment.
@ -246,7 +365,7 @@ type UnitedDeploymentCondition struct {
// The reason for the condition's last transition. // The reason for the condition's last transition.
Reason string `json:"reason,omitempty"` Reason string `json:"reason,omitempty"`
// A human readable message indicating details about the transition. // A human-readable message indicating details about the transition.
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
} }
@ -261,13 +380,69 @@ type UpdateStatus struct {
CurrentPartitions map[string]int32 `json:"currentPartitions,omitempty"` CurrentPartitions map[string]int32 `json:"currentPartitions,omitempty"`
} }
type UnitedDeploymentSubsetStatus struct {
// Subset name specified in Topology.Subsets
Name string `json:"name,omitempty"`
// Recores the current replicas. Currently unused.
Replicas int32 `json:"replicas,omitempty"`
// Records the current partition. Currently unused.
Partition int32 `json:"partition,omitempty"`
// Conditions is an array of current observed subset conditions.
Conditions []UnitedDeploymentSubsetCondition `json:"conditions,omitempty"`
}
func (s *UnitedDeploymentSubsetStatus) GetCondition(condType UnitedDeploymentSubsetConditionType) *UnitedDeploymentSubsetCondition {
for _, condition := range s.Conditions {
if condition.Type == condType {
return &condition
}
}
return nil
}
func (s *UnitedDeploymentSubsetStatus) SetCondition(condType UnitedDeploymentSubsetConditionType, status corev1.ConditionStatus, reason, message string) {
var currentCond *UnitedDeploymentSubsetCondition
for i, c := range s.Conditions {
if c.Type == condType {
currentCond = &s.Conditions[i]
break
}
}
if currentCond != nil && currentCond.Status == status && currentCond.Reason == reason {
return
}
if currentCond == nil {
s.Conditions = append(s.Conditions, UnitedDeploymentSubsetCondition{Type: condType})
currentCond = &s.Conditions[len(s.Conditions)-1]
}
currentCond.LastTransitionTime = metav1.Now()
currentCond.Status = status
currentCond.Reason = reason
currentCond.Message = message
}
type UnitedDeploymentSubsetConditionType string
const (
// UnitedDeploymentSubsetSchedulable means new pods allocated into the subset will keep pending.
UnitedDeploymentSubsetSchedulable UnitedDeploymentSubsetConditionType = "Schedulable"
)
type UnitedDeploymentSubsetCondition struct {
Type UnitedDeploymentSubsetConditionType `json:"type"`
Status corev1.ConditionStatus `json:"status"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
// +genclient // +genclient
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
// +k8s:openapi-gen=true // +k8s:openapi-gen=true
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector
// +kubebuilder:resource:shortName=ud // +kubebuilder:resource:shortName=ud
// +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods." // +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods."
// +kubebuilder:printcolumn:name="CURRENT",type="integer",JSONPath=".status.replicas",description="The number of currently all pods." // +kubebuilder:printcolumn:name="CURRENT",type="integer",JSONPath=".status.replicas",description="The number of currently all pods."

View File

@ -1,55 +0,0 @@
/*
Copyright 2020 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// UpdatePriorityStrategy is the strategy to define priority for pods update.
// Only one of orderPriority and weightPriority can be set.
type UpdatePriorityStrategy struct {
// Order priority terms, pods will be sorted by the value of orderedKey.
// For example:
// ```
// orderPriority:
// - orderedKey: key1
// - orderedKey: key2
// ```
// First, all pods which have key1 in labels will be sorted by the value of key1.
// Then, the left pods which have no key1 but have key2 in labels will be sorted by
// the value of key2 and put behind those pods have key1.
OrderPriority []UpdatePriorityOrderTerm `json:"orderPriority,omitempty"`
// Weight priority terms, pods will be sorted by the sum of all terms weight.
WeightPriority []UpdatePriorityWeightTerm `json:"weightPriority,omitempty"`
}
// UpdatePriorityOrder defines order priority.
type UpdatePriorityOrderTerm struct {
// Calculate priority by value of this key.
// Values of this key, will be sorted by GetInt(val). GetInt method will find the last int in value,
// such as getting 5 in value '5', getting 10 in value 'sts-10'.
OrderedKey string `json:"orderedKey"`
}
// UpdatePriorityWeightTerm defines weight priority.
type UpdatePriorityWeightTerm struct {
// Weight associated with matching the corresponding matchExpressions, in the range 1-100.
Weight int32 `json:"weight"`
// MatchSelector is used to select by pod's labels.
MatchSelector metav1.LabelSelector `json:"matchSelector"`
}

View File

@ -0,0 +1,8 @@
package v1alpha1
const (
// AnnotationUsingEnhancedLiveness indicates that the enhanced liveness probe of pod is enabled.
AnnotationUsingEnhancedLiveness = "apps.kruise.io/using-enhanced-liveness"
// AnnotationUsingEnhancedLiveness indicates the backup probe (json types) of the pod native container livnessprobe configuration.
AnnotationNativeContainerProbeContext = "apps.kruise.io/container-probe-context"
)

View File

@ -15,4 +15,18 @@ const (
// ImagePreDownloadIgnoredKey indicates the images of this revision have been ignored to pre-download // ImagePreDownloadIgnoredKey indicates the images of this revision have been ignored to pre-download
ImagePreDownloadIgnoredKey = "apps.kruise.io/image-predownload-ignored" ImagePreDownloadIgnoredKey = "apps.kruise.io/image-predownload-ignored"
// AnnotationSubsetPatchKey indicates the patch for every subset
AnnotationSubsetPatchKey = "apps.kruise.io/subset-patch"
)
// Sidecar container environment variable definitions which are used to enable SidecarTerminator to take effect on the sidecar container.
const (
// KruiseTerminateSidecarEnv is an env name, which represents a switch to enable sidecar terminator.
// The corresponding value is "true", which means apply a crr to kill sidecar using kruise-daemon.
KruiseTerminateSidecarEnv = "KRUISE_TERMINATE_SIDECAR_WHEN_JOB_EXIT"
// KruiseTerminateSidecarWithImageEnv is an env name, which refers to an image that will replace the original image
// using in-place update strategy to kill sidecar. This image must be given if you want to use in-place update
// strategy to terminate sidecar containers.
KruiseTerminateSidecarWithImageEnv = "KRUISE_TERMINATE_SIDECAR_WHEN_JOB_EXIT_WITH_IMAGE"
) )

View File

@ -28,8 +28,15 @@ type WorkloadSpreadSpec struct {
// TargetReference is the target workload that WorkloadSpread want to control. // TargetReference is the target workload that WorkloadSpread want to control.
TargetReference *TargetReference `json:"targetRef"` TargetReference *TargetReference `json:"targetRef"`
// TargetFilter allows WorkloadSpread to manage only a portion of the Pods in the TargetReference:
// by specifying the criteria for the Pods to be managed through a label selector,
// and by specifying how to obtain the total number of these selected Pods from the workload using replicasPaths.
TargetFilter *TargetFilter `json:"targetFilter,omitempty"`
// Subsets describes the pods distribution details between each of subsets. // Subsets describes the pods distribution details between each of subsets.
Subsets []WorkloadSpreadSubset `json:"subsets"` // +patchMergeKey=name
// +patchStrategy=merge
Subsets []WorkloadSpreadSubset `json:"subsets" patchStrategy:"merge" patchMergeKey:"name"`
// ScheduleStrategy indicates the strategy the WorkloadSpread used to preform the schedule between each of subsets. // ScheduleStrategy indicates the strategy the WorkloadSpread used to preform the schedule between each of subsets.
// +optional // +optional
@ -46,6 +53,58 @@ type TargetReference struct {
Name string `json:"name"` Name string `json:"name"`
} }
/*
TargetFilter is an optional parameter that allows WorkloadSpread to manage only a subset of the Pods generated by the target workload.
For example, suppose a WorkloadSpread points to the following Kubeflow TFJob resource:
```yaml
apiVersion: kubeflow.org/v1
kind: TFJob
spec:
tfReplicaSpecs:
PS:
replicas: 1
...
MASTER:
replicas: 1
...
Worker:
replicas: 2
...
```
If you want to manage only the 2 Worker Pods that are generated, you need to configure the TargetFilter as follows:
```yaml
targetFilter:
selector:
matchLabels:
role: worker
replicasPathList:
- spec.tfReplicaSpecs.Worker.replicas
```
With this configuration, the PS Pods and Master Pods generated by the TFJob will not be managed by WorkloadSpread and will not be
counted toward the total number of replicas.
*/
type TargetFilter struct {
// Selector is used to filter the Pods to be managed.
//
//+optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// ReplicasPathList is a list of resource paths used to specify how to determine the total number of replicas of
// the target workload after filtering. If this list is not empty, WorkloadSpread will look for the corresponding
// values in the target resource according to each path, and treat the sum of these values as the total number of replicas after filtering.
//
// The replicas path is a dot-separated path, similar to "spec.replicas". If there are arrays, you can use numbers to denote indexes, like "subsets.1.replicas".
// The real values of these paths must be integers.
//
// +optional
ReplicasPathList []string `json:"replicasPathList,omitempty"`
}
// WorkloadSpreadScheduleStrategyType is a string enumeration type that enumerates // WorkloadSpreadScheduleStrategyType is a string enumeration type that enumerates
// all possible schedule strategies for the WorkloadSpread controller. // all possible schedule strategies for the WorkloadSpread controller.
// +kubebuilder:validation:Enum=Adaptive;Fixed;"" // +kubebuilder:validation:Enum=Adaptive;Fixed;""
@ -128,6 +187,11 @@ type WorkloadSpreadStatus struct {
// Contains the status of each subset. Each element in this array represents one subset // Contains the status of each subset. Each element in this array represents one subset
// +optional // +optional
SubsetStatuses []WorkloadSpreadSubsetStatus `json:"subsetStatuses,omitempty"` SubsetStatuses []WorkloadSpreadSubsetStatus `json:"subsetStatuses,omitempty"`
// VersionedSubsetStatuses is to solve rolling-update problems, where the creation of new-version pod
// may be earlier than deletion of old-version pod. We have to calculate the pod subset distribution for
// each version.
VersionedSubsetStatuses map[string][]WorkloadSpreadSubsetStatus `json:"versionedSubsetStatuses,omitempty"`
} }
type WorkloadSpreadSubsetConditionType string type WorkloadSpreadSubsetConditionType string

File diff suppressed because it is too large Load Diff

View File

@ -20,8 +20,8 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"github.com/openkruise/kruise-api/utils/scheme"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"github.com/openkruise/kruise-api/utils/scheme"
) )
var ( var (

View File

@ -0,0 +1,532 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2021 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1beta1
import (
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
)
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/openkruise/kruise-api/apps/v1beta1.RollingUpdateStatefulSetStrategy": schema_kruise_apis_apps_v1beta1_RollingUpdateStatefulSetStrategy(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSet": schema_kruise_apis_apps_v1beta1_StatefulSet(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetList": schema_kruise_apis_apps_v1beta1_StatefulSetList(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetPersistentVolumeClaimRetentionPolicy": schema_kruise_apis_apps_v1beta1_StatefulSetPersistentVolumeClaimRetentionPolicy(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetScaleStrategy": schema_kruise_apis_apps_v1beta1_StatefulSetScaleStrategy(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetSpec": schema_kruise_apis_apps_v1beta1_StatefulSetSpec(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetStatus": schema_kruise_apis_apps_v1beta1_StatefulSetStatus(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetUpdateStrategy": schema_kruise_apis_apps_v1beta1_StatefulSetUpdateStrategy(ref),
"github.com/openkruise/kruise-api/apps/v1beta1.UnorderedUpdateStrategy": schema_kruise_apis_apps_v1beta1_UnorderedUpdateStrategy(ref),
}
}
func schema_kruise_apis_apps_v1beta1_RollingUpdateStatefulSetStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"partition": {
SchemaProps: spec.SchemaProps{
Description: "Partition indicates the ordinal at which the StatefulSet should be partitioned by default. But if unorderedUpdate has been set:\n - Partition indicates the number of pods with non-updated revisions when rolling update.\n - It means controller will update $(replicas - partition) number of pod.\nDefault value is 0.",
Type: []string{"integer"},
Format: "int32",
},
},
"maxUnavailable": {
SchemaProps: spec.SchemaProps{
Description: "The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. Also, maxUnavailable can just be allowed to work with Parallel podManagementPolicy. Defaults to 1.",
Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"),
},
},
"podUpdatePolicy": {
SchemaProps: spec.SchemaProps{
Description: "PodUpdatePolicy indicates how pods should be updated Default value is \"ReCreate\"",
Type: []string{"string"},
Format: "",
},
},
"paused": {
SchemaProps: spec.SchemaProps{
Description: "Paused indicates that the StatefulSet is paused. Default value is false",
Type: []string{"boolean"},
Format: "",
},
},
"unorderedUpdate": {
SchemaProps: spec.SchemaProps{
Description: "UnorderedUpdate contains strategies for non-ordered update. If it is not nil, pods will be updated with non-ordered sequence. Noted that UnorderedUpdate can only be allowed to work with Parallel podManagementPolicy",
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.UnorderedUpdateStrategy"),
},
},
"inPlaceUpdateStrategy": {
SchemaProps: spec.SchemaProps{
Description: "InPlaceUpdateStrategy contains strategies for in-place update.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateStrategy"),
},
},
"minReadySeconds": {
SchemaProps: spec.SchemaProps{
Description: "MinReadySeconds indicates how long will the pod be considered ready after it's updated. MinReadySeconds works with both OrderedReady and Parallel podManagementPolicy. It affects the pod scale up speed when the podManagementPolicy is set to be OrderedReady. Combined with MaxUnavailable, it affects the pod update speed regardless of podManagementPolicy. Default value is 0, max is 300.",
Type: []string{"integer"},
Format: "int32",
},
},
},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.InPlaceUpdateStrategy", "github.com/openkruise/kruise-api/apps/v1beta1.UnorderedUpdateStrategy", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSet(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSet is the Schema for the statefulsets API",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetSpec", "github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSetList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSetList contains a list of StatefulSet",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.StatefulSet"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/v1beta1.StatefulSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSetPersistentVolumeClaimRetentionPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"whenDeleted": {
SchemaProps: spec.SchemaProps{
Description: "WhenDeleted specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is deleted. The default policy of `Retain` causes PVCs to not be affected by StatefulSet deletion. The `Delete` policy causes those PVCs to be deleted.",
Type: []string{"string"},
Format: "",
},
},
"whenScaled": {
SchemaProps: spec.SchemaProps{
Description: "WhenScaled specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is scaled down. The default policy of `Retain` causes PVCs to not be affected by a scaledown. The `Delete` policy causes the associated PVCs for any excess pods above the replica count to be deleted.",
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSetScaleStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSetScaleStrategy defines strategies for pods scale.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"maxUnavailable": {
SchemaProps: spec.SchemaProps{
Description: "The maximum number of pods that can be unavailable during scaling. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. It can just be allowed to work with Parallel podManagementPolicy.",
Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/util/intstr.IntOrString"},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSetSpec defines the desired state of StatefulSet",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "replicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.",
Type: []string{"integer"},
Format: "int32",
},
},
"selector": {
SchemaProps: spec.SchemaProps{
Description: "selector is a label query over pods that should match the replica count. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
"template": {
SchemaProps: spec.SchemaProps{
Description: "template is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PodTemplateSpec"),
},
},
"volumeClaimTemplates": {
SchemaProps: spec.SchemaProps{
Description: "volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaim"),
},
},
},
},
},
"serviceName": {
SchemaProps: spec.SchemaProps{
Description: "serviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where \"pod-specific-string\" is managed by the StatefulSet controller.",
Type: []string{"string"},
Format: "",
},
},
"podManagementPolicy": {
SchemaProps: spec.SchemaProps{
Description: "podManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is `OrderedReady`, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is `Parallel` which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.",
Type: []string{"string"},
Format: "",
},
},
"updateStrategy": {
SchemaProps: spec.SchemaProps{
Description: "updateStrategy indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.",
Default: map[string]interface{}{},
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetUpdateStrategy"),
},
},
"revisionHistoryLimit": {
SchemaProps: spec.SchemaProps{
Description: "revisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet's revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10.",
Type: []string{"integer"},
Format: "int32",
},
},
"reserveOrdinals": {
SchemaProps: spec.SchemaProps{
Description: "reserveOrdinals controls the ordinal numbers that should be reserved, and the replicas will always be the expectation number of running Pods. For a sts with replicas=3 and its Pods in [0, 1, 2]: - If you want to migrate Pod-1 and reserve this ordinal, just set spec.reserveOrdinal to [1].\n Then controller will delete Pod-1 and create Pod-3 (existing Pods will be [0, 2, 3])\n- If you just want to delete Pod-1, you should set spec.reserveOrdinal to [1] and spec.replicas to 2.\n Then controller will delete Pod-1 (existing Pods will be [0, 2])",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
},
},
},
"lifecycle": {
SchemaProps: spec.SchemaProps{
Description: "Lifecycle defines the lifecycle hooks for Pods pre-delete, in-place update.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.Lifecycle"),
},
},
"scaleStrategy": {
SchemaProps: spec.SchemaProps{
Description: "scaleStrategy indicates the StatefulSetScaleStrategy that will be employed to scale Pods in the StatefulSet.",
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetScaleStrategy"),
},
},
"persistentVolumeClaimRetentionPolicy": {
SchemaProps: spec.SchemaProps{
Description: "PersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates. This requires the StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha.",
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetPersistentVolumeClaimRetentionPolicy"),
},
},
},
Required: []string{"selector", "template"},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.Lifecycle", "github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetPersistentVolumeClaimRetentionPolicy", "github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetScaleStrategy", "github.com/openkruise/kruise-api/apps/v1beta1.StatefulSetUpdateStrategy", "k8s.io/api/core/v1.PersistentVolumeClaim", "k8s.io/api/core/v1.PodTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSetStatus defines the observed state of StatefulSet",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"observedGeneration": {
SchemaProps: spec.SchemaProps{
Description: "observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the StatefulSet's generation, which is updated on mutation by the API Server.",
Type: []string{"integer"},
Format: "int64",
},
},
"replicas": {
SchemaProps: spec.SchemaProps{
Description: "replicas is the number of Pods created by the StatefulSet controller.",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"readyReplicas": {
SchemaProps: spec.SchemaProps{
Description: "readyReplicas is the number of Pods created by the StatefulSet controller that have a Ready Condition.",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"availableReplicas": {
SchemaProps: spec.SchemaProps{
Description: "AvailableReplicas is the number of Pods created by the StatefulSet controller that have been ready for minReadySeconds.",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"currentReplicas": {
SchemaProps: spec.SchemaProps{
Description: "currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision.",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"updatedReplicas": {
SchemaProps: spec.SchemaProps{
Description: "updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision.",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"updatedReadyReplicas": {
SchemaProps: spec.SchemaProps{
Description: "updatedReadyReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready Condition.",
Type: []string{"integer"},
Format: "int32",
},
},
"updatedAvailableReplicas": {
SchemaProps: spec.SchemaProps{
Description: "updatedAvailableReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready condition for atleast minReadySeconds.",
Type: []string{"integer"},
Format: "int32",
},
},
"currentRevision": {
SchemaProps: spec.SchemaProps{
Description: "currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [0,currentReplicas).",
Type: []string{"string"},
Format: "",
},
},
"updateRevision": {
SchemaProps: spec.SchemaProps{
Description: "updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [replicas-updatedReplicas,replicas)",
Type: []string{"string"},
Format: "",
},
},
"collisionCount": {
SchemaProps: spec.SchemaProps{
Description: "collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.",
Type: []string{"integer"},
Format: "int32",
},
},
"conditions": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge",
},
},
SchemaProps: spec.SchemaProps{
Description: "Represents the latest available observations of a statefulset's current state.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/apps/v1.StatefulSetCondition"),
},
},
},
},
},
"labelSelector": {
SchemaProps: spec.SchemaProps{
Description: "LabelSelector is label selectors for query over pods that should match the replica count used by HPA.",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"replicas", "readyReplicas", "availableReplicas", "currentReplicas", "updatedReplicas"},
},
},
Dependencies: []string{
"k8s.io/api/apps/v1.StatefulSetCondition"},
}
}
func schema_kruise_apis_apps_v1beta1_StatefulSetUpdateStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.",
Type: []string{"string"},
Format: "",
},
},
"rollingUpdate": {
SchemaProps: spec.SchemaProps{
Description: "RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.",
Ref: ref("github.com/openkruise/kruise-api/apps/v1beta1.RollingUpdateStatefulSetStrategy"),
},
},
},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/v1beta1.RollingUpdateStatefulSetStrategy"},
}
}
func schema_kruise_apis_apps_v1beta1_UnorderedUpdateStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "UnorderedUpdateStrategy defines strategies for non-ordered update.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"priorityStrategy": {
SchemaProps: spec.SchemaProps{
Description: "Priorities are the rules for calculating the priority of updating pods. Each pod to be updated, will pass through these terms and get a sum of weights.",
Ref: ref("github.com/openkruise/kruise-api/apps/pub.UpdatePriorityStrategy"),
},
},
},
},
},
Dependencies: []string{
"github.com/openkruise/kruise-api/apps/pub.UpdatePriorityStrategy"},
}
}

View File

@ -29,6 +29,39 @@ const (
MaxMinReadySeconds = 300 MaxMinReadySeconds = 300
) )
// VolumeClaimUpdateStrategyType defines the update strategy types for volume claims.
// It is an enumerated type that provides two different update strategies.
// +enum
type VolumeClaimUpdateStrategyType string
const (
// OnPodRollingUpdateVolumeClaimUpdateStrategyType indicates that volume claim updates are triggered when associated Pods undergo rolling updates.
// This strategy ensures that storage availability and integrity are maintained during the update process.
OnPodRollingUpdateVolumeClaimUpdateStrategyType VolumeClaimUpdateStrategyType = "OnPodRollingUpdate"
// OnPVCDeleteVolumeClaimUpdateStrategyType indicates that updates are triggered when a Persistent Volume Claim (PVC) is deleted.
// This strategy places full control of the update timing in the hands of the user, typically executed after ensuring data has been backed up or there are no data security concerns,
// allowing for storage resource management that aligns with specific user requirements and security policies.
OnPVCDeleteVolumeClaimUpdateStrategyType VolumeClaimUpdateStrategyType = "OnDelete"
)
// VolumeClaimStatus describes the status of a volume claim template.
// It provides details about the compatibility and readiness of the volume claim.
type VolumeClaimStatus struct {
// VolumeClaimName is the name of the volume claim.
// This is a unique identifier used to reference a specific volume claim.
VolumeClaimName string `json:"volumeClaimName"`
// CompatibleReplicas is the number of replicas currently compatible with the volume claim.
// It indicates how many replicas can function properly, being compatible with this volume claim.
// Compatibility is determined by whether the PVC spec storage requests are greater than or equal to the template spec storage requests
CompatibleReplicas int32 `json:"compatibleReplicas"`
// CompatibleReadyReplicas is the number of replicas that are both ready and compatible with the volume claim.
// It highlights that these replicas are not only compatible but also ready to be put into service immediately.
// Compatibility is determined by whether the pvc spec storage requests are greater than or equal to the template spec storage requests
// The "ready" status is determined by whether the PVC status capacity is greater than or equal to the PVC spec storage requests.
CompatibleReadyReplicas int32 `json:"compatibleReadyReplicas"`
}
// StatefulSetUpdateStrategy indicates the strategy that the StatefulSet // StatefulSetUpdateStrategy indicates the strategy that the StatefulSet
// controller will use to perform updates. It includes any additional parameters // controller will use to perform updates. It includes any additional parameters
// necessary to perform the update for the indicated strategy. // necessary to perform the update for the indicated strategy.
@ -42,11 +75,18 @@ type StatefulSetUpdateStrategy struct {
RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty"` RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty"`
} }
// VolumeClaimUpdateStrategy defines the strategy for updating volume claims.
// This structure is used to control how updates to PersistentVolumeClaims are handled during pod rolling updates or PersistentVolumeClaim deletions.
type VolumeClaimUpdateStrategy struct {
// Type specifies the type of update strategy, possible values include:
// OnPodRollingUpdateVolumeClaimUpdateStrategyType: Apply the update strategy during pod rolling updates.
// OnPVCDeleteVolumeClaimUpdateStrategyType: Apply the update strategy when a PersistentVolumeClaim is deleted.
Type VolumeClaimUpdateStrategyType `json:"type,omitempty"`
}
// RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. // RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.
type RollingUpdateStatefulSetStrategy struct { type RollingUpdateStatefulSetStrategy struct {
// Partition indicates the ordinal at which the StatefulSet should be partitioned by default. // Partition indicates the number of pods the StatefulSet should be partitioned by default.
// But if unorderedUpdate has been set:
// - Partition indicates the number of pods with non-updated revisions when rolling update.
// - It means controller will update $(replicas - partition) number of pod. // - It means controller will update $(replicas - partition) number of pod.
// Default value is 0. // Default value is 0.
// +optional // +optional
@ -128,7 +168,7 @@ const (
) )
// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs // StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
// created from the StatefulSet VolumeClaimTemplates. // created from the StatefulSet VolumeClaims.
type StatefulSetPersistentVolumeClaimRetentionPolicy struct { type StatefulSetPersistentVolumeClaimRetentionPolicy struct {
// WhenDeleted specifies what happens to PVCs created from StatefulSet // WhenDeleted specifies what happens to PVCs created from StatefulSet
// VolumeClaimTemplates when the StatefulSet is deleted. The default policy // VolumeClaimTemplates when the StatefulSet is deleted. The default policy
@ -143,6 +183,21 @@ type StatefulSetPersistentVolumeClaimRetentionPolicy struct {
WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"` WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"`
} }
// StatefulSetOrdinals describes the policy used for replica ordinal assignment
// in this StatefulSet.
type StatefulSetOrdinals struct {
// start is the number representing the first replica's index. It may be used
// to number replicas from an alternate index (eg: 1-indexed) over the default
// 0-indexed names, or to orchestrate progressive movement of replicas from
// one StatefulSet to another.
// If set, replica indices will be in the range:
// [.spec.ordinals.start, .spec.ordinals.start + .spec.replicas).
// If unset, defaults to 0. Replica indices will be in the range:
// [0, .spec.replicas).
// +optional
Start int32 `json:"start" protobuf:"varint,1,opt,name=start"`
}
// StatefulSetSpec defines the desired state of StatefulSet // StatefulSetSpec defines the desired state of StatefulSet
type StatefulSetSpec struct { type StatefulSetSpec struct {
// replicas is the desired number of replicas of the given Template. // replicas is the desired number of replicas of the given Template.
@ -178,6 +233,11 @@ type StatefulSetSpec struct {
// +kubebuilder:validation:Schemaless // +kubebuilder:validation:Schemaless
VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"` VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
// VolumeClaimUpdateStrategy specifies the strategy for updating VolumeClaimTemplates within a StatefulSet.
// This field is currently only effective if the StatefulSetAutoResizePVCGate is enabled.
// +optional
VolumeClaimUpdateStrategy VolumeClaimUpdateStrategy `json:"volumeClaimUpdateStrategy,omitempty"`
// serviceName is the name of the service that governs this StatefulSet. // serviceName is the name of the service that governs this StatefulSet.
// This service must exist before the StatefulSet, and is responsible for // This service must exist before the StatefulSet, and is responsible for
// the network identity of the set. Pods get DNS/hostnames that follow the // the network identity of the set. Pods get DNS/hostnames that follow the
@ -214,7 +274,8 @@ type StatefulSetSpec struct {
// Then controller will delete Pod-1 and create Pod-3 (existing Pods will be [0, 2, 3]) // Then controller will delete Pod-1 and create Pod-3 (existing Pods will be [0, 2, 3])
// - If you just want to delete Pod-1, you should set spec.reserveOrdinal to [1] and spec.replicas to 2. // - If you just want to delete Pod-1, you should set spec.reserveOrdinal to [1] and spec.replicas to 2.
// Then controller will delete Pod-1 (existing Pods will be [0, 2]) // Then controller will delete Pod-1 (existing Pods will be [0, 2])
ReserveOrdinals []int `json:"reserveOrdinals,omitempty"` // You can also use ranges along with numbers, such as [1, 3-5], which is a shortcut for [1, 3, 4, 5].
ReserveOrdinals []intstr.IntOrString `json:"reserveOrdinals,omitempty"`
// Lifecycle defines the lifecycle hooks for Pods pre-delete, in-place update. // Lifecycle defines the lifecycle hooks for Pods pre-delete, in-place update.
Lifecycle *appspub.Lifecycle `json:"lifecycle,omitempty"` Lifecycle *appspub.Lifecycle `json:"lifecycle,omitempty"`
@ -228,6 +289,14 @@ type StatefulSetSpec struct {
// StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha. // StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha.
// +optional // +optional
PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"` PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
// ordinals controls the numbering of replica indices in a StatefulSet. The
// default ordinals behavior assigns a "0" index to the first replica and
// increments the index by one for each additional replica requested. Using
// the ordinals field requires the StatefulSetStartOrdinal feature gate to be
// enabled, which is beta.
// +optional
Ordinals *StatefulSetOrdinals `json:"ordinals,omitempty"`
} }
// StatefulSetScaleStrategy defines strategies for pods scale. // StatefulSetScaleStrategy defines strategies for pods scale.
@ -267,6 +336,10 @@ type StatefulSetStatus struct {
// updatedReadyReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready Condition. // updatedReadyReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready Condition.
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"` UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"`
// updatedAvailableReplicas is the number of updated Pods created by the StatefulSet controller that have a Ready condition
//for atleast minReadySeconds.
UpdatedAvailableReplicas int32 `json:"updatedAvailableReplicas,omitempty"`
// currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the // currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the
// sequence [0,currentReplicas). // sequence [0,currentReplicas).
CurrentRevision string `json:"currentRevision,omitempty"` CurrentRevision string `json:"currentRevision,omitempty"`
@ -289,6 +362,12 @@ type StatefulSetStatus struct {
// LabelSelector is label selectors for query over pods that should match the replica count used by HPA. // LabelSelector is label selectors for query over pods that should match the replica count used by HPA.
LabelSelector string `json:"labelSelector,omitempty"` LabelSelector string `json:"labelSelector,omitempty"`
// VolumeClaims represents the status of compatibility between existing PVCs
// and their respective templates. It tracks whether the PersistentVolumeClaims have been updated
// to match any changes made to the volumeClaimTemplates, ensuring synchronization
// between the defined templates and the actual PersistentVolumeClaims in use.
VolumeClaims []VolumeClaimStatus `json:"volumeClaims,omitempty"`
} }
// These are valid conditions of a statefulset. // These are valid conditions of a statefulset.

View File

@ -1,5 +1,4 @@
//go:build !ignore_autogenerated //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/* /*
Copyright 2021 The Kruise Authors. Copyright 2021 The Kruise Authors.
@ -129,6 +128,21 @@ func (in *StatefulSetList) DeepCopyObject() runtime.Object {
return nil return nil
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StatefulSetOrdinals) DeepCopyInto(out *StatefulSetOrdinals) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetOrdinals.
func (in *StatefulSetOrdinals) DeepCopy() *StatefulSetOrdinals {
if in == nil {
return nil
}
out := new(StatefulSetOrdinals)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StatefulSetPersistentVolumeClaimRetentionPolicy) DeepCopyInto(out *StatefulSetPersistentVolumeClaimRetentionPolicy) { func (in *StatefulSetPersistentVolumeClaimRetentionPolicy) DeepCopyInto(out *StatefulSetPersistentVolumeClaimRetentionPolicy) {
*out = *in *out = *in
@ -185,6 +199,7 @@ func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
} }
} }
out.VolumeClaimUpdateStrategy = in.VolumeClaimUpdateStrategy
in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy)
if in.RevisionHistoryLimit != nil { if in.RevisionHistoryLimit != nil {
in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit
@ -193,7 +208,7 @@ func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
} }
if in.ReserveOrdinals != nil { if in.ReserveOrdinals != nil {
in, out := &in.ReserveOrdinals, &out.ReserveOrdinals in, out := &in.ReserveOrdinals, &out.ReserveOrdinals
*out = make([]int, len(*in)) *out = make([]intstr.IntOrString, len(*in))
copy(*out, *in) copy(*out, *in)
} }
if in.Lifecycle != nil { if in.Lifecycle != nil {
@ -211,6 +226,11 @@ func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
*out = new(StatefulSetPersistentVolumeClaimRetentionPolicy) *out = new(StatefulSetPersistentVolumeClaimRetentionPolicy)
**out = **in **out = **in
} }
if in.Ordinals != nil {
in, out := &in.Ordinals, &out.Ordinals
*out = new(StatefulSetOrdinals)
**out = **in
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetSpec. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetSpec.
@ -238,6 +258,11 @@ func (in *StatefulSetStatus) DeepCopyInto(out *StatefulSetStatus) {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
} }
} }
if in.VolumeClaims != nil {
in, out := &in.VolumeClaims, &out.VolumeClaims
*out = make([]VolumeClaimStatus, len(*in))
copy(*out, *in)
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetStatus. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetStatus.
@ -289,3 +314,33 @@ func (in *UnorderedUpdateStrategy) DeepCopy() *UnorderedUpdateStrategy {
in.DeepCopyInto(out) in.DeepCopyInto(out)
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VolumeClaimStatus) DeepCopyInto(out *VolumeClaimStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeClaimStatus.
func (in *VolumeClaimStatus) DeepCopy() *VolumeClaimStatus {
if in == nil {
return nil
}
out := new(VolumeClaimStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VolumeClaimUpdateStrategy) DeepCopyInto(out *VolumeClaimUpdateStrategy) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeClaimUpdateStrategy.
func (in *VolumeClaimUpdateStrategy) DeepCopy() *VolumeClaimUpdateStrategy {
if in == nil {
return nil
}
out := new(VolumeClaimUpdateStrategy)
in.DeepCopyInto(out)
return out
}

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@ package versioned
import ( import (
"fmt" "fmt"
"net/http"
appsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1alpha1" appsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1" appsv1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1"
@ -36,8 +37,7 @@ type Interface interface {
PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface
} }
// Clientset contains the clients for groups. Each group has exactly one // Clientset contains the clients for groups.
// version included in a Clientset.
type Clientset struct { type Clientset struct {
*discovery.DiscoveryClient *discovery.DiscoveryClient
appsV1alpha1 *appsv1alpha1.AppsV1alpha1Client appsV1alpha1 *appsv1alpha1.AppsV1alpha1Client
@ -71,30 +71,53 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
// NewForConfig creates a new Clientset for the given config. // NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable, // If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy. // NewForConfig will generate a rate-limiter in configShallowCopy.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c configShallowCopy := *c
if configShallowCopy.UserAgent == "" {
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
}
// share the transport between all clients
httpClient, err := rest.HTTPClientFor(&configShallowCopy)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&configShallowCopy, httpClient)
}
// NewForConfigAndClient creates a new Clientset for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 { if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
} }
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
} }
var cs Clientset var cs Clientset
var err error var err error
cs.appsV1alpha1, err = appsv1alpha1.NewForConfig(&configShallowCopy) cs.appsV1alpha1, err = appsv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cs.appsV1beta1, err = appsv1beta1.NewForConfig(&configShallowCopy) cs.appsV1beta1, err = appsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cs.policyV1alpha1, err = policyv1alpha1.NewForConfig(&configShallowCopy) cs.policyV1alpha1, err = policyv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil { if err != nil {
return nil, err return nil, err
} }
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -104,13 +127,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// NewForConfigOrDie creates a new Clientset for the given config and // NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config. // panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset { func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset cs, err := NewForConfig(c)
cs.appsV1alpha1 = appsv1alpha1.NewForConfigOrDie(c) if err != nil {
cs.appsV1beta1 = appsv1beta1.NewForConfigOrDie(c) panic(err)
cs.policyV1alpha1 = policyv1alpha1.NewForConfigOrDie(c) }
return cs
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
} }
// New creates a new Clientset for the given RESTClient. // New creates a new Clientset for the given RESTClient.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -78,7 +78,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker return c.tracker
} }
var _ clientset.Interface = &Clientset{} var (
_ clientset.Interface = &Clientset{}
_ testing.FakeClient = &Clientset{}
)
// AppsV1alpha1 retrieves the AppsV1alpha1Client // AppsV1alpha1 retrieves the AppsV1alpha1Client
func (c *Clientset) AppsV1alpha1() appsv1alpha1.AppsV1alpha1Interface { func (c *Clientset) AppsV1alpha1() appsv1alpha1.AppsV1alpha1Interface {

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -19,6 +19,8 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"net/http"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme" "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
@ -32,8 +34,12 @@ type AppsV1alpha1Interface interface {
ContainerRecreateRequestsGetter ContainerRecreateRequestsGetter
DaemonSetsGetter DaemonSetsGetter
EphemeralJobsGetter EphemeralJobsGetter
ImageListPullJobsGetter
ImagePullJobsGetter ImagePullJobsGetter
NodeImagesGetter NodeImagesGetter
NodePodProbesGetter
PersistentPodStatesGetter
PodProbeMarkersGetter
ResourceDistributionsGetter ResourceDistributionsGetter
SidecarSetsGetter SidecarSetsGetter
StatefulSetsGetter StatefulSetsGetter
@ -70,6 +76,10 @@ func (c *AppsV1alpha1Client) EphemeralJobs(namespace string) EphemeralJobInterfa
return newEphemeralJobs(c, namespace) return newEphemeralJobs(c, namespace)
} }
func (c *AppsV1alpha1Client) ImageListPullJobs(namespace string) ImageListPullJobInterface {
return newImageListPullJobs(c, namespace)
}
func (c *AppsV1alpha1Client) ImagePullJobs(namespace string) ImagePullJobInterface { func (c *AppsV1alpha1Client) ImagePullJobs(namespace string) ImagePullJobInterface {
return newImagePullJobs(c, namespace) return newImagePullJobs(c, namespace)
} }
@ -78,6 +88,18 @@ func (c *AppsV1alpha1Client) NodeImages() NodeImageInterface {
return newNodeImages(c) return newNodeImages(c)
} }
func (c *AppsV1alpha1Client) NodePodProbes() NodePodProbeInterface {
return newNodePodProbes(c)
}
func (c *AppsV1alpha1Client) PersistentPodStates(namespace string) PersistentPodStateInterface {
return newPersistentPodStates(c, namespace)
}
func (c *AppsV1alpha1Client) PodProbeMarkers(namespace string) PodProbeMarkerInterface {
return newPodProbeMarkers(c, namespace)
}
func (c *AppsV1alpha1Client) ResourceDistributions() ResourceDistributionInterface { func (c *AppsV1alpha1Client) ResourceDistributions() ResourceDistributionInterface {
return newResourceDistributions(c) return newResourceDistributions(c)
} }
@ -99,12 +121,28 @@ func (c *AppsV1alpha1Client) WorkloadSpreads(namespace string) WorkloadSpreadInt
} }
// NewForConfig creates a new AppsV1alpha1Client for the given config. // NewForConfig creates a new AppsV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*AppsV1alpha1Client, error) { func NewForConfig(c *rest.Config) (*AppsV1alpha1Client, error) {
config := *c config := *c
if err := setConfigDefaults(&config); err != nil { if err := setConfigDefaults(&config); err != nil {
return nil, err return nil, err
} }
client, err := rest.RESTClientFor(&config) httpClient, err := rest.HTTPClientFor(&config)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new AppsV1alpha1Client for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AppsV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientForConfigAndClient(&config, h)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeAdvancedCronJobs struct {
ns string ns string
} }
var advancedcronjobsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "advancedcronjobs"} var advancedcronjobsResource = v1alpha1.SchemeGroupVersion.WithResource("advancedcronjobs")
var advancedcronjobsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "AdvancedCronJob"} var advancedcronjobsKind = v1alpha1.SchemeGroupVersion.WithKind("AdvancedCronJob")
// Get takes name of the advancedCronJob, and returns the corresponding advancedCronJob object, and an error if there is any. // Get takes name of the advancedCronJob, and returns the corresponding advancedCronJob object, and an error if there is any.
func (c *FakeAdvancedCronJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AdvancedCronJob, err error) { func (c *FakeAdvancedCronJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AdvancedCronJob, err error) {
@ -117,7 +116,7 @@ func (c *FakeAdvancedCronJobs) UpdateStatus(ctx context.Context, advancedCronJob
// Delete takes name of the advancedCronJob and deletes it. Returns an error if one occurs. // Delete takes name of the advancedCronJob and deletes it. Returns an error if one occurs.
func (c *FakeAdvancedCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeAdvancedCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(advancedcronjobsResource, c.ns, name), &v1alpha1.AdvancedCronJob{}) Invokes(testing.NewDeleteActionWithOptions(advancedcronjobsResource, c.ns, name, opts), &v1alpha1.AdvancedCronJob{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -52,6 +52,10 @@ func (c *FakeAppsV1alpha1) EphemeralJobs(namespace string) v1alpha1.EphemeralJob
return &FakeEphemeralJobs{c, namespace} return &FakeEphemeralJobs{c, namespace}
} }
func (c *FakeAppsV1alpha1) ImageListPullJobs(namespace string) v1alpha1.ImageListPullJobInterface {
return &FakeImageListPullJobs{c, namespace}
}
func (c *FakeAppsV1alpha1) ImagePullJobs(namespace string) v1alpha1.ImagePullJobInterface { func (c *FakeAppsV1alpha1) ImagePullJobs(namespace string) v1alpha1.ImagePullJobInterface {
return &FakeImagePullJobs{c, namespace} return &FakeImagePullJobs{c, namespace}
} }
@ -60,6 +64,18 @@ func (c *FakeAppsV1alpha1) NodeImages() v1alpha1.NodeImageInterface {
return &FakeNodeImages{c} return &FakeNodeImages{c}
} }
func (c *FakeAppsV1alpha1) NodePodProbes() v1alpha1.NodePodProbeInterface {
return &FakeNodePodProbes{c}
}
func (c *FakeAppsV1alpha1) PersistentPodStates(namespace string) v1alpha1.PersistentPodStateInterface {
return &FakePersistentPodStates{c, namespace}
}
func (c *FakeAppsV1alpha1) PodProbeMarkers(namespace string) v1alpha1.PodProbeMarkerInterface {
return &FakePodProbeMarkers{c, namespace}
}
func (c *FakeAppsV1alpha1) ResourceDistributions() v1alpha1.ResourceDistributionInterface { func (c *FakeAppsV1alpha1) ResourceDistributions() v1alpha1.ResourceDistributionInterface {
return &FakeResourceDistributions{c} return &FakeResourceDistributions{c}
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeBroadcastJobs struct {
ns string ns string
} }
var broadcastjobsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "broadcastjobs"} var broadcastjobsResource = v1alpha1.SchemeGroupVersion.WithResource("broadcastjobs")
var broadcastjobsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "BroadcastJob"} var broadcastjobsKind = v1alpha1.SchemeGroupVersion.WithKind("BroadcastJob")
// Get takes name of the broadcastJob, and returns the corresponding broadcastJob object, and an error if there is any. // Get takes name of the broadcastJob, and returns the corresponding broadcastJob object, and an error if there is any.
func (c *FakeBroadcastJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BroadcastJob, err error) { func (c *FakeBroadcastJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BroadcastJob, err error) {
@ -117,7 +116,7 @@ func (c *FakeBroadcastJobs) UpdateStatus(ctx context.Context, broadcastJob *v1al
// Delete takes name of the broadcastJob and deletes it. Returns an error if one occurs. // Delete takes name of the broadcastJob and deletes it. Returns an error if one occurs.
func (c *FakeBroadcastJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeBroadcastJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(broadcastjobsResource, c.ns, name), &v1alpha1.BroadcastJob{}) Invokes(testing.NewDeleteActionWithOptions(broadcastjobsResource, c.ns, name, opts), &v1alpha1.BroadcastJob{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeCloneSets struct {
ns string ns string
} }
var clonesetsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "clonesets"} var clonesetsResource = v1alpha1.SchemeGroupVersion.WithResource("clonesets")
var clonesetsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "CloneSet"} var clonesetsKind = v1alpha1.SchemeGroupVersion.WithKind("CloneSet")
// Get takes name of the cloneSet, and returns the corresponding cloneSet object, and an error if there is any. // Get takes name of the cloneSet, and returns the corresponding cloneSet object, and an error if there is any.
func (c *FakeCloneSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CloneSet, err error) { func (c *FakeCloneSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CloneSet, err error) {
@ -118,7 +117,7 @@ func (c *FakeCloneSets) UpdateStatus(ctx context.Context, cloneSet *v1alpha1.Clo
// Delete takes name of the cloneSet and deletes it. Returns an error if one occurs. // Delete takes name of the cloneSet and deletes it. Returns an error if one occurs.
func (c *FakeCloneSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeCloneSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(clonesetsResource, c.ns, name), &v1alpha1.CloneSet{}) Invokes(testing.NewDeleteActionWithOptions(clonesetsResource, c.ns, name, opts), &v1alpha1.CloneSet{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeContainerRecreateRequests struct {
ns string ns string
} }
var containerrecreaterequestsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "containerrecreaterequests"} var containerrecreaterequestsResource = v1alpha1.SchemeGroupVersion.WithResource("containerrecreaterequests")
var containerrecreaterequestsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "ContainerRecreateRequest"} var containerrecreaterequestsKind = v1alpha1.SchemeGroupVersion.WithKind("ContainerRecreateRequest")
// Get takes name of the containerRecreateRequest, and returns the corresponding containerRecreateRequest object, and an error if there is any. // Get takes name of the containerRecreateRequest, and returns the corresponding containerRecreateRequest object, and an error if there is any.
func (c *FakeContainerRecreateRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ContainerRecreateRequest, err error) { func (c *FakeContainerRecreateRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ContainerRecreateRequest, err error) {
@ -117,7 +116,7 @@ func (c *FakeContainerRecreateRequests) UpdateStatus(ctx context.Context, contai
// Delete takes name of the containerRecreateRequest and deletes it. Returns an error if one occurs. // Delete takes name of the containerRecreateRequest and deletes it. Returns an error if one occurs.
func (c *FakeContainerRecreateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeContainerRecreateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(containerrecreaterequestsResource, c.ns, name), &v1alpha1.ContainerRecreateRequest{}) Invokes(testing.NewDeleteActionWithOptions(containerrecreaterequestsResource, c.ns, name, opts), &v1alpha1.ContainerRecreateRequest{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeDaemonSets struct {
ns string ns string
} }
var daemonsetsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "daemonsets"} var daemonsetsResource = v1alpha1.SchemeGroupVersion.WithResource("daemonsets")
var daemonsetsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "DaemonSet"} var daemonsetsKind = v1alpha1.SchemeGroupVersion.WithKind("DaemonSet")
// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any. // Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
func (c *FakeDaemonSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DaemonSet, err error) { func (c *FakeDaemonSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DaemonSet, err error) {
@ -117,7 +116,7 @@ func (c *FakeDaemonSets) UpdateStatus(ctx context.Context, daemonSet *v1alpha1.D
// Delete takes name of the daemonSet and deletes it. Returns an error if one occurs. // Delete takes name of the daemonSet and deletes it. Returns an error if one occurs.
func (c *FakeDaemonSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeDaemonSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &v1alpha1.DaemonSet{}) Invokes(testing.NewDeleteActionWithOptions(daemonsetsResource, c.ns, name, opts), &v1alpha1.DaemonSet{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeEphemeralJobs struct {
ns string ns string
} }
var ephemeraljobsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "ephemeraljobs"} var ephemeraljobsResource = v1alpha1.SchemeGroupVersion.WithResource("ephemeraljobs")
var ephemeraljobsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "EphemeralJob"} var ephemeraljobsKind = v1alpha1.SchemeGroupVersion.WithKind("EphemeralJob")
// Get takes name of the ephemeralJob, and returns the corresponding ephemeralJob object, and an error if there is any. // Get takes name of the ephemeralJob, and returns the corresponding ephemeralJob object, and an error if there is any.
func (c *FakeEphemeralJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EphemeralJob, err error) { func (c *FakeEphemeralJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EphemeralJob, err error) {
@ -117,7 +116,7 @@ func (c *FakeEphemeralJobs) UpdateStatus(ctx context.Context, ephemeralJob *v1al
// Delete takes name of the ephemeralJob and deletes it. Returns an error if one occurs. // Delete takes name of the ephemeralJob and deletes it. Returns an error if one occurs.
func (c *FakeEphemeralJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeEphemeralJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(ephemeraljobsResource, c.ns, name), &v1alpha1.EphemeralJob{}) Invokes(testing.NewDeleteActionWithOptions(ephemeraljobsResource, c.ns, name, opts), &v1alpha1.EphemeralJob{})
return err return err
} }

View File

@ -0,0 +1,141 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeImageListPullJobs implements ImageListPullJobInterface
type FakeImageListPullJobs struct {
Fake *FakeAppsV1alpha1
ns string
}
var imagelistpulljobsResource = v1alpha1.SchemeGroupVersion.WithResource("imagelistpulljobs")
var imagelistpulljobsKind = v1alpha1.SchemeGroupVersion.WithKind("ImageListPullJob")
// Get takes name of the imageListPullJob, and returns the corresponding imageListPullJob object, and an error if there is any.
func (c *FakeImageListPullJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ImageListPullJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(imagelistpulljobsResource, c.ns, name), &v1alpha1.ImageListPullJob{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ImageListPullJob), err
}
// List takes label and field selectors, and returns the list of ImageListPullJobs that match those selectors.
func (c *FakeImageListPullJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ImageListPullJobList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(imagelistpulljobsResource, imagelistpulljobsKind, c.ns, opts), &v1alpha1.ImageListPullJobList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ImageListPullJobList{ListMeta: obj.(*v1alpha1.ImageListPullJobList).ListMeta}
for _, item := range obj.(*v1alpha1.ImageListPullJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested imageListPullJobs.
func (c *FakeImageListPullJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(imagelistpulljobsResource, c.ns, opts))
}
// Create takes the representation of a imageListPullJob and creates it. Returns the server's representation of the imageListPullJob, and an error, if there is any.
func (c *FakeImageListPullJobs) Create(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.CreateOptions) (result *v1alpha1.ImageListPullJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(imagelistpulljobsResource, c.ns, imageListPullJob), &v1alpha1.ImageListPullJob{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ImageListPullJob), err
}
// Update takes the representation of a imageListPullJob and updates it. Returns the server's representation of the imageListPullJob, and an error, if there is any.
func (c *FakeImageListPullJobs) Update(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.UpdateOptions) (result *v1alpha1.ImageListPullJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(imagelistpulljobsResource, c.ns, imageListPullJob), &v1alpha1.ImageListPullJob{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ImageListPullJob), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeImageListPullJobs) UpdateStatus(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.UpdateOptions) (*v1alpha1.ImageListPullJob, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(imagelistpulljobsResource, "status", c.ns, imageListPullJob), &v1alpha1.ImageListPullJob{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ImageListPullJob), err
}
// Delete takes name of the imageListPullJob and deletes it. Returns an error if one occurs.
func (c *FakeImageListPullJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(imagelistpulljobsResource, c.ns, name, opts), &v1alpha1.ImageListPullJob{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeImageListPullJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(imagelistpulljobsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ImageListPullJobList{})
return err
}
// Patch applies the patch and returns the patched imageListPullJob.
func (c *FakeImageListPullJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ImageListPullJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(imagelistpulljobsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ImageListPullJob{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ImageListPullJob), err
}

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeImagePullJobs struct {
ns string ns string
} }
var imagepulljobsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "imagepulljobs"} var imagepulljobsResource = v1alpha1.SchemeGroupVersion.WithResource("imagepulljobs")
var imagepulljobsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "ImagePullJob"} var imagepulljobsKind = v1alpha1.SchemeGroupVersion.WithKind("ImagePullJob")
// Get takes name of the imagePullJob, and returns the corresponding imagePullJob object, and an error if there is any. // Get takes name of the imagePullJob, and returns the corresponding imagePullJob object, and an error if there is any.
func (c *FakeImagePullJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ImagePullJob, err error) { func (c *FakeImagePullJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ImagePullJob, err error) {
@ -117,7 +116,7 @@ func (c *FakeImagePullJobs) UpdateStatus(ctx context.Context, imagePullJob *v1al
// Delete takes name of the imagePullJob and deletes it. Returns an error if one occurs. // Delete takes name of the imagePullJob and deletes it. Returns an error if one occurs.
func (c *FakeImagePullJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeImagePullJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(imagepulljobsResource, c.ns, name), &v1alpha1.ImagePullJob{}) Invokes(testing.NewDeleteActionWithOptions(imagepulljobsResource, c.ns, name, opts), &v1alpha1.ImagePullJob{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeNodeImages struct {
Fake *FakeAppsV1alpha1 Fake *FakeAppsV1alpha1
} }
var nodeimagesResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "nodeimages"} var nodeimagesResource = v1alpha1.SchemeGroupVersion.WithResource("nodeimages")
var nodeimagesKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "NodeImage"} var nodeimagesKind = v1alpha1.SchemeGroupVersion.WithKind("NodeImage")
// Get takes name of the nodeImage, and returns the corresponding nodeImage object, and an error if there is any. // Get takes name of the nodeImage, and returns the corresponding nodeImage object, and an error if there is any.
func (c *FakeNodeImages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeImage, err error) { func (c *FakeNodeImages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodeImage, err error) {
@ -110,7 +109,7 @@ func (c *FakeNodeImages) UpdateStatus(ctx context.Context, nodeImage *v1alpha1.N
// Delete takes name of the nodeImage and deletes it. Returns an error if one occurs. // Delete takes name of the nodeImage and deletes it. Returns an error if one occurs.
func (c *FakeNodeImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeNodeImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewRootDeleteAction(nodeimagesResource, name), &v1alpha1.NodeImage{}) Invokes(testing.NewRootDeleteActionWithOptions(nodeimagesResource, name, opts), &v1alpha1.NodeImage{})
return err return err
} }

View File

@ -0,0 +1,132 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeNodePodProbes implements NodePodProbeInterface
type FakeNodePodProbes struct {
Fake *FakeAppsV1alpha1
}
var nodepodprobesResource = v1alpha1.SchemeGroupVersion.WithResource("nodepodprobes")
var nodepodprobesKind = v1alpha1.SchemeGroupVersion.WithKind("NodePodProbe")
// Get takes name of the nodePodProbe, and returns the corresponding nodePodProbe object, and an error if there is any.
func (c *FakeNodePodProbes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodePodProbe, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(nodepodprobesResource, name), &v1alpha1.NodePodProbe{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.NodePodProbe), err
}
// List takes label and field selectors, and returns the list of NodePodProbes that match those selectors.
func (c *FakeNodePodProbes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodePodProbeList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(nodepodprobesResource, nodepodprobesKind, opts), &v1alpha1.NodePodProbeList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.NodePodProbeList{ListMeta: obj.(*v1alpha1.NodePodProbeList).ListMeta}
for _, item := range obj.(*v1alpha1.NodePodProbeList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested nodePodProbes.
func (c *FakeNodePodProbes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(nodepodprobesResource, opts))
}
// Create takes the representation of a nodePodProbe and creates it. Returns the server's representation of the nodePodProbe, and an error, if there is any.
func (c *FakeNodePodProbes) Create(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.CreateOptions) (result *v1alpha1.NodePodProbe, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(nodepodprobesResource, nodePodProbe), &v1alpha1.NodePodProbe{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.NodePodProbe), err
}
// Update takes the representation of a nodePodProbe and updates it. Returns the server's representation of the nodePodProbe, and an error, if there is any.
func (c *FakeNodePodProbes) Update(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.UpdateOptions) (result *v1alpha1.NodePodProbe, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(nodepodprobesResource, nodePodProbe), &v1alpha1.NodePodProbe{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.NodePodProbe), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeNodePodProbes) UpdateStatus(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.UpdateOptions) (*v1alpha1.NodePodProbe, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(nodepodprobesResource, "status", nodePodProbe), &v1alpha1.NodePodProbe{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.NodePodProbe), err
}
// Delete takes name of the nodePodProbe and deletes it. Returns an error if one occurs.
func (c *FakeNodePodProbes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(nodepodprobesResource, name, opts), &v1alpha1.NodePodProbe{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeNodePodProbes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(nodepodprobesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.NodePodProbeList{})
return err
}
// Patch applies the patch and returns the patched nodePodProbe.
func (c *FakeNodePodProbes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodePodProbe, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(nodepodprobesResource, name, pt, data, subresources...), &v1alpha1.NodePodProbe{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.NodePodProbe), err
}

View File

@ -0,0 +1,141 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakePersistentPodStates implements PersistentPodStateInterface
type FakePersistentPodStates struct {
Fake *FakeAppsV1alpha1
ns string
}
var persistentpodstatesResource = v1alpha1.SchemeGroupVersion.WithResource("persistentpodstates")
var persistentpodstatesKind = v1alpha1.SchemeGroupVersion.WithKind("PersistentPodState")
// Get takes name of the persistentPodState, and returns the corresponding persistentPodState object, and an error if there is any.
func (c *FakePersistentPodStates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PersistentPodState, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(persistentpodstatesResource, c.ns, name), &v1alpha1.PersistentPodState{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PersistentPodState), err
}
// List takes label and field selectors, and returns the list of PersistentPodStates that match those selectors.
func (c *FakePersistentPodStates) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PersistentPodStateList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(persistentpodstatesResource, persistentpodstatesKind, c.ns, opts), &v1alpha1.PersistentPodStateList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.PersistentPodStateList{ListMeta: obj.(*v1alpha1.PersistentPodStateList).ListMeta}
for _, item := range obj.(*v1alpha1.PersistentPodStateList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested persistentPodStates.
func (c *FakePersistentPodStates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(persistentpodstatesResource, c.ns, opts))
}
// Create takes the representation of a persistentPodState and creates it. Returns the server's representation of the persistentPodState, and an error, if there is any.
func (c *FakePersistentPodStates) Create(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.CreateOptions) (result *v1alpha1.PersistentPodState, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(persistentpodstatesResource, c.ns, persistentPodState), &v1alpha1.PersistentPodState{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PersistentPodState), err
}
// Update takes the representation of a persistentPodState and updates it. Returns the server's representation of the persistentPodState, and an error, if there is any.
func (c *FakePersistentPodStates) Update(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.UpdateOptions) (result *v1alpha1.PersistentPodState, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(persistentpodstatesResource, c.ns, persistentPodState), &v1alpha1.PersistentPodState{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PersistentPodState), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakePersistentPodStates) UpdateStatus(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.UpdateOptions) (*v1alpha1.PersistentPodState, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(persistentpodstatesResource, "status", c.ns, persistentPodState), &v1alpha1.PersistentPodState{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PersistentPodState), err
}
// Delete takes name of the persistentPodState and deletes it. Returns an error if one occurs.
func (c *FakePersistentPodStates) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(persistentpodstatesResource, c.ns, name, opts), &v1alpha1.PersistentPodState{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePersistentPodStates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(persistentpodstatesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.PersistentPodStateList{})
return err
}
// Patch applies the patch and returns the patched persistentPodState.
func (c *FakePersistentPodStates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PersistentPodState, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(persistentpodstatesResource, c.ns, name, pt, data, subresources...), &v1alpha1.PersistentPodState{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PersistentPodState), err
}

View File

@ -0,0 +1,141 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakePodProbeMarkers implements PodProbeMarkerInterface
type FakePodProbeMarkers struct {
Fake *FakeAppsV1alpha1
ns string
}
var podprobemarkersResource = v1alpha1.SchemeGroupVersion.WithResource("podprobemarkers")
var podprobemarkersKind = v1alpha1.SchemeGroupVersion.WithKind("PodProbeMarker")
// Get takes name of the podProbeMarker, and returns the corresponding podProbeMarker object, and an error if there is any.
func (c *FakePodProbeMarkers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodProbeMarker, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(podprobemarkersResource, c.ns, name), &v1alpha1.PodProbeMarker{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PodProbeMarker), err
}
// List takes label and field selectors, and returns the list of PodProbeMarkers that match those selectors.
func (c *FakePodProbeMarkers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PodProbeMarkerList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(podprobemarkersResource, podprobemarkersKind, c.ns, opts), &v1alpha1.PodProbeMarkerList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.PodProbeMarkerList{ListMeta: obj.(*v1alpha1.PodProbeMarkerList).ListMeta}
for _, item := range obj.(*v1alpha1.PodProbeMarkerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested podProbeMarkers.
func (c *FakePodProbeMarkers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(podprobemarkersResource, c.ns, opts))
}
// Create takes the representation of a podProbeMarker and creates it. Returns the server's representation of the podProbeMarker, and an error, if there is any.
func (c *FakePodProbeMarkers) Create(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.CreateOptions) (result *v1alpha1.PodProbeMarker, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(podprobemarkersResource, c.ns, podProbeMarker), &v1alpha1.PodProbeMarker{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PodProbeMarker), err
}
// Update takes the representation of a podProbeMarker and updates it. Returns the server's representation of the podProbeMarker, and an error, if there is any.
func (c *FakePodProbeMarkers) Update(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.UpdateOptions) (result *v1alpha1.PodProbeMarker, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(podprobemarkersResource, c.ns, podProbeMarker), &v1alpha1.PodProbeMarker{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PodProbeMarker), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakePodProbeMarkers) UpdateStatus(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.UpdateOptions) (*v1alpha1.PodProbeMarker, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(podprobemarkersResource, "status", c.ns, podProbeMarker), &v1alpha1.PodProbeMarker{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PodProbeMarker), err
}
// Delete takes name of the podProbeMarker and deletes it. Returns an error if one occurs.
func (c *FakePodProbeMarkers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(podprobemarkersResource, c.ns, name, opts), &v1alpha1.PodProbeMarker{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePodProbeMarkers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(podprobemarkersResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.PodProbeMarkerList{})
return err
}
// Patch applies the patch and returns the patched podProbeMarker.
func (c *FakePodProbeMarkers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PodProbeMarker, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(podprobemarkersResource, c.ns, name, pt, data, subresources...), &v1alpha1.PodProbeMarker{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.PodProbeMarker), err
}

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeResourceDistributions struct {
Fake *FakeAppsV1alpha1 Fake *FakeAppsV1alpha1
} }
var resourcedistributionsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "resourcedistributions"} var resourcedistributionsResource = v1alpha1.SchemeGroupVersion.WithResource("resourcedistributions")
var resourcedistributionsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "ResourceDistribution"} var resourcedistributionsKind = v1alpha1.SchemeGroupVersion.WithKind("ResourceDistribution")
// Get takes name of the resourceDistribution, and returns the corresponding resourceDistribution object, and an error if there is any. // Get takes name of the resourceDistribution, and returns the corresponding resourceDistribution object, and an error if there is any.
func (c *FakeResourceDistributions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceDistribution, err error) { func (c *FakeResourceDistributions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceDistribution, err error) {
@ -110,7 +109,7 @@ func (c *FakeResourceDistributions) UpdateStatus(ctx context.Context, resourceDi
// Delete takes name of the resourceDistribution and deletes it. Returns an error if one occurs. // Delete takes name of the resourceDistribution and deletes it. Returns an error if one occurs.
func (c *FakeResourceDistributions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeResourceDistributions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewRootDeleteAction(resourcedistributionsResource, name), &v1alpha1.ResourceDistribution{}) Invokes(testing.NewRootDeleteActionWithOptions(resourcedistributionsResource, name, opts), &v1alpha1.ResourceDistribution{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeSidecarSets struct {
Fake *FakeAppsV1alpha1 Fake *FakeAppsV1alpha1
} }
var sidecarsetsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "sidecarsets"} var sidecarsetsResource = v1alpha1.SchemeGroupVersion.WithResource("sidecarsets")
var sidecarsetsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "SidecarSet"} var sidecarsetsKind = v1alpha1.SchemeGroupVersion.WithKind("SidecarSet")
// Get takes name of the sidecarSet, and returns the corresponding sidecarSet object, and an error if there is any. // Get takes name of the sidecarSet, and returns the corresponding sidecarSet object, and an error if there is any.
func (c *FakeSidecarSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SidecarSet, err error) { func (c *FakeSidecarSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.SidecarSet, err error) {
@ -110,7 +109,7 @@ func (c *FakeSidecarSets) UpdateStatus(ctx context.Context, sidecarSet *v1alpha1
// Delete takes name of the sidecarSet and deletes it. Returns an error if one occurs. // Delete takes name of the sidecarSet and deletes it. Returns an error if one occurs.
func (c *FakeSidecarSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeSidecarSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewRootDeleteAction(sidecarsetsResource, name), &v1alpha1.SidecarSet{}) Invokes(testing.NewRootDeleteActionWithOptions(sidecarsetsResource, name, opts), &v1alpha1.SidecarSet{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeStatefulSets struct {
ns string ns string
} }
var statefulsetsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "statefulsets"} var statefulsetsResource = v1alpha1.SchemeGroupVersion.WithResource("statefulsets")
var statefulsetsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "StatefulSet"} var statefulsetsKind = v1alpha1.SchemeGroupVersion.WithKind("StatefulSet")
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. // Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
func (c *FakeStatefulSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.StatefulSet, err error) { func (c *FakeStatefulSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.StatefulSet, err error) {
@ -118,7 +117,7 @@ func (c *FakeStatefulSets) UpdateStatus(ctx context.Context, statefulSet *v1alph
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs. // Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1alpha1.StatefulSet{}) Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1alpha1.StatefulSet{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeUnitedDeployments struct {
ns string ns string
} }
var uniteddeploymentsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "uniteddeployments"} var uniteddeploymentsResource = v1alpha1.SchemeGroupVersion.WithResource("uniteddeployments")
var uniteddeploymentsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "UnitedDeployment"} var uniteddeploymentsKind = v1alpha1.SchemeGroupVersion.WithKind("UnitedDeployment")
// Get takes name of the unitedDeployment, and returns the corresponding unitedDeployment object, and an error if there is any. // Get takes name of the unitedDeployment, and returns the corresponding unitedDeployment object, and an error if there is any.
func (c *FakeUnitedDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.UnitedDeployment, err error) { func (c *FakeUnitedDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.UnitedDeployment, err error) {
@ -118,7 +117,7 @@ func (c *FakeUnitedDeployments) UpdateStatus(ctx context.Context, unitedDeployme
// Delete takes name of the unitedDeployment and deletes it. Returns an error if one occurs. // Delete takes name of the unitedDeployment and deletes it. Returns an error if one occurs.
func (c *FakeUnitedDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeUnitedDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(uniteddeploymentsResource, c.ns, name), &v1alpha1.UnitedDeployment{}) Invokes(testing.NewDeleteActionWithOptions(uniteddeploymentsResource, c.ns, name, opts), &v1alpha1.UnitedDeployment{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeWorkloadSpreads struct {
ns string ns string
} }
var workloadspreadsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "workloadspreads"} var workloadspreadsResource = v1alpha1.SchemeGroupVersion.WithResource("workloadspreads")
var workloadspreadsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "WorkloadSpread"} var workloadspreadsKind = v1alpha1.SchemeGroupVersion.WithKind("WorkloadSpread")
// Get takes name of the workloadSpread, and returns the corresponding workloadSpread object, and an error if there is any. // Get takes name of the workloadSpread, and returns the corresponding workloadSpread object, and an error if there is any.
func (c *FakeWorkloadSpreads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WorkloadSpread, err error) { func (c *FakeWorkloadSpreads) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.WorkloadSpread, err error) {
@ -117,7 +116,7 @@ func (c *FakeWorkloadSpreads) UpdateStatus(ctx context.Context, workloadSpread *
// Delete takes name of the workloadSpread and deletes it. Returns an error if one occurs. // Delete takes name of the workloadSpread and deletes it. Returns an error if one occurs.
func (c *FakeWorkloadSpreads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeWorkloadSpreads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(workloadspreadsResource, c.ns, name), &v1alpha1.WorkloadSpread{}) Invokes(testing.NewDeleteActionWithOptions(workloadspreadsResource, c.ns, name, opts), &v1alpha1.WorkloadSpread{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -30,10 +30,18 @@ type DaemonSetExpansion interface{}
type EphemeralJobExpansion interface{} type EphemeralJobExpansion interface{}
type ImageListPullJobExpansion interface{}
type ImagePullJobExpansion interface{} type ImagePullJobExpansion interface{}
type NodeImageExpansion interface{} type NodeImageExpansion interface{}
type NodePodProbeExpansion interface{}
type PersistentPodStateExpansion interface{}
type PodProbeMarkerExpansion interface{}
type ResourceDistributionExpansion interface{} type ResourceDistributionExpansion interface{}
type SidecarSetExpansion interface{} type SidecarSetExpansion interface{}

View File

@ -0,0 +1,195 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ImageListPullJobsGetter has a method to return a ImageListPullJobInterface.
// A group's client should implement this interface.
type ImageListPullJobsGetter interface {
ImageListPullJobs(namespace string) ImageListPullJobInterface
}
// ImageListPullJobInterface has methods to work with ImageListPullJob resources.
type ImageListPullJobInterface interface {
Create(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.CreateOptions) (*v1alpha1.ImageListPullJob, error)
Update(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.UpdateOptions) (*v1alpha1.ImageListPullJob, error)
UpdateStatus(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.UpdateOptions) (*v1alpha1.ImageListPullJob, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ImageListPullJob, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ImageListPullJobList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ImageListPullJob, err error)
ImageListPullJobExpansion
}
// imageListPullJobs implements ImageListPullJobInterface
type imageListPullJobs struct {
client rest.Interface
ns string
}
// newImageListPullJobs returns a ImageListPullJobs
func newImageListPullJobs(c *AppsV1alpha1Client, namespace string) *imageListPullJobs {
return &imageListPullJobs{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the imageListPullJob, and returns the corresponding imageListPullJob object, and an error if there is any.
func (c *imageListPullJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ImageListPullJob, err error) {
result = &v1alpha1.ImageListPullJob{}
err = c.client.Get().
Namespace(c.ns).
Resource("imagelistpulljobs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ImageListPullJobs that match those selectors.
func (c *imageListPullJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ImageListPullJobList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ImageListPullJobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("imagelistpulljobs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested imageListPullJobs.
func (c *imageListPullJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("imagelistpulljobs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a imageListPullJob and creates it. Returns the server's representation of the imageListPullJob, and an error, if there is any.
func (c *imageListPullJobs) Create(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.CreateOptions) (result *v1alpha1.ImageListPullJob, err error) {
result = &v1alpha1.ImageListPullJob{}
err = c.client.Post().
Namespace(c.ns).
Resource("imagelistpulljobs").
VersionedParams(&opts, scheme.ParameterCodec).
Body(imageListPullJob).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a imageListPullJob and updates it. Returns the server's representation of the imageListPullJob, and an error, if there is any.
func (c *imageListPullJobs) Update(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.UpdateOptions) (result *v1alpha1.ImageListPullJob, err error) {
result = &v1alpha1.ImageListPullJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("imagelistpulljobs").
Name(imageListPullJob.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(imageListPullJob).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *imageListPullJobs) UpdateStatus(ctx context.Context, imageListPullJob *v1alpha1.ImageListPullJob, opts v1.UpdateOptions) (result *v1alpha1.ImageListPullJob, err error) {
result = &v1alpha1.ImageListPullJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("imagelistpulljobs").
Name(imageListPullJob.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(imageListPullJob).
Do(ctx).
Into(result)
return
}
// Delete takes name of the imageListPullJob and deletes it. Returns an error if one occurs.
func (c *imageListPullJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("imagelistpulljobs").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *imageListPullJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("imagelistpulljobs").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched imageListPullJob.
func (c *imageListPullJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ImageListPullJob, err error) {
result = &v1alpha1.ImageListPullJob{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("imagelistpulljobs").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -0,0 +1,184 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// NodePodProbesGetter has a method to return a NodePodProbeInterface.
// A group's client should implement this interface.
type NodePodProbesGetter interface {
NodePodProbes() NodePodProbeInterface
}
// NodePodProbeInterface has methods to work with NodePodProbe resources.
type NodePodProbeInterface interface {
Create(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.CreateOptions) (*v1alpha1.NodePodProbe, error)
Update(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.UpdateOptions) (*v1alpha1.NodePodProbe, error)
UpdateStatus(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.UpdateOptions) (*v1alpha1.NodePodProbe, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.NodePodProbe, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NodePodProbeList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodePodProbe, err error)
NodePodProbeExpansion
}
// nodePodProbes implements NodePodProbeInterface
type nodePodProbes struct {
client rest.Interface
}
// newNodePodProbes returns a NodePodProbes
func newNodePodProbes(c *AppsV1alpha1Client) *nodePodProbes {
return &nodePodProbes{
client: c.RESTClient(),
}
}
// Get takes name of the nodePodProbe, and returns the corresponding nodePodProbe object, and an error if there is any.
func (c *nodePodProbes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.NodePodProbe, err error) {
result = &v1alpha1.NodePodProbe{}
err = c.client.Get().
Resource("nodepodprobes").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of NodePodProbes that match those selectors.
func (c *nodePodProbes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.NodePodProbeList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.NodePodProbeList{}
err = c.client.Get().
Resource("nodepodprobes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested nodePodProbes.
func (c *nodePodProbes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("nodepodprobes").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a nodePodProbe and creates it. Returns the server's representation of the nodePodProbe, and an error, if there is any.
func (c *nodePodProbes) Create(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.CreateOptions) (result *v1alpha1.NodePodProbe, err error) {
result = &v1alpha1.NodePodProbe{}
err = c.client.Post().
Resource("nodepodprobes").
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodePodProbe).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a nodePodProbe and updates it. Returns the server's representation of the nodePodProbe, and an error, if there is any.
func (c *nodePodProbes) Update(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.UpdateOptions) (result *v1alpha1.NodePodProbe, err error) {
result = &v1alpha1.NodePodProbe{}
err = c.client.Put().
Resource("nodepodprobes").
Name(nodePodProbe.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodePodProbe).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *nodePodProbes) UpdateStatus(ctx context.Context, nodePodProbe *v1alpha1.NodePodProbe, opts v1.UpdateOptions) (result *v1alpha1.NodePodProbe, err error) {
result = &v1alpha1.NodePodProbe{}
err = c.client.Put().
Resource("nodepodprobes").
Name(nodePodProbe.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(nodePodProbe).
Do(ctx).
Into(result)
return
}
// Delete takes name of the nodePodProbe and deletes it. Returns an error if one occurs.
func (c *nodePodProbes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("nodepodprobes").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *nodePodProbes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("nodepodprobes").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched nodePodProbe.
func (c *nodePodProbes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.NodePodProbe, err error) {
result = &v1alpha1.NodePodProbe{}
err = c.client.Patch(pt).
Resource("nodepodprobes").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,195 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// PersistentPodStatesGetter has a method to return a PersistentPodStateInterface.
// A group's client should implement this interface.
type PersistentPodStatesGetter interface {
PersistentPodStates(namespace string) PersistentPodStateInterface
}
// PersistentPodStateInterface has methods to work with PersistentPodState resources.
type PersistentPodStateInterface interface {
Create(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.CreateOptions) (*v1alpha1.PersistentPodState, error)
Update(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.UpdateOptions) (*v1alpha1.PersistentPodState, error)
UpdateStatus(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.UpdateOptions) (*v1alpha1.PersistentPodState, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PersistentPodState, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PersistentPodStateList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PersistentPodState, err error)
PersistentPodStateExpansion
}
// persistentPodStates implements PersistentPodStateInterface
type persistentPodStates struct {
client rest.Interface
ns string
}
// newPersistentPodStates returns a PersistentPodStates
func newPersistentPodStates(c *AppsV1alpha1Client, namespace string) *persistentPodStates {
return &persistentPodStates{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the persistentPodState, and returns the corresponding persistentPodState object, and an error if there is any.
func (c *persistentPodStates) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PersistentPodState, err error) {
result = &v1alpha1.PersistentPodState{}
err = c.client.Get().
Namespace(c.ns).
Resource("persistentpodstates").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of PersistentPodStates that match those selectors.
func (c *persistentPodStates) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PersistentPodStateList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.PersistentPodStateList{}
err = c.client.Get().
Namespace(c.ns).
Resource("persistentpodstates").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested persistentPodStates.
func (c *persistentPodStates) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("persistentpodstates").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a persistentPodState and creates it. Returns the server's representation of the persistentPodState, and an error, if there is any.
func (c *persistentPodStates) Create(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.CreateOptions) (result *v1alpha1.PersistentPodState, err error) {
result = &v1alpha1.PersistentPodState{}
err = c.client.Post().
Namespace(c.ns).
Resource("persistentpodstates").
VersionedParams(&opts, scheme.ParameterCodec).
Body(persistentPodState).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a persistentPodState and updates it. Returns the server's representation of the persistentPodState, and an error, if there is any.
func (c *persistentPodStates) Update(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.UpdateOptions) (result *v1alpha1.PersistentPodState, err error) {
result = &v1alpha1.PersistentPodState{}
err = c.client.Put().
Namespace(c.ns).
Resource("persistentpodstates").
Name(persistentPodState.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(persistentPodState).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *persistentPodStates) UpdateStatus(ctx context.Context, persistentPodState *v1alpha1.PersistentPodState, opts v1.UpdateOptions) (result *v1alpha1.PersistentPodState, err error) {
result = &v1alpha1.PersistentPodState{}
err = c.client.Put().
Namespace(c.ns).
Resource("persistentpodstates").
Name(persistentPodState.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(persistentPodState).
Do(ctx).
Into(result)
return
}
// Delete takes name of the persistentPodState and deletes it. Returns an error if one occurs.
func (c *persistentPodStates) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("persistentpodstates").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *persistentPodStates) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("persistentpodstates").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched persistentPodState.
func (c *persistentPodStates) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PersistentPodState, err error) {
result = &v1alpha1.PersistentPodState{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("persistentpodstates").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,195 @@
/*
Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// PodProbeMarkersGetter has a method to return a PodProbeMarkerInterface.
// A group's client should implement this interface.
type PodProbeMarkersGetter interface {
PodProbeMarkers(namespace string) PodProbeMarkerInterface
}
// PodProbeMarkerInterface has methods to work with PodProbeMarker resources.
type PodProbeMarkerInterface interface {
Create(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.CreateOptions) (*v1alpha1.PodProbeMarker, error)
Update(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.UpdateOptions) (*v1alpha1.PodProbeMarker, error)
UpdateStatus(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.UpdateOptions) (*v1alpha1.PodProbeMarker, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PodProbeMarker, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PodProbeMarkerList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PodProbeMarker, err error)
PodProbeMarkerExpansion
}
// podProbeMarkers implements PodProbeMarkerInterface
type podProbeMarkers struct {
client rest.Interface
ns string
}
// newPodProbeMarkers returns a PodProbeMarkers
func newPodProbeMarkers(c *AppsV1alpha1Client, namespace string) *podProbeMarkers {
return &podProbeMarkers{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the podProbeMarker, and returns the corresponding podProbeMarker object, and an error if there is any.
func (c *podProbeMarkers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodProbeMarker, err error) {
result = &v1alpha1.PodProbeMarker{}
err = c.client.Get().
Namespace(c.ns).
Resource("podprobemarkers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of PodProbeMarkers that match those selectors.
func (c *podProbeMarkers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PodProbeMarkerList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.PodProbeMarkerList{}
err = c.client.Get().
Namespace(c.ns).
Resource("podprobemarkers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested podProbeMarkers.
func (c *podProbeMarkers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("podprobemarkers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a podProbeMarker and creates it. Returns the server's representation of the podProbeMarker, and an error, if there is any.
func (c *podProbeMarkers) Create(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.CreateOptions) (result *v1alpha1.PodProbeMarker, err error) {
result = &v1alpha1.PodProbeMarker{}
err = c.client.Post().
Namespace(c.ns).
Resource("podprobemarkers").
VersionedParams(&opts, scheme.ParameterCodec).
Body(podProbeMarker).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a podProbeMarker and updates it. Returns the server's representation of the podProbeMarker, and an error, if there is any.
func (c *podProbeMarkers) Update(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.UpdateOptions) (result *v1alpha1.PodProbeMarker, err error) {
result = &v1alpha1.PodProbeMarker{}
err = c.client.Put().
Namespace(c.ns).
Resource("podprobemarkers").
Name(podProbeMarker.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(podProbeMarker).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *podProbeMarkers) UpdateStatus(ctx context.Context, podProbeMarker *v1alpha1.PodProbeMarker, opts v1.UpdateOptions) (result *v1alpha1.PodProbeMarker, err error) {
result = &v1alpha1.PodProbeMarker{}
err = c.client.Put().
Namespace(c.ns).
Resource("podprobemarkers").
Name(podProbeMarker.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(podProbeMarker).
Do(ctx).
Into(result)
return
}
// Delete takes name of the podProbeMarker and deletes it. Returns an error if one occurs.
func (c *podProbeMarkers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("podprobemarkers").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *podProbeMarkers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("podprobemarkers").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched podProbeMarker.
func (c *podProbeMarkers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PodProbeMarker, err error) {
result = &v1alpha1.PodProbeMarker{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("podprobemarkers").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -19,6 +19,8 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"net/http"
v1beta1 "github.com/openkruise/kruise-api/apps/v1beta1" v1beta1 "github.com/openkruise/kruise-api/apps/v1beta1"
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme" "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
@ -39,12 +41,28 @@ func (c *AppsV1beta1Client) StatefulSets(namespace string) StatefulSetInterface
} }
// NewForConfig creates a new AppsV1beta1Client for the given config. // NewForConfig creates a new AppsV1beta1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*AppsV1beta1Client, error) { func NewForConfig(c *rest.Config) (*AppsV1beta1Client, error) {
config := *c config := *c
if err := setConfigDefaults(&config); err != nil { if err := setConfigDefaults(&config); err != nil {
return nil, err return nil, err
} }
client, err := rest.RESTClientFor(&config) httpClient, err := rest.HTTPClientFor(&config)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new AppsV1beta1Client for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AppsV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientForConfigAndClient(&config, h)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeStatefulSets struct {
ns string ns string
} }
var statefulsetsResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1beta1", Resource: "statefulsets"} var statefulsetsResource = v1beta1.SchemeGroupVersion.WithResource("statefulsets")
var statefulsetsKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1beta1", Kind: "StatefulSet"} var statefulsetsKind = v1beta1.SchemeGroupVersion.WithKind("StatefulSet")
// Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any. // Get takes name of the statefulSet, and returns the corresponding statefulSet object, and an error if there is any.
func (c *FakeStatefulSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.StatefulSet, err error) { func (c *FakeStatefulSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.StatefulSet, err error) {
@ -118,7 +117,7 @@ func (c *FakeStatefulSets) UpdateStatus(ctx context.Context, statefulSet *v1beta
// Delete takes name of the statefulSet and deletes it. Returns an error if one occurs. // Delete takes name of the statefulSet and deletes it. Returns an error if one occurs.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1beta1.StatefulSet{}) Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1beta1.StatefulSet{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels" labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types" types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch" watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakePodUnavailableBudgets struct {
ns string ns string
} }
var podunavailablebudgetsResource = schema.GroupVersionResource{Group: "policy.kruise.io", Version: "v1alpha1", Resource: "podunavailablebudgets"} var podunavailablebudgetsResource = v1alpha1.SchemeGroupVersion.WithResource("podunavailablebudgets")
var podunavailablebudgetsKind = schema.GroupVersionKind{Group: "policy.kruise.io", Version: "v1alpha1", Kind: "PodUnavailableBudget"} var podunavailablebudgetsKind = v1alpha1.SchemeGroupVersion.WithKind("PodUnavailableBudget")
// Get takes name of the podUnavailableBudget, and returns the corresponding podUnavailableBudget object, and an error if there is any. // Get takes name of the podUnavailableBudget, and returns the corresponding podUnavailableBudget object, and an error if there is any.
func (c *FakePodUnavailableBudgets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodUnavailableBudget, err error) { func (c *FakePodUnavailableBudgets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodUnavailableBudget, err error) {
@ -117,7 +116,7 @@ func (c *FakePodUnavailableBudgets) UpdateStatus(ctx context.Context, podUnavail
// Delete takes name of the podUnavailableBudget and deletes it. Returns an error if one occurs. // Delete takes name of the podUnavailableBudget and deletes it. Returns an error if one occurs.
func (c *FakePodUnavailableBudgets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { func (c *FakePodUnavailableBudgets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(testing.NewDeleteAction(podunavailablebudgetsResource, c.ns, name), &v1alpha1.PodUnavailableBudget{}) Invokes(testing.NewDeleteActionWithOptions(podunavailablebudgetsResource, c.ns, name, opts), &v1alpha1.PodUnavailableBudget{})
return err return err
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 The Kruise Authors. Copyright 2024 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -19,6 +19,8 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
"net/http"
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme" "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1" v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
@ -39,12 +41,28 @@ func (c *PolicyV1alpha1Client) PodUnavailableBudgets(namespace string) PodUnavai
} }
// NewForConfig creates a new PolicyV1alpha1Client for the given config. // NewForConfig creates a new PolicyV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*PolicyV1alpha1Client, error) { func NewForConfig(c *rest.Config) (*PolicyV1alpha1Client, error) {
config := *c config := *c
if err := setConfigDefaults(&config); err != nil { if err := setConfigDefaults(&config); err != nil {
return nil, err return nil, err
} }
client, err := rest.RESTClientFor(&config) httpClient, err := rest.HTTPClientFor(&config)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new PolicyV1alpha1Client for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*PolicyV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientForConfigAndClient(&config, h)
if err != nil { if err != nil {
return nil, err return nil, err
} }

Some files were not shown because too many files have changed in this diff Show More