From ff879e6ab017e023c0d11f5b55950f1c911dd4de Mon Sep 17 00:00:00 2001 From: AiRanthem Date: Thu, 16 Jan 2025 15:21:29 +0800 Subject: [PATCH] remove inner apis Signed-off-by: AiRanthem --- .github/workflows/e2e-test.yml | 31 +- Makefile | 11 +- .../typed/rollouts/v1alpha1/batchrelease.go | 195 --- .../v1alpha1/fake/fake_batchrelease.go | 142 -- .../v1alpha1/fake/fake_rollouthistory.go | 142 -- .../v1alpha1/fake/fake_rollouts_client.go | 8 - .../rollouts/v1alpha1/generated_expansion.go | 4 - .../typed/rollouts/v1alpha1/rollouthistory.go | 195 --- .../rollouts/v1alpha1/rollouts_client.go | 10 - .../typed/rollouts/v1beta1/batchrelease.go | 195 --- .../v1beta1/fake/fake_batchrelease.go | 142 -- .../v1beta1/fake/fake_rollouts_client.go | 4 - .../rollouts/v1beta1/generated_expansion.go | 2 - .../typed/rollouts/v1beta1/rollouts_client.go | 5 - client/informers/externalversions/generic.go | 6 - .../rollouts/v1alpha1/batchrelease.go | 90 -- .../rollouts/v1alpha1/interface.go | 14 - .../rollouts/v1alpha1/rollouthistory.go | 90 -- .../rollouts/v1beta1/batchrelease.go | 90 -- .../rollouts/v1beta1/interface.go | 7 - .../listers/rollouts/v1alpha1/batchrelease.go | 99 -- .../rollouts/v1alpha1/expansion_generated.go | 16 - .../rollouts/v1alpha1/rollouthistory.go | 99 -- .../listers/rollouts/v1beta1/batchrelease.go | 99 -- .../rollouts/v1beta1/expansion_generated.go | 8 - pkg/rollouts/openapi_generated.go | 1334 ----------------- pkg/rollouts/violation_exceptions.list | 9 - rollouts/v1alpha1/batchrelease_plan_types.go | 157 -- rollouts/v1alpha1/batchrelease_types.go | 59 - rollouts/v1alpha1/conversion.go | 477 ------ rollouts/v1alpha1/deployment_types.go | 105 -- rollouts/v1alpha1/rollouthistory_types.go | 151 -- rollouts/v1alpha1/zz_generated.deepcopy.go | 478 +----- rollouts/v1beta1/batchrelease_plan_types.go | 159 -- rollouts/v1beta1/batchrelease_types.go | 61 - rollouts/v1beta1/convertion.go | 21 - rollouts/v1beta1/zz_generated.deepcopy.go | 182 +-- .../openkruise_rollouts_kustomize_schema.json | 971 ------------ tests/e2e/rollout_e2e_test.go | 84 +- 39 files changed, 107 insertions(+), 5845 deletions(-) delete mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/batchrelease.go delete mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_batchrelease.go delete mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouthistory.go delete mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/rollouthistory.go delete mode 100644 client/clientset/versioned/typed/rollouts/v1beta1/batchrelease.go delete mode 100644 client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_batchrelease.go delete mode 100644 client/informers/externalversions/rollouts/v1alpha1/batchrelease.go delete mode 100644 client/informers/externalversions/rollouts/v1alpha1/rollouthistory.go delete mode 100644 client/informers/externalversions/rollouts/v1beta1/batchrelease.go delete mode 100644 client/listers/rollouts/v1alpha1/batchrelease.go delete mode 100644 client/listers/rollouts/v1alpha1/rollouthistory.go delete mode 100644 client/listers/rollouts/v1beta1/batchrelease.go delete mode 100644 rollouts/v1alpha1/batchrelease_plan_types.go delete mode 100644 rollouts/v1alpha1/batchrelease_types.go delete mode 100644 rollouts/v1alpha1/conversion.go delete mode 100644 rollouts/v1alpha1/deployment_types.go delete mode 100644 rollouts/v1alpha1/rollouthistory_types.go delete mode 100644 rollouts/v1beta1/batchrelease_plan_types.go delete mode 100644 rollouts/v1beta1/batchrelease_types.go delete mode 100644 rollouts/v1beta1/convertion.go diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index c25b47c..f97c66d 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -13,23 +13,32 @@ on: - master - release-* +env: + # Common versions + GO_VERSION: '1.20' + KIND_VERSION: 'v0.18.0' + KIND_IMAGE: 'kindest/node:v1.26.3' + KIND_CLUSTER_NAME: 'ci-testing' + jobs: e2e-test: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install tools - run: | - sudo apt-get update - sudo snap install kubectl --classic - - - name: Set up Go - uses: actions/setup-go@v2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - go-version: 1.19 + submodules: true + - name: Setup Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: ${{ env.GO_VERSION }} + - name: Setup Kind Cluster + uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0 + with: + node_image: ${{ env.KIND_IMAGE }} + cluster_name: ${{ env.KIND_CLUSTER_NAME }} + config: ./test/kind-conf.yaml + version: ${{ env.KIND_VERSION }} - name: Install dependencies run: go mod download diff --git a/Makefile b/Makefile index 75e314f..cd28ea2 100644 --- a/Makefile +++ b/Makefile @@ -9,21 +9,24 @@ endif KIND_VERSION ?= v0.18.0 CLUSTER_NAME ?= rollout-ci-testing +all: generate gen-openapi-schema + # Run go vet against code vet: go vet ./... # Generate code -generate: controller-gen - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./rollouts" +generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./rollouts/..." @hack/generate_client.sh CONTROLLER_GEN = $(shell pwd)/bin/controller-gen +CONTROLLER_GEN_VERSION = v0.16.0 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)", "Version: ${CONTROLLER_GEN_VERSION}") 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@${CONTROLLER_GEN_VERSION}) endif OPENAPI_GEN = $(shell pwd)/bin/openapi-gen diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/batchrelease.go b/client/clientset/versioned/typed/rollouts/v1alpha1/batchrelease.go deleted file mode 100644 index 0451fa2..0000000 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/batchrelease.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -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" - - scheme "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme" - v1alpha1 "github.com/openkruise/kruise-rollout-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 -} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_batchrelease.go b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_batchrelease.go deleted file mode 100644 index f2d275a..0000000 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_batchrelease.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -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-rollout-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.NewDeleteActionWithOptions(batchreleasesResource, c.ns, name, opts), &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 -} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouthistory.go b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouthistory.go deleted file mode 100644 index deb943b..0000000 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouthistory.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -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-rollout-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.NewDeleteActionWithOptions(rollouthistoriesResource, c.ns, name, opts), &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 -} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouts_client.go b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouts_client.go index 0cbd13e..3379935 100644 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouts_client.go +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouts_client.go @@ -28,18 +28,10 @@ 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} -} - func (c *FakeRolloutsV1alpha1) TrafficRoutings(namespace string) v1alpha1.TrafficRoutingInterface { return &FakeTrafficRoutings{c, namespace} } diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go index 85f1eea..1f96f49 100644 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go @@ -18,10 +18,6 @@ limitations under the License. package v1alpha1 -type BatchReleaseExpansion interface{} - type RolloutExpansion interface{} -type RolloutHistoryExpansion interface{} - type TrafficRoutingExpansion interface{} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/rollouthistory.go b/client/clientset/versioned/typed/rollouts/v1alpha1/rollouthistory.go deleted file mode 100644 index 61f2d65..0000000 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/rollouthistory.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -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" - - scheme "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme" - v1alpha1 "github.com/openkruise/kruise-rollout-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 -} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go b/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go index 273a849..56bee75 100644 --- a/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go @@ -28,9 +28,7 @@ import ( type RolloutsV1alpha1Interface interface { RESTClient() rest.Interface - BatchReleasesGetter RolloutsGetter - RolloutHistoriesGetter TrafficRoutingsGetter } @@ -39,18 +37,10 @@ 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) -} - func (c *RolloutsV1alpha1Client) TrafficRoutings(namespace string) TrafficRoutingInterface { return newTrafficRoutings(c, namespace) } diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/batchrelease.go b/client/clientset/versioned/typed/rollouts/v1beta1/batchrelease.go deleted file mode 100644 index ead1af6..0000000 --- a/client/clientset/versioned/typed/rollouts/v1beta1/batchrelease.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -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 v1beta1 - -import ( - "context" - "time" - - scheme "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme" - v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" - 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 *v1beta1.BatchRelease, opts v1.CreateOptions) (*v1beta1.BatchRelease, error) - Update(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (*v1beta1.BatchRelease, error) - UpdateStatus(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (*v1beta1.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) (*v1beta1.BatchRelease, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.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 *v1beta1.BatchRelease, err error) - BatchReleaseExpansion -} - -// batchReleases implements BatchReleaseInterface -type batchReleases struct { - client rest.Interface - ns string -} - -// newBatchReleases returns a BatchReleases -func newBatchReleases(c *RolloutsV1beta1Client, 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 *v1beta1.BatchRelease, err error) { - result = &v1beta1.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 *v1beta1.BatchReleaseList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.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 *v1beta1.BatchRelease, opts v1.CreateOptions) (result *v1beta1.BatchRelease, err error) { - result = &v1beta1.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 *v1beta1.BatchRelease, opts v1.UpdateOptions) (result *v1beta1.BatchRelease, err error) { - result = &v1beta1.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 *v1beta1.BatchRelease, opts v1.UpdateOptions) (result *v1beta1.BatchRelease, err error) { - result = &v1beta1.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 *v1beta1.BatchRelease, err error) { - result = &v1beta1.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 -} diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_batchrelease.go b/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_batchrelease.go deleted file mode 100644 index 8d34bff..0000000 --- a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_batchrelease.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -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" - - v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" - 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 *FakeRolloutsV1beta1 - ns string -} - -var batchreleasesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1beta1", Resource: "batchreleases"} - -var batchreleasesKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1beta1", 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 *v1beta1.BatchRelease, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(batchreleasesResource, c.ns, name), &v1beta1.BatchRelease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.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 *v1beta1.BatchReleaseList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(batchreleasesResource, batchreleasesKind, c.ns, opts), &v1beta1.BatchReleaseList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.BatchReleaseList{ListMeta: obj.(*v1beta1.BatchReleaseList).ListMeta} - for _, item := range obj.(*v1beta1.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 *v1beta1.BatchRelease, opts v1.CreateOptions) (result *v1beta1.BatchRelease, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(batchreleasesResource, c.ns, batchRelease), &v1beta1.BatchRelease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.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 *v1beta1.BatchRelease, opts v1.UpdateOptions) (result *v1beta1.BatchRelease, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(batchreleasesResource, c.ns, batchRelease), &v1beta1.BatchRelease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.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 *v1beta1.BatchRelease, opts v1.UpdateOptions) (*v1beta1.BatchRelease, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(batchreleasesResource, "status", c.ns, batchRelease), &v1beta1.BatchRelease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.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.NewDeleteActionWithOptions(batchreleasesResource, c.ns, name, opts), &v1beta1.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, &v1beta1.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 *v1beta1.BatchRelease, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(batchreleasesResource, c.ns, name, pt, data, subresources...), &v1beta1.BatchRelease{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.BatchRelease), err -} diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollouts_client.go b/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollouts_client.go index 8093f1e..5bbfd6f 100644 --- a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollouts_client.go +++ b/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollouts_client.go @@ -28,10 +28,6 @@ type FakeRolloutsV1beta1 struct { *testing.Fake } -func (c *FakeRolloutsV1beta1) BatchReleases(namespace string) v1beta1.BatchReleaseInterface { - return &FakeBatchReleases{c, namespace} -} - func (c *FakeRolloutsV1beta1) Rollouts(namespace string) v1beta1.RolloutInterface { return &FakeRollouts{c, namespace} } diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/generated_expansion.go b/client/clientset/versioned/typed/rollouts/v1beta1/generated_expansion.go index e4a6dda..fd270b8 100644 --- a/client/clientset/versioned/typed/rollouts/v1beta1/generated_expansion.go +++ b/client/clientset/versioned/typed/rollouts/v1beta1/generated_expansion.go @@ -18,6 +18,4 @@ limitations under the License. package v1beta1 -type BatchReleaseExpansion interface{} - type RolloutExpansion interface{} diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go b/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go index dc35139..d9fd226 100644 --- a/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go +++ b/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go @@ -28,7 +28,6 @@ import ( type RolloutsV1beta1Interface interface { RESTClient() rest.Interface - BatchReleasesGetter RolloutsGetter } @@ -37,10 +36,6 @@ type RolloutsV1beta1Client struct { restClient rest.Interface } -func (c *RolloutsV1beta1Client) BatchReleases(namespace string) BatchReleaseInterface { - return newBatchReleases(c, namespace) -} - func (c *RolloutsV1beta1Client) Rollouts(namespace string) RolloutInterface { return newRollouts(c, namespace) } diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index 8420d41..4623e96 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -54,18 +54,12 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=rollouts.kruise.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("batchreleases"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().BatchReleases().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("rollouts"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().Rollouts().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("rollouthistories"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().RolloutHistories().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("trafficroutings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().TrafficRoutings().Informer()}, nil // Group=rollouts.kruise.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("batchreleases"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1beta1().BatchReleases().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("rollouts"): return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1beta1().Rollouts().Informer()}, nil diff --git a/client/informers/externalversions/rollouts/v1alpha1/batchrelease.go b/client/informers/externalversions/rollouts/v1alpha1/batchrelease.go deleted file mode 100644 index a7436d7..0000000 --- a/client/informers/externalversions/rollouts/v1alpha1/batchrelease.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -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 informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - versioned "github.com/openkruise/kruise-rollout-api/client/clientset/versioned" - internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/openkruise/kruise-rollout-api/client/listers/rollouts/v1alpha1" - rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// BatchReleaseInformer provides access to a shared informer and lister for -// BatchReleases. -type BatchReleaseInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.BatchReleaseLister -} - -type batchReleaseInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBatchReleaseInformer constructs a new informer for BatchRelease type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBatchReleaseInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBatchReleaseInformer constructs a new informer for BatchRelease type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.RolloutsV1alpha1().BatchReleases(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.RolloutsV1alpha1().BatchReleases(namespace).Watch(context.TODO(), options) - }, - }, - &rolloutsv1alpha1.BatchRelease{}, - resyncPeriod, - indexers, - ) -} - -func (f *batchReleaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBatchReleaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *batchReleaseInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&rolloutsv1alpha1.BatchRelease{}, f.defaultInformer) -} - -func (f *batchReleaseInformer) Lister() v1alpha1.BatchReleaseLister { - return v1alpha1.NewBatchReleaseLister(f.Informer().GetIndexer()) -} diff --git a/client/informers/externalversions/rollouts/v1alpha1/interface.go b/client/informers/externalversions/rollouts/v1alpha1/interface.go index f8af5e2..86f1f83 100644 --- a/client/informers/externalversions/rollouts/v1alpha1/interface.go +++ b/client/informers/externalversions/rollouts/v1alpha1/interface.go @@ -24,12 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // BatchReleases returns a BatchReleaseInformer. - BatchReleases() BatchReleaseInformer // Rollouts returns a RolloutInformer. Rollouts() RolloutInformer - // RolloutHistories returns a RolloutHistoryInformer. - RolloutHistories() RolloutHistoryInformer // TrafficRoutings returns a TrafficRoutingInformer. TrafficRoutings() TrafficRoutingInformer } @@ -45,21 +41,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// BatchReleases returns a BatchReleaseInformer. -func (v *version) BatchReleases() BatchReleaseInformer { - return &batchReleaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - // Rollouts returns a RolloutInformer. func (v *version) Rollouts() RolloutInformer { return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } -// RolloutHistories returns a RolloutHistoryInformer. -func (v *version) RolloutHistories() RolloutHistoryInformer { - return &rolloutHistoryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - // TrafficRoutings returns a TrafficRoutingInformer. func (v *version) TrafficRoutings() TrafficRoutingInformer { return &trafficRoutingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/rollouts/v1alpha1/rollouthistory.go b/client/informers/externalversions/rollouts/v1alpha1/rollouthistory.go deleted file mode 100644 index fc1e585..0000000 --- a/client/informers/externalversions/rollouts/v1alpha1/rollouthistory.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -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 informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - versioned "github.com/openkruise/kruise-rollout-api/client/clientset/versioned" - internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/openkruise/kruise-rollout-api/client/listers/rollouts/v1alpha1" - rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// RolloutHistoryInformer provides access to a shared informer and lister for -// RolloutHistories. -type RolloutHistoryInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.RolloutHistoryLister -} - -type rolloutHistoryInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewRolloutHistoryInformer constructs a new informer for RolloutHistory type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewRolloutHistoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRolloutHistoryInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredRolloutHistoryInformer constructs a new informer for RolloutHistory type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredRolloutHistoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.RolloutsV1alpha1().RolloutHistories(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.RolloutsV1alpha1().RolloutHistories(namespace).Watch(context.TODO(), options) - }, - }, - &rolloutsv1alpha1.RolloutHistory{}, - resyncPeriod, - indexers, - ) -} - -func (f *rolloutHistoryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRolloutHistoryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *rolloutHistoryInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&rolloutsv1alpha1.RolloutHistory{}, f.defaultInformer) -} - -func (f *rolloutHistoryInformer) Lister() v1alpha1.RolloutHistoryLister { - return v1alpha1.NewRolloutHistoryLister(f.Informer().GetIndexer()) -} diff --git a/client/informers/externalversions/rollouts/v1beta1/batchrelease.go b/client/informers/externalversions/rollouts/v1beta1/batchrelease.go deleted file mode 100644 index 154e7f4..0000000 --- a/client/informers/externalversions/rollouts/v1beta1/batchrelease.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -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 informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - time "time" - - versioned "github.com/openkruise/kruise-rollout-api/client/clientset/versioned" - internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces" - v1beta1 "github.com/openkruise/kruise-rollout-api/client/listers/rollouts/v1beta1" - rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// BatchReleaseInformer provides access to a shared informer and lister for -// BatchReleases. -type BatchReleaseInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.BatchReleaseLister -} - -type batchReleaseInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewBatchReleaseInformer constructs a new informer for BatchRelease type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredBatchReleaseInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredBatchReleaseInformer constructs a new informer for BatchRelease type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.RolloutsV1beta1().BatchReleases(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.RolloutsV1beta1().BatchReleases(namespace).Watch(context.TODO(), options) - }, - }, - &rolloutsv1beta1.BatchRelease{}, - resyncPeriod, - indexers, - ) -} - -func (f *batchReleaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredBatchReleaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *batchReleaseInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&rolloutsv1beta1.BatchRelease{}, f.defaultInformer) -} - -func (f *batchReleaseInformer) Lister() v1beta1.BatchReleaseLister { - return v1beta1.NewBatchReleaseLister(f.Informer().GetIndexer()) -} diff --git a/client/informers/externalversions/rollouts/v1beta1/interface.go b/client/informers/externalversions/rollouts/v1beta1/interface.go index 4b6a4a4..79c0fe0 100644 --- a/client/informers/externalversions/rollouts/v1beta1/interface.go +++ b/client/informers/externalversions/rollouts/v1beta1/interface.go @@ -24,8 +24,6 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // BatchReleases returns a BatchReleaseInformer. - BatchReleases() BatchReleaseInformer // Rollouts returns a RolloutInformer. Rollouts() RolloutInformer } @@ -41,11 +39,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// BatchReleases returns a BatchReleaseInformer. -func (v *version) BatchReleases() BatchReleaseInformer { - return &batchReleaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - // Rollouts returns a RolloutInformer. func (v *version) Rollouts() RolloutInformer { return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/listers/rollouts/v1alpha1/batchrelease.go b/client/listers/rollouts/v1alpha1/batchrelease.go deleted file mode 100644 index 18a9ab5..0000000 --- a/client/listers/rollouts/v1alpha1/batchrelease.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -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 lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// BatchReleaseLister helps list BatchReleases. -// All objects returned here must be treated as read-only. -type BatchReleaseLister interface { - // List lists all BatchReleases in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error) - // BatchReleases returns an object that can list and get BatchReleases. - BatchReleases(namespace string) BatchReleaseNamespaceLister - BatchReleaseListerExpansion -} - -// batchReleaseLister implements the BatchReleaseLister interface. -type batchReleaseLister struct { - indexer cache.Indexer -} - -// NewBatchReleaseLister returns a new BatchReleaseLister. -func NewBatchReleaseLister(indexer cache.Indexer) BatchReleaseLister { - return &batchReleaseLister{indexer: indexer} -} - -// List lists all BatchReleases in the indexer. -func (s *batchReleaseLister) List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.BatchRelease)) - }) - return ret, err -} - -// BatchReleases returns an object that can list and get BatchReleases. -func (s *batchReleaseLister) BatchReleases(namespace string) BatchReleaseNamespaceLister { - return batchReleaseNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BatchReleaseNamespaceLister helps list and get BatchReleases. -// All objects returned here must be treated as read-only. -type BatchReleaseNamespaceLister interface { - // List lists all BatchReleases in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error) - // Get retrieves the BatchRelease from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.BatchRelease, error) - BatchReleaseNamespaceListerExpansion -} - -// batchReleaseNamespaceLister implements the BatchReleaseNamespaceLister -// interface. -type batchReleaseNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all BatchReleases in the indexer for a given namespace. -func (s batchReleaseNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.BatchRelease)) - }) - return ret, err -} - -// Get retrieves the BatchRelease from the indexer for a given namespace and name. -func (s batchReleaseNamespaceLister) Get(name string) (*v1alpha1.BatchRelease, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("batchrelease"), name) - } - return obj.(*v1alpha1.BatchRelease), nil -} diff --git a/client/listers/rollouts/v1alpha1/expansion_generated.go b/client/listers/rollouts/v1alpha1/expansion_generated.go index a2c1c4a..a612cc4 100644 --- a/client/listers/rollouts/v1alpha1/expansion_generated.go +++ b/client/listers/rollouts/v1alpha1/expansion_generated.go @@ -18,14 +18,6 @@ limitations under the License. package v1alpha1 -// BatchReleaseListerExpansion allows custom methods to be added to -// BatchReleaseLister. -type BatchReleaseListerExpansion interface{} - -// BatchReleaseNamespaceListerExpansion allows custom methods to be added to -// BatchReleaseNamespaceLister. -type BatchReleaseNamespaceListerExpansion interface{} - // RolloutListerExpansion allows custom methods to be added to // RolloutLister. type RolloutListerExpansion interface{} @@ -34,14 +26,6 @@ type RolloutListerExpansion interface{} // RolloutNamespaceLister. type RolloutNamespaceListerExpansion interface{} -// RolloutHistoryListerExpansion allows custom methods to be added to -// RolloutHistoryLister. -type RolloutHistoryListerExpansion interface{} - -// RolloutHistoryNamespaceListerExpansion allows custom methods to be added to -// RolloutHistoryNamespaceLister. -type RolloutHistoryNamespaceListerExpansion interface{} - // TrafficRoutingListerExpansion allows custom methods to be added to // TrafficRoutingLister. type TrafficRoutingListerExpansion interface{} diff --git a/client/listers/rollouts/v1alpha1/rollouthistory.go b/client/listers/rollouts/v1alpha1/rollouthistory.go deleted file mode 100644 index d3b8ed3..0000000 --- a/client/listers/rollouts/v1alpha1/rollouthistory.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -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 lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// RolloutHistoryLister helps list RolloutHistories. -// All objects returned here must be treated as read-only. -type RolloutHistoryLister interface { - // List lists all RolloutHistories in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error) - // RolloutHistories returns an object that can list and get RolloutHistories. - RolloutHistories(namespace string) RolloutHistoryNamespaceLister - RolloutHistoryListerExpansion -} - -// rolloutHistoryLister implements the RolloutHistoryLister interface. -type rolloutHistoryLister struct { - indexer cache.Indexer -} - -// NewRolloutHistoryLister returns a new RolloutHistoryLister. -func NewRolloutHistoryLister(indexer cache.Indexer) RolloutHistoryLister { - return &rolloutHistoryLister{indexer: indexer} -} - -// List lists all RolloutHistories in the indexer. -func (s *rolloutHistoryLister) List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.RolloutHistory)) - }) - return ret, err -} - -// RolloutHistories returns an object that can list and get RolloutHistories. -func (s *rolloutHistoryLister) RolloutHistories(namespace string) RolloutHistoryNamespaceLister { - return rolloutHistoryNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// RolloutHistoryNamespaceLister helps list and get RolloutHistories. -// All objects returned here must be treated as read-only. -type RolloutHistoryNamespaceLister interface { - // List lists all RolloutHistories in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error) - // Get retrieves the RolloutHistory from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.RolloutHistory, error) - RolloutHistoryNamespaceListerExpansion -} - -// rolloutHistoryNamespaceLister implements the RolloutHistoryNamespaceLister -// interface. -type rolloutHistoryNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all RolloutHistories in the indexer for a given namespace. -func (s rolloutHistoryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.RolloutHistory)) - }) - return ret, err -} - -// Get retrieves the RolloutHistory from the indexer for a given namespace and name. -func (s rolloutHistoryNamespaceLister) Get(name string) (*v1alpha1.RolloutHistory, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("rollouthistory"), name) - } - return obj.(*v1alpha1.RolloutHistory), nil -} diff --git a/client/listers/rollouts/v1beta1/batchrelease.go b/client/listers/rollouts/v1beta1/batchrelease.go deleted file mode 100644 index fe66005..0000000 --- a/client/listers/rollouts/v1beta1/batchrelease.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -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 lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// BatchReleaseLister helps list BatchReleases. -// All objects returned here must be treated as read-only. -type BatchReleaseLister interface { - // List lists all BatchReleases in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error) - // BatchReleases returns an object that can list and get BatchReleases. - BatchReleases(namespace string) BatchReleaseNamespaceLister - BatchReleaseListerExpansion -} - -// batchReleaseLister implements the BatchReleaseLister interface. -type batchReleaseLister struct { - indexer cache.Indexer -} - -// NewBatchReleaseLister returns a new BatchReleaseLister. -func NewBatchReleaseLister(indexer cache.Indexer) BatchReleaseLister { - return &batchReleaseLister{indexer: indexer} -} - -// List lists all BatchReleases in the indexer. -func (s *batchReleaseLister) List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.BatchRelease)) - }) - return ret, err -} - -// BatchReleases returns an object that can list and get BatchReleases. -func (s *batchReleaseLister) BatchReleases(namespace string) BatchReleaseNamespaceLister { - return batchReleaseNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// BatchReleaseNamespaceLister helps list and get BatchReleases. -// All objects returned here must be treated as read-only. -type BatchReleaseNamespaceLister interface { - // List lists all BatchReleases in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error) - // Get retrieves the BatchRelease from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1beta1.BatchRelease, error) - BatchReleaseNamespaceListerExpansion -} - -// batchReleaseNamespaceLister implements the BatchReleaseNamespaceLister -// interface. -type batchReleaseNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all BatchReleases in the indexer for a given namespace. -func (s batchReleaseNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.BatchRelease)) - }) - return ret, err -} - -// Get retrieves the BatchRelease from the indexer for a given namespace and name. -func (s batchReleaseNamespaceLister) Get(name string) (*v1beta1.BatchRelease, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("batchrelease"), name) - } - return obj.(*v1beta1.BatchRelease), nil -} diff --git a/client/listers/rollouts/v1beta1/expansion_generated.go b/client/listers/rollouts/v1beta1/expansion_generated.go index aabdac0..5bfe118 100644 --- a/client/listers/rollouts/v1beta1/expansion_generated.go +++ b/client/listers/rollouts/v1beta1/expansion_generated.go @@ -18,14 +18,6 @@ limitations under the License. package v1beta1 -// BatchReleaseListerExpansion allows custom methods to be added to -// BatchReleaseLister. -type BatchReleaseListerExpansion interface{} - -// BatchReleaseNamespaceListerExpansion allows custom methods to be added to -// BatchReleaseNamespaceLister. -type BatchReleaseNamespaceListerExpansion interface{} - // RolloutListerExpansion allows custom methods to be added to // RolloutLister. type RolloutListerExpansion interface{} diff --git a/pkg/rollouts/openapi_generated.go b/pkg/rollouts/openapi_generated.go index 1889cc2..72fa768 100644 --- a/pkg/rollouts/openapi_generated.go +++ b/pkg/rollouts/openapi_generated.go @@ -30,56 +30,29 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchRelease": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchRelease(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseCanaryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseCanaryStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseList": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseList(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseSpec": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseSpec(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseStatus(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStatus(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStep": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStep(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStepInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStepInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStrategy(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CustomNetworkRef": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CustomNetworkRef(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.DeploymentExtraStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_DeploymentExtraStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.DeploymentStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_DeploymentStrategy(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.GatewayTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_GatewayTrafficRouting(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.HTTPRouteInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_HTTPRouteInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.HttpRouteMatch": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_HttpRouteMatch(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.IngressInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.IngressTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressTrafficRouting(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.NameAndSpecData": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_NameAndSpecData(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ObjectRef": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ObjectRef(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.PatchPodTemplateMetadata": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_PatchPodTemplateMetadata(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.Pod": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_Pod(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ReleaseBatch": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ReleaseBatch(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ReleasePlan": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ReleasePlan(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.Rollout": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_Rollout(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutCondition": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutCondition(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistory": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistory(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistoryList": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistoryList(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistorySpec": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistorySpec(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistoryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistoryStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutList": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutList(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutPause": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutPause(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutSpec": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutSpec(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutStatus(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutStrategy(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ServiceInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ServiceInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRouting(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingList": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingList(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingRef": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingRef(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingSpec": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingSpec(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingStatus": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingStatus(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingStrategy(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.WorkloadInfo": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_WorkloadInfo(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.WorkloadRef": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_WorkloadRef(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchRelease": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchRelease(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseCanaryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseCanaryStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseList": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseList(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseSpec": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseSpec(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseStatus(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BlueGreenStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BlueGreenStatus(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BlueGreenStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BlueGreenStrategy(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.CanaryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStatus(ref), @@ -93,8 +66,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.IngressTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_IngressTrafficRouting(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ObjectRef": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_ObjectRef(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.PatchPodTemplateMetadata": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_PatchPodTemplateMetadata(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ReleaseBatch": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_ReleaseBatch(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ReleasePlan": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_ReleasePlan(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.Rollout": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_Rollout(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutCondition": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutCondition(ref), "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutList": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutList(ref), @@ -107,280 +78,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - 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-rollout-api/rollouts/v1alpha1.BatchReleaseSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseSpec", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseCanaryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "batchState": { - SchemaProps: spec.SchemaProps{ - Description: "CurrentBatchState indicates the release state of the current batch.", - Type: []string{"string"}, - Format: "", - }, - }, - "currentBatch": { - SchemaProps: spec.SchemaProps{ - Description: "The current batch the rollout is working on/blocked, it starts from 0", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - "batchReadyTime": { - SchemaProps: spec.SchemaProps{ - Description: "BatchReadyTime is the ready timestamp of the current batch or the last batch. This field is updated once a batch ready, and the batches[x].pausedSeconds relies on this field to calculate the real-time duration.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "updatedReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "UpdatedReplicas is the number of upgraded Pods.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "updatedReadyReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "noNeedUpdateReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "the number of pods that no need to rollback in rollback scene.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"currentBatch"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BatchReleaseList contains a list of BatchRelease", - 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-rollout-api/rollouts/v1alpha1.BatchRelease"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchRelease", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BatchReleaseSpec defines how to describe an update between different compRevision", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "targetReference": { - SchemaProps: spec.SchemaProps{ - Description: "TargetRef contains the GVK and name of the workload that we need to upgrade to.", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ObjectRef"), - }, - }, - "releasePlan": { - SchemaProps: spec.SchemaProps{ - Description: "ReleasePlan is the details on how to rollout the resources", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ReleasePlan"), - }, - }, - }, - Required: []string{"targetReference", "releasePlan"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ObjectRef", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ReleasePlan"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_BatchReleaseStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BatchReleaseStatus defines the observed state of a release plan", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions represents the observed process state of each phase during executing the release plan.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutCondition"), - }, - }, - }, - }, - }, - "canaryStatus": { - SchemaProps: spec.SchemaProps{ - Description: "CanaryStatus describes the state of the canary rollout.", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseCanaryStatus"), - }, - }, - "stableRevision": { - SchemaProps: spec.SchemaProps{ - Description: "StableRevision is the pod-template-hash of stable revision pod template.", - Type: []string{"string"}, - Format: "", - }, - }, - "updateRevision": { - SchemaProps: spec.SchemaProps{ - Description: "UpdateRevision is the pod-template-hash of update revision pod template.", - Type: []string{"string"}, - Format: "", - }, - }, - "observedGeneration": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedGeneration is the most recent generation observed for this BatchRelease. It corresponds to this BatchRelease's generation, which is updated on mutation by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "observedRolloutID": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedRolloutID is the most recent rollout-id observed for this BatchRelease. If RolloutID was changed, we will restart to roll out from batch 0, to ensure the batch-id and rollout-id labels of Pods are correct.", - Type: []string{"string"}, - Format: "", - }, - }, - "observedWorkloadReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedWorkloadReplicas is observed replicas of target referenced workload. This field is designed to deal with scaling event during rollout, if this field changed, it means that the workload is scaling during rollout.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "collisionCount": { - SchemaProps: spec.SchemaProps{ - Description: "Count of hash collisions for creating canary Deployment. The controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest canary Deployment.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "observedReleasePlanHash": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan.", - Type: []string{"string"}, - Format: "", - }, - }, - "phase": { - SchemaProps: spec.SchemaProps{ - Description: "Phase is the release plan phase, which indicates the current state of release plan state machine in BatchRelease controller.", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.BatchReleaseCanaryStatus", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutCondition"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -552,42 +249,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStep(ref commo } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStepInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "CanaryStepInfo indicates the pods for a revision", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "canaryStepIndex": { - SchemaProps: spec.SchemaProps{ - Description: "CanaryStepIndex indicates step this revision", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "pods": { - SchemaProps: spec.SchemaProps{ - Description: "Pods indicates the pods information", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.Pod"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.Pod"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -684,75 +345,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CustomNetworkRef(ref } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_DeploymentExtraStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "DeploymentExtraStatus is extra status field for Advanced Deployment", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "updatedReadyReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "UpdatedReadyReplicas the number of pods that has been updated and ready.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "expectedUpdatedReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "ExpectedUpdatedReplicas is an absolute number calculated based on Partition and Deployment.Spec.Replicas, means how many pods are expected be updated under current strategy. This field is designed to avoid users to fall into the details of algorithm for Partition calculation.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_DeploymentStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "DeploymentStrategy is strategy field for Advanced Deployment", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "rollingStyle": { - SchemaProps: spec.SchemaProps{ - Description: "RollingStyle define the behavior of rolling for deployment.", - Type: []string{"string"}, - Format: "", - }, - }, - "rollingUpdate": { - SchemaProps: spec.SchemaProps{ - Description: "original deployment strategy rolling update fields", - Ref: ref("k8s.io/api/apps/v1.RollingUpdateDeployment"), - }, - }, - "paused": { - SchemaProps: spec.SchemaProps{ - Description: "Paused = true will block the upgrade of Pods", - Type: []string{"boolean"}, - Format: "", - }, - }, - "partition": { - SchemaProps: spec.SchemaProps{ - Description: "Partition describe how many Pods should be updated during rollout. We use this field to implement partition-style rolling update.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/api/apps/v1.RollingUpdateDeployment", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_GatewayTrafficRouting(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -773,37 +365,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_GatewayTrafficRoutin } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_HTTPRouteInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "HTTPRouteInfo indicates information of gateway API", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "data": { - SchemaProps: spec.SchemaProps{ - Description: "Data indecates the spec of object ref", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"name"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_HttpRouteMatch(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -832,37 +393,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_HttpRouteMatch(ref c } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "IngressInfo indicates information of the ingress related", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "data": { - SchemaProps: spec.SchemaProps{ - Description: "Data indecates the spec of object ref", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"name"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressTrafficRouting(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -892,36 +422,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressTrafficRoutin } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_NameAndSpecData(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "data": { - SchemaProps: spec.SchemaProps{ - Description: "Data indecates the spec of object ref", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"name"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ObjectRef(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -986,141 +486,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_PatchPodTemplateMeta } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_Pod(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Pod indicates the information of a pod, including name, ip, node_name.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the node name", - Type: []string{"string"}, - Format: "", - }, - }, - "ip": { - SchemaProps: spec.SchemaProps{ - Description: "IP indicates the pod ip", - Type: []string{"string"}, - Format: "", - }, - }, - "nodeName": { - SchemaProps: spec.SchemaProps{ - Description: "NodeName indicates the node which pod is located at", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ReleaseBatch(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ReleaseBatch is used to describe how each batch release should be", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "canaryReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "CanaryReplicas is the number of upgraded pods that should have in this batch. it can be an absolute number (ex: 5) or a percentage of workload replicas. batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - }, - Required: []string{"canaryReplicas"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ReleasePlan(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ReleasePlan fines the details of the release plan", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "batches": { - SchemaProps: spec.SchemaProps{ - Description: "Batches is the details on each batch of the ReleasePlan. Users can specify their batch plan in this field, such as: batches: - canaryReplicas: 1 # batches 0 - canaryReplicas: 2 # batches 1 - canaryReplicas: 5 # batches 2 Not that these canaryReplicas should be a non-decreasing sequence.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ReleaseBatch"), - }, - }, - }, - }, - }, - "batchPartition": { - SchemaProps: spec.SchemaProps{ - Description: "All pods in the batches up to the batchPartition (included) will have the target resource specification while the rest still is the stable revision. This is designed for the operators to manually rollout. Default is nil, which means no partition and will release all batches. BatchPartition start from 0.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "rolloutID": { - SchemaProps: spec.SchemaProps{ - Description: "RolloutID indicates an id for each rollout progress", - Type: []string{"string"}, - Format: "", - }, - }, - "failureThreshold": { - SchemaProps: spec.SchemaProps{ - Description: "FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods. Only when FailureThreshold are satisfied, Rollout can enter ready state. If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its FailureThreshold. Defaults to nil.", - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - "finalizingPolicy": { - SchemaProps: spec.SchemaProps{ - Description: "FinalizingPolicy define the behavior of controller when phase enter Finalizing Defaults to \"Immediate\"", - Type: []string{"string"}, - Format: "", - }, - }, - "patchPodTemplateMetadata": { - SchemaProps: spec.SchemaProps{ - Description: "PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata only support for canary deployment", - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.PatchPodTemplateMetadata"), - }, - }, - "rollingStyle": { - SchemaProps: spec.SchemaProps{ - Description: "RollingStyle can be \"Canary\", \"Partiton\" or \"BlueGreen\"", - Type: []string{"string"}, - Format: "", - }, - }, - "enableExtraWorkloadForCanary": { - SchemaProps: spec.SchemaProps{ - Description: "EnableExtraWorkloadForCanary indicates whether to create extra workload for canary True corresponds to RollingStyle \"Canary\". False corresponds to RollingStyle \"Partiton\". Ignored in BlueGreen-style. This field is about to deprecate, use RollingStyle instead. If both of them are set, controller will only consider this filed when RollingStyle is empty", - Default: false, - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - Required: []string{"enableExtraWorkloadForCanary"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.PatchPodTemplateMetadata", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ReleaseBatch", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_Rollout(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1230,220 +595,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutCondition(ref } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistory(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RolloutHistory is the Schema for the rollouthistories 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-rollout-api/rollouts/v1alpha1.RolloutHistorySpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistoryStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistorySpec", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistoryStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistoryList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RolloutHistoryList contains a list of RolloutHistory", - 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-rollout-api/rollouts/v1alpha1.RolloutHistory"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutHistory", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistorySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RolloutHistorySpec defines the desired state of RolloutHistory", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "rollout": { - SchemaProps: spec.SchemaProps{ - Description: "Rollout indicates information of the rollout related with rollouthistory", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutInfo"), - }, - }, - "workload": { - SchemaProps: spec.SchemaProps{ - Description: "Workload indicates information of the workload, such as cloneset, deployment, advanced statefulset", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.WorkloadInfo"), - }, - }, - "service": { - SchemaProps: spec.SchemaProps{ - Description: "Service indicates information of the service related with workload", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ServiceInfo"), - }, - }, - "trafficRouting": { - SchemaProps: spec.SchemaProps{ - Description: "TrafficRouting indicates information of traffic route related with workload", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingInfo"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutInfo", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ServiceInfo", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingInfo", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.WorkloadInfo"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutHistoryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RolloutHistoryStatus defines the observed state of RolloutHistory", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "phase": { - SchemaProps: spec.SchemaProps{ - Description: "Phase indicates phase of RolloutHistory, just \"\" or \"completed\"", - Type: []string{"string"}, - Format: "", - }, - }, - "canarySteps": { - SchemaProps: spec.SchemaProps{ - Description: "CanarySteps indicates the pods released each step", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStepInfo"), - }, - }, - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStepInfo"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RolloutInfo indicates information of the rollout related", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "rolloutID": { - SchemaProps: spec.SchemaProps{ - Description: "RolloutID indicates the new rollout if there is no new RolloutID this time, ignore it and not execute RolloutHistory", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "data": { - SchemaProps: spec.SchemaProps{ - Description: "Data indecates the spec of object ref", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"rolloutID", "name"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1641,37 +792,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutStrategy(ref } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ServiceInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ServiceInfo indicates information of the service related", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "data": { - SchemaProps: spec.SchemaProps{ - Description: "Data indecates the spec of object ref", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"name"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRouting(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1719,33 +839,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRouting(ref c } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "TrafficRoutingInfo indicates information of Gateway API or Ingress", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "ingress": { - SchemaProps: spec.SchemaProps{ - Description: "IngressRef indicates information of ingress", - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.IngressInfo"), - }, - }, - "httpRoute": { - SchemaProps: spec.SchemaProps{ - Description: "HTTPRouteRef indacates information of Gateway API", - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.HTTPRouteInfo"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.HTTPRouteInfo", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.IngressInfo"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1962,51 +1055,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingStrate } } -func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_WorkloadInfo(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "WorkloadInfo indicates information of the workload, such as cloneset, deployment, advanced 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: "", - }, - }, - "name": { - SchemaProps: spec.SchemaProps{ - Description: "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "data": { - SchemaProps: spec.SchemaProps{ - Description: "Data indecates the spec of object ref", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), - }, - }, - }, - Required: []string{"name"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/runtime.RawExtension"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_WorkloadRef(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -2045,287 +1093,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_WorkloadRef(ref comm } } -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchRelease(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - 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-rollout-api/rollouts/v1beta1.BatchReleaseSpec"), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseStatus"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseSpec", "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseCanaryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "batchState": { - SchemaProps: spec.SchemaProps{ - Description: "CurrentBatchState indicates the release state of the current batch.", - Type: []string{"string"}, - Format: "", - }, - }, - "currentBatch": { - SchemaProps: spec.SchemaProps{ - Description: "The current batch the rollout is working on/blocked, it starts from 0", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - "batchReadyTime": { - SchemaProps: spec.SchemaProps{ - Description: "BatchReadyTime is the ready timestamp of the current batch or the last batch. This field is updated once a batch ready, and the batches[x].pausedSeconds relies on this field to calculate the real-time duration.", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), - }, - }, - "updatedReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "UpdatedReplicas is the number of upgraded Pods.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "updatedReadyReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "noNeedUpdateReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "the number of pods that no need to rollback in rollback scene.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"currentBatch"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BatchReleaseList contains a list of BatchRelease", - 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-rollout-api/rollouts/v1beta1.BatchRelease"), - }, - }, - }, - }, - }, - }, - Required: []string{"items"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchRelease", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BatchReleaseSpec defines how to describe an update between different compRevision", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "workloadRef": { - SchemaProps: spec.SchemaProps{ - Description: "WorkloadRef contains enough information to let you identify a workload for Rollout Batch release of the bypass", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ObjectRef"), - }, - }, - "releasePlan": { - SchemaProps: spec.SchemaProps{ - Description: "ReleasePlan is the details on how to rollout the resources", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ReleasePlan"), - }, - }, - }, - Required: []string{"releasePlan"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ObjectRef", "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ReleasePlan"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BatchReleaseStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BatchReleaseStatus defines the observed state of a release plan", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "conditions": { - SchemaProps: spec.SchemaProps{ - Description: "Conditions represents the observed process state of each phase during executing the release plan.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutCondition"), - }, - }, - }, - }, - }, - "canaryStatus": { - SchemaProps: spec.SchemaProps{ - Description: "CanaryStatus describes the state of the canary rollout.", - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseCanaryStatus"), - }, - }, - "stableRevision": { - SchemaProps: spec.SchemaProps{ - Description: "StableRevision is the pod-template-hash of stable revision pod template.", - Type: []string{"string"}, - Format: "", - }, - }, - "updateRevision": { - SchemaProps: spec.SchemaProps{ - Description: "UpdateRevision is the pod-template-hash of update revision pod template.", - Type: []string{"string"}, - Format: "", - }, - }, - "observedGeneration": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedGeneration is the most recent generation observed for this BatchRelease. It corresponds to this BatchRelease's generation, which is updated on mutation by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1.", - Type: []string{"integer"}, - Format: "int64", - }, - }, - "observedRolloutID": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedRolloutID is the most recent rollout-id observed for this BatchRelease. If RolloutID was changed, we will restart to roll out from batch 0, to ensure the batch-id and rollout-id labels of Pods are correct.", - Type: []string{"string"}, - Format: "", - }, - }, - "observedWorkloadReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedWorkloadReplicas is observed replicas of target referenced workload. This field is designed to deal with scaling event during rollout, if this field changed, it means that the workload is scaling during rollout.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "collisionCount": { - SchemaProps: spec.SchemaProps{ - Description: "Count of hash collisions for creating canary Deployment. The controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest canary Deployment.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "observedReleasePlanHash": { - SchemaProps: spec.SchemaProps{ - Description: "ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan.", - Type: []string{"string"}, - Format: "", - }, - }, - "phase": { - SchemaProps: spec.SchemaProps{ - Description: "Phase is the release plan phase, which indicates the current state of release plan state machine in BatchRelease controller.", - Type: []string{"string"}, - Format: "", - }, - }, - "message": { - SchemaProps: spec.SchemaProps{ - Description: "Message provides details on why the rollout is in its current phase", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.BatchReleaseCanaryStatus", "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutCondition"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_BlueGreenStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3114,107 +1881,6 @@ func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_PatchPodTemplateMetad } } -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_ReleaseBatch(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ReleaseBatch is used to describe how each batch release should be", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "canaryReplicas": { - SchemaProps: spec.SchemaProps{ - Description: "CanaryReplicas is the number of upgraded pods that should have in this batch. it can be an absolute number (ex: 5) or a percentage of workload replicas. batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j.", - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - }, - Required: []string{"canaryReplicas"}, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, - } -} - -func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_ReleasePlan(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ReleasePlan fines the details of the release plan", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "batches": { - SchemaProps: spec.SchemaProps{ - Description: "Batches is the details on each batch of the ReleasePlan. Users can specify their batch plan in this field, such as: batches: - canaryReplicas: 1 # batches 0 - canaryReplicas: 2 # batches 1 - canaryReplicas: 5 # batches 2 Not that these canaryReplicas should be a non-decreasing sequence.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ReleaseBatch"), - }, - }, - }, - }, - }, - "batchPartition": { - SchemaProps: spec.SchemaProps{ - Description: "All pods in the batches up to the batchPartition (included) will have the target resource specification while the rest still is the stable revision. This is designed for the operators to manually rollout. Default is nil, which means no partition and will release all batches. BatchPartition start from 0.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "rolloutID": { - SchemaProps: spec.SchemaProps{ - Description: "RolloutID indicates an id for each rollout progress", - Type: []string{"string"}, - Format: "", - }, - }, - "failureThreshold": { - SchemaProps: spec.SchemaProps{ - Description: "FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods. Only when FailureThreshold are satisfied, Rollout can enter ready state. If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its FailureThreshold. Defaults to nil.", - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - "finalizingPolicy": { - SchemaProps: spec.SchemaProps{ - Description: "FinalizingPolicy define the behavior of controller when phase enter Finalizing Defaults to \"Immediate\"", - Type: []string{"string"}, - Format: "", - }, - }, - "patchPodTemplateMetadata": { - SchemaProps: spec.SchemaProps{ - Description: "PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata only support for canary deployment", - Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.PatchPodTemplateMetadata"), - }, - }, - "rollingStyle": { - SchemaProps: spec.SchemaProps{ - Description: "RollingStyle can be \"Canary\", \"Partiton\" or \"BlueGreen\"", - Type: []string{"string"}, - Format: "", - }, - }, - "enableExtraWorkloadForCanary": { - SchemaProps: spec.SchemaProps{ - Description: "EnableExtraWorkloadForCanary indicates whether to create extra workload for canary True corresponds to RollingStyle \"Canary\". False corresponds to RollingStyle \"Partiton\". Ignored in BlueGreen-style. This field is about to deprecate, use RollingStyle instead. If both of them are set, controller will only consider this filed when RollingStyle is empty", - Default: false, - Type: []string{"boolean"}, - Format: "", - }, - }, - }, - Required: []string{"enableExtraWorkloadForCanary"}, - }, - }, - Dependencies: []string{ - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.PatchPodTemplateMetadata", "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.ReleaseBatch", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, - } -} - func schema_openkruise_kruise_rollout_api_rollouts_v1beta1_Rollout(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/rollouts/violation_exceptions.list b/pkg/rollouts/violation_exceptions.list index 7308ff7..53d42bb 100644 --- a/pkg/rollouts/violation_exceptions.list +++ b/pkg/rollouts/violation_exceptions.list @@ -1,24 +1,15 @@ -API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,BatchReleaseStatus,Conditions -API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,CanaryStepInfo,Pods API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,CanaryStrategy,Steps API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,CanaryStrategy,TrafficRoutings API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,HttpRouteMatch,Headers -API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,ReleasePlan,Batches -API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutHistoryStatus,CanarySteps API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutStatus,Conditions API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,TrafficRoutingRef,CustomNetworkRefs API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,TrafficRoutingSpec,ObjectRef API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,TrafficRoutingStrategy,Matches -API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BatchReleaseStatus,Conditions API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BlueGreenStrategy,Steps API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BlueGreenStrategy,TrafficRoutings API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,Steps API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,TrafficRoutings -API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,ReleasePlan,Batches API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,RolloutStatus,Conditions API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,TrafficRoutingRef,CustomNetworkRefs API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,TrafficRoutingStrategy,Matches -API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,BatchReleaseCanaryStatus,CurrentBatchState -API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,BatchReleaseSpec,TargetRef API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutSpec,DeprecatedRolloutID -API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BatchReleaseCanaryStatus,CurrentBatchState diff --git a/rollouts/v1alpha1/batchrelease_plan_types.go b/rollouts/v1alpha1/batchrelease_plan_types.go deleted file mode 100644 index 01dda46..0000000 --- a/rollouts/v1alpha1/batchrelease_plan_types.go +++ /dev/null @@ -1,157 +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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -// ReleasePlan fines the details of the release plan -type ReleasePlan struct { - // Batches is the details on each batch of the ReleasePlan. - //Users can specify their batch plan in this field, such as: - // batches: - // - canaryReplicas: 1 # batches 0 - // - canaryReplicas: 2 # batches 1 - // - canaryReplicas: 5 # batches 2 - // Not that these canaryReplicas should be a non-decreasing sequence. - // +optional - Batches []ReleaseBatch `json:"batches"` - // All pods in the batches up to the batchPartition (included) will have - // the target resource specification while the rest still is the stable revision. - // This is designed for the operators to manually rollout. - // Default is nil, which means no partition and will release all batches. - // BatchPartition start from 0. - // +optional - BatchPartition *int32 `json:"batchPartition,omitempty"` - // RolloutID indicates an id for each rollout progress - RolloutID string `json:"rolloutID,omitempty"` - // FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods. - // Only when FailureThreshold are satisfied, Rollout can enter ready state. - // If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its - // FailureThreshold. - // Defaults to nil. - FailureThreshold *intstr.IntOrString `json:"failureThreshold,omitempty"` - // FinalizingPolicy define the behavior of controller when phase enter Finalizing - // Defaults to "Immediate" - FinalizingPolicy FinalizingPolicyType `json:"finalizingPolicy,omitempty"` - // PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata - // only support for canary deployment - // +optional - PatchPodTemplateMetadata *PatchPodTemplateMetadata `json:"patchPodTemplateMetadata,omitempty"` - // RollingStyle can be "Canary", "Partiton" or "BlueGreen" - RollingStyle RollingStyleType `json:"rollingStyle,omitempty"` - // EnableExtraWorkloadForCanary indicates whether to create extra workload for canary - // True corresponds to RollingStyle "Canary". - // False corresponds to RollingStyle "Partiton". - // Ignored in BlueGreen-style. - // This field is about to deprecate, use RollingStyle instead. - // If both of them are set, controller will only consider this - // filed when RollingStyle is empty - EnableExtraWorkloadForCanary bool `json:"enableExtraWorkloadForCanary"` -} - -type FinalizingPolicyType string - -const ( - // WaitResumeFinalizingPolicyType will wait workload to be resumed, which means - // controller will be hold at Finalizing phase util all pods of workload is upgraded. - // WaitResumeFinalizingPolicyType only works in canary-style BatchRelease controller. - WaitResumeFinalizingPolicyType FinalizingPolicyType = "WaitResume" - // ImmediateFinalizingPolicyType will not to wait workload to be resumed. - ImmediateFinalizingPolicyType FinalizingPolicyType = "Immediate" -) - -// ReleaseBatch is used to describe how each batch release should be -type ReleaseBatch struct { - // CanaryReplicas is the number of upgraded pods that should have in this batch. - // it can be an absolute number (ex: 5) or a percentage of workload replicas. - // batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j. - CanaryReplicas intstr.IntOrString `json:"canaryReplicas"` -} - -// BatchReleaseStatus defines the observed state of a release plan -type BatchReleaseStatus struct { - // Conditions represents the observed process state of each phase during executing the release plan. - Conditions []RolloutCondition `json:"conditions,omitempty"` - // CanaryStatus describes the state of the canary rollout. - CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"` - // StableRevision is the pod-template-hash of stable revision pod template. - StableRevision string `json:"stableRevision,omitempty"` - // UpdateRevision is the pod-template-hash of update revision pod template. - UpdateRevision string `json:"updateRevision,omitempty"` - // ObservedGeneration is the most recent generation observed for this BatchRelease. - // It corresponds to this BatchRelease's generation, which is updated on mutation - // by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1. - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - // ObservedRolloutID is the most recent rollout-id observed for this BatchRelease. - // If RolloutID was changed, we will restart to roll out from batch 0, - // to ensure the batch-id and rollout-id labels of Pods are correct. - ObservedRolloutID string `json:"observedRolloutID,omitempty"` - // ObservedWorkloadReplicas is observed replicas of target referenced workload. - // This field is designed to deal with scaling event during rollout, if this field changed, - // it means that the workload is scaling during rollout. - ObservedWorkloadReplicas int32 `json:"observedWorkloadReplicas,omitempty"` - // Count of hash collisions for creating canary Deployment. The controller uses this - // field as a collision avoidance mechanism when it needs to create the name for the - // newest canary Deployment. - // +optional - CollisionCount *int32 `json:"collisionCount,omitempty"` - // ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan. - ObservedReleasePlanHash string `json:"observedReleasePlanHash,omitempty"` - // Phase is the release plan phase, which indicates the current state of release - // plan state machine in BatchRelease controller. - Phase RolloutPhase `json:"phase,omitempty"` -} - -type BatchReleaseCanaryStatus struct { - // CurrentBatchState indicates the release state of the current batch. - CurrentBatchState BatchReleaseBatchStateType `json:"batchState,omitempty"` - // The current batch the rollout is working on/blocked, it starts from 0 - CurrentBatch int32 `json:"currentBatch"` - // BatchReadyTime is the ready timestamp of the current batch or the last batch. - // This field is updated once a batch ready, and the batches[x].pausedSeconds - // relies on this field to calculate the real-time duration. - BatchReadyTime *metav1.Time `json:"batchReadyTime,omitempty"` - // UpdatedReplicas is the number of upgraded Pods. - UpdatedReplicas int32 `json:"updatedReplicas,omitempty"` - // UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition. - UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"` - // the number of pods that no need to rollback in rollback scene. - NoNeedUpdateReplicas *int32 `json:"noNeedUpdateReplicas,omitempty"` -} - -type BatchReleaseBatchStateType string - -const ( - // UpgradingBatchState indicates that current batch is at upgrading pod state - UpgradingBatchState BatchReleaseBatchStateType = "Upgrading" - // VerifyingBatchState indicates that current batch is at verifying whether it's ready state - VerifyingBatchState BatchReleaseBatchStateType = "Verifying" - // ReadyBatchState indicates that current batch is at batch ready state - ReadyBatchState BatchReleaseBatchStateType = "Ready" -) - -const ( - // RolloutPhasePreparing indicates a rollout is preparing for next progress. - RolloutPhasePreparing RolloutPhase = "Preparing" - // RolloutPhaseFinalizing indicates a rollout is finalizing - RolloutPhaseFinalizing RolloutPhase = "Finalizing" - // RolloutPhaseCompleted indicates a rollout is completed/cancelled/terminated - RolloutPhaseCompleted RolloutPhase = "Completed" -) diff --git a/rollouts/v1alpha1/batchrelease_types.go b/rollouts/v1alpha1/batchrelease_types.go deleted file mode 100644 index bcbcd86..0000000 --- a/rollouts/v1alpha1/batchrelease_types.go +++ /dev/null @@ -1,59 +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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:openapi-gen=true -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="KIND",type=string,JSONPath=`.spec.targetReference.workloadRef.kind` -// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase` -// +kubebuilder:printcolumn:name="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch` -// +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState` -// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp" - -type BatchRelease struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec BatchReleaseSpec `json:"spec,omitempty"` - Status BatchReleaseStatus `json:"status,omitempty"` -} - -// BatchReleaseSpec defines how to describe an update between different compRevision -type BatchReleaseSpec struct { - // TargetRef contains the GVK and name of the workload that we need to upgrade to. - TargetRef ObjectRef `json:"targetReference"` - // ReleasePlan is the details on how to rollout the resources - ReleasePlan ReleasePlan `json:"releasePlan"` -} - -// BatchReleaseList contains a list of BatchRelease -// +kubebuilder:object:root=true -type BatchReleaseList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []BatchRelease `json:"items"` -} - -func init() { - SchemeBuilder.Register(&BatchRelease{}, &BatchReleaseList{}) -} diff --git a/rollouts/v1alpha1/conversion.go b/rollouts/v1alpha1/conversion.go deleted file mode 100644 index b6fa87a..0000000 --- a/rollouts/v1alpha1/conversion.go +++ /dev/null @@ -1,477 +0,0 @@ -/* -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 ( - "fmt" - - "strings" - - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" - "github.com/openkruise/kruise-rollout-api/utils/conversion" - "k8s.io/apimachinery/pkg/util/intstr" - utilpointer "k8s.io/utils/pointer" -) - -func (src *Rollout) ConvertTo(dst conversion.Hub) error { - switch t := dst.(type) { - case *v1beta1.Rollout: - obj := dst.(*v1beta1.Rollout) - obj.ObjectMeta = src.ObjectMeta - obj.Spec = v1beta1.RolloutSpec{} - srcSpec := src.Spec - obj.Spec.WorkloadRef = v1beta1.ObjectRef{ - APIVersion: srcSpec.ObjectRef.WorkloadRef.APIVersion, - Kind: srcSpec.ObjectRef.WorkloadRef.Kind, - Name: srcSpec.ObjectRef.WorkloadRef.Name, - } - obj.Spec.Disabled = srcSpec.Disabled - obj.Spec.Strategy = v1beta1.RolloutStrategy{ - Paused: srcSpec.Strategy.Paused, - Canary: &v1beta1.CanaryStrategy{ - FailureThreshold: srcSpec.Strategy.Canary.FailureThreshold, - }, - } - for _, step := range srcSpec.Strategy.Canary.Steps { - o := v1beta1.CanaryStep{ - TrafficRoutingStrategy: ConversionToV1beta1TrafficRoutingStrategy(step.TrafficRoutingStrategy), - Replicas: step.Replicas, - Pause: v1beta1.RolloutPause{Duration: step.Pause.Duration}, - } - if step.Replicas == nil && step.Weight != nil { - o.Replicas = &intstr.IntOrString{ - Type: intstr.String, - StrVal: fmt.Sprintf("%d", *step.Weight) + "%", - } - } - obj.Spec.Strategy.Canary.Steps = append(obj.Spec.Strategy.Canary.Steps, o) - } - for _, ref := range srcSpec.Strategy.Canary.TrafficRoutings { - o := ConversionToV1beta1TrafficRoutingRef(ref) - obj.Spec.Strategy.Canary.TrafficRoutings = append(obj.Spec.Strategy.Canary.TrafficRoutings, o) - } - if srcSpec.Strategy.Canary.PatchPodTemplateMetadata != nil { - obj.Spec.Strategy.Canary.PatchPodTemplateMetadata = &v1beta1.PatchPodTemplateMetadata{ - Annotations: map[string]string{}, - Labels: map[string]string{}, - } - for k, v := range srcSpec.Strategy.Canary.PatchPodTemplateMetadata.Annotations { - obj.Spec.Strategy.Canary.PatchPodTemplateMetadata.Annotations[k] = v - } - for k, v := range srcSpec.Strategy.Canary.PatchPodTemplateMetadata.Labels { - obj.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels[k] = v - } - } - if !strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(PartitionRollingStyle)) { - obj.Spec.Strategy.Canary.EnableExtraWorkloadForCanary = true - } - if src.Annotations[TrafficRoutingAnnotation] != "" { - obj.Spec.Strategy.Canary.TrafficRoutingRef = src.Annotations[TrafficRoutingAnnotation] - } - - // status - obj.Status = v1beta1.RolloutStatus{ - ObservedGeneration: src.Status.ObservedGeneration, - Phase: v1beta1.RolloutPhase(src.Status.Phase), - Message: src.Status.Message, - } - for _, cond := range src.Status.Conditions { - o := v1beta1.RolloutCondition{ - Type: v1beta1.RolloutConditionType(cond.Type), - Status: cond.Status, - LastUpdateTime: cond.LastUpdateTime, - LastTransitionTime: cond.LastTransitionTime, - Reason: cond.Reason, - Message: cond.Message, - } - obj.Status.Conditions = append(obj.Status.Conditions, o) - } - if src.Status.CanaryStatus == nil { - return nil - } - obj.Status.CanaryStatus = &v1beta1.CanaryStatus{ - CommonStatus: v1beta1.CommonStatus{ - ObservedWorkloadGeneration: src.Status.CanaryStatus.ObservedWorkloadGeneration, - ObservedRolloutID: src.Status.CanaryStatus.ObservedRolloutID, - RolloutHash: src.Status.CanaryStatus.RolloutHash, - StableRevision: src.Status.CanaryStatus.StableRevision, - PodTemplateHash: src.Status.CanaryStatus.PodTemplateHash, - CurrentStepIndex: src.Status.CanaryStatus.CurrentStepIndex, - CurrentStepState: v1beta1.CanaryStepState(src.Status.CanaryStatus.CurrentStepState), - Message: src.Status.CanaryStatus.Message, - LastUpdateTime: src.Status.CanaryStatus.LastUpdateTime, - FinalisingStep: v1beta1.FinalisingStepType(src.Status.CanaryStatus.FinalisingStep), - NextStepIndex: src.Status.CanaryStatus.NextStepIndex, - }, - CanaryRevision: src.Status.CanaryStatus.CanaryRevision, - CanaryReplicas: src.Status.CanaryStatus.CanaryReplicas, - CanaryReadyReplicas: src.Status.CanaryStatus.CanaryReadyReplicas, - } - return nil - default: - return fmt.Errorf("unsupported type %v", t) - } -} - -func ConversionToV1beta1TrafficRoutingRef(src TrafficRoutingRef) (dst v1beta1.TrafficRoutingRef) { - dst.Service = src.Service - dst.GracePeriodSeconds = src.GracePeriodSeconds - if src.Ingress != nil { - dst.Ingress = &v1beta1.IngressTrafficRouting{ - ClassType: src.Ingress.ClassType, - Name: src.Ingress.Name, - } - } - if src.Gateway != nil { - dst.Gateway = &v1beta1.GatewayTrafficRouting{ - HTTPRouteName: src.Gateway.HTTPRouteName, - } - } - for _, ref := range src.CustomNetworkRefs { - obj := v1beta1.ObjectRef{ - APIVersion: ref.APIVersion, - Kind: ref.Kind, - Name: ref.Name, - } - dst.CustomNetworkRefs = append(dst.CustomNetworkRefs, obj) - } - return dst -} - -func ConversionToV1beta1TrafficRoutingStrategy(src TrafficRoutingStrategy) (dst v1beta1.TrafficRoutingStrategy) { - if src.Weight != nil { - dst.Traffic = utilpointer.String(fmt.Sprintf("%d", *src.Weight) + "%") - } - dst.RequestHeaderModifier = src.RequestHeaderModifier - for _, match := range src.Matches { - obj := v1beta1.HttpRouteMatch{ - Headers: match.Headers, - } - dst.Matches = append(dst.Matches, obj) - } - return dst -} - -func (dst *Rollout) ConvertFrom(src conversion.Hub) error { - switch t := src.(type) { - case *v1beta1.Rollout: - srcV1beta1 := src.(*v1beta1.Rollout) - dst.ObjectMeta = srcV1beta1.ObjectMeta - if !srcV1beta1.Spec.Strategy.IsCanaryStragegy() { - // only v1beta1 supports bluegreen strategy - // Don't log the message because it will print too often - return nil - } - // spec - dst.Spec = RolloutSpec{ - ObjectRef: ObjectRef{ - WorkloadRef: &WorkloadRef{ - APIVersion: srcV1beta1.Spec.WorkloadRef.APIVersion, - Kind: srcV1beta1.Spec.WorkloadRef.Kind, - Name: srcV1beta1.Spec.WorkloadRef.Name, - }, - }, - Strategy: RolloutStrategy{ - Paused: srcV1beta1.Spec.Strategy.Paused, - Canary: &CanaryStrategy{ - FailureThreshold: srcV1beta1.Spec.Strategy.Canary.FailureThreshold, - }, - }, - Disabled: srcV1beta1.Spec.Disabled, - } - for _, step := range srcV1beta1.Spec.Strategy.Canary.Steps { - obj := CanaryStep{ - TrafficRoutingStrategy: ConversionToV1alpha1TrafficRoutingStrategy(step.TrafficRoutingStrategy), - Replicas: step.Replicas, - Pause: RolloutPause{Duration: step.Pause.Duration}, - } - dst.Spec.Strategy.Canary.Steps = append(dst.Spec.Strategy.Canary.Steps, obj) - } - for _, ref := range srcV1beta1.Spec.Strategy.Canary.TrafficRoutings { - obj := ConversionToV1alpha1TrafficRoutingRef(ref) - dst.Spec.Strategy.Canary.TrafficRoutings = append(dst.Spec.Strategy.Canary.TrafficRoutings, obj) - } - if srcV1beta1.Spec.Strategy.Canary.PatchPodTemplateMetadata != nil { - dst.Spec.Strategy.Canary.PatchPodTemplateMetadata = &PatchPodTemplateMetadata{ - Annotations: map[string]string{}, - Labels: map[string]string{}, - } - for k, v := range srcV1beta1.Spec.Strategy.Canary.PatchPodTemplateMetadata.Annotations { - dst.Spec.Strategy.Canary.PatchPodTemplateMetadata.Annotations[k] = v - } - for k, v := range srcV1beta1.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels { - dst.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels[k] = v - } - } - if dst.Annotations == nil { - dst.Annotations = map[string]string{} - } - if srcV1beta1.Spec.Strategy.Canary.EnableExtraWorkloadForCanary { - dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(CanaryRollingStyle)) - } else { - dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(PartitionRollingStyle)) - } - if srcV1beta1.Spec.Strategy.Canary.TrafficRoutingRef != "" { - dst.Annotations[TrafficRoutingAnnotation] = srcV1beta1.Spec.Strategy.Canary.TrafficRoutingRef - } - - // status - dst.Status = RolloutStatus{ - ObservedGeneration: srcV1beta1.Status.ObservedGeneration, - Phase: RolloutPhase(srcV1beta1.Status.Phase), - Message: srcV1beta1.Status.Message, - } - for _, cond := range srcV1beta1.Status.Conditions { - obj := RolloutCondition{ - Type: RolloutConditionType(cond.Type), - Status: cond.Status, - LastUpdateTime: cond.LastUpdateTime, - LastTransitionTime: cond.LastTransitionTime, - Reason: cond.Reason, - Message: cond.Message, - } - dst.Status.Conditions = append(dst.Status.Conditions, obj) - } - if srcV1beta1.Status.CanaryStatus == nil { - return nil - } - dst.Status.CanaryStatus = &CanaryStatus{ - ObservedWorkloadGeneration: srcV1beta1.Status.CanaryStatus.ObservedWorkloadGeneration, - ObservedRolloutID: srcV1beta1.Status.CanaryStatus.ObservedRolloutID, - RolloutHash: srcV1beta1.Status.CanaryStatus.RolloutHash, - StableRevision: srcV1beta1.Status.CanaryStatus.StableRevision, - CanaryRevision: srcV1beta1.Status.CanaryStatus.CanaryRevision, - PodTemplateHash: srcV1beta1.Status.CanaryStatus.PodTemplateHash, - CanaryReplicas: srcV1beta1.Status.CanaryStatus.CanaryReplicas, - CanaryReadyReplicas: srcV1beta1.Status.CanaryStatus.CanaryReadyReplicas, - CurrentStepIndex: srcV1beta1.Status.CanaryStatus.CurrentStepIndex, - CurrentStepState: CanaryStepState(srcV1beta1.Status.CanaryStatus.CurrentStepState), - Message: srcV1beta1.Status.CanaryStatus.Message, - LastUpdateTime: srcV1beta1.Status.CanaryStatus.LastUpdateTime, - FinalisingStep: FinalizeStateType(srcV1beta1.Status.CanaryStatus.FinalisingStep), - NextStepIndex: srcV1beta1.Status.CanaryStatus.NextStepIndex, - } - return nil - default: - return fmt.Errorf("unsupported type %v", t) - } -} - -func ConversionToV1alpha1TrafficRoutingStrategy(src v1beta1.TrafficRoutingStrategy) (dst TrafficRoutingStrategy) { - if src.Traffic != nil { - is := intstr.FromString(*src.Traffic) - weight, _ := intstr.GetScaledValueFromIntOrPercent(&is, 100, true) - dst.Weight = utilpointer.Int32(int32(weight)) - } - dst.RequestHeaderModifier = src.RequestHeaderModifier - for _, match := range src.Matches { - obj := HttpRouteMatch{ - Headers: match.Headers, - } - dst.Matches = append(dst.Matches, obj) - } - return dst -} - -func ConversionToV1alpha1TrafficRoutingRef(src v1beta1.TrafficRoutingRef) (dst TrafficRoutingRef) { - dst.Service = src.Service - dst.GracePeriodSeconds = src.GracePeriodSeconds - if src.Ingress != nil { - dst.Ingress = &IngressTrafficRouting{ - ClassType: src.Ingress.ClassType, - Name: src.Ingress.Name, - } - } - if src.Gateway != nil { - dst.Gateway = &GatewayTrafficRouting{ - HTTPRouteName: src.Gateway.HTTPRouteName, - } - } - for _, ref := range src.CustomNetworkRefs { - obj := CustomNetworkRef{ - APIVersion: ref.APIVersion, - Kind: ref.Kind, - Name: ref.Name, - } - dst.CustomNetworkRefs = append(dst.CustomNetworkRefs, obj) - } - return dst -} - -func (src *BatchRelease) ConvertTo(dst conversion.Hub) error { - switch t := dst.(type) { - case *v1beta1.BatchRelease: - obj := dst.(*v1beta1.BatchRelease) - obj.ObjectMeta = src.ObjectMeta - obj.Spec = v1beta1.BatchReleaseSpec{} - srcSpec := src.Spec - obj.Spec.WorkloadRef = v1beta1.ObjectRef{ - APIVersion: srcSpec.TargetRef.WorkloadRef.APIVersion, - Kind: srcSpec.TargetRef.WorkloadRef.Kind, - Name: srcSpec.TargetRef.WorkloadRef.Name, - } - obj.Spec.ReleasePlan = v1beta1.ReleasePlan{ - BatchPartition: srcSpec.ReleasePlan.BatchPartition, - RolloutID: srcSpec.ReleasePlan.RolloutID, - FailureThreshold: srcSpec.ReleasePlan.FailureThreshold, - FinalizingPolicy: v1beta1.FinalizingPolicyType(srcSpec.ReleasePlan.FinalizingPolicy), - } - for _, batch := range srcSpec.ReleasePlan.Batches { - o := v1beta1.ReleaseBatch{ - CanaryReplicas: batch.CanaryReplicas, - } - obj.Spec.ReleasePlan.Batches = append(obj.Spec.ReleasePlan.Batches, o) - } - if srcSpec.ReleasePlan.PatchPodTemplateMetadata != nil { - obj.Spec.ReleasePlan.PatchPodTemplateMetadata = &v1beta1.PatchPodTemplateMetadata{ - Annotations: map[string]string{}, - Labels: map[string]string{}, - } - for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Annotations { - obj.Spec.ReleasePlan.PatchPodTemplateMetadata.Annotations[k] = v - } - for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Labels { - obj.Spec.ReleasePlan.PatchPodTemplateMetadata.Labels[k] = v - } - } - - if strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(PartitionRollingStyle)) { - obj.Spec.ReleasePlan.RollingStyle = v1beta1.PartitionRollingStyle - } - if strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(CanaryRollingStyle)) { - obj.Spec.ReleasePlan.RollingStyle = v1beta1.CanaryRollingStyle - } - if strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(BlueGreenRollingStyle)) { - obj.Spec.ReleasePlan.RollingStyle = v1beta1.BlueGreenRollingStyle - } - - obj.Spec.ReleasePlan.EnableExtraWorkloadForCanary = srcSpec.ReleasePlan.EnableExtraWorkloadForCanary - - // status - obj.Status = v1beta1.BatchReleaseStatus{ - StableRevision: src.Status.StableRevision, - UpdateRevision: src.Status.UpdateRevision, - ObservedGeneration: src.Status.ObservedGeneration, - ObservedRolloutID: src.Status.ObservedRolloutID, - ObservedWorkloadReplicas: src.Status.ObservedWorkloadReplicas, - ObservedReleasePlanHash: src.Status.ObservedReleasePlanHash, - CollisionCount: src.Status.CollisionCount, - Phase: v1beta1.RolloutPhase(src.Status.Phase), - } - for _, cond := range src.Status.Conditions { - o := v1beta1.RolloutCondition{ - Type: v1beta1.RolloutConditionType(cond.Type), - Status: cond.Status, - LastUpdateTime: cond.LastUpdateTime, - LastTransitionTime: cond.LastTransitionTime, - Reason: cond.Reason, - Message: cond.Message, - } - obj.Status.Conditions = append(obj.Status.Conditions, o) - } - obj.Status.CanaryStatus = v1beta1.BatchReleaseCanaryStatus{ - CurrentBatchState: v1beta1.BatchReleaseBatchStateType(src.Status.CanaryStatus.CurrentBatchState), - CurrentBatch: src.Status.CanaryStatus.CurrentBatch, - BatchReadyTime: src.Status.CanaryStatus.BatchReadyTime, - UpdatedReplicas: src.Status.CanaryStatus.UpdatedReplicas, - UpdatedReadyReplicas: src.Status.CanaryStatus.UpdatedReadyReplicas, - NoNeedUpdateReplicas: src.Status.CanaryStatus.NoNeedUpdateReplicas, - } - return nil - default: - return fmt.Errorf("unsupported type %v", t) - } -} - -func (dst *BatchRelease) ConvertFrom(src conversion.Hub) error { - switch t := src.(type) { - case *v1beta1.BatchRelease: - srcV1beta1 := src.(*v1beta1.BatchRelease) - dst.ObjectMeta = srcV1beta1.ObjectMeta - dst.Spec = BatchReleaseSpec{} - srcSpec := srcV1beta1.Spec - dst.Spec.TargetRef.WorkloadRef = &WorkloadRef{ - APIVersion: srcSpec.WorkloadRef.APIVersion, - Kind: srcSpec.WorkloadRef.Kind, - Name: srcSpec.WorkloadRef.Name, - } - dst.Spec.ReleasePlan = ReleasePlan{ - BatchPartition: srcSpec.ReleasePlan.BatchPartition, - RolloutID: srcSpec.ReleasePlan.RolloutID, - FailureThreshold: srcSpec.ReleasePlan.FailureThreshold, - FinalizingPolicy: FinalizingPolicyType(srcSpec.ReleasePlan.FinalizingPolicy), - } - for _, batch := range srcSpec.ReleasePlan.Batches { - obj := ReleaseBatch{ - CanaryReplicas: batch.CanaryReplicas, - } - dst.Spec.ReleasePlan.Batches = append(dst.Spec.ReleasePlan.Batches, obj) - } - if srcSpec.ReleasePlan.PatchPodTemplateMetadata != nil { - dst.Spec.ReleasePlan.PatchPodTemplateMetadata = &PatchPodTemplateMetadata{ - Annotations: map[string]string{}, - Labels: map[string]string{}, - } - for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Annotations { - dst.Spec.ReleasePlan.PatchPodTemplateMetadata.Annotations[k] = v - } - for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Labels { - dst.Spec.ReleasePlan.PatchPodTemplateMetadata.Labels[k] = v - } - } - if dst.Annotations == nil { - dst.Annotations = map[string]string{} - } - dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(srcV1beta1.Spec.ReleasePlan.RollingStyle)) - dst.Spec.ReleasePlan.RollingStyle = RollingStyleType(srcV1beta1.Spec.ReleasePlan.RollingStyle) - dst.Spec.ReleasePlan.EnableExtraWorkloadForCanary = srcV1beta1.Spec.ReleasePlan.EnableExtraWorkloadForCanary - - // status - dst.Status = BatchReleaseStatus{ - StableRevision: srcV1beta1.Status.StableRevision, - UpdateRevision: srcV1beta1.Status.UpdateRevision, - ObservedGeneration: srcV1beta1.Status.ObservedGeneration, - ObservedRolloutID: srcV1beta1.Status.ObservedRolloutID, - ObservedWorkloadReplicas: srcV1beta1.Status.ObservedWorkloadReplicas, - ObservedReleasePlanHash: srcV1beta1.Status.ObservedReleasePlanHash, - CollisionCount: srcV1beta1.Status.CollisionCount, - Phase: RolloutPhase(srcV1beta1.Status.Phase), - } - for _, cond := range srcV1beta1.Status.Conditions { - obj := RolloutCondition{ - Type: RolloutConditionType(cond.Type), - Status: cond.Status, - LastUpdateTime: cond.LastUpdateTime, - LastTransitionTime: cond.LastTransitionTime, - Reason: cond.Reason, - Message: cond.Message, - } - dst.Status.Conditions = append(dst.Status.Conditions, obj) - } - dst.Status.CanaryStatus = BatchReleaseCanaryStatus{ - CurrentBatchState: BatchReleaseBatchStateType(srcV1beta1.Status.CanaryStatus.CurrentBatchState), - CurrentBatch: srcV1beta1.Status.CanaryStatus.CurrentBatch, - BatchReadyTime: srcV1beta1.Status.CanaryStatus.BatchReadyTime, - UpdatedReplicas: srcV1beta1.Status.CanaryStatus.UpdatedReplicas, - UpdatedReadyReplicas: srcV1beta1.Status.CanaryStatus.UpdatedReadyReplicas, - NoNeedUpdateReplicas: srcV1beta1.Status.CanaryStatus.NoNeedUpdateReplicas, - } - return nil - default: - return fmt.Errorf("unsupported type %v", t) - } -} diff --git a/rollouts/v1alpha1/deployment_types.go b/rollouts/v1alpha1/deployment_types.go deleted file mode 100644 index 98fc474..0000000 --- a/rollouts/v1alpha1/deployment_types.go +++ /dev/null @@ -1,105 +0,0 @@ -/* -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 ( - apps "k8s.io/api/apps/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -const ( - // DeploymentStrategyAnnotation is annotation for deployment, - // which is strategy fields of Advanced Deployment. - DeploymentStrategyAnnotation = "rollouts.kruise.io/deployment-strategy" - - // DeploymentExtraStatusAnnotation is annotation for deployment, - // which is extra status field of Advanced Deployment. - DeploymentExtraStatusAnnotation = "rollouts.kruise.io/deployment-extra-status" - - // DeploymentStableRevisionLabel is label for deployment, - // which record the stable revision during the current rolling process. - DeploymentStableRevisionLabel = "rollouts.kruise.io/stable-revision" - - // AdvancedDeploymentControlLabel is label for deployment, - // which labels whether the deployment is controlled by advanced-deployment-controller. - AdvancedDeploymentControlLabel = "rollouts.kruise.io/controlled-by-advanced-deployment-controller" -) - -// DeploymentStrategy is strategy field for Advanced Deployment -type DeploymentStrategy struct { - // RollingStyle define the behavior of rolling for deployment. - RollingStyle RollingStyleType `json:"rollingStyle,omitempty"` - // original deployment strategy rolling update fields - RollingUpdate *apps.RollingUpdateDeployment `json:"rollingUpdate,omitempty"` - // Paused = true will block the upgrade of Pods - Paused bool `json:"paused,omitempty"` - // Partition describe how many Pods should be updated during rollout. - // We use this field to implement partition-style rolling update. - Partition intstr.IntOrString `json:"partition,omitempty"` -} - -type RollingStyleType string - -const ( - // PartitionRollingStyle means rolling in batches just like CloneSet, and will NOT create any extra Deployment; - PartitionRollingStyle RollingStyleType = "Partition" - // CanaryRollingStyle means rolling in canary way, and will create a canary Deployment. - CanaryRollingStyle RollingStyleType = "Canary" - // BlueGreenRollingStyle means rolling in blue-green way, and will NOT create a canary Deployment. - BlueGreenRollingStyle RollingStyleType = "BlueGreen" -) - -// DeploymentExtraStatus is extra status field for Advanced Deployment -type DeploymentExtraStatus struct { - // UpdatedReadyReplicas the number of pods that has been updated and ready. - UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"` - // ExpectedUpdatedReplicas is an absolute number calculated based on Partition - // and Deployment.Spec.Replicas, means how many pods are expected be updated under - // current strategy. - // This field is designed to avoid users to fall into the details of algorithm - // for Partition calculation. - ExpectedUpdatedReplicas int32 `json:"expectedUpdatedReplicas,omitempty"` -} - -func SetDefaultDeploymentStrategy(strategy *DeploymentStrategy) { - if strategy.RollingStyle != PartitionRollingStyle { - return - } - if strategy.RollingUpdate == nil { - strategy.RollingUpdate = &apps.RollingUpdateDeployment{} - } - if strategy.RollingUpdate.MaxUnavailable == nil { - // Set MaxUnavailable as 25% by default - maxUnavailable := intstr.FromString("25%") - strategy.RollingUpdate.MaxUnavailable = &maxUnavailable - } - if strategy.RollingUpdate.MaxSurge == nil { - // Set MaxSurge as 25% by default - maxSurge := intstr.FromString("25%") - strategy.RollingUpdate.MaxUnavailable = &maxSurge - } - - // Cannot allow maxSurge==0 && MaxUnavailable==0, otherwise, no pod can be updated when rolling update. - maxSurge, _ := intstr.GetScaledValueFromIntOrPercent(strategy.RollingUpdate.MaxSurge, 100, true) - maxUnavailable, _ := intstr.GetScaledValueFromIntOrPercent(strategy.RollingUpdate.MaxUnavailable, 100, true) - if maxSurge == 0 && maxUnavailable == 0 { - strategy.RollingUpdate = &apps.RollingUpdateDeployment{ - MaxSurge: &intstr.IntOrString{Type: intstr.Int, IntVal: 0}, - MaxUnavailable: &intstr.IntOrString{Type: intstr.Int, IntVal: 1}, - } - } -} diff --git a/rollouts/v1alpha1/rollouthistory_types.go b/rollouts/v1alpha1/rollouthistory_types.go deleted file mode 100644 index 0a80be3..0000000 --- a/rollouts/v1alpha1/rollouthistory_types.go +++ /dev/null @@ -1,151 +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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// RolloutHistorySpec defines the desired state of RolloutHistory -type RolloutHistorySpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Rollout indicates information of the rollout related with rollouthistory - Rollout RolloutInfo `json:"rollout,omitempty"` - // Workload indicates information of the workload, such as cloneset, deployment, advanced statefulset - Workload WorkloadInfo `json:"workload,omitempty"` - // Service indicates information of the service related with workload - Service ServiceInfo `json:"service,omitempty"` - // TrafficRouting indicates information of traffic route related with workload - TrafficRouting TrafficRoutingInfo `json:"trafficRouting,omitempty"` -} - -type NameAndSpecData struct { - // Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc. - Name string `json:"name"` - // Data indecates the spec of object ref - // +kubebuilder:pruning:PreserveUnknownFields - // +kubebuilder:validation:Schemaless - Data runtime.RawExtension `json:"data,omitempty"` -} - -// RolloutInfo indicates information of the rollout related -type RolloutInfo struct { - // RolloutID indicates the new rollout - // if there is no new RolloutID this time, ignore it and not execute RolloutHistory - RolloutID string `json:"rolloutID"` - NameAndSpecData `json:",inline"` -} - -// ServiceInfo indicates information of the service related -type ServiceInfo struct { - NameAndSpecData `json:",inline"` -} - -// TrafficRoutingInfo indicates information of Gateway API or Ingress -type TrafficRoutingInfo struct { - // IngressRef indicates information of ingress - // +optional - Ingress *IngressInfo `json:"ingress,omitempty"` - // HTTPRouteRef indacates information of Gateway API - // +optional - HTTPRoute *HTTPRouteInfo `json:"httpRoute,omitempty"` -} - -// IngressInfo indicates information of the ingress related -type IngressInfo struct { - NameAndSpecData `json:",inline"` -} - -// HTTPRouteInfo indicates information of gateway API -type HTTPRouteInfo struct { - NameAndSpecData `json:",inline"` -} - -// WorkloadInfo indicates information of the workload, such as cloneset, deployment, advanced statefulset -type WorkloadInfo struct { - metav1.TypeMeta `json:",inline"` - NameAndSpecData `json:",inline"` -} - -// RolloutHistoryStatus defines the observed state of RolloutHistory -type RolloutHistoryStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - - // Phase indicates phase of RolloutHistory, just "" or "completed" - Phase string `json:"phase,omitempty"` - // CanarySteps indicates the pods released each step - CanarySteps []CanaryStepInfo `json:"canarySteps,omitempty"` -} - -// CanaryStepInfo indicates the pods for a revision -type CanaryStepInfo struct { - // CanaryStepIndex indicates step this revision - CanaryStepIndex int32 `json:"canaryStepIndex,omitempty"` - // Pods indicates the pods information - Pods []Pod `json:"pods,omitempty"` -} - -// Pod indicates the information of a pod, including name, ip, node_name. -type Pod struct { - // Name indicates the node name - Name string `json:"name,omitempty"` - // IP indicates the pod ip - IP string `json:"ip,omitempty"` - // NodeName indicates the node which pod is located at - NodeName string `json:"nodeName,omitempty"` - // todo - // State indicates whether the pod is ready or not - // State string `json:"state, omitempty"` -} - -// Phase indicates rollouthistory phase -const ( - PhaseCompleted string = "completed" -) - -// +genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status - -// RolloutHistory is the Schema for the rollouthistories API -type RolloutHistory struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec RolloutHistorySpec `json:"spec,omitempty"` - Status RolloutHistoryStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// RolloutHistoryList contains a list of RolloutHistory -type RolloutHistoryList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []RolloutHistory `json:"items"` -} - -func init() { - SchemeBuilder.Register(&RolloutHistory{}, &RolloutHistoryList{}) -} diff --git a/rollouts/v1alpha1/zz_generated.deepcopy.go b/rollouts/v1alpha1/zz_generated.deepcopy.go index b999a5b..f0b5c54 100644 --- a/rollouts/v1alpha1/zz_generated.deepcopy.go +++ b/rollouts/v1alpha1/zz_generated.deepcopy.go @@ -1,8 +1,7 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* -Copyright 2023 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,140 +21,11 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/api/apps/v1" - "k8s.io/apimachinery/pkg/runtime" + runtime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/gateway-api/apis/v1beta1" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BatchRelease) DeepCopyInto(out *BatchRelease) { - *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 BatchRelease. -func (in *BatchRelease) DeepCopy() *BatchRelease { - if in == nil { - return nil - } - out := new(BatchRelease) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BatchRelease) 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 *BatchReleaseCanaryStatus) DeepCopyInto(out *BatchReleaseCanaryStatus) { - *out = *in - if in.BatchReadyTime != nil { - in, out := &in.BatchReadyTime, &out.BatchReadyTime - *out = (*in).DeepCopy() - } - if in.NoNeedUpdateReplicas != nil { - in, out := &in.NoNeedUpdateReplicas, &out.NoNeedUpdateReplicas - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseCanaryStatus. -func (in *BatchReleaseCanaryStatus) DeepCopy() *BatchReleaseCanaryStatus { - if in == nil { - return nil - } - out := new(BatchReleaseCanaryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BatchReleaseList) DeepCopyInto(out *BatchReleaseList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]BatchRelease, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseList. -func (in *BatchReleaseList) DeepCopy() *BatchReleaseList { - if in == nil { - return nil - } - out := new(BatchReleaseList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BatchReleaseList) 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 *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) { - *out = *in - in.TargetRef.DeepCopyInto(&out.TargetRef) - in.ReleasePlan.DeepCopyInto(&out.ReleasePlan) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseSpec. -func (in *BatchReleaseSpec) DeepCopy() *BatchReleaseSpec { - if in == nil { - return nil - } - out := new(BatchReleaseSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BatchReleaseStatus) DeepCopyInto(out *BatchReleaseStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]RolloutCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.CanaryStatus.DeepCopyInto(&out.CanaryStatus) - if in.CollisionCount != nil { - in, out := &in.CollisionCount, &out.CollisionCount - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseStatus. -func (in *BatchReleaseStatus) DeepCopy() *BatchReleaseStatus { - if in == nil { - return nil - } - out := new(BatchReleaseStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) { *out = *in @@ -197,26 +67,6 @@ func (in *CanaryStep) DeepCopy() *CanaryStep { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CanaryStepInfo) DeepCopyInto(out *CanaryStepInfo) { - *out = *in - if in.Pods != nil { - in, out := &in.Pods, &out.Pods - *out = make([]Pod, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStepInfo. -func (in *CanaryStepInfo) DeepCopy() *CanaryStepInfo { - if in == nil { - return nil - } - out := new(CanaryStepInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CanaryStrategy) DeepCopyInto(out *CanaryStrategy) { *out = *in @@ -271,42 +121,6 @@ func (in *CustomNetworkRef) DeepCopy() *CustomNetworkRef { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DeploymentExtraStatus) DeepCopyInto(out *DeploymentExtraStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentExtraStatus. -func (in *DeploymentExtraStatus) DeepCopy() *DeploymentExtraStatus { - if in == nil { - return nil - } - out := new(DeploymentExtraStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DeploymentStrategy) DeepCopyInto(out *DeploymentStrategy) { - *out = *in - if in.RollingUpdate != nil { - in, out := &in.RollingUpdate, &out.RollingUpdate - *out = new(v1.RollingUpdateDeployment) - (*in).DeepCopyInto(*out) - } - out.Partition = in.Partition -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStrategy. -func (in *DeploymentStrategy) DeepCopy() *DeploymentStrategy { - if in == nil { - return nil - } - out := new(DeploymentStrategy) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatewayTrafficRouting) DeepCopyInto(out *GatewayTrafficRouting) { *out = *in @@ -327,22 +141,6 @@ func (in *GatewayTrafficRouting) DeepCopy() *GatewayTrafficRouting { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteInfo) DeepCopyInto(out *HTTPRouteInfo) { - *out = *in - in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteInfo. -func (in *HTTPRouteInfo) DeepCopy() *HTTPRouteInfo { - if in == nil { - return nil - } - out := new(HTTPRouteInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HttpRouteMatch) DeepCopyInto(out *HttpRouteMatch) { *out = *in @@ -365,22 +163,6 @@ func (in *HttpRouteMatch) DeepCopy() *HttpRouteMatch { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressInfo) DeepCopyInto(out *IngressInfo) { - *out = *in - in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressInfo. -func (in *IngressInfo) DeepCopy() *IngressInfo { - if in == nil { - return nil - } - out := new(IngressInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IngressTrafficRouting) DeepCopyInto(out *IngressTrafficRouting) { *out = *in @@ -396,22 +178,6 @@ func (in *IngressTrafficRouting) DeepCopy() *IngressTrafficRouting { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NameAndSpecData) DeepCopyInto(out *NameAndSpecData) { - *out = *in - in.Data.DeepCopyInto(&out.Data) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameAndSpecData. -func (in *NameAndSpecData) DeepCopy() *NameAndSpecData { - if in == nil { - return nil - } - out := new(NameAndSpecData) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectRef) DeepCopyInto(out *ObjectRef) { *out = *in @@ -461,72 +227,6 @@ func (in *PatchPodTemplateMetadata) DeepCopy() *PatchPodTemplateMetadata { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Pod) DeepCopyInto(out *Pod) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pod. -func (in *Pod) DeepCopy() *Pod { - if in == nil { - return nil - } - out := new(Pod) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReleaseBatch) DeepCopyInto(out *ReleaseBatch) { - *out = *in - out.CanaryReplicas = in.CanaryReplicas -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseBatch. -func (in *ReleaseBatch) DeepCopy() *ReleaseBatch { - if in == nil { - return nil - } - out := new(ReleaseBatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReleasePlan) DeepCopyInto(out *ReleasePlan) { - *out = *in - if in.Batches != nil { - in, out := &in.Batches, &out.Batches - *out = make([]ReleaseBatch, len(*in)) - copy(*out, *in) - } - if in.BatchPartition != nil { - in, out := &in.BatchPartition, &out.BatchPartition - *out = new(int32) - **out = **in - } - if in.FailureThreshold != nil { - in, out := &in.FailureThreshold, &out.FailureThreshold - *out = new(intstr.IntOrString) - **out = **in - } - if in.PatchPodTemplateMetadata != nil { - in, out := &in.PatchPodTemplateMetadata, &out.PatchPodTemplateMetadata - *out = new(PatchPodTemplateMetadata) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleasePlan. -func (in *ReleasePlan) DeepCopy() *ReleasePlan { - if in == nil { - return nil - } - out := new(ReleasePlan) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Rollout) DeepCopyInto(out *Rollout) { *out = *in @@ -571,122 +271,6 @@ func (in *RolloutCondition) DeepCopy() *RolloutCondition { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RolloutHistory) DeepCopyInto(out *RolloutHistory) { - *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 RolloutHistory. -func (in *RolloutHistory) DeepCopy() *RolloutHistory { - if in == nil { - return nil - } - out := new(RolloutHistory) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RolloutHistory) 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 *RolloutHistoryList) DeepCopyInto(out *RolloutHistoryList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]RolloutHistory, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistoryList. -func (in *RolloutHistoryList) DeepCopy() *RolloutHistoryList { - if in == nil { - return nil - } - out := new(RolloutHistoryList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *RolloutHistoryList) 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 *RolloutHistorySpec) DeepCopyInto(out *RolloutHistorySpec) { - *out = *in - in.Rollout.DeepCopyInto(&out.Rollout) - in.Workload.DeepCopyInto(&out.Workload) - in.Service.DeepCopyInto(&out.Service) - in.TrafficRouting.DeepCopyInto(&out.TrafficRouting) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistorySpec. -func (in *RolloutHistorySpec) DeepCopy() *RolloutHistorySpec { - if in == nil { - return nil - } - out := new(RolloutHistorySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RolloutHistoryStatus) DeepCopyInto(out *RolloutHistoryStatus) { - *out = *in - if in.CanarySteps != nil { - in, out := &in.CanarySteps, &out.CanarySteps - *out = make([]CanaryStepInfo, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistoryStatus. -func (in *RolloutHistoryStatus) DeepCopy() *RolloutHistoryStatus { - if in == nil { - return nil - } - out := new(RolloutHistoryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RolloutInfo) DeepCopyInto(out *RolloutInfo) { - *out = *in - in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutInfo. -func (in *RolloutInfo) DeepCopy() *RolloutInfo { - if in == nil { - return nil - } - out := new(RolloutInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RolloutList) DeepCopyInto(out *RolloutList) { *out = *in @@ -803,22 +387,6 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceInfo) DeepCopyInto(out *ServiceInfo) { - *out = *in - in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceInfo. -func (in *ServiceInfo) DeepCopy() *ServiceInfo { - if in == nil { - return nil - } - out := new(ServiceInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrafficRouting) DeepCopyInto(out *TrafficRouting) { *out = *in @@ -846,31 +414,6 @@ func (in *TrafficRouting) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TrafficRoutingInfo) DeepCopyInto(out *TrafficRoutingInfo) { - *out = *in - if in.Ingress != nil { - in, out := &in.Ingress, &out.Ingress - *out = new(IngressInfo) - (*in).DeepCopyInto(*out) - } - if in.HTTPRoute != nil { - in, out := &in.HTTPRoute, &out.HTTPRoute - *out = new(HTTPRouteInfo) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingInfo. -func (in *TrafficRoutingInfo) DeepCopy() *TrafficRoutingInfo { - if in == nil { - return nil - } - out := new(TrafficRoutingInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TrafficRoutingList) DeepCopyInto(out *TrafficRoutingList) { *out = *in @@ -1003,23 +546,6 @@ func (in *TrafficRoutingStrategy) DeepCopy() *TrafficRoutingStrategy { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadInfo) DeepCopyInto(out *WorkloadInfo) { - *out = *in - out.TypeMeta = in.TypeMeta - in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadInfo. -func (in *WorkloadInfo) DeepCopy() *WorkloadInfo { - if in == nil { - return nil - } - out := new(WorkloadInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkloadRef) DeepCopyInto(out *WorkloadRef) { *out = *in diff --git a/rollouts/v1beta1/batchrelease_plan_types.go b/rollouts/v1beta1/batchrelease_plan_types.go deleted file mode 100644 index a147294..0000000 --- a/rollouts/v1beta1/batchrelease_plan_types.go +++ /dev/null @@ -1,159 +0,0 @@ -/* -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 v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -// ReleasePlan fines the details of the release plan -type ReleasePlan struct { - // Batches is the details on each batch of the ReleasePlan. - //Users can specify their batch plan in this field, such as: - // batches: - // - canaryReplicas: 1 # batches 0 - // - canaryReplicas: 2 # batches 1 - // - canaryReplicas: 5 # batches 2 - // Not that these canaryReplicas should be a non-decreasing sequence. - // +optional - Batches []ReleaseBatch `json:"batches"` - // All pods in the batches up to the batchPartition (included) will have - // the target resource specification while the rest still is the stable revision. - // This is designed for the operators to manually rollout. - // Default is nil, which means no partition and will release all batches. - // BatchPartition start from 0. - // +optional - BatchPartition *int32 `json:"batchPartition,omitempty"` - // RolloutID indicates an id for each rollout progress - RolloutID string `json:"rolloutID,omitempty"` - // FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods. - // Only when FailureThreshold are satisfied, Rollout can enter ready state. - // If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its - // FailureThreshold. - // Defaults to nil. - FailureThreshold *intstr.IntOrString `json:"failureThreshold,omitempty"` - // FinalizingPolicy define the behavior of controller when phase enter Finalizing - // Defaults to "Immediate" - FinalizingPolicy FinalizingPolicyType `json:"finalizingPolicy,omitempty"` - // PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata - // only support for canary deployment - // +optional - PatchPodTemplateMetadata *PatchPodTemplateMetadata `json:"patchPodTemplateMetadata,omitempty"` - // RollingStyle can be "Canary", "Partiton" or "BlueGreen" - RollingStyle RollingStyleType `json:"rollingStyle,omitempty"` - // EnableExtraWorkloadForCanary indicates whether to create extra workload for canary - // True corresponds to RollingStyle "Canary". - // False corresponds to RollingStyle "Partiton". - // Ignored in BlueGreen-style. - // This field is about to deprecate, use RollingStyle instead. - // If both of them are set, controller will only consider this - // filed when RollingStyle is empty - EnableExtraWorkloadForCanary bool `json:"enableExtraWorkloadForCanary"` -} - -type FinalizingPolicyType string - -const ( - // WaitResumeFinalizingPolicyType will wait workload to be resumed, which means - // controller will be hold at Finalizing phase until all pods of workload is upgraded. - // WaitResumeFinalizingPolicyType only works in canary-style BatchRelease controller. - WaitResumeFinalizingPolicyType FinalizingPolicyType = "WaitResume" - // ImmediateFinalizingPolicyType will not to wait workload to be resumed. - ImmediateFinalizingPolicyType FinalizingPolicyType = "Immediate" -) - -// ReleaseBatch is used to describe how each batch release should be -type ReleaseBatch struct { - // CanaryReplicas is the number of upgraded pods that should have in this batch. - // it can be an absolute number (ex: 5) or a percentage of workload replicas. - // batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j. - CanaryReplicas intstr.IntOrString `json:"canaryReplicas"` -} - -// BatchReleaseStatus defines the observed state of a release plan -type BatchReleaseStatus struct { - // Conditions represents the observed process state of each phase during executing the release plan. - Conditions []RolloutCondition `json:"conditions,omitempty"` - // CanaryStatus describes the state of the canary rollout. - CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"` - // StableRevision is the pod-template-hash of stable revision pod template. - StableRevision string `json:"stableRevision,omitempty"` - // UpdateRevision is the pod-template-hash of update revision pod template. - UpdateRevision string `json:"updateRevision,omitempty"` - // ObservedGeneration is the most recent generation observed for this BatchRelease. - // It corresponds to this BatchRelease's generation, which is updated on mutation - // by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1. - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - // ObservedRolloutID is the most recent rollout-id observed for this BatchRelease. - // If RolloutID was changed, we will restart to roll out from batch 0, - // to ensure the batch-id and rollout-id labels of Pods are correct. - ObservedRolloutID string `json:"observedRolloutID,omitempty"` - // ObservedWorkloadReplicas is observed replicas of target referenced workload. - // This field is designed to deal with scaling event during rollout, if this field changed, - // it means that the workload is scaling during rollout. - ObservedWorkloadReplicas int32 `json:"observedWorkloadReplicas,omitempty"` - // Count of hash collisions for creating canary Deployment. The controller uses this - // field as a collision avoidance mechanism when it needs to create the name for the - // newest canary Deployment. - // +optional - CollisionCount *int32 `json:"collisionCount,omitempty"` - // ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan. - ObservedReleasePlanHash string `json:"observedReleasePlanHash,omitempty"` - // Phase is the release plan phase, which indicates the current state of release - // plan state machine in BatchRelease controller. - Phase RolloutPhase `json:"phase,omitempty"` - // Message provides details on why the rollout is in its current phase - Message string `json:"message,omitempty"` -} - -type BatchReleaseCanaryStatus struct { - // CurrentBatchState indicates the release state of the current batch. - CurrentBatchState BatchReleaseBatchStateType `json:"batchState,omitempty"` - // The current batch the rollout is working on/blocked, it starts from 0 - CurrentBatch int32 `json:"currentBatch"` - // BatchReadyTime is the ready timestamp of the current batch or the last batch. - // This field is updated once a batch ready, and the batches[x].pausedSeconds - // relies on this field to calculate the real-time duration. - BatchReadyTime *metav1.Time `json:"batchReadyTime,omitempty"` - // UpdatedReplicas is the number of upgraded Pods. - UpdatedReplicas int32 `json:"updatedReplicas,omitempty"` - // UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition. - UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"` - // the number of pods that no need to rollback in rollback scene. - NoNeedUpdateReplicas *int32 `json:"noNeedUpdateReplicas,omitempty"` -} - -type BatchReleaseBatchStateType string - -const ( - // UpgradingBatchState indicates that current batch is at upgrading pod state - UpgradingBatchState BatchReleaseBatchStateType = "Upgrading" - // VerifyingBatchState indicates that current batch is at verifying whether it's ready state - VerifyingBatchState BatchReleaseBatchStateType = "Verifying" - // ReadyBatchState indicates that current batch is at batch ready state - ReadyBatchState BatchReleaseBatchStateType = "Ready" -) - -const ( - // RolloutPhasePreparing indicates a rollout is preparing for next progress. - RolloutPhasePreparing RolloutPhase = "Preparing" - // RolloutPhaseFinalizing indicates a rollout is finalizing - RolloutPhaseFinalizing RolloutPhase = "Finalizing" - // RolloutPhaseCompleted indicates a rollout is completed/cancelled/terminated - RolloutPhaseCompleted RolloutPhase = "Completed" -) diff --git a/rollouts/v1beta1/batchrelease_types.go b/rollouts/v1beta1/batchrelease_types.go deleted file mode 100644 index 25e5bef..0000000 --- a/rollouts/v1beta1/batchrelease_types.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -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 v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:openapi-gen=true -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:storageversion -// +kubebuilder:printcolumn:name="KIND",type=string,JSONPath=`.spec.targetReference.workloadRef.kind` -// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase` -// +kubebuilder:printcolumn:name="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch` -// +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState` -// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp" - -type BatchRelease struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec BatchReleaseSpec `json:"spec,omitempty"` - Status BatchReleaseStatus `json:"status,omitempty"` -} - -// BatchReleaseSpec defines how to describe an update between different compRevision -type BatchReleaseSpec struct { - // WorkloadRef contains enough information to let you identify a workload for Rollout - // Batch release of the bypass - WorkloadRef ObjectRef `json:"workloadRef,omitempty"` - // ReleasePlan is the details on how to rollout the resources - ReleasePlan ReleasePlan `json:"releasePlan"` -} - -// BatchReleaseList contains a list of BatchRelease -// +kubebuilder:object:root=true -type BatchReleaseList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []BatchRelease `json:"items"` -} - -func init() { - SchemeBuilder.Register(&BatchRelease{}, &BatchReleaseList{}) -} diff --git a/rollouts/v1beta1/convertion.go b/rollouts/v1beta1/convertion.go deleted file mode 100644 index 5d1600a..0000000 --- a/rollouts/v1beta1/convertion.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -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 v1beta1 - -func (*Rollout) Hub() {} - -func (*BatchRelease) Hub() {} diff --git a/rollouts/v1beta1/zz_generated.deepcopy.go b/rollouts/v1beta1/zz_generated.deepcopy.go index 0cbeea3..73ccbed 100644 --- a/rollouts/v1beta1/zz_generated.deepcopy.go +++ b/rollouts/v1beta1/zz_generated.deepcopy.go @@ -1,8 +1,7 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* -Copyright 2023 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. @@ -28,134 +27,6 @@ import ( apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BatchRelease) DeepCopyInto(out *BatchRelease) { - *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 BatchRelease. -func (in *BatchRelease) DeepCopy() *BatchRelease { - if in == nil { - return nil - } - out := new(BatchRelease) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BatchRelease) 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 *BatchReleaseCanaryStatus) DeepCopyInto(out *BatchReleaseCanaryStatus) { - *out = *in - if in.BatchReadyTime != nil { - in, out := &in.BatchReadyTime, &out.BatchReadyTime - *out = (*in).DeepCopy() - } - if in.NoNeedUpdateReplicas != nil { - in, out := &in.NoNeedUpdateReplicas, &out.NoNeedUpdateReplicas - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseCanaryStatus. -func (in *BatchReleaseCanaryStatus) DeepCopy() *BatchReleaseCanaryStatus { - if in == nil { - return nil - } - out := new(BatchReleaseCanaryStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BatchReleaseList) DeepCopyInto(out *BatchReleaseList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]BatchRelease, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseList. -func (in *BatchReleaseList) DeepCopy() *BatchReleaseList { - if in == nil { - return nil - } - out := new(BatchReleaseList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *BatchReleaseList) 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 *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) { - *out = *in - out.WorkloadRef = in.WorkloadRef - in.ReleasePlan.DeepCopyInto(&out.ReleasePlan) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseSpec. -func (in *BatchReleaseSpec) DeepCopy() *BatchReleaseSpec { - if in == nil { - return nil - } - out := new(BatchReleaseSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BatchReleaseStatus) DeepCopyInto(out *BatchReleaseStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]RolloutCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.CanaryStatus.DeepCopyInto(&out.CanaryStatus) - if in.CollisionCount != nil { - in, out := &in.CollisionCount, &out.CollisionCount - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseStatus. -func (in *BatchReleaseStatus) DeepCopy() *BatchReleaseStatus { - if in == nil { - return nil - } - out := new(BatchReleaseStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BlueGreenStatus) DeepCopyInto(out *BlueGreenStatus) { *out = *in @@ -451,57 +322,6 @@ func (in *PatchPodTemplateMetadata) DeepCopy() *PatchPodTemplateMetadata { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReleaseBatch) DeepCopyInto(out *ReleaseBatch) { - *out = *in - out.CanaryReplicas = in.CanaryReplicas -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseBatch. -func (in *ReleaseBatch) DeepCopy() *ReleaseBatch { - if in == nil { - return nil - } - out := new(ReleaseBatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReleasePlan) DeepCopyInto(out *ReleasePlan) { - *out = *in - if in.Batches != nil { - in, out := &in.Batches, &out.Batches - *out = make([]ReleaseBatch, len(*in)) - copy(*out, *in) - } - if in.BatchPartition != nil { - in, out := &in.BatchPartition, &out.BatchPartition - *out = new(int32) - **out = **in - } - if in.FailureThreshold != nil { - in, out := &in.FailureThreshold, &out.FailureThreshold - *out = new(intstr.IntOrString) - **out = **in - } - if in.PatchPodTemplateMetadata != nil { - in, out := &in.PatchPodTemplateMetadata, &out.PatchPodTemplateMetadata - *out = new(PatchPodTemplateMetadata) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleasePlan. -func (in *ReleasePlan) DeepCopy() *ReleasePlan { - if in == nil { - return nil - } - out := new(ReleasePlan) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Rollout) DeepCopyInto(out *Rollout) { *out = *in diff --git a/schema/openkruise_rollouts_kustomize_schema.json b/schema/openkruise_rollouts_kustomize_schema.json index 5fb7e06..b0fde11 100644 --- a/schema/openkruise_rollouts_kustomize_schema.json +++ b/schema/openkruise_rollouts_kustomize_schema.json @@ -1,204 +1,5 @@ { "definitions": { - "io.kruise.rollouts.v1alpha1.BatchRelease": { - "type": "object", - "properties": { - "apiVersion": { - "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" - }, - "kind": { - "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" - }, - "metadata": { - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.BatchReleaseSpec" - }, - "status": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.BatchReleaseStatus" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchRelease", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.BatchReleaseCanaryStatus": { - "type": "object", - "required": [ - "currentBatch" - ], - "properties": { - "batchReadyTime": { - "description": "BatchReadyTime is the ready timestamp of the current batch or the last batch. This field is updated once a batch ready, and the batches[x].pausedSeconds relies on this field to calculate the real-time duration.", - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" - }, - "batchState": { - "description": "CurrentBatchState indicates the release state of the current batch.", - "type": "string" - }, - "currentBatch": { - "description": "The current batch the rollout is working on/blocked, it starts from 0", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noNeedUpdateReplicas": { - "description": "the number of pods that no need to rollback in rollback scene.", - "type": "integer", - "format": "int32" - }, - "updatedReadyReplicas": { - "description": "UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition.", - "type": "integer", - "format": "int32" - }, - "updatedReplicas": { - "description": "UpdatedReplicas is the number of upgraded Pods.", - "type": "integer", - "format": "int32" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseCanaryStatus", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.BatchReleaseList": { - "description": "BatchReleaseList contains a list of BatchRelease", - "type": "object", - "required": [ - "items" - ], - "properties": { - "apiVersion": { - "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" - }, - "items": { - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.BatchRelease" - } - }, - "kind": { - "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" - }, - "metadata": { - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseList", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.BatchReleaseSpec": { - "description": "BatchReleaseSpec defines how to describe an update between different compRevision", - "type": "object", - "required": [ - "targetReference", - "releasePlan" - ], - "properties": { - "releasePlan": { - "description": "ReleasePlan is the details on how to rollout the resources", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.ReleasePlan" - }, - "targetReference": { - "description": "TargetRef contains the GVK and name of the workload that we need to upgrade to.", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.ObjectRef" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseSpec", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.BatchReleaseStatus": { - "description": "BatchReleaseStatus defines the observed state of a release plan", - "type": "object", - "properties": { - "canaryStatus": { - "description": "CanaryStatus describes the state of the canary rollout.", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.BatchReleaseCanaryStatus" - }, - "collisionCount": { - "description": "Count of hash collisions for creating canary Deployment. The controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest canary Deployment.", - "type": "integer", - "format": "int32" - }, - "conditions": { - "description": "Conditions represents the observed process state of each phase during executing the release plan.", - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutCondition" - } - }, - "observedGeneration": { - "description": "ObservedGeneration is the most recent generation observed for this BatchRelease. It corresponds to this BatchRelease's generation, which is updated on mutation by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1.", - "type": "integer", - "format": "int64" - }, - "observedReleasePlanHash": { - "description": "ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan.", - "type": "string" - }, - "observedRolloutID": { - "description": "ObservedRolloutID is the most recent rollout-id observed for this BatchRelease. If RolloutID was changed, we will restart to roll out from batch 0, to ensure the batch-id and rollout-id labels of Pods are correct.", - "type": "string" - }, - "observedWorkloadReplicas": { - "description": "ObservedWorkloadReplicas is observed replicas of target referenced workload. This field is designed to deal with scaling event during rollout, if this field changed, it means that the workload is scaling during rollout.", - "type": "integer", - "format": "int32" - }, - "phase": { - "description": "Phase is the release plan phase, which indicates the current state of release plan state machine in BatchRelease controller.", - "type": "string" - }, - "stableRevision": { - "description": "StableRevision is the pod-template-hash of stable revision pod template.", - "type": "string" - }, - "updateRevision": { - "description": "UpdateRevision is the pod-template-hash of update revision pod template.", - "type": "string" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseStatus", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.CanaryStatus": { "description": "CanaryStatus status fields that only pertain to the canary rollout", "type": "object", @@ -324,32 +125,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.CanaryStepInfo": { - "description": "CanaryStepInfo indicates the pods for a revision", - "type": "object", - "properties": { - "canaryStepIndex": { - "description": "CanaryStepIndex indicates step this revision", - "type": "integer", - "format": "int32" - }, - "pods": { - "description": "Pods indicates the pods information", - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.Pod" - } - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "CanaryStepInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.CanaryStrategy": { "description": "CanaryStrategy defines parameters for a Replica Based Canary", "type": "object", @@ -420,59 +195,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.DeploymentExtraStatus": { - "description": "DeploymentExtraStatus is extra status field for Advanced Deployment", - "type": "object", - "properties": { - "expectedUpdatedReplicas": { - "description": "ExpectedUpdatedReplicas is an absolute number calculated based on Partition and Deployment.Spec.Replicas, means how many pods are expected be updated under current strategy. This field is designed to avoid users to fall into the details of algorithm for Partition calculation.", - "type": "integer", - "format": "int32" - }, - "updatedReadyReplicas": { - "description": "UpdatedReadyReplicas the number of pods that has been updated and ready.", - "type": "integer", - "format": "int32" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "DeploymentExtraStatus", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.DeploymentStrategy": { - "description": "DeploymentStrategy is strategy field for Advanced Deployment", - "type": "object", - "properties": { - "partition": { - "description": "Partition describe how many Pods should be updated during rollout. We use this field to implement partition-style rolling update.", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" - }, - "paused": { - "description": "Paused = true will block the upgrade of Pods", - "type": "boolean" - }, - "rollingStyle": { - "description": "RollingStyle define the behavior of rolling for deployment.", - "type": "string" - }, - "rollingUpdate": { - "description": "original deployment strategy rolling update fields", - "$ref": "#/definitions/io.k8s.api.apps.v1.RollingUpdateDeployment" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "DeploymentStrategy", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.GatewayTrafficRouting": { "description": "GatewayTrafficRouting configuration for gateway api", "type": "object", @@ -490,32 +212,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.HTTPRouteInfo": { - "description": "HTTPRouteInfo indicates information of gateway API", - "type": "object", - "required": [ - "name" - ], - "properties": { - "data": { - "description": "Data indecates the spec of object ref", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension" - }, - "name": { - "description": "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - "type": "string", - "default": "" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "HTTPRouteInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.HttpRouteMatch": { "type": "object", "properties": { @@ -536,32 +232,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.IngressInfo": { - "description": "IngressInfo indicates information of the ingress related", - "type": "object", - "required": [ - "name" - ], - "properties": { - "data": { - "description": "Data indecates the spec of object ref", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension" - }, - "name": { - "description": "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - "type": "string", - "default": "" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "IngressInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.IngressTrafficRouting": { "description": "IngressTrafficRouting configuration for ingress controller to control traffic routing", "type": "object", @@ -587,31 +257,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.NameAndSpecData": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "data": { - "description": "Data indecates the spec of object ref", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension" - }, - "name": { - "description": "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - "type": "string", - "default": "" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "NameAndSpecData", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.ObjectRef": { "type": "object", "properties": { @@ -656,106 +301,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.Pod": { - "description": "Pod indicates the information of a pod, including name, ip, node_name.", - "type": "object", - "properties": { - "ip": { - "description": "IP indicates the pod ip", - "type": "string" - }, - "name": { - "description": "Name indicates the node name", - "type": "string" - }, - "nodeName": { - "description": "NodeName indicates the node which pod is located at", - "type": "string" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "Pod", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.ReleaseBatch": { - "description": "ReleaseBatch is used to describe how each batch release should be", - "type": "object", - "required": [ - "canaryReplicas" - ], - "properties": { - "canaryReplicas": { - "description": "CanaryReplicas is the number of upgraded pods that should have in this batch. it can be an absolute number (ex: 5) or a percentage of workload replicas. batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i \u003c j.", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "ReleaseBatch", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.ReleasePlan": { - "description": "ReleasePlan fines the details of the release plan", - "type": "object", - "required": [ - "enableExtraWorkloadForCanary" - ], - "properties": { - "batchPartition": { - "description": "All pods in the batches up to the batchPartition (included) will have the target resource specification while the rest still is the stable revision. This is designed for the operators to manually rollout. Default is nil, which means no partition and will release all batches. BatchPartition start from 0.", - "type": "integer", - "format": "int32" - }, - "batches": { - "description": "Batches is the details on each batch of the ReleasePlan. Users can specify their batch plan in this field, such as: batches: - canaryReplicas: 1 # batches 0 - canaryReplicas: 2 # batches 1 - canaryReplicas: 5 # batches 2 Not that these canaryReplicas should be a non-decreasing sequence.", - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.ReleaseBatch" - } - }, - "enableExtraWorkloadForCanary": { - "description": "EnableExtraWorkloadForCanary indicates whether to create extra workload for canary True corresponds to RollingStyle \"Canary\". False corresponds to RollingStyle \"Partiton\". Ignored in BlueGreen-style. This field is about to deprecate, use RollingStyle instead. If both of them are set, controller will only consider this filed when RollingStyle is empty", - "type": "boolean", - "default": false - }, - "failureThreshold": { - "description": "FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods. Only when FailureThreshold are satisfied, Rollout can enter ready state. If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its FailureThreshold. Defaults to nil.", - "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" - }, - "finalizingPolicy": { - "description": "FinalizingPolicy define the behavior of controller when phase enter Finalizing Defaults to \"Immediate\"", - "type": "string" - }, - "patchPodTemplateMetadata": { - "description": "PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata only support for canary deployment", - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.PatchPodTemplateMetadata" - }, - "rollingStyle": { - "description": "RollingStyle can be \"Canary\", \"Partiton\" or \"BlueGreen\"", - "type": "string" - }, - "rolloutID": { - "description": "RolloutID indicates an id for each rollout progress", - "type": "string" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "ReleasePlan", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.Rollout": { "description": "Rollout is the Schema for the rollouts API", "type": "object", @@ -838,164 +383,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.RolloutHistory": { - "description": "RolloutHistory is the Schema for the rollouthistories API", - "type": "object", - "properties": { - "apiVersion": { - "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" - }, - "kind": { - "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" - }, - "metadata": { - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutHistorySpec" - }, - "status": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutHistoryStatus" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "RolloutHistory", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.RolloutHistoryList": { - "description": "RolloutHistoryList contains a list of RolloutHistory", - "type": "object", - "required": [ - "items" - ], - "properties": { - "apiVersion": { - "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" - }, - "items": { - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutHistory" - } - }, - "kind": { - "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" - }, - "metadata": { - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "RolloutHistoryList", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.RolloutHistorySpec": { - "description": "RolloutHistorySpec defines the desired state of RolloutHistory", - "type": "object", - "properties": { - "rollout": { - "description": "Rollout indicates information of the rollout related with rollouthistory", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutInfo" - }, - "service": { - "description": "Service indicates information of the service related with workload", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.ServiceInfo" - }, - "trafficRouting": { - "description": "TrafficRouting indicates information of traffic route related with workload", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.TrafficRoutingInfo" - }, - "workload": { - "description": "Workload indicates information of the workload, such as cloneset, deployment, advanced statefulset", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.WorkloadInfo" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "RolloutHistorySpec", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.RolloutHistoryStatus": { - "description": "RolloutHistoryStatus defines the observed state of RolloutHistory", - "type": "object", - "properties": { - "canarySteps": { - "description": "CanarySteps indicates the pods released each step", - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.CanaryStepInfo" - } - }, - "phase": { - "description": "Phase indicates phase of RolloutHistory, just \"\" or \"completed\"", - "type": "string" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "RolloutHistoryStatus", - "version": "v1alpha1" - } - ] - }, - "io.kruise.rollouts.v1alpha1.RolloutInfo": { - "description": "RolloutInfo indicates information of the rollout related", - "type": "object", - "required": [ - "rolloutID", - "name" - ], - "properties": { - "data": { - "description": "Data indecates the spec of object ref", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension" - }, - "name": { - "description": "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - "type": "string", - "default": "" - }, - "rolloutID": { - "description": "RolloutID indicates the new rollout if there is no new RolloutID this time, ignore it and not execute RolloutHistory", - "type": "string", - "default": "" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "RolloutInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.RolloutList": { "description": "RolloutList contains a list of Rollout", "type": "object", @@ -1144,32 +531,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.ServiceInfo": { - "description": "ServiceInfo indicates information of the service related", - "type": "object", - "required": [ - "name" - ], - "properties": { - "data": { - "description": "Data indecates the spec of object ref", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension" - }, - "name": { - "description": "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - "type": "string", - "default": "" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "ServiceInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.TrafficRouting": { "description": "TrafficRouting is the Schema for the TrafficRoutings API", "type": "object", @@ -1203,27 +564,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.TrafficRoutingInfo": { - "description": "TrafficRoutingInfo indicates information of Gateway API or Ingress", - "type": "object", - "properties": { - "httpRoute": { - "description": "HTTPRouteRef indacates information of Gateway API", - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.HTTPRouteInfo" - }, - "ingress": { - "description": "IngressRef indicates information of ingress", - "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.IngressInfo" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "TrafficRoutingInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.TrafficRoutingList": { "description": "TrafficRoutingList contains a list of TrafficRouting", "type": "object", @@ -1384,40 +724,6 @@ } ] }, - "io.kruise.rollouts.v1alpha1.WorkloadInfo": { - "description": "WorkloadInfo indicates information of the workload, such as cloneset, deployment, advanced statefulset", - "type": "object", - "required": [ - "name" - ], - "properties": { - "apiVersion": { - "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" - }, - "data": { - "description": "Data indecates the spec of object ref", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension" - }, - "kind": { - "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" - }, - "name": { - "description": "Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.", - "type": "string", - "default": "" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "WorkloadInfo", - "version": "v1alpha1" - } - ] - }, "io.kruise.rollouts.v1alpha1.WorkloadRef": { "description": "WorkloadRef holds a references to the Kubernetes object", "type": "object", @@ -1451,208 +757,6 @@ } ] }, - "io.kruise.rollouts.v1beta1.BatchRelease": { - "type": "object", - "properties": { - "apiVersion": { - "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" - }, - "kind": { - "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" - }, - "metadata": { - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.BatchReleaseSpec" - }, - "status": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.BatchReleaseStatus" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchRelease", - "version": "v1beta1" - } - ] - }, - "io.kruise.rollouts.v1beta1.BatchReleaseCanaryStatus": { - "type": "object", - "required": [ - "currentBatch" - ], - "properties": { - "batchReadyTime": { - "description": "BatchReadyTime is the ready timestamp of the current batch or the last batch. This field is updated once a batch ready, and the batches[x].pausedSeconds relies on this field to calculate the real-time duration.", - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" - }, - "batchState": { - "description": "CurrentBatchState indicates the release state of the current batch.", - "type": "string" - }, - "currentBatch": { - "description": "The current batch the rollout is working on/blocked, it starts from 0", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noNeedUpdateReplicas": { - "description": "the number of pods that no need to rollback in rollback scene.", - "type": "integer", - "format": "int32" - }, - "updatedReadyReplicas": { - "description": "UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition.", - "type": "integer", - "format": "int32" - }, - "updatedReplicas": { - "description": "UpdatedReplicas is the number of upgraded Pods.", - "type": "integer", - "format": "int32" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseCanaryStatus", - "version": "v1beta1" - } - ] - }, - "io.kruise.rollouts.v1beta1.BatchReleaseList": { - "description": "BatchReleaseList contains a list of BatchRelease", - "type": "object", - "required": [ - "items" - ], - "properties": { - "apiVersion": { - "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" - }, - "items": { - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.BatchRelease" - } - }, - "kind": { - "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" - }, - "metadata": { - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseList", - "version": "v1beta1" - } - ] - }, - "io.kruise.rollouts.v1beta1.BatchReleaseSpec": { - "description": "BatchReleaseSpec defines how to describe an update between different compRevision", - "type": "object", - "required": [ - "releasePlan" - ], - "properties": { - "releasePlan": { - "description": "ReleasePlan is the details on how to rollout the resources", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.ReleasePlan" - }, - "workloadRef": { - "description": "WorkloadRef contains enough information to let you identify a workload for Rollout Batch release of the bypass", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.ObjectRef" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseSpec", - "version": "v1beta1" - } - ] - }, - "io.kruise.rollouts.v1beta1.BatchReleaseStatus": { - "description": "BatchReleaseStatus defines the observed state of a release plan", - "type": "object", - "properties": { - "canaryStatus": { - "description": "CanaryStatus describes the state of the canary rollout.", - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.BatchReleaseCanaryStatus" - }, - "collisionCount": { - "description": "Count of hash collisions for creating canary Deployment. The controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest canary Deployment.", - "type": "integer", - "format": "int32" - }, - "conditions": { - "description": "Conditions represents the observed process state of each phase during executing the release plan.", - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.RolloutCondition" - } - }, - "message": { - "description": "Message provides details on why the rollout is in its current phase", - "type": "string" - }, - "observedGeneration": { - "description": "ObservedGeneration is the most recent generation observed for this BatchRelease. It corresponds to this BatchRelease's generation, which is updated on mutation by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1.", - "type": "integer", - "format": "int64" - }, - "observedReleasePlanHash": { - "description": "ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan.", - "type": "string" - }, - "observedRolloutID": { - "description": "ObservedRolloutID is the most recent rollout-id observed for this BatchRelease. If RolloutID was changed, we will restart to roll out from batch 0, to ensure the batch-id and rollout-id labels of Pods are correct.", - "type": "string" - }, - "observedWorkloadReplicas": { - "description": "ObservedWorkloadReplicas is observed replicas of target referenced workload. This field is designed to deal with scaling event during rollout, if this field changed, it means that the workload is scaling during rollout.", - "type": "integer", - "format": "int32" - }, - "phase": { - "description": "Phase is the release plan phase, which indicates the current state of release plan state machine in BatchRelease controller.", - "type": "string" - }, - "stableRevision": { - "description": "StableRevision is the pod-template-hash of stable revision pod template.", - "type": "string" - }, - "updateRevision": { - "description": "UpdateRevision is the pod-template-hash of update revision pod template.", - "type": "string" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "BatchReleaseStatus", - "version": "v1beta1" - } - ] - }, "io.kruise.rollouts.v1beta1.BlueGreenStatus": { "description": "BlueGreenStatus status fields that only pertain to the blueGreen rollout", "type": "object", @@ -2221,81 +1325,6 @@ } ] }, - "io.kruise.rollouts.v1beta1.ReleaseBatch": { - "description": "ReleaseBatch is used to describe how each batch release should be", - "type": "object", - "required": [ - "canaryReplicas" - ], - "properties": { - "canaryReplicas": { - "description": "CanaryReplicas is the number of upgraded pods that should have in this batch. it can be an absolute number (ex: 5) or a percentage of workload replicas. batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i \u003c j.", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "ReleaseBatch", - "version": "v1beta1" - } - ] - }, - "io.kruise.rollouts.v1beta1.ReleasePlan": { - "description": "ReleasePlan fines the details of the release plan", - "type": "object", - "required": [ - "enableExtraWorkloadForCanary" - ], - "properties": { - "batchPartition": { - "description": "All pods in the batches up to the batchPartition (included) will have the target resource specification while the rest still is the stable revision. This is designed for the operators to manually rollout. Default is nil, which means no partition and will release all batches. BatchPartition start from 0.", - "type": "integer", - "format": "int32" - }, - "batches": { - "description": "Batches is the details on each batch of the ReleasePlan. Users can specify their batch plan in this field, such as: batches: - canaryReplicas: 1 # batches 0 - canaryReplicas: 2 # batches 1 - canaryReplicas: 5 # batches 2 Not that these canaryReplicas should be a non-decreasing sequence.", - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.ReleaseBatch" - } - }, - "enableExtraWorkloadForCanary": { - "description": "EnableExtraWorkloadForCanary indicates whether to create extra workload for canary True corresponds to RollingStyle \"Canary\". False corresponds to RollingStyle \"Partiton\". Ignored in BlueGreen-style. This field is about to deprecate, use RollingStyle instead. If both of them are set, controller will only consider this filed when RollingStyle is empty", - "type": "boolean", - "default": false - }, - "failureThreshold": { - "description": "FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods. Only when FailureThreshold are satisfied, Rollout can enter ready state. If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its FailureThreshold. Defaults to nil.", - "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" - }, - "finalizingPolicy": { - "description": "FinalizingPolicy define the behavior of controller when phase enter Finalizing Defaults to \"Immediate\"", - "type": "string" - }, - "patchPodTemplateMetadata": { - "description": "PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata only support for canary deployment", - "$ref": "#/definitions/io.kruise.rollouts.v1beta1.PatchPodTemplateMetadata" - }, - "rollingStyle": { - "description": "RollingStyle can be \"Canary\", \"Partiton\" or \"BlueGreen\"", - "type": "string" - }, - "rolloutID": { - "description": "RolloutID indicates an id for each rollout progress", - "type": "string" - } - }, - "x-kubernetes-group-version-kind": [ - { - "group": "rollouts.kruise.io", - "kind": "ReleasePlan", - "version": "v1beta1" - } - ] - }, "io.kruise.rollouts.v1beta1.Rollout": { "description": "Rollout is the Schema for the rollouts API", "type": "object", diff --git a/tests/e2e/rollout_e2e_test.go b/tests/e2e/rollout_e2e_test.go index 520aa2d..94cb650 100644 --- a/tests/e2e/rollout_e2e_test.go +++ b/tests/e2e/rollout_e2e_test.go @@ -8,7 +8,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned" + rollouts "github.com/openkruise/kruise-rollout-api/client/clientset/versioned" + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -18,7 +19,7 @@ import ( var _ = Describe("Rollout E2E Tests", func() { var ( - clientset *rolloutsv1beta1.Clientset + clientset *rollouts.Clientset namespace = "default" ) @@ -33,10 +34,10 @@ var _ = Describe("Rollout E2E Tests", func() { config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig) Expect(err).NotTo(HaveOccurred()) - clientset, err = rolloutsv1beta1.NewForConfig(config) + clientset, err = rollouts.NewForConfig(config) Expect(err).NotTo(HaveOccurred()) - Context("Rollout Operations", func() { + Context("v1beta1", func() { var rolloutDemo *v1beta1.Rollout BeforeEach(func() { @@ -67,7 +68,7 @@ var _ = Describe("Rollout E2E Tests", func() { It("should create a Rollout", func() { rollout := rolloutDemo.DeepCopy() - rollout.Name = "test-create" + rollout.Name = "test-create-v1beta1" result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) Expect(result.Name).To(Equal(rollout.Name)) @@ -75,7 +76,7 @@ var _ = Describe("Rollout E2E Tests", func() { It("should update a Rollout", func() { rollout := rolloutDemo.DeepCopy() - rollout.Name = "test-update" + rollout.Name = "test-update-v1beta1" result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) @@ -90,7 +91,7 @@ var _ = Describe("Rollout E2E Tests", func() { It("should delete a Rollout", func() { rollout := rolloutDemo.DeepCopy() - rollout.Name = "test-delete" + rollout.Name = "test-delete-v1beta1" result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) @@ -101,6 +102,75 @@ var _ = Describe("Rollout E2E Tests", func() { Expect(err).To(HaveOccurred()) }) }) + + Context("v1alpha1", func() { + var rolloutDemo *v1alpha1.Rollout + + BeforeEach(func() { + firststep := intstr.FromString("10%") + + rolloutDemo = &v1alpha1.Rollout{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-create", + Namespace: namespace, + }, + Spec: v1alpha1.RolloutSpec{ + ObjectRef: v1alpha1.ObjectRef{ + WorkloadRef: &v1alpha1.WorkloadRef{ + APIVersion: "apps/v1", + Kind: "Deployment", + Name: "demo", + }, + }, + Strategy: v1alpha1.RolloutStrategy{ + Canary: &v1alpha1.CanaryStrategy{ + Steps: []v1alpha1.CanaryStep{ + { + Replicas: &firststep, + }, + }, + }, + }, + }, + } + }) + + It("should create a Rollout", func() { + rollout := rolloutDemo.DeepCopy() + rollout.Name = "test-create-v1alpha1" + result, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{}) + Expect(err).NotTo(HaveOccurred()) + Expect(result.Name).To(Equal(rollout.Name)) + }) + + It("should update a Rollout", func() { + rollout := rolloutDemo.DeepCopy() + rollout.Name = "test-update-v1alpha1" + result, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{}) + Expect(err).NotTo(HaveOccurred()) + + result.Spec.Strategy.Canary.Steps[0].Replicas = &intstr.IntOrString{ + Type: intstr.String, + StrVal: "20%", + } + updatedResult, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Update(context.TODO(), result, metav1.UpdateOptions{}) + Expect(err).NotTo(HaveOccurred()) + Expect(updatedResult.Spec.Strategy.Canary.Steps[0].Replicas.StrVal).To(Equal("20%")) + }) + + It("should delete a Rollout", func() { + rollout := rolloutDemo.DeepCopy() + rollout.Name = "test-delete-v1alpha1" + result, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{}) + Expect(err).NotTo(HaveOccurred()) + + err = clientset.RolloutsV1alpha1().Rollouts(namespace).Delete(context.TODO(), result.Name, metav1.DeleteOptions{}) + Expect(err).NotTo(HaveOccurred()) + + _, err = clientset.RolloutsV1alpha1().Rollouts(namespace).Get(context.TODO(), result.Name, metav1.GetOptions{}) + Expect(err).To(HaveOccurred()) + }) + }) }) func TestRolloutE2E(t *testing.T) {