Compare commits

..

7 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
186 changed files with 28455 additions and 33028 deletions

View File

@ -12,15 +12,15 @@ vet:
# Generate code
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
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
ifeq ("$(shell $(CONTROLLER_GEN) --version 2> /dev/null)", "Version: v0.7.0")
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.7.0)
$(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
@ -52,32 +52,8 @@ gen-schema-only:
go run cmd/gen-schema/main.go
.PHONY: gen-openapi-schema
gen-openapi-schema: gen-all-openapi gen-kruise-openapi gen-rollouts-openapi
gen-openapi-schema: gen-all-openapi
go run cmd/gen-schema/main.go
.PHONY: gen-all-openapi
gen-all-openapi: openapi-gen
$(OPENAPI_GEN) \
--go-header-file ./hack/boilerplate.go.txt \
--input-dirs github.com/openkruise/kruise-api/apps/v1alpha1,github.com/openkruise/kruise-api/apps/pub,github.com/openkruise/kruise-api/apps/v1beta1,github.com/openkruise/kruise-api/policy/v1alpha1,github.com/openkruise/kruise-api/rollouts/v1alpha1,k8s.io/api/admission/v1,k8s.io/api/admissionregistration/v1,k8s.io/api/admissionregistration/v1beta1,k8s.io/api/authentication/v1,k8s.io/api/apps/v1,k8s.io/api/apps/v1beta1,k8s.io/api/apps/v1beta2,k8s.io/api/autoscaling/v1,k8s.io/api/batch/v1,k8s.io/api/batch/v1beta1,k8s.io/api/certificates/v1beta1,k8s.io/api/certificates/v1,k8s.io/api/core/v1,k8s.io/api/extensions/v1beta1,k8s.io/api/networking/v1,k8s.io/api/networking/v1beta1,k8s.io/api/policy/v1,k8s.io/api/policy/v1beta1,k8s.io/api/rbac/v1,k8s.io/api/rbac/v1alpha1,k8s.io/api/storage/v1,k8s.io/api/storage/v1alpha1,k8s.io/api/storage/v1beta1 \
--output-package ./pkg/apis \
--report-filename ./pkg/apis/violation_exceptions.list \
-o $(CURRENT_DIR)
.PHONY: gen-kruise-openapi
gen-kruise-openapi: openapi-gen
$(OPENAPI_GEN) \
--go-header-file hack/boilerplate.go.txt \
--input-dirs github.com/openkruise/kruise-api/apps/v1alpha1,github.com/openkruise/kruise-api/apps/pub,github.com/openkruise/kruise-api/apps/v1beta1,github.com/openkruise/kruise-api/policy/v1alpha1 \
--output-package pkg/kruise/ \
--report-filename pkg/kruise/violation_exceptions.list \
-o $(CURRENT_DIR)
.PHONY: gen-rollouts-openapi
gen-rollouts-openapi: openapi-gen
$(OPENAPI_GEN) \
--go-header-file hack/boilerplate.go.txt \
--input-dirs github.com/openkruise/kruise-api/rollouts/v1alpha1 \
--output-package pkg/rollouts/ \
--report-filename pkg/rollouts/violation_exceptions.list \
-o $(CURRENT_DIR)
@hack/generate_openapi.sh

View File

@ -4,22 +4,44 @@ Schema of the API types that are served by Kruise.
## 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.
## 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 |
|------------------------------------|----------------------------|----------------------------|
| < 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) |
## Versioning
For each `v1.x.y` Kruise release, the corresponding kruise-api will `v1.x.z`.
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?
`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.
### 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
[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");
you may not use this file except in compliance with the License.

View File

@ -1,26 +0,0 @@
/*
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 apis
import (
"github.com/openkruise/kruise-api/rollouts/v1alpha1"
)
func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
}

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

@ -62,12 +62,21 @@ type InPlaceUpdateState struct {
// UpdateEnvFromMetadata indicates there are envs from annotations/labels that should be in-place update.
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 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 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 *InPlaceUpdatePreCheckBeforeNext `json:"preCheckBeforeNext,omitempty"`
@ -140,6 +149,10 @@ type RuntimeContainerHashes struct {
// 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.
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],
// whose envs from annotations/labels have already been extracted to the real values.
ExtractedEnvFromMetadataHash uint64 `json:"extractedEnvFromMetadataHash,omitempty"`

View File

@ -29,4 +29,8 @@ const (
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

@ -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

@ -1,8 +1,7 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2022 The Kruise Authors.
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.
@ -22,6 +21,7 @@ limitations under the License.
package pub
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -106,6 +106,13 @@ func (in *InPlaceUpdateState) DeepCopyInto(out *InPlaceUpdateState) {
(*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 {
in, out := &in.PreCheckBeforeNext, &out.PreCheckBeforeNext
*out = new(InPlaceUpdatePreCheckBeforeNext)

View File

@ -17,10 +17,11 @@ limitations under the License.
package v1alpha1
import (
appspub "github.com/openkruise/kruise-api/apps/pub"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
appspub "github.com/openkruise/kruise-api/apps/pub"
)
const (
@ -178,6 +179,8 @@ type CloneSetStatus struct {
// 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.
@ -237,6 +240,7 @@ type CloneSetCondition struct {
// +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_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="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."

View File

@ -17,11 +17,12 @@ limitations under the License.
package v1alpha1
import (
appspub "github.com/openkruise/kruise-api/apps/pub"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"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.
@ -91,7 +92,7 @@ type RollingUpdateDaemonSet struct {
// 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
// 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
// daemonset on any given node can double if the readiness check fails, and
// so resource intensive daemonsets should take into account that they may

View File

@ -20,8 +20,8 @@ limitations under the License.
package v1alpha1
import (
"github.com/openkruise/kruise-api/utils/scheme"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/openkruise/kruise-api/utils/scheme"
)
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,6 +27,17 @@ const (
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
type ImagePullJobSpec struct {
// Image is the image to be pulled by the job
@ -69,6 +80,11 @@ type ImagePullJobTemplate struct {
// 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

View File

@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -32,6 +33,8 @@ type PodProbe struct {
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"`
}
@ -85,6 +88,17 @@ const (
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

View File

@ -80,6 +80,11 @@ type ImageTagSpec struct {
// Value must be treated as opaque by clients and .
// +optional
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

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,31 @@ import (
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

View File

@ -216,7 +216,8 @@ type SidecarSetInjectRevision struct {
// + optional
RevisionName *string `json:"revisionName,omitempty"`
// Policy describes the behavior of revision injection.
// Defaults to Always.
// +kubebuilder:validation:Enum=Always;Partial;
// +kubebuilder:default=Always
Policy SidecarSetInjectRevisionPolicy `json:"policy,omitempty"`
}
@ -226,9 +227,15 @@ const (
// AlwaysSidecarSetInjectRevisionPolicy means the SidecarSet will always inject
// the specific revision to Pods when pod creating, except matching UpdateStrategy.Selector.
AlwaysSidecarSetInjectRevisionPolicy SidecarSetInjectRevisionPolicy = "Always"
// PartitionBasedSidecarSetInjectRevisionPolicy means the SidecarSet will inject the
// specific or the latest revision according to Partition.
//PartitionBasedSidecarSetInjectRevisionPolicy SidecarSetInjectRevisionPolicy = "PartitionBased"
// 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
@ -242,11 +249,15 @@ type SidecarSetUpdateStrategy struct {
Type SidecarSetUpdateStrategyType `json:"type,omitempty"`
// 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.
// default is false
// For the impact on the injection behavior for newly created Pods, please refer to the comments of Selector.
Paused bool `json:"paused,omitempty"`
// 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"`
// Partition is the desired number of pods in old revisions. It means when partition

View File

@ -17,13 +17,14 @@ limitations under the License.
package v1alpha1
import (
"time"
"github.com/openkruise/kruise-api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
"github.com/openkruise/kruise-api/apps/v1beta1"
)
// UpdateStrategyType is a string enumeration type that enumerates
@ -165,6 +166,10 @@ type Topology struct {
// +patchStrategy=merge
// +optional
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.
@ -189,8 +194,26 @@ type Subset struct {
// 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.
// 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
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
@ -200,6 +223,69 @@ type Subset struct {
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.
type UnitedDeploymentStatus struct {
// ObservedGeneration is the most recent generation observed for this UnitedDeployment. It corresponds to the
@ -234,6 +320,8 @@ type UnitedDeploymentStatus struct {
// +optional
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.
// +optional
Conditions []UnitedDeploymentCondition `json:"conditions,omitempty"`
@ -246,6 +334,23 @@ type UnitedDeploymentStatus struct {
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.
type UnitedDeploymentCondition struct {
// Type of in place set condition.
@ -260,7 +365,7 @@ type UnitedDeploymentCondition struct {
// The reason for the condition's last transition.
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"`
}
@ -275,6 +380,62 @@ type UpdateStatus struct {
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: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

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

@ -28,6 +28,11 @@ type WorkloadSpreadSpec struct {
// TargetReference is the target workload that WorkloadSpread want to control.
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.
// +patchMergeKey=name
// +patchStrategy=merge
@ -48,6 +53,58 @@ type TargetReference struct {
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
// all possible schedule strategies for the WorkloadSpread controller.
// +kubebuilder:validation:Enum=Adaptive;Fixed;""
@ -130,6 +187,11 @@ type WorkloadSpreadStatus struct {
// Contains the status of each subset. Each element in this array represents one subset
// +optional
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

View File

@ -1,8 +1,7 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2022 The Kruise Authors.
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.
@ -31,6 +30,31 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AdaptiveUnitedDeploymentStrategy) DeepCopyInto(out *AdaptiveUnitedDeploymentStrategy) {
*out = *in
if in.RescheduleCriticalSeconds != nil {
in, out := &in.RescheduleCriticalSeconds, &out.RescheduleCriticalSeconds
*out = new(int32)
**out = **in
}
if in.UnschedulableLastSeconds != nil {
in, out := &in.UnschedulableLastSeconds, &out.UnschedulableLastSeconds
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptiveUnitedDeploymentStrategy.
func (in *AdaptiveUnitedDeploymentStrategy) DeepCopy() *AdaptiveUnitedDeploymentStrategy {
if in == nil {
return nil
}
out := new(AdaptiveUnitedDeploymentStrategy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AdaptiveWorkloadSpreadStrategy) DeepCopyInto(out *AdaptiveWorkloadSpreadStrategy) {
*out = *in
@ -1203,6 +1227,21 @@ func (in *EphemeralJobStatus) DeepCopy() *EphemeralJobStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FailedImageStatus) DeepCopyInto(out *FailedImageStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FailedImageStatus.
func (in *FailedImageStatus) DeepCopy() *FailedImageStatus {
if in == nil {
return nil
}
out := new(FailedImageStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FailurePolicy) DeepCopyInto(out *FailurePolicy) {
*out = *in
@ -1218,6 +1257,120 @@ func (in *FailurePolicy) DeepCopy() *FailurePolicy {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageListPullJob) DeepCopyInto(out *ImageListPullJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageListPullJob.
func (in *ImageListPullJob) DeepCopy() *ImageListPullJob {
if in == nil {
return nil
}
out := new(ImageListPullJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ImageListPullJob) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageListPullJobList) DeepCopyInto(out *ImageListPullJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ImageListPullJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageListPullJobList.
func (in *ImageListPullJobList) DeepCopy() *ImageListPullJobList {
if in == nil {
return nil
}
out := new(ImageListPullJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ImageListPullJobList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageListPullJobSpec) DeepCopyInto(out *ImageListPullJobSpec) {
*out = *in
if in.Images != nil {
in, out := &in.Images, &out.Images
*out = make([]string, len(*in))
copy(*out, *in)
}
in.ImagePullJobTemplate.DeepCopyInto(&out.ImagePullJobTemplate)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageListPullJobSpec.
func (in *ImageListPullJobSpec) DeepCopy() *ImageListPullJobSpec {
if in == nil {
return nil
}
out := new(ImageListPullJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageListPullJobStatus) DeepCopyInto(out *ImageListPullJobStatus) {
*out = *in
if in.StartTime != nil {
in, out := &in.StartTime, &out.StartTime
*out = (*in).DeepCopy()
}
if in.CompletionTime != nil {
in, out := &in.CompletionTime, &out.CompletionTime
*out = (*in).DeepCopy()
}
if in.FailedImageStatuses != nil {
in, out := &in.FailedImageStatuses, &out.FailedImageStatuses
*out = make([]*FailedImageStatus, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(FailedImageStatus)
**out = **in
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageListPullJobStatus.
func (in *ImageListPullJobStatus) DeepCopy() *ImageListPullJobStatus {
if in == nil {
return nil
}
out := new(ImageListPullJobStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImagePullJob) DeepCopyInto(out *ImagePullJob) {
*out = *in
@ -3041,6 +3194,16 @@ func (in *Subset) DeepCopyInto(out *Subset) {
*out = new(intstr.IntOrString)
**out = **in
}
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(intstr.IntOrString)
**out = **in
}
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(intstr.IntOrString)
**out = **in
}
in.Patch.DeepCopyInto(&out.Patch)
}
@ -3105,6 +3268,31 @@ func (in *SyncStatus) DeepCopy() *SyncStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TargetFilter) DeepCopyInto(out *TargetFilter) {
*out = *in
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
if in.ReplicasPathList != nil {
in, out := &in.ReplicasPathList, &out.ReplicasPathList
*out = make([]string, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetFilter.
func (in *TargetFilter) DeepCopy() *TargetFilter {
if in == nil {
return nil
}
out := new(TargetFilter)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TargetReference) DeepCopyInto(out *TargetReference) {
*out = *in
@ -3130,6 +3318,7 @@ func (in *Topology) DeepCopyInto(out *Topology) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
in.ScheduleStrategy.DeepCopyInto(&out.ScheduleStrategy)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topology.
@ -3242,6 +3431,26 @@ func (in *UnitedDeploymentList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UnitedDeploymentScheduleStrategy) DeepCopyInto(out *UnitedDeploymentScheduleStrategy) {
*out = *in
if in.Adaptive != nil {
in, out := &in.Adaptive, &out.Adaptive
*out = new(AdaptiveUnitedDeploymentStrategy)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnitedDeploymentScheduleStrategy.
func (in *UnitedDeploymentScheduleStrategy) DeepCopy() *UnitedDeploymentScheduleStrategy {
if in == nil {
return nil
}
out := new(UnitedDeploymentScheduleStrategy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UnitedDeploymentSpec) DeepCopyInto(out *UnitedDeploymentSpec) {
*out = *in
@ -3290,6 +3499,13 @@ func (in *UnitedDeploymentStatus) DeepCopyInto(out *UnitedDeploymentStatus) {
(*out)[key] = val
}
}
if in.SubsetStatuses != nil {
in, out := &in.SubsetStatuses, &out.SubsetStatuses
*out = make([]UnitedDeploymentSubsetStatus, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]UnitedDeploymentCondition, len(*in))
@ -3314,6 +3530,44 @@ func (in *UnitedDeploymentStatus) DeepCopy() *UnitedDeploymentStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UnitedDeploymentSubsetCondition) DeepCopyInto(out *UnitedDeploymentSubsetCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnitedDeploymentSubsetCondition.
func (in *UnitedDeploymentSubsetCondition) DeepCopy() *UnitedDeploymentSubsetCondition {
if in == nil {
return nil
}
out := new(UnitedDeploymentSubsetCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UnitedDeploymentSubsetStatus) DeepCopyInto(out *UnitedDeploymentSubsetStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]UnitedDeploymentSubsetCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnitedDeploymentSubsetStatus.
func (in *UnitedDeploymentSubsetStatus) DeepCopy() *UnitedDeploymentSubsetStatus {
if in == nil {
return nil
}
out := new(UnitedDeploymentSubsetStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UnitedDeploymentUpdateStrategy) DeepCopyInto(out *UnitedDeploymentUpdateStrategy) {
*out = *in
@ -3354,64 +3608,6 @@ func (in *UnorderedUpdateStrategy) DeepCopy() *UnorderedUpdateStrategy {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UpdatePriorityOrderTerm) DeepCopyInto(out *UpdatePriorityOrderTerm) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdatePriorityOrderTerm.
func (in *UpdatePriorityOrderTerm) DeepCopy() *UpdatePriorityOrderTerm {
if in == nil {
return nil
}
out := new(UpdatePriorityOrderTerm)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UpdatePriorityStrategy) DeepCopyInto(out *UpdatePriorityStrategy) {
*out = *in
if in.OrderPriority != nil {
in, out := &in.OrderPriority, &out.OrderPriority
*out = make([]UpdatePriorityOrderTerm, len(*in))
copy(*out, *in)
}
if in.WeightPriority != nil {
in, out := &in.WeightPriority, &out.WeightPriority
*out = make([]UpdatePriorityWeightTerm, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdatePriorityStrategy.
func (in *UpdatePriorityStrategy) DeepCopy() *UpdatePriorityStrategy {
if in == nil {
return nil
}
out := new(UpdatePriorityStrategy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UpdatePriorityWeightTerm) DeepCopyInto(out *UpdatePriorityWeightTerm) {
*out = *in
in.MatchSelector.DeepCopyInto(&out.MatchSelector)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdatePriorityWeightTerm.
func (in *UpdatePriorityWeightTerm) DeepCopy() *UpdatePriorityWeightTerm {
if in == nil {
return nil
}
out := new(UpdatePriorityWeightTerm)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in UpdateScatterStrategy) DeepCopyInto(out *UpdateScatterStrategy) {
{
@ -3555,6 +3751,11 @@ func (in *WorkloadSpreadSpec) DeepCopyInto(out *WorkloadSpreadSpec) {
*out = new(TargetReference)
**out = **in
}
if in.TargetFilter != nil {
in, out := &in.TargetFilter, &out.TargetFilter
*out = new(TargetFilter)
(*in).DeepCopyInto(*out)
}
if in.Subsets != nil {
in, out := &in.Subsets, &out.Subsets
*out = make([]WorkloadSpreadSubset, len(*in))
@ -3585,6 +3786,24 @@ func (in *WorkloadSpreadStatus) DeepCopyInto(out *WorkloadSpreadStatus) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.VersionedSubsetStatuses != nil {
in, out := &in.VersionedSubsetStatuses, &out.VersionedSubsetStatuses
*out = make(map[string][]WorkloadSpreadSubsetStatus, len(*in))
for key, val := range *in {
var outVal []WorkloadSpreadSubsetStatus
if val == nil {
(*out)[key] = nil
} else {
inVal := (*in)[key]
in, out := &inVal, &outVal
*out = make([]WorkloadSpreadSubsetStatus, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
(*out)[key] = outVal
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpreadStatus.

View File

@ -20,8 +20,8 @@ limitations under the License.
package v1beta1
import (
"github.com/openkruise/kruise-api/utils/scheme"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/openkruise/kruise-api/utils/scheme"
)
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
)
// 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
// controller will use to perform updates. It includes any additional parameters
// necessary to perform the update for the indicated strategy.
@ -42,11 +75,18 @@ type StatefulSetUpdateStrategy struct {
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.
type RollingUpdateStatefulSetStrategy struct {
// Partition indicates the ordinal at which 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.
// Partition indicates the number of pods the StatefulSet should be partitioned by default.
// - It means controller will update $(replicas - partition) number of pod.
// Default value is 0.
// +optional
@ -128,7 +168,7 @@ const (
)
// StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs
// created from the StatefulSet VolumeClaimTemplates.
// created from the StatefulSet VolumeClaims.
type StatefulSetPersistentVolumeClaimRetentionPolicy struct {
// WhenDeleted specifies what happens to PVCs created from StatefulSet
// VolumeClaimTemplates when the StatefulSet is deleted. The default policy
@ -143,6 +183,21 @@ type StatefulSetPersistentVolumeClaimRetentionPolicy struct {
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
type StatefulSetSpec struct {
// replicas is the desired number of replicas of the given Template.
@ -178,6 +233,11 @@ type StatefulSetSpec struct {
// +kubebuilder:validation:Schemaless
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.
// This service must exist before the StatefulSet, and is responsible for
// 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])
// - 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])
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 *appspub.Lifecycle `json:"lifecycle,omitempty"`
@ -228,6 +289,14 @@ type StatefulSetSpec struct {
// StatefulSetAutoDeletePVC feature gate to be enabled, which is alpha.
// +optional
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.
@ -293,6 +362,12 @@ type StatefulSetStatus struct {
// LabelSelector is label selectors for query over pods that should match the replica count used by HPA.
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.

View File

@ -1,8 +1,7 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2022 The Kruise Authors.
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.
@ -129,6 +128,21 @@ func (in *StatefulSetList) DeepCopyObject() runtime.Object {
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.
func (in *StatefulSetPersistentVolumeClaimRetentionPolicy) DeepCopyInto(out *StatefulSetPersistentVolumeClaimRetentionPolicy) {
*out = *in
@ -185,6 +199,7 @@ func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
out.VolumeClaimUpdateStrategy = in.VolumeClaimUpdateStrategy
in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy)
if in.RevisionHistoryLimit != nil {
in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit
@ -193,7 +208,7 @@ func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
}
if in.ReserveOrdinals != nil {
in, out := &in.ReserveOrdinals, &out.ReserveOrdinals
*out = make([]int, len(*in))
*out = make([]intstr.IntOrString, len(*in))
copy(*out, *in)
}
if in.Lifecycle != nil {
@ -211,6 +226,11 @@ func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
*out = new(StatefulSetPersistentVolumeClaimRetentionPolicy)
**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.
@ -238,6 +258,11 @@ func (in *StatefulSetStatus) DeepCopyInto(out *StatefulSetStatus) {
(*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.
@ -289,3 +314,33 @@ func (in *UnorderedUpdateStrategy) DeepCopy() *UnorderedUpdateStrategy {
in.DeepCopyInto(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 2022 The Kruise Authors.
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.
@ -20,11 +20,11 @@ package versioned
import (
"fmt"
"net/http"
appsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1"
policyv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/policy/v1alpha1"
rolloutsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/rollouts/v1alpha1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
@ -35,17 +35,14 @@ type Interface interface {
AppsV1alpha1() appsv1alpha1.AppsV1alpha1Interface
AppsV1beta1() appsv1beta1.AppsV1beta1Interface
PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface
RolloutsV1alpha1() rolloutsv1alpha1.RolloutsV1alpha1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
// Clientset contains the clients for groups.
type Clientset struct {
*discovery.DiscoveryClient
appsV1alpha1 *appsv1alpha1.AppsV1alpha1Client
appsV1beta1 *appsv1beta1.AppsV1beta1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
rolloutsV1alpha1 *rolloutsv1alpha1.RolloutsV1alpha1Client
appsV1alpha1 *appsv1alpha1.AppsV1alpha1Client
appsV1beta1 *appsv1beta1.AppsV1beta1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
}
// AppsV1alpha1 retrieves the AppsV1alpha1Client
@ -63,11 +60,6 @@ func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return c.policyV1alpha1
}
// RolloutsV1alpha1 retrieves the RolloutsV1alpha1Client
func (c *Clientset) RolloutsV1alpha1() rolloutsv1alpha1.RolloutsV1alpha1Interface {
return c.rolloutsV1alpha1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
@ -79,34 +71,53 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
// NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.UserAgent == "" {
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
}
// share the transport between all clients
httpClient, err := rest.HTTPClientFor(&configShallowCopy)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&configShallowCopy, httpClient)
}
// NewForConfigAndClient creates a new Clientset for the given config and http client.
// Note the http client provided takes precedence over the configured transport values.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.appsV1alpha1, err = appsv1alpha1.NewForConfig(&configShallowCopy)
cs.appsV1alpha1, err = appsv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.appsV1beta1, err = appsv1beta1.NewForConfig(&configShallowCopy)
cs.appsV1beta1, err = appsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.policyV1alpha1, err = policyv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.rolloutsV1alpha1, err = rolloutsv1alpha1.NewForConfig(&configShallowCopy)
cs.policyV1alpha1, err = policyv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
@ -116,14 +127,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.appsV1alpha1 = appsv1alpha1.NewForConfigOrDie(c)
cs.appsV1beta1 = appsv1beta1.NewForConfigOrDie(c)
cs.policyV1alpha1 = policyv1alpha1.NewForConfigOrDie(c)
cs.rolloutsV1alpha1 = rolloutsv1alpha1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
cs, err := NewForConfig(c)
if err != nil {
panic(err)
}
return cs
}
// New creates a new Clientset for the given RESTClient.
@ -132,7 +140,6 @@ func New(c rest.Interface) *Clientset {
cs.appsV1alpha1 = appsv1alpha1.New(c)
cs.appsV1beta1 = appsv1beta1.New(c)
cs.policyV1alpha1 = policyv1alpha1.New(c)
cs.rolloutsV1alpha1 = rolloutsv1alpha1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs

View File

@ -1,20 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated clientset.
package versioned

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -26,8 +26,6 @@ import (
fakeappsv1beta1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/apps/v1beta1/fake"
policyv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/policy/v1alpha1"
fakepolicyv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/policy/v1alpha1/fake"
rolloutsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/rollouts/v1alpha1"
fakerolloutsv1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/rollouts/v1alpha1/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
@ -99,8 +97,3 @@ func (c *Clientset) AppsV1beta1() appsv1beta1.AppsV1beta1Interface {
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return &fakepolicyv1alpha1.FakePolicyV1alpha1{Fake: &c.Fake}
}
// RolloutsV1alpha1 retrieves the RolloutsV1alpha1Client
func (c *Clientset) RolloutsV1alpha1() rolloutsv1alpha1.RolloutsV1alpha1Interface {
return &fakerolloutsv1alpha1.FakeRolloutsV1alpha1{Fake: &c.Fake}
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -22,7 +22,6 @@ import (
appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise-api/apps/v1beta1"
policyv1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1"
rolloutsv1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -37,7 +36,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{
appsv1alpha1.AddToScheme,
appsv1beta1.AddToScheme,
policyv1alpha1.AddToScheme,
rolloutsv1alpha1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -22,7 +22,6 @@ import (
appsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
appsv1beta1 "github.com/openkruise/kruise-api/apps/v1beta1"
policyv1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1"
rolloutsv1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
@ -37,7 +36,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{
appsv1alpha1.AddToScheme,
appsv1beta1.AddToScheme,
policyv1alpha1.AddToScheme,
rolloutsv1alpha1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -19,6 +19,8 @@ limitations under the License.
package v1alpha1
import (
"net/http"
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
@ -32,6 +34,7 @@ type AppsV1alpha1Interface interface {
ContainerRecreateRequestsGetter
DaemonSetsGetter
EphemeralJobsGetter
ImageListPullJobsGetter
ImagePullJobsGetter
NodeImagesGetter
NodePodProbesGetter
@ -73,6 +76,10 @@ func (c *AppsV1alpha1Client) EphemeralJobs(namespace string) EphemeralJobInterfa
return newEphemeralJobs(c, namespace)
}
func (c *AppsV1alpha1Client) ImageListPullJobs(namespace string) ImageListPullJobInterface {
return newImageListPullJobs(c, namespace)
}
func (c *AppsV1alpha1Client) ImagePullJobs(namespace string) ImagePullJobInterface {
return newImagePullJobs(c, namespace)
}
@ -114,12 +121,28 @@ func (c *AppsV1alpha1Client) WorkloadSpreads(namespace string) WorkloadSpreadInt
}
// 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) {
config := *c
if err := setConfigDefaults(&config); err != nil {
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 {
return nil, err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeAdvancedCronJobs struct {
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.
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.
func (c *FakeAdvancedCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(advancedcronjobsResource, c.ns, name), &v1alpha1.AdvancedCronJob{})
Invokes(testing.NewDeleteActionWithOptions(advancedcronjobsResource, c.ns, name, opts), &v1alpha1.AdvancedCronJob{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -52,6 +52,10 @@ func (c *FakeAppsV1alpha1) EphemeralJobs(namespace string) v1alpha1.EphemeralJob
return &FakeEphemeralJobs{c, namespace}
}
func (c *FakeAppsV1alpha1) ImageListPullJobs(namespace string) v1alpha1.ImageListPullJobInterface {
return &FakeImageListPullJobs{c, namespace}
}
func (c *FakeAppsV1alpha1) ImagePullJobs(namespace string) v1alpha1.ImagePullJobInterface {
return &FakeImagePullJobs{c, namespace}
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeBroadcastJobs struct {
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.
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.
func (c *FakeBroadcastJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(broadcastjobsResource, c.ns, name), &v1alpha1.BroadcastJob{})
Invokes(testing.NewDeleteActionWithOptions(broadcastjobsResource, c.ns, name, opts), &v1alpha1.BroadcastJob{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeCloneSets struct {
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.
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.
func (c *FakeCloneSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clonesetsResource, c.ns, name), &v1alpha1.CloneSet{})
Invokes(testing.NewDeleteActionWithOptions(clonesetsResource, c.ns, name, opts), &v1alpha1.CloneSet{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeContainerRecreateRequests struct {
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.
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.
func (c *FakeContainerRecreateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(containerrecreaterequestsResource, c.ns, name), &v1alpha1.ContainerRecreateRequest{})
Invokes(testing.NewDeleteActionWithOptions(containerrecreaterequestsResource, c.ns, name, opts), &v1alpha1.ContainerRecreateRequest{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeDaemonSets struct {
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.
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.
func (c *FakeDaemonSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(daemonsetsResource, c.ns, name), &v1alpha1.DaemonSet{})
Invokes(testing.NewDeleteActionWithOptions(daemonsetsResource, c.ns, name, opts), &v1alpha1.DaemonSet{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeEphemeralJobs struct {
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.
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.
func (c *FakeEphemeralJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(ephemeraljobsResource, c.ns, name), &v1alpha1.EphemeralJob{})
Invokes(testing.NewDeleteActionWithOptions(ephemeraljobsResource, c.ns, name, opts), &v1alpha1.EphemeralJob{})
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 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeImagePullJobs struct {
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.
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.
func (c *FakeImagePullJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(imagepulljobsResource, c.ns, name), &v1alpha1.ImagePullJob{})
Invokes(testing.NewDeleteActionWithOptions(imagepulljobsResource, c.ns, name, opts), &v1alpha1.ImagePullJob{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeNodeImages struct {
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.
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.
func (c *FakeNodeImages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(nodeimagesResource, name), &v1alpha1.NodeImage{})
Invokes(testing.NewRootDeleteActionWithOptions(nodeimagesResource, name, opts), &v1alpha1.NodeImage{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeNodePodProbes struct {
Fake *FakeAppsV1alpha1
}
var nodepodprobesResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "nodepodprobes"}
var nodepodprobesResource = v1alpha1.SchemeGroupVersion.WithResource("nodepodprobes")
var nodepodprobesKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "NodePodProbe"}
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) {
@ -110,7 +109,7 @@ func (c *FakeNodePodProbes) UpdateStatus(ctx context.Context, nodePodProbe *v1al
// 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.NewRootDeleteAction(nodepodprobesResource, name), &v1alpha1.NodePodProbe{})
Invokes(testing.NewRootDeleteActionWithOptions(nodepodprobesResource, name, opts), &v1alpha1.NodePodProbe{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakePersistentPodStates struct {
ns string
}
var persistentpodstatesResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "persistentpodstates"}
var persistentpodstatesResource = v1alpha1.SchemeGroupVersion.WithResource("persistentpodstates")
var persistentpodstatesKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "PersistentPodState"}
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) {
@ -117,7 +116,7 @@ func (c *FakePersistentPodStates) UpdateStatus(ctx context.Context, persistentPo
// 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.NewDeleteAction(persistentpodstatesResource, c.ns, name), &v1alpha1.PersistentPodState{})
Invokes(testing.NewDeleteActionWithOptions(persistentpodstatesResource, c.ns, name, opts), &v1alpha1.PersistentPodState{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakePodProbeMarkers struct {
ns string
}
var podprobemarkersResource = schema.GroupVersionResource{Group: "apps.kruise.io", Version: "v1alpha1", Resource: "podprobemarkers"}
var podprobemarkersResource = v1alpha1.SchemeGroupVersion.WithResource("podprobemarkers")
var podprobemarkersKind = schema.GroupVersionKind{Group: "apps.kruise.io", Version: "v1alpha1", Kind: "PodProbeMarker"}
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) {
@ -117,7 +116,7 @@ func (c *FakePodProbeMarkers) UpdateStatus(ctx context.Context, podProbeMarker *
// 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.NewDeleteAction(podprobemarkersResource, c.ns, name), &v1alpha1.PodProbeMarker{})
Invokes(testing.NewDeleteActionWithOptions(podprobemarkersResource, c.ns, name, opts), &v1alpha1.PodProbeMarker{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeResourceDistributions struct {
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.
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.
func (c *FakeResourceDistributions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(resourcedistributionsResource, name), &v1alpha1.ResourceDistribution{})
Invokes(testing.NewRootDeleteActionWithOptions(resourcedistributionsResource, name, opts), &v1alpha1.ResourceDistribution{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -35,9 +34,9 @@ type FakeSidecarSets struct {
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.
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.
func (c *FakeSidecarSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(sidecarsetsResource, name), &v1alpha1.SidecarSet{})
Invokes(testing.NewRootDeleteActionWithOptions(sidecarsetsResource, name, opts), &v1alpha1.SidecarSet{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeStatefulSets struct {
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.
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.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1alpha1.StatefulSet{})
Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1alpha1.StatefulSet{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeUnitedDeployments struct {
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.
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.
func (c *FakeUnitedDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(uniteddeploymentsResource, c.ns, name), &v1alpha1.UnitedDeployment{})
Invokes(testing.NewDeleteActionWithOptions(uniteddeploymentsResource, c.ns, name, opts), &v1alpha1.UnitedDeployment{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeWorkloadSpreads struct {
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.
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.
func (c *FakeWorkloadSpreads) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(workloadspreadsResource, c.ns, name), &v1alpha1.WorkloadSpread{})
Invokes(testing.NewDeleteActionWithOptions(workloadspreadsResource, c.ns, name, opts), &v1alpha1.WorkloadSpread{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -30,6 +30,8 @@ type DaemonSetExpansion interface{}
type EphemeralJobExpansion interface{}
type ImageListPullJobExpansion interface{}
type ImagePullJobExpansion interface{}
type NodeImageExpansion 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 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -19,6 +19,8 @@ limitations under the License.
package v1beta1
import (
"net/http"
v1beta1 "github.com/openkruise/kruise-api/apps/v1beta1"
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
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 is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*AppsV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
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 {
return nil, err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -25,7 +25,6 @@ import (
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -37,9 +36,9 @@ type FakeStatefulSets struct {
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.
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.
func (c *FakeStatefulSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(statefulsetsResource, c.ns, name), &v1beta1.StatefulSet{})
Invokes(testing.NewDeleteActionWithOptions(statefulsetsResource, c.ns, name, opts), &v1beta1.StatefulSet{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -24,7 +24,6 @@ import (
v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakePodUnavailableBudgets struct {
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.
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.
func (c *FakePodUnavailableBudgets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(podunavailablebudgetsResource, c.ns, name), &v1alpha1.PodUnavailableBudget{})
Invokes(testing.NewDeleteActionWithOptions(podunavailablebudgetsResource, c.ns, name, opts), &v1alpha1.PodUnavailableBudget{})
return err
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.
@ -19,6 +19,8 @@ limitations under the License.
package v1alpha1
import (
"net/http"
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1alpha1 "github.com/openkruise/kruise-api/policy/v1alpha1"
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 is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*PolicyV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
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 {
return nil, err
}

View File

@ -1,195 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
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"
)
// BatchReleasesGetter has a method to return a BatchReleaseInterface.
// A group's client should implement this interface.
type BatchReleasesGetter interface {
BatchReleases(namespace string) BatchReleaseInterface
}
// BatchReleaseInterface has methods to work with BatchRelease resources.
type BatchReleaseInterface interface {
Create(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.CreateOptions) (*v1alpha1.BatchRelease, error)
Update(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (*v1alpha1.BatchRelease, error)
UpdateStatus(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (*v1alpha1.BatchRelease, 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.BatchRelease, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BatchReleaseList, 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.BatchRelease, err error)
BatchReleaseExpansion
}
// batchReleases implements BatchReleaseInterface
type batchReleases struct {
client rest.Interface
ns string
}
// newBatchReleases returns a BatchReleases
func newBatchReleases(c *RolloutsV1alpha1Client, namespace string) *batchReleases {
return &batchReleases{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the batchRelease, and returns the corresponding batchRelease object, and an error if there is any.
func (c *batchReleases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BatchRelease, err error) {
result = &v1alpha1.BatchRelease{}
err = c.client.Get().
Namespace(c.ns).
Resource("batchreleases").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of BatchReleases that match those selectors.
func (c *batchReleases) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BatchReleaseList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.BatchReleaseList{}
err = c.client.Get().
Namespace(c.ns).
Resource("batchreleases").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested batchReleases.
func (c *batchReleases) 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("batchreleases").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a batchRelease and creates it. Returns the server's representation of the batchRelease, and an error, if there is any.
func (c *batchReleases) Create(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.CreateOptions) (result *v1alpha1.BatchRelease, err error) {
result = &v1alpha1.BatchRelease{}
err = c.client.Post().
Namespace(c.ns).
Resource("batchreleases").
VersionedParams(&opts, scheme.ParameterCodec).
Body(batchRelease).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a batchRelease and updates it. Returns the server's representation of the batchRelease, and an error, if there is any.
func (c *batchReleases) Update(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (result *v1alpha1.BatchRelease, err error) {
result = &v1alpha1.BatchRelease{}
err = c.client.Put().
Namespace(c.ns).
Resource("batchreleases").
Name(batchRelease.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(batchRelease).
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 *batchReleases) UpdateStatus(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (result *v1alpha1.BatchRelease, err error) {
result = &v1alpha1.BatchRelease{}
err = c.client.Put().
Namespace(c.ns).
Resource("batchreleases").
Name(batchRelease.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(batchRelease).
Do(ctx).
Into(result)
return
}
// Delete takes name of the batchRelease and deletes it. Returns an error if one occurs.
func (c *batchReleases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("batchreleases").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *batchReleases) 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("batchreleases").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched batchRelease.
func (c *batchReleases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BatchRelease, err error) {
result = &v1alpha1.BatchRelease{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("batchreleases").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,20 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -1,20 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake

View File

@ -1,142 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeBatchReleases implements BatchReleaseInterface
type FakeBatchReleases struct {
Fake *FakeRolloutsV1alpha1
ns string
}
var batchreleasesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "batchreleases"}
var batchreleasesKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "BatchRelease"}
// Get takes name of the batchRelease, and returns the corresponding batchRelease object, and an error if there is any.
func (c *FakeBatchReleases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BatchRelease, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(batchreleasesResource, c.ns, name), &v1alpha1.BatchRelease{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BatchRelease), err
}
// List takes label and field selectors, and returns the list of BatchReleases that match those selectors.
func (c *FakeBatchReleases) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BatchReleaseList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(batchreleasesResource, batchreleasesKind, c.ns, opts), &v1alpha1.BatchReleaseList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.BatchReleaseList{ListMeta: obj.(*v1alpha1.BatchReleaseList).ListMeta}
for _, item := range obj.(*v1alpha1.BatchReleaseList).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 batchReleases.
func (c *FakeBatchReleases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(batchreleasesResource, c.ns, opts))
}
// Create takes the representation of a batchRelease and creates it. Returns the server's representation of the batchRelease, and an error, if there is any.
func (c *FakeBatchReleases) Create(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.CreateOptions) (result *v1alpha1.BatchRelease, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(batchreleasesResource, c.ns, batchRelease), &v1alpha1.BatchRelease{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BatchRelease), err
}
// Update takes the representation of a batchRelease and updates it. Returns the server's representation of the batchRelease, and an error, if there is any.
func (c *FakeBatchReleases) Update(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (result *v1alpha1.BatchRelease, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(batchreleasesResource, c.ns, batchRelease), &v1alpha1.BatchRelease{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BatchRelease), 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 *FakeBatchReleases) UpdateStatus(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (*v1alpha1.BatchRelease, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(batchreleasesResource, "status", c.ns, batchRelease), &v1alpha1.BatchRelease{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BatchRelease), err
}
// Delete takes name of the batchRelease and deletes it. Returns an error if one occurs.
func (c *FakeBatchReleases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(batchreleasesResource, c.ns, name), &v1alpha1.BatchRelease{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeBatchReleases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(batchreleasesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.BatchReleaseList{})
return err
}
// Patch applies the patch and returns the patched batchRelease.
func (c *FakeBatchReleases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BatchRelease, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(batchreleasesResource, c.ns, name, pt, data, subresources...), &v1alpha1.BatchRelease{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BatchRelease), err
}

View File

@ -1,142 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeRollouts implements RolloutInterface
type FakeRollouts struct {
Fake *FakeRolloutsV1alpha1
ns string
}
var rolloutsResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "rollouts"}
var rolloutsKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "Rollout"}
// Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any.
func (c *FakeRollouts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rollout, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(rolloutsResource, c.ns, name), &v1alpha1.Rollout{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Rollout), err
}
// List takes label and field selectors, and returns the list of Rollouts that match those selectors.
func (c *FakeRollouts) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(rolloutsResource, rolloutsKind, c.ns, opts), &v1alpha1.RolloutList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.RolloutList{ListMeta: obj.(*v1alpha1.RolloutList).ListMeta}
for _, item := range obj.(*v1alpha1.RolloutList).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 rollouts.
func (c *FakeRollouts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(rolloutsResource, c.ns, opts))
}
// Create takes the representation of a rollout and creates it. Returns the server's representation of the rollout, and an error, if there is any.
func (c *FakeRollouts) Create(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.CreateOptions) (result *v1alpha1.Rollout, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(rolloutsResource, c.ns, rollout), &v1alpha1.Rollout{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Rollout), err
}
// Update takes the representation of a rollout and updates it. Returns the server's representation of the rollout, and an error, if there is any.
func (c *FakeRollouts) Update(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (result *v1alpha1.Rollout, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(rolloutsResource, c.ns, rollout), &v1alpha1.Rollout{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Rollout), 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 *FakeRollouts) UpdateStatus(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (*v1alpha1.Rollout, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(rolloutsResource, "status", c.ns, rollout), &v1alpha1.Rollout{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Rollout), err
}
// Delete takes name of the rollout and deletes it. Returns an error if one occurs.
func (c *FakeRollouts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(rolloutsResource, c.ns, name), &v1alpha1.Rollout{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRollouts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(rolloutsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.RolloutList{})
return err
}
// Patch applies the patch and returns the patched rollout.
func (c *FakeRollouts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rollout, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(rolloutsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Rollout{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Rollout), err
}

View File

@ -1,142 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeRolloutHistories implements RolloutHistoryInterface
type FakeRolloutHistories struct {
Fake *FakeRolloutsV1alpha1
ns string
}
var rollouthistoriesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "rollouthistories"}
var rollouthistoriesKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "RolloutHistory"}
// Get takes name of the rolloutHistory, and returns the corresponding rolloutHistory object, and an error if there is any.
func (c *FakeRolloutHistories) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RolloutHistory, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(rollouthistoriesResource, c.ns, name), &v1alpha1.RolloutHistory{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RolloutHistory), err
}
// List takes label and field selectors, and returns the list of RolloutHistories that match those selectors.
func (c *FakeRolloutHistories) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutHistoryList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(rollouthistoriesResource, rollouthistoriesKind, c.ns, opts), &v1alpha1.RolloutHistoryList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.RolloutHistoryList{ListMeta: obj.(*v1alpha1.RolloutHistoryList).ListMeta}
for _, item := range obj.(*v1alpha1.RolloutHistoryList).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 rolloutHistories.
func (c *FakeRolloutHistories) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(rollouthistoriesResource, c.ns, opts))
}
// Create takes the representation of a rolloutHistory and creates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
func (c *FakeRolloutHistories) Create(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.CreateOptions) (result *v1alpha1.RolloutHistory, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(rollouthistoriesResource, c.ns, rolloutHistory), &v1alpha1.RolloutHistory{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RolloutHistory), err
}
// Update takes the representation of a rolloutHistory and updates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
func (c *FakeRolloutHistories) Update(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (result *v1alpha1.RolloutHistory, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(rollouthistoriesResource, c.ns, rolloutHistory), &v1alpha1.RolloutHistory{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RolloutHistory), 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 *FakeRolloutHistories) UpdateStatus(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (*v1alpha1.RolloutHistory, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(rollouthistoriesResource, "status", c.ns, rolloutHistory), &v1alpha1.RolloutHistory{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RolloutHistory), err
}
// Delete takes name of the rolloutHistory and deletes it. Returns an error if one occurs.
func (c *FakeRolloutHistories) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(rollouthistoriesResource, c.ns, name), &v1alpha1.RolloutHistory{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRolloutHistories) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(rollouthistoriesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.RolloutHistoryList{})
return err
}
// Patch applies the patch and returns the patched rolloutHistory.
func (c *FakeRolloutHistories) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RolloutHistory, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(rollouthistoriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.RolloutHistory{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.RolloutHistory), err
}

View File

@ -1,48 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha1 "github.com/openkruise/kruise-api/client/clientset/versioned/typed/rollouts/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeRolloutsV1alpha1 struct {
*testing.Fake
}
func (c *FakeRolloutsV1alpha1) BatchReleases(namespace string) v1alpha1.BatchReleaseInterface {
return &FakeBatchReleases{c, namespace}
}
func (c *FakeRolloutsV1alpha1) Rollouts(namespace string) v1alpha1.RolloutInterface {
return &FakeRollouts{c, namespace}
}
func (c *FakeRolloutsV1alpha1) RolloutHistories(namespace string) v1alpha1.RolloutHistoryInterface {
return &FakeRolloutHistories{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeRolloutsV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -1,25 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type BatchReleaseExpansion interface{}
type RolloutExpansion interface{}
type RolloutHistoryExpansion interface{}

View File

@ -1,195 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
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"
)
// RolloutsGetter has a method to return a RolloutInterface.
// A group's client should implement this interface.
type RolloutsGetter interface {
Rollouts(namespace string) RolloutInterface
}
// RolloutInterface has methods to work with Rollout resources.
type RolloutInterface interface {
Create(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.CreateOptions) (*v1alpha1.Rollout, error)
Update(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (*v1alpha1.Rollout, error)
UpdateStatus(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (*v1alpha1.Rollout, 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.Rollout, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RolloutList, 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.Rollout, err error)
RolloutExpansion
}
// rollouts implements RolloutInterface
type rollouts struct {
client rest.Interface
ns string
}
// newRollouts returns a Rollouts
func newRollouts(c *RolloutsV1alpha1Client, namespace string) *rollouts {
return &rollouts{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any.
func (c *rollouts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rollout, err error) {
result = &v1alpha1.Rollout{}
err = c.client.Get().
Namespace(c.ns).
Resource("rollouts").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Rollouts that match those selectors.
func (c *rollouts) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.RolloutList{}
err = c.client.Get().
Namespace(c.ns).
Resource("rollouts").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested rollouts.
func (c *rollouts) 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("rollouts").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a rollout and creates it. Returns the server's representation of the rollout, and an error, if there is any.
func (c *rollouts) Create(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.CreateOptions) (result *v1alpha1.Rollout, err error) {
result = &v1alpha1.Rollout{}
err = c.client.Post().
Namespace(c.ns).
Resource("rollouts").
VersionedParams(&opts, scheme.ParameterCodec).
Body(rollout).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a rollout and updates it. Returns the server's representation of the rollout, and an error, if there is any.
func (c *rollouts) Update(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (result *v1alpha1.Rollout, err error) {
result = &v1alpha1.Rollout{}
err = c.client.Put().
Namespace(c.ns).
Resource("rollouts").
Name(rollout.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(rollout).
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 *rollouts) UpdateStatus(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (result *v1alpha1.Rollout, err error) {
result = &v1alpha1.Rollout{}
err = c.client.Put().
Namespace(c.ns).
Resource("rollouts").
Name(rollout.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(rollout).
Do(ctx).
Into(result)
return
}
// Delete takes name of the rollout and deletes it. Returns an error if one occurs.
func (c *rollouts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("rollouts").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *rollouts) 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("rollouts").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched rollout.
func (c *rollouts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rollout, err error) {
result = &v1alpha1.Rollout{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("rollouts").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,195 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
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"
)
// RolloutHistoriesGetter has a method to return a RolloutHistoryInterface.
// A group's client should implement this interface.
type RolloutHistoriesGetter interface {
RolloutHistories(namespace string) RolloutHistoryInterface
}
// RolloutHistoryInterface has methods to work with RolloutHistory resources.
type RolloutHistoryInterface interface {
Create(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.CreateOptions) (*v1alpha1.RolloutHistory, error)
Update(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (*v1alpha1.RolloutHistory, error)
UpdateStatus(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (*v1alpha1.RolloutHistory, 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.RolloutHistory, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RolloutHistoryList, 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.RolloutHistory, err error)
RolloutHistoryExpansion
}
// rolloutHistories implements RolloutHistoryInterface
type rolloutHistories struct {
client rest.Interface
ns string
}
// newRolloutHistories returns a RolloutHistories
func newRolloutHistories(c *RolloutsV1alpha1Client, namespace string) *rolloutHistories {
return &rolloutHistories{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the rolloutHistory, and returns the corresponding rolloutHistory object, and an error if there is any.
func (c *rolloutHistories) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RolloutHistory, err error) {
result = &v1alpha1.RolloutHistory{}
err = c.client.Get().
Namespace(c.ns).
Resource("rollouthistories").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of RolloutHistories that match those selectors.
func (c *rolloutHistories) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutHistoryList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.RolloutHistoryList{}
err = c.client.Get().
Namespace(c.ns).
Resource("rollouthistories").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested rolloutHistories.
func (c *rolloutHistories) 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("rollouthistories").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a rolloutHistory and creates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
func (c *rolloutHistories) Create(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.CreateOptions) (result *v1alpha1.RolloutHistory, err error) {
result = &v1alpha1.RolloutHistory{}
err = c.client.Post().
Namespace(c.ns).
Resource("rollouthistories").
VersionedParams(&opts, scheme.ParameterCodec).
Body(rolloutHistory).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a rolloutHistory and updates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
func (c *rolloutHistories) Update(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (result *v1alpha1.RolloutHistory, err error) {
result = &v1alpha1.RolloutHistory{}
err = c.client.Put().
Namespace(c.ns).
Resource("rollouthistories").
Name(rolloutHistory.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(rolloutHistory).
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 *rolloutHistories) UpdateStatus(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (result *v1alpha1.RolloutHistory, err error) {
result = &v1alpha1.RolloutHistory{}
err = c.client.Put().
Namespace(c.ns).
Resource("rollouthistories").
Name(rolloutHistory.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(rolloutHistory).
Do(ctx).
Into(result)
return
}
// Delete takes name of the rolloutHistory and deletes it. Returns an error if one occurs.
func (c *rolloutHistories) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("rollouthistories").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *rolloutHistories) 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("rollouthistories").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched rolloutHistory.
func (c *rolloutHistories) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RolloutHistory, err error) {
result = &v1alpha1.RolloutHistory{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("rollouthistories").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -1,99 +0,0 @@
/*
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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"github.com/openkruise/kruise-api/client/clientset/versioned/scheme"
v1alpha1 "github.com/openkruise/kruise-api/rollouts/v1alpha1"
rest "k8s.io/client-go/rest"
)
type RolloutsV1alpha1Interface interface {
RESTClient() rest.Interface
BatchReleasesGetter
RolloutsGetter
RolloutHistoriesGetter
}
// RolloutsV1alpha1Client is used to interact with features provided by the rollouts.kruise.io group.
type RolloutsV1alpha1Client struct {
restClient rest.Interface
}
func (c *RolloutsV1alpha1Client) BatchReleases(namespace string) BatchReleaseInterface {
return newBatchReleases(c, namespace)
}
func (c *RolloutsV1alpha1Client) Rollouts(namespace string) RolloutInterface {
return newRollouts(c, namespace)
}
func (c *RolloutsV1alpha1Client) RolloutHistories(namespace string) RolloutHistoryInterface {
return newRolloutHistories(c, namespace)
}
// NewForConfig creates a new RolloutsV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*RolloutsV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &RolloutsV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new RolloutsV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *RolloutsV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new RolloutsV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *RolloutsV1alpha1Client {
return &RolloutsV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *RolloutsV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
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.

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