From c4e913278102b19fbdb62c1e58cb56699b9a28dc Mon Sep 17 00:00:00 2001 From: furykerry Date: Wed, 23 Oct 2024 20:15:12 +0800 Subject: [PATCH] support v1alpha1 api, e.g. TrafficRouting Signed-off-by: furykerry --- Makefile | 4 +- client/clientset/versioned/clientset.go | 15 +- .../versioned/fake/clientset_generated.go | 7 + client/clientset/versioned/fake/register.go | 2 + client/clientset/versioned/scheme/register.go | 2 + .../versioned/typed/rollouts/v1alpha1/doc.go | 20 + .../typed/rollouts/v1alpha1/fake/doc.go | 20 + .../rollouts/v1alpha1/fake/fake_rollout.go | 142 +++ .../v1alpha1/fake/fake_rollouts_client.go | 44 + .../v1alpha1/fake/fake_trafficrouting.go | 142 +++ .../rollouts/v1alpha1/generated_expansion.go | 23 + .../typed/rollouts/v1alpha1/rollout.go | 195 +++ .../rollouts/v1alpha1/rollouts_client.go | 112 ++ .../typed/rollouts/v1alpha1/trafficrouting.go | 195 +++ .../v1beta1/fake/fake_batchrelease.go | 4 +- .../rollouts/v1beta1/fake/fake_rollout.go | 4 +- .../typed/rollouts/v1beta1/rollouts_client.go | 2 +- client/informers/externalversions/generic.go | 9 +- .../externalversions/rollouts/interface.go | 8 + .../rollouts/v1alpha1/interface.go | 52 + .../rollouts/v1alpha1/rollout.go | 90 ++ .../rollouts/v1alpha1/trafficrouting.go | 90 ++ .../rollouts/v1alpha1/expansion_generated.go | 35 + client/listers/rollouts/v1alpha1/rollout.go | 99 ++ .../rollouts/v1alpha1/trafficrouting.go | 99 ++ hack/generate_client.sh | 2 +- pkg/rollouts/openapi_generated.go | 1090 ++++++++++++++++- pkg/rollouts/violation_exceptions.list | 8 + rollouts/addtoscheme_rollouts_v1alpha1.go | 26 + rollouts/apis.go | 29 + rollouts/v1alpha1/doc.go | 19 + rollouts/v1alpha1/groupversion_info.go | 44 + rollouts/v1alpha1/rollout_types.go | 322 +++++ rollouts/v1alpha1/trafficrouting_types.go | 163 +++ rollouts/v1alpha1/zz_generated.deepcopy.go | 563 +++++++++ rollouts/v1beta1/zz_generated.deepcopy.go | 2 +- .../openkruise_rollouts_kustomize_schema.json | 757 ++++++++++++ 37 files changed, 4403 insertions(+), 37 deletions(-) create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/doc.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/fake/doc.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollout.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouts_client.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_trafficrouting.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/rollout.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go create mode 100644 client/clientset/versioned/typed/rollouts/v1alpha1/trafficrouting.go create mode 100644 client/informers/externalversions/rollouts/v1alpha1/interface.go create mode 100644 client/informers/externalversions/rollouts/v1alpha1/rollout.go create mode 100644 client/informers/externalversions/rollouts/v1alpha1/trafficrouting.go create mode 100644 client/listers/rollouts/v1alpha1/expansion_generated.go create mode 100644 client/listers/rollouts/v1alpha1/rollout.go create mode 100644 client/listers/rollouts/v1alpha1/trafficrouting.go create mode 100644 rollouts/addtoscheme_rollouts_v1alpha1.go create mode 100644 rollouts/apis.go create mode 100644 rollouts/v1alpha1/doc.go create mode 100644 rollouts/v1alpha1/groupversion_info.go create mode 100644 rollouts/v1alpha1/rollout_types.go create mode 100644 rollouts/v1alpha1/trafficrouting_types.go create mode 100644 rollouts/v1alpha1/zz_generated.deepcopy.go diff --git a/Makefile b/Makefile index 206946b..9f536e7 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ vet: # Generate code generate: controller-gen - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./rollouts" @hack/generate_client.sh CONTROLLER_GEN = $(shell pwd)/bin/controller-gen @@ -59,7 +59,7 @@ gen-openapi-schema: gen-rollouts-openapi gen-rollouts-openapi: openapi-gen $(OPENAPI_GEN) \ --go-header-file hack/boilerplate.go.txt \ - --input-dirs github.com/openkruise/kruise-rollout-api/rollouts/v1beta1 \ + --input-dirs github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1 \ --output-package pkg/rollouts/ \ --report-filename pkg/rollouts/violation_exceptions.list \ -o $(CURRENT_DIR) diff --git a/client/clientset/versioned/clientset.go b/client/clientset/versioned/clientset.go index 184e732..388f0be 100644 --- a/client/clientset/versioned/clientset.go +++ b/client/clientset/versioned/clientset.go @@ -22,6 +22,7 @@ import ( "fmt" "net/http" + rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1alpha1" rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -30,6 +31,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + RolloutsV1alpha1() rolloutsv1alpha1.RolloutsV1alpha1Interface RolloutsV1beta1() rolloutsv1beta1.RolloutsV1beta1Interface } @@ -37,7 +39,13 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - rolloutsV1beta1 *rolloutsv1beta1.RolloutsV1beta1Client + rolloutsV1alpha1 *rolloutsv1alpha1.RolloutsV1alpha1Client + rolloutsV1beta1 *rolloutsv1beta1.RolloutsV1beta1Client +} + +// RolloutsV1alpha1 retrieves the RolloutsV1alpha1Client +func (c *Clientset) RolloutsV1alpha1() rolloutsv1alpha1.RolloutsV1alpha1Interface { + return c.rolloutsV1alpha1 } // RolloutsV1beta1 retrieves the RolloutsV1beta1Client @@ -89,6 +97,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error + cs.rolloutsV1alpha1, err = rolloutsv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.rolloutsV1beta1, err = rolloutsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -114,6 +126,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.rolloutsV1alpha1 = rolloutsv1alpha1.New(c) cs.rolloutsV1beta1 = rolloutsv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/client/clientset/versioned/fake/clientset_generated.go b/client/clientset/versioned/fake/clientset_generated.go index 9d5549b..cc26b7f 100644 --- a/client/clientset/versioned/fake/clientset_generated.go +++ b/client/clientset/versioned/fake/clientset_generated.go @@ -20,6 +20,8 @@ package fake import ( clientset "github.com/openkruise/kruise-rollout-api/client/clientset/versioned" + rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1alpha1" + fakerolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1alpha1/fake" rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1beta1" fakerolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" @@ -79,6 +81,11 @@ var ( _ testing.FakeClient = &Clientset{} ) +// RolloutsV1alpha1 retrieves the RolloutsV1alpha1Client +func (c *Clientset) RolloutsV1alpha1() rolloutsv1alpha1.RolloutsV1alpha1Interface { + return &fakerolloutsv1alpha1.FakeRolloutsV1alpha1{Fake: &c.Fake} +} + // RolloutsV1beta1 retrieves the RolloutsV1beta1Client func (c *Clientset) RolloutsV1beta1() rolloutsv1beta1.RolloutsV1beta1Interface { return &fakerolloutsv1beta1.FakeRolloutsV1beta1{Fake: &c.Fake} diff --git a/client/clientset/versioned/fake/register.go b/client/clientset/versioned/fake/register.go index ec9de59..f6ea8c5 100644 --- a/client/clientset/versioned/fake/register.go +++ b/client/clientset/versioned/fake/register.go @@ -19,6 +19,7 @@ limitations under the License. package fake import ( + rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -31,6 +32,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + rolloutsv1alpha1.AddToScheme, rolloutsv1beta1.AddToScheme, } diff --git a/client/clientset/versioned/scheme/register.go b/client/clientset/versioned/scheme/register.go index 6bd53c4..c6d8ff9 100644 --- a/client/clientset/versioned/scheme/register.go +++ b/client/clientset/versioned/scheme/register.go @@ -19,6 +19,7 @@ limitations under the License. package scheme import ( + rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -31,6 +32,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + rolloutsv1alpha1.AddToScheme, rolloutsv1beta1.AddToScheme, } diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/doc.go b/client/clientset/versioned/typed/rollouts/v1alpha1/doc.go new file mode 100644 index 0000000..aac23c1 --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +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. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/doc.go b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/doc.go new file mode 100644 index 0000000..5e1ae11 --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +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 has the automatically generated clients. +package fake diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollout.go b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollout.go new file mode 100644 index 0000000..3aafbf9 --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollout.go @@ -0,0 +1,142 @@ +/* +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" +) + +// FakeRollouts implements RolloutInterface +type FakeRollouts struct { + Fake *FakeRolloutsV1alpha1 + ns string +} + +var rolloutsResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "rollouts"} + +var rolloutsKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "Rollout"} + +// Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any. +func (c *FakeRollouts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rollout, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolloutsResource, c.ns, name), &v1alpha1.Rollout{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Rollout), err +} + +// List takes label and field selectors, and returns the list of Rollouts that match those selectors. +func (c *FakeRollouts) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolloutsResource, rolloutsKind, c.ns, opts), &v1alpha1.RolloutList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RolloutList{ListMeta: obj.(*v1alpha1.RolloutList).ListMeta} + for _, item := range obj.(*v1alpha1.RolloutList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested rollouts. +func (c *FakeRollouts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolloutsResource, c.ns, opts)) + +} + +// Create takes the representation of a rollout and creates it. Returns the server's representation of the rollout, and an error, if there is any. +func (c *FakeRollouts) Create(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.CreateOptions) (result *v1alpha1.Rollout, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolloutsResource, c.ns, rollout), &v1alpha1.Rollout{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Rollout), err +} + +// Update takes the representation of a rollout and updates it. Returns the server's representation of the rollout, and an error, if there is any. +func (c *FakeRollouts) Update(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (result *v1alpha1.Rollout, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolloutsResource, c.ns, rollout), &v1alpha1.Rollout{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Rollout), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeRollouts) UpdateStatus(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (*v1alpha1.Rollout, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(rolloutsResource, "status", c.ns, rollout), &v1alpha1.Rollout{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Rollout), err +} + +// Delete takes name of the rollout and deletes it. Returns an error if one occurs. +func (c *FakeRollouts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(rolloutsResource, c.ns, name, opts), &v1alpha1.Rollout{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRollouts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolloutsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.RolloutList{}) + return err +} + +// Patch applies the patch and returns the patched rollout. +func (c *FakeRollouts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rollout, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolloutsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Rollout{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Rollout), err +} 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 new file mode 100644 index 0000000..3379935 --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_rollouts_client.go @@ -0,0 +1,44 @@ +/* +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 ( + v1alpha1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/typed/rollouts/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeRolloutsV1alpha1 struct { + *testing.Fake +} + +func (c *FakeRolloutsV1alpha1) Rollouts(namespace string) v1alpha1.RolloutInterface { + return &FakeRollouts{c, namespace} +} + +func (c *FakeRolloutsV1alpha1) TrafficRoutings(namespace string) v1alpha1.TrafficRoutingInterface { + return &FakeTrafficRoutings{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRolloutsV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_trafficrouting.go b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_trafficrouting.go new file mode 100644 index 0000000..410450d --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/fake/fake_trafficrouting.go @@ -0,0 +1,142 @@ +/* +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" +) + +// FakeTrafficRoutings implements TrafficRoutingInterface +type FakeTrafficRoutings struct { + Fake *FakeRolloutsV1alpha1 + ns string +} + +var trafficroutingsResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "trafficroutings"} + +var trafficroutingsKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "TrafficRouting"} + +// Get takes name of the trafficRouting, and returns the corresponding trafficRouting object, and an error if there is any. +func (c *FakeTrafficRoutings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficRouting, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(trafficroutingsResource, c.ns, name), &v1alpha1.TrafficRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TrafficRouting), err +} + +// List takes label and field selectors, and returns the list of TrafficRoutings that match those selectors. +func (c *FakeTrafficRoutings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficRoutingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(trafficroutingsResource, trafficroutingsKind, c.ns, opts), &v1alpha1.TrafficRoutingList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.TrafficRoutingList{ListMeta: obj.(*v1alpha1.TrafficRoutingList).ListMeta} + for _, item := range obj.(*v1alpha1.TrafficRoutingList).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 trafficRoutings. +func (c *FakeTrafficRoutings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(trafficroutingsResource, c.ns, opts)) + +} + +// Create takes the representation of a trafficRouting and creates it. Returns the server's representation of the trafficRouting, and an error, if there is any. +func (c *FakeTrafficRoutings) Create(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.CreateOptions) (result *v1alpha1.TrafficRouting, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(trafficroutingsResource, c.ns, trafficRouting), &v1alpha1.TrafficRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TrafficRouting), err +} + +// Update takes the representation of a trafficRouting and updates it. Returns the server's representation of the trafficRouting, and an error, if there is any. +func (c *FakeTrafficRoutings) Update(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.UpdateOptions) (result *v1alpha1.TrafficRouting, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(trafficroutingsResource, c.ns, trafficRouting), &v1alpha1.TrafficRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TrafficRouting), 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 *FakeTrafficRoutings) UpdateStatus(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.UpdateOptions) (*v1alpha1.TrafficRouting, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(trafficroutingsResource, "status", c.ns, trafficRouting), &v1alpha1.TrafficRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TrafficRouting), err +} + +// Delete takes name of the trafficRouting and deletes it. Returns an error if one occurs. +func (c *FakeTrafficRoutings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(trafficroutingsResource, c.ns, name, opts), &v1alpha1.TrafficRouting{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTrafficRoutings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(trafficroutingsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.TrafficRoutingList{}) + return err +} + +// Patch applies the patch and returns the patched trafficRouting. +func (c *FakeTrafficRoutings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficRouting, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(trafficroutingsResource, c.ns, name, pt, data, subresources...), &v1alpha1.TrafficRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.TrafficRouting), err +} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go new file mode 100644 index 0000000..1f96f49 --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/generated_expansion.go @@ -0,0 +1,23 @@ +/* +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 + +type RolloutExpansion interface{} + +type TrafficRoutingExpansion interface{} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/rollout.go b/client/clientset/versioned/typed/rollouts/v1alpha1/rollout.go new file mode 100644 index 0000000..4cc431a --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/rollout.go @@ -0,0 +1,195 @@ +/* +Copyright 2024 The Kruise Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + 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" +) + +// RolloutsGetter has a method to return a RolloutInterface. +// A group's client should implement this interface. +type RolloutsGetter interface { + Rollouts(namespace string) RolloutInterface +} + +// RolloutInterface has methods to work with Rollout resources. +type RolloutInterface interface { + Create(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.CreateOptions) (*v1alpha1.Rollout, error) + Update(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (*v1alpha1.Rollout, error) + UpdateStatus(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (*v1alpha1.Rollout, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Rollout, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RolloutList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rollout, err error) + RolloutExpansion +} + +// rollouts implements RolloutInterface +type rollouts struct { + client rest.Interface + ns string +} + +// newRollouts returns a Rollouts +func newRollouts(c *RolloutsV1alpha1Client, namespace string) *rollouts { + return &rollouts{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any. +func (c *rollouts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Rollout, err error) { + result = &v1alpha1.Rollout{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rollouts"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Rollouts that match those selectors. +func (c *rollouts) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.RolloutList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rollouts"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested rollouts. +func (c *rollouts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("rollouts"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a rollout and creates it. Returns the server's representation of the rollout, and an error, if there is any. +func (c *rollouts) Create(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.CreateOptions) (result *v1alpha1.Rollout, err error) { + result = &v1alpha1.Rollout{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rollouts"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rollout). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a rollout and updates it. Returns the server's representation of the rollout, and an error, if there is any. +func (c *rollouts) Update(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (result *v1alpha1.Rollout, err error) { + result = &v1alpha1.Rollout{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rollouts"). + Name(rollout.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rollout). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *rollouts) UpdateStatus(ctx context.Context, rollout *v1alpha1.Rollout, opts v1.UpdateOptions) (result *v1alpha1.Rollout, err error) { + result = &v1alpha1.Rollout{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rollouts"). + Name(rollout.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(rollout). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the rollout and deletes it. Returns an error if one occurs. +func (c *rollouts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rollouts"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *rollouts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("rollouts"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched rollout. +func (c *rollouts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Rollout, err error) { + result = &v1alpha1.Rollout{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rollouts"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go b/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go new file mode 100644 index 0000000..56bee75 --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/rollouts_client.go @@ -0,0 +1,112 @@ +/* +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 ( + "net/http" + + "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme" + v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" + rest "k8s.io/client-go/rest" +) + +type RolloutsV1alpha1Interface interface { + RESTClient() rest.Interface + RolloutsGetter + TrafficRoutingsGetter +} + +// RolloutsV1alpha1Client is used to interact with features provided by the rollouts.kruise.io group. +type RolloutsV1alpha1Client struct { + restClient rest.Interface +} + +func (c *RolloutsV1alpha1Client) Rollouts(namespace string) RolloutInterface { + return newRollouts(c, namespace) +} + +func (c *RolloutsV1alpha1Client) TrafficRoutings(namespace string) TrafficRoutingInterface { + return newTrafficRoutings(c, namespace) +} + +// NewForConfig creates a new RolloutsV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*RolloutsV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new RolloutsV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*RolloutsV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &RolloutsV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new RolloutsV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RolloutsV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RolloutsV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *RolloutsV1alpha1Client { + return &RolloutsV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RolloutsV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/client/clientset/versioned/typed/rollouts/v1alpha1/trafficrouting.go b/client/clientset/versioned/typed/rollouts/v1alpha1/trafficrouting.go new file mode 100644 index 0000000..0d1793f --- /dev/null +++ b/client/clientset/versioned/typed/rollouts/v1alpha1/trafficrouting.go @@ -0,0 +1,195 @@ +/* +Copyright 2024 The Kruise Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + 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" +) + +// TrafficRoutingsGetter has a method to return a TrafficRoutingInterface. +// A group's client should implement this interface. +type TrafficRoutingsGetter interface { + TrafficRoutings(namespace string) TrafficRoutingInterface +} + +// TrafficRoutingInterface has methods to work with TrafficRouting resources. +type TrafficRoutingInterface interface { + Create(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.CreateOptions) (*v1alpha1.TrafficRouting, error) + Update(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.UpdateOptions) (*v1alpha1.TrafficRouting, error) + UpdateStatus(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.UpdateOptions) (*v1alpha1.TrafficRouting, 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.TrafficRouting, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TrafficRoutingList, 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.TrafficRouting, err error) + TrafficRoutingExpansion +} + +// trafficRoutings implements TrafficRoutingInterface +type trafficRoutings struct { + client rest.Interface + ns string +} + +// newTrafficRoutings returns a TrafficRoutings +func newTrafficRoutings(c *RolloutsV1alpha1Client, namespace string) *trafficRoutings { + return &trafficRoutings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the trafficRouting, and returns the corresponding trafficRouting object, and an error if there is any. +func (c *trafficRoutings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TrafficRouting, err error) { + result = &v1alpha1.TrafficRouting{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trafficroutings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TrafficRoutings that match those selectors. +func (c *trafficRoutings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TrafficRoutingList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.TrafficRoutingList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("trafficroutings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested trafficRoutings. +func (c *trafficRoutings) 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("trafficroutings"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a trafficRouting and creates it. Returns the server's representation of the trafficRouting, and an error, if there is any. +func (c *trafficRoutings) Create(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.CreateOptions) (result *v1alpha1.TrafficRouting, err error) { + result = &v1alpha1.TrafficRouting{} + err = c.client.Post(). + Namespace(c.ns). + Resource("trafficroutings"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trafficRouting). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a trafficRouting and updates it. Returns the server's representation of the trafficRouting, and an error, if there is any. +func (c *trafficRoutings) Update(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.UpdateOptions) (result *v1alpha1.TrafficRouting, err error) { + result = &v1alpha1.TrafficRouting{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trafficroutings"). + Name(trafficRouting.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trafficRouting). + 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 *trafficRoutings) UpdateStatus(ctx context.Context, trafficRouting *v1alpha1.TrafficRouting, opts v1.UpdateOptions) (result *v1alpha1.TrafficRouting, err error) { + result = &v1alpha1.TrafficRouting{} + err = c.client.Put(). + Namespace(c.ns). + Resource("trafficroutings"). + Name(trafficRouting.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(trafficRouting). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the trafficRouting and deletes it. Returns an error if one occurs. +func (c *trafficRoutings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("trafficroutings"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *trafficRoutings) 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("trafficroutings"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched trafficRouting. +func (c *trafficRoutings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TrafficRouting, err error) { + result = &v1alpha1.TrafficRouting{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("trafficroutings"). + 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 index 52c7cb8..8d34bff 100644 --- a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_batchrelease.go +++ b/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_batchrelease.go @@ -36,9 +36,9 @@ type FakeBatchReleases struct { ns string } -var batchreleasesResource = schema.GroupVersionResource{Group: "rollouts", Version: "v1beta1", Resource: "batchreleases"} +var batchreleasesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1beta1", Resource: "batchreleases"} -var batchreleasesKind = schema.GroupVersionKind{Group: "rollouts", Version: "v1beta1", Kind: "BatchRelease"} +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) { diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollout.go b/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollout.go index 3b7e603..7052bef 100644 --- a/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollout.go +++ b/client/clientset/versioned/typed/rollouts/v1beta1/fake/fake_rollout.go @@ -36,9 +36,9 @@ type FakeRollouts struct { ns string } -var rolloutsResource = schema.GroupVersionResource{Group: "rollouts", Version: "v1beta1", Resource: "rollouts"} +var rolloutsResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1beta1", Resource: "rollouts"} -var rolloutsKind = schema.GroupVersionKind{Group: "rollouts", Version: "v1beta1", Kind: "Rollout"} +var rolloutsKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1beta1", Kind: "Rollout"} // Get takes name of the rollout, and returns the corresponding rollout object, and an error if there is any. func (c *FakeRollouts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.Rollout, err error) { diff --git a/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go b/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go index 4024b86..dc35139 100644 --- a/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go +++ b/client/clientset/versioned/typed/rollouts/v1beta1/rollouts_client.go @@ -32,7 +32,7 @@ type RolloutsV1beta1Interface interface { RolloutsGetter } -// RolloutsV1beta1Client is used to interact with features provided by the rollouts group. +// RolloutsV1beta1Client is used to interact with features provided by the rollouts.kruise.io group. type RolloutsV1beta1Client struct { restClient rest.Interface } diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index 87ea8e4..d00d150 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -21,6 +21,7 @@ package externalversions import ( "fmt" + v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -52,7 +53,13 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=rollouts, Version=v1beta1 + // Group=rollouts.kruise.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("rollouts"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().Rollouts().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"): diff --git a/client/informers/externalversions/rollouts/interface.go b/client/informers/externalversions/rollouts/interface.go index 83d5a3d..ef47dd0 100644 --- a/client/informers/externalversions/rollouts/interface.go +++ b/client/informers/externalversions/rollouts/interface.go @@ -20,11 +20,14 @@ package rollouts import ( internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/rollouts/v1alpha1" v1beta1 "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/rollouts/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -40,6 +43,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/client/informers/externalversions/rollouts/v1alpha1/interface.go b/client/informers/externalversions/rollouts/v1alpha1/interface.go new file mode 100644 index 0000000..86f1f83 --- /dev/null +++ b/client/informers/externalversions/rollouts/v1alpha1/interface.go @@ -0,0 +1,52 @@ +/* +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 ( + internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Rollouts returns a RolloutInformer. + Rollouts() RolloutInformer + // TrafficRoutings returns a TrafficRoutingInformer. + TrafficRoutings() TrafficRoutingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Rollouts returns a RolloutInformer. +func (v *version) Rollouts() RolloutInformer { + return &rolloutInformer{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/rollout.go b/client/informers/externalversions/rollouts/v1alpha1/rollout.go new file mode 100644 index 0000000..6b09590 --- /dev/null +++ b/client/informers/externalversions/rollouts/v1alpha1/rollout.go @@ -0,0 +1,90 @@ +/* +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" +) + +// RolloutInformer provides access to a shared informer and lister for +// Rollouts. +type RolloutInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RolloutLister +} + +type rolloutInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRolloutInformer constructs a new informer for Rollout 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 NewRolloutInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRolloutInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRolloutInformer constructs a new informer for Rollout 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 NewFilteredRolloutInformer(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().Rollouts(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RolloutsV1alpha1().Rollouts(namespace).Watch(context.TODO(), options) + }, + }, + &rolloutsv1alpha1.Rollout{}, + resyncPeriod, + indexers, + ) +} + +func (f *rolloutInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRolloutInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *rolloutInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rolloutsv1alpha1.Rollout{}, f.defaultInformer) +} + +func (f *rolloutInformer) Lister() v1alpha1.RolloutLister { + return v1alpha1.NewRolloutLister(f.Informer().GetIndexer()) +} diff --git a/client/informers/externalversions/rollouts/v1alpha1/trafficrouting.go b/client/informers/externalversions/rollouts/v1alpha1/trafficrouting.go new file mode 100644 index 0000000..796257a --- /dev/null +++ b/client/informers/externalversions/rollouts/v1alpha1/trafficrouting.go @@ -0,0 +1,90 @@ +/* +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" +) + +// TrafficRoutingInformer provides access to a shared informer and lister for +// TrafficRoutings. +type TrafficRoutingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.TrafficRoutingLister +} + +type trafficRoutingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewTrafficRoutingInformer constructs a new informer for TrafficRouting 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 NewTrafficRoutingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTrafficRoutingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredTrafficRoutingInformer constructs a new informer for TrafficRouting 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 NewFilteredTrafficRoutingInformer(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().TrafficRoutings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RolloutsV1alpha1().TrafficRoutings(namespace).Watch(context.TODO(), options) + }, + }, + &rolloutsv1alpha1.TrafficRouting{}, + resyncPeriod, + indexers, + ) +} + +func (f *trafficRoutingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTrafficRoutingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *trafficRoutingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rolloutsv1alpha1.TrafficRouting{}, f.defaultInformer) +} + +func (f *trafficRoutingInformer) Lister() v1alpha1.TrafficRoutingLister { + return v1alpha1.NewTrafficRoutingLister(f.Informer().GetIndexer()) +} diff --git a/client/listers/rollouts/v1alpha1/expansion_generated.go b/client/listers/rollouts/v1alpha1/expansion_generated.go new file mode 100644 index 0000000..a612cc4 --- /dev/null +++ b/client/listers/rollouts/v1alpha1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +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 + +// RolloutListerExpansion allows custom methods to be added to +// RolloutLister. +type RolloutListerExpansion interface{} + +// RolloutNamespaceListerExpansion allows custom methods to be added to +// RolloutNamespaceLister. +type RolloutNamespaceListerExpansion interface{} + +// TrafficRoutingListerExpansion allows custom methods to be added to +// TrafficRoutingLister. +type TrafficRoutingListerExpansion interface{} + +// TrafficRoutingNamespaceListerExpansion allows custom methods to be added to +// TrafficRoutingNamespaceLister. +type TrafficRoutingNamespaceListerExpansion interface{} diff --git a/client/listers/rollouts/v1alpha1/rollout.go b/client/listers/rollouts/v1alpha1/rollout.go new file mode 100644 index 0000000..772db3d --- /dev/null +++ b/client/listers/rollouts/v1alpha1/rollout.go @@ -0,0 +1,99 @@ +/* +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" +) + +// RolloutLister helps list Rollouts. +// All objects returned here must be treated as read-only. +type RolloutLister interface { + // List lists all Rollouts in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Rollout, err error) + // Rollouts returns an object that can list and get Rollouts. + Rollouts(namespace string) RolloutNamespaceLister + RolloutListerExpansion +} + +// rolloutLister implements the RolloutLister interface. +type rolloutLister struct { + indexer cache.Indexer +} + +// NewRolloutLister returns a new RolloutLister. +func NewRolloutLister(indexer cache.Indexer) RolloutLister { + return &rolloutLister{indexer: indexer} +} + +// List lists all Rollouts in the indexer. +func (s *rolloutLister) List(selector labels.Selector) (ret []*v1alpha1.Rollout, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Rollout)) + }) + return ret, err +} + +// Rollouts returns an object that can list and get Rollouts. +func (s *rolloutLister) Rollouts(namespace string) RolloutNamespaceLister { + return rolloutNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RolloutNamespaceLister helps list and get Rollouts. +// All objects returned here must be treated as read-only. +type RolloutNamespaceLister interface { + // List lists all Rollouts in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Rollout, err error) + // Get retrieves the Rollout from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Rollout, error) + RolloutNamespaceListerExpansion +} + +// rolloutNamespaceLister implements the RolloutNamespaceLister +// interface. +type rolloutNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Rollouts in the indexer for a given namespace. +func (s rolloutNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Rollout, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Rollout)) + }) + return ret, err +} + +// Get retrieves the Rollout from the indexer for a given namespace and name. +func (s rolloutNamespaceLister) Get(name string) (*v1alpha1.Rollout, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("rollout"), name) + } + return obj.(*v1alpha1.Rollout), nil +} diff --git a/client/listers/rollouts/v1alpha1/trafficrouting.go b/client/listers/rollouts/v1alpha1/trafficrouting.go new file mode 100644 index 0000000..03c61a8 --- /dev/null +++ b/client/listers/rollouts/v1alpha1/trafficrouting.go @@ -0,0 +1,99 @@ +/* +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" +) + +// TrafficRoutingLister helps list TrafficRoutings. +// All objects returned here must be treated as read-only. +type TrafficRoutingLister interface { + // List lists all TrafficRoutings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.TrafficRouting, err error) + // TrafficRoutings returns an object that can list and get TrafficRoutings. + TrafficRoutings(namespace string) TrafficRoutingNamespaceLister + TrafficRoutingListerExpansion +} + +// trafficRoutingLister implements the TrafficRoutingLister interface. +type trafficRoutingLister struct { + indexer cache.Indexer +} + +// NewTrafficRoutingLister returns a new TrafficRoutingLister. +func NewTrafficRoutingLister(indexer cache.Indexer) TrafficRoutingLister { + return &trafficRoutingLister{indexer: indexer} +} + +// List lists all TrafficRoutings in the indexer. +func (s *trafficRoutingLister) List(selector labels.Selector) (ret []*v1alpha1.TrafficRouting, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.TrafficRouting)) + }) + return ret, err +} + +// TrafficRoutings returns an object that can list and get TrafficRoutings. +func (s *trafficRoutingLister) TrafficRoutings(namespace string) TrafficRoutingNamespaceLister { + return trafficRoutingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TrafficRoutingNamespaceLister helps list and get TrafficRoutings. +// All objects returned here must be treated as read-only. +type TrafficRoutingNamespaceLister interface { + // List lists all TrafficRoutings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.TrafficRouting, err error) + // Get retrieves the TrafficRouting from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.TrafficRouting, error) + TrafficRoutingNamespaceListerExpansion +} + +// trafficRoutingNamespaceLister implements the TrafficRoutingNamespaceLister +// interface. +type trafficRoutingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TrafficRoutings in the indexer for a given namespace. +func (s trafficRoutingNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TrafficRouting, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.TrafficRouting)) + }) + return ret, err +} + +// Get retrieves the TrafficRouting from the indexer for a given namespace and name. +func (s trafficRoutingNamespaceLister) Get(name string) (*v1alpha1.TrafficRouting, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("trafficrouting"), name) + } + return obj.(*v1alpha1.TrafficRouting), nil +} diff --git a/hack/generate_client.sh b/hack/generate_client.sh index c1fee26..02ed0da 100755 --- a/hack/generate_client.sh +++ b/hack/generate_client.sh @@ -13,7 +13,7 @@ cp -r ./{rollouts,hack,vendor,go.mod} "${TMP_DIR}"/src/github.com/openkruise/kru (cd "${TMP_DIR}"/src/github.com/openkruise/kruise-rollout-api; \ GOPATH=${TMP_DIR} GO111MODULE=on /bin/bash vendor/k8s.io/code-generator/generate-groups.sh all \ - github.com/openkruise/kruise-rollout-api/client github.com/openkruise/kruise-rollout-api "rollouts:v1beta1" -h ./hack/boilerplate.go.txt) + github.com/openkruise/kruise-rollout-api/client github.com/openkruise/kruise-rollout-api "rollouts:v1alpha1,v1beta1" -h ./hack/boilerplate.go.txt) mkdir -p ./client rm -rf ./client/{clientset,informers,listers} diff --git a/pkg/rollouts/openapi_generated.go b/pkg/rollouts/openapi_generated.go index b69e357..7d0cf46 100644 --- a/pkg/rollouts/openapi_generated.go +++ b/pkg/rollouts/openapi_generated.go @@ -30,32 +30,1070 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "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.CanaryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.CanaryStep": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStep(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.CanaryStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStrategy(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.DeploymentExtraStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_DeploymentExtraStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.DeploymentStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_DeploymentStrategy(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.GatewayTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_GatewayTrafficRouting(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.HttpRouteMatch": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_HttpRouteMatch(ref), - "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), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutPause": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutPause(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutSpec": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutSpec(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutStatus(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutStrategy(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.TrafficRoutingRef": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_TrafficRoutingRef(ref), - "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.TrafficRoutingStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_TrafficRoutingStrategy(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.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.GatewayTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_GatewayTrafficRouting(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.IngressTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressTrafficRouting(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.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.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.TrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRouting(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.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.CanaryStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStatus(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.CanaryStep": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStep(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.CanaryStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_CanaryStrategy(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.DeploymentExtraStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_DeploymentExtraStatus(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.DeploymentStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_DeploymentStrategy(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.GatewayTrafficRouting": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_GatewayTrafficRouting(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.HttpRouteMatch": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_HttpRouteMatch(ref), + "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), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutPause": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutPause(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutSpec": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutSpec(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutStatus": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutStatus(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.RolloutStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_RolloutStrategy(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.TrafficRoutingRef": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_TrafficRoutingRef(ref), + "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1.TrafficRoutingStrategy": schema_openkruise_kruise_rollout_api_rollouts_v1beta1_TrafficRoutingStrategy(ref), + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CanaryStatus status fields that only pertain to the canary rollout", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "observedWorkloadGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedWorkloadGeneration is the most recent generation observed for this Rollout ref workload generation.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "observedRolloutID": { + SchemaProps: spec.SchemaProps{ + Description: "ObservedRolloutID will record the newest spec.RolloutID if status.canaryRevision equals to workload.updateRevision", + Type: []string{"string"}, + Format: "", + }, + }, + "rolloutHash": { + SchemaProps: spec.SchemaProps{ + Description: "RolloutHash from rollout.spec object", + Type: []string{"string"}, + Format: "", + }, + }, + "stableRevision": { + SchemaProps: spec.SchemaProps{ + Description: "StableRevision indicates the revision of stable pods", + Type: []string{"string"}, + Format: "", + }, + }, + "canaryRevision": { + SchemaProps: spec.SchemaProps{ + Description: "CanaryRevision is calculated by rollout based on podTemplateHash, and the internal logic flow uses It may be different from rs podTemplateHash in different k8s versions, so it cannot be used as service selector label", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "podTemplateHash": { + SchemaProps: spec.SchemaProps{ + Description: "pod template hash is used as service selector label", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "canaryReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "CanaryReplicas the numbers of canary revision pods", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "canaryReadyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "CanaryReadyReplicas the numbers of ready canary revision pods", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nextStepIndex": { + SchemaProps: spec.SchemaProps{ + Description: "NextStepIndex defines the next step of the rollout is on. In normal case, NextStepIndex is equal to CurrentStepIndex + 1 If the current step is the last step, NextStepIndex is equal to -1 Before the release, NextStepIndex is also equal to -1 0 is not used and won't appear in any case It is allowed to patch NextStepIndex by design, e.g. if CurrentStepIndex is 2, user can patch NextStepIndex to 3 (if exists) to achieve batch jump, or patch NextStepIndex to 1 to implement a re-execution of step 1 Patching it with a non-positive value is meaningless, which will be corrected in the next reconciliation achieve batch jump, or patch NextStepIndex to 1 to implement a re-execution of step 1", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "currentStepIndex": { + SchemaProps: spec.SchemaProps{ + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "currentStepState": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "lastUpdateTime": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "finalisingStep": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"canaryRevision", "podTemplateHash", "canaryReplicas", "canaryReadyReplicas", "nextStepIndex", "currentStepState", "finalisingStep"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStep(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CanaryStep defines a step of a canary workload.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "weight": { + SchemaProps: spec.SchemaProps{ + Description: "Weight indicate how many percentage of traffic the canary pods should receive", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "requestHeaderModifier": { + SchemaProps: spec.SchemaProps{ + Description: "Set overwrites the request with the given header (name, value) before the action.\n\nInput:\n GET /foo HTTP/1.1\n my-header: foo\n\nrequestHeaderModifier:\n set:\n - name: \"my-header\"\n value: \"bar\"\n\nOutput:\n GET /foo HTTP/1.1\n my-header: bar", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1beta1.HTTPRequestHeaderFilter"), + }, + }, + "matches": { + SchemaProps: spec.SchemaProps{ + Description: "Matches define conditions used for matching the incoming HTTP requests to canary service. Each match is independent, i.e. this rule will be matched if **any** one of the matches is satisfied. If Gateway API, current only support one match. And cannot support both weight and matches, if both are configured, then matches takes precedence.", + 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.HttpRouteMatch"), + }, + }, + }, + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Replicas is the number of expected canary pods in this batch it can be an absolute number (ex: 5) or a percentage of total pods.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "pause": { + SchemaProps: spec.SchemaProps{ + Description: "Pause defines a pause stage for a rollout, manual or auto", + Default: map[string]interface{}{}, + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutPause"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.HttpRouteMatch", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutPause", "k8s.io/apimachinery/pkg/util/intstr.IntOrString", "sigs.k8s.io/gateway-api/apis/v1beta1.HTTPRequestHeaderFilter"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CanaryStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CanaryStrategy defines parameters for a Replica Based Canary", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "steps": { + SchemaProps: spec.SchemaProps{ + Description: "Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%)", + 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.CanaryStep"), + }, + }, + }, + }, + }, + "trafficRoutings": { + SchemaProps: spec.SchemaProps{ + Description: "TrafficRoutings hosts all the supported service meshes supported to enable more fine-grained traffic routing and current only support one TrafficRouting", + 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.TrafficRoutingRef"), + }, + }, + }, + }, + }, + "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"), + }, + }, + "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"), + }, + }, + "disableGenerateCanaryService": { + SchemaProps: spec.SchemaProps{ + Description: "canary service will not be generated if DisableGenerateCanaryService is true", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStep", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.PatchPodTemplateMetadata", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingRef", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_CustomNetworkRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name"}, + }, + }, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_GatewayTrafficRouting(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "GatewayTrafficRouting configuration for gateway api", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "httpRouteName": { + SchemaProps: spec.SchemaProps{ + Description: "HTTPRouteName refers to the name of an `HTTPRoute` resource in the same namespace as the `Rollout`", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_HttpRouteMatch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "headers": { + SchemaProps: spec.SchemaProps{ + Description: "Headers specifies HTTP request header matchers. Multiple match values are ANDed together, meaning, a request must match all the specified headers to select the route.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/gateway-api/apis/v1beta1.HTTPHeaderMatch"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/gateway-api/apis/v1beta1.HTTPHeaderMatch"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_IngressTrafficRouting(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "IngressTrafficRouting configuration for ingress controller to control traffic routing", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "classType": { + SchemaProps: spec.SchemaProps{ + Description: "ClassType refers to the type of `Ingress`. current support nginx, aliyun-alb. default is nginx.", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name refers to the name of an `Ingress` resource in the same namespace as the `Rollout`", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_ObjectRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + 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", + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.WorkloadRef"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.WorkloadRef"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_PatchPodTemplateMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "annotations": { + SchemaProps: spec.SchemaProps{ + Description: "annotations", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_Rollout(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Rollout is the Schema for the rollouts 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.RolloutSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutSpec", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutCondition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RolloutCondition describes the state of a rollout at a certain point.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Type of rollout condition.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Phase of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "lastUpdateTime": { + SchemaProps: spec.SchemaProps{ + Description: "The last time this condition was updated.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "Last time the condition transitioned from one status to another.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "The reason for the condition's last transition.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "A human readable message indicating details about the transition.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RolloutList contains a list of Rollout", + 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.Rollout"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.Rollout", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutPause(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RolloutPause defines a pause stage for a rollout", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "duration": { + SchemaProps: spec.SchemaProps{ + Description: "Duration the amount of time to wait before moving to the next step.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RolloutSpec defines the desired state of Rollout", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "objectRef": { + SchemaProps: spec.SchemaProps{ + Description: "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file ObjectRef indicates workload", + Default: map[string]interface{}{}, + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ObjectRef"), + }, + }, + "strategy": { + SchemaProps: spec.SchemaProps{ + Description: "rollout strategy", + Default: map[string]interface{}{}, + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutStrategy"), + }, + }, + "rolloutID": { + SchemaProps: spec.SchemaProps{ + Description: "DeprecatedRolloutID is the deprecated field. It is recommended that configure RolloutId in workload.annotations[rollouts.kruise.io/rollout-id]. RolloutID should be changed before each workload revision publication. It is to distinguish consecutive multiple workload publications and rollout progress.", + Type: []string{"string"}, + Format: "", + }, + }, + "disabled": { + SchemaProps: spec.SchemaProps{ + Description: "if a rollout disabled, then the rollout would not watch changes of workload", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"objectRef", "strategy", "disabled"}, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.ObjectRef", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutStrategy"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RolloutStatus defines the observed state of Rollout", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration is the most recent generation observed for this Rollout.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "canaryStatus": { + SchemaProps: spec.SchemaProps{ + Description: "Canary describes the state of the canary rollout", + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStatus"), + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions a list of conditions a rollout can have.", + 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"), + }, + }, + }, + }, + }, + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase is the rollout phase.", + 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/v1alpha1.CanaryStatus", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.RolloutCondition"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_RolloutStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RolloutStrategy defines strategy to apply during next rollout", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "paused": { + SchemaProps: spec.SchemaProps{ + Description: "Paused indicates that the Rollout is paused. Default value is false", + Type: []string{"boolean"}, + Format: "", + }, + }, + "canary": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStrategy"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CanaryStrategy"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRouting(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrafficRouting is the Schema for the TrafficRoutings 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.TrafficRoutingSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingSpec", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrafficRoutingList contains a list of TrafficRouting", + 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.TrafficRouting"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRouting", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TrafficRoutingRef hosts all the different configuration for supported service meshes to enable more fine-grained traffic routing", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "service": { + SchemaProps: spec.SchemaProps{ + Description: "Service holds the name of a service which selects pods with stable version and don't select any pods with canary version.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "gracePeriodSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "Optional duration in seconds the traffic provider(e.g. nginx ingress controller) consumes the service, ingress configuration changes gracefully.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "ingress": { + SchemaProps: spec.SchemaProps{ + Description: "Ingress holds Ingress specific configuration to route traffic, e.g. Nginx, Alb.", + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.IngressTrafficRouting"), + }, + }, + "gateway": { + SchemaProps: spec.SchemaProps{ + Description: "Gateway holds Gateway specific configuration to route traffic Gateway configuration only supports >= v0.4.0 (v1alpha2).", + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.GatewayTrafficRouting"), + }, + }, + "customNetworkRefs": { + SchemaProps: spec.SchemaProps{ + Description: "CustomNetworkRefs hold a list of custom providers to route traffic", + 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.CustomNetworkRef"), + }, + }, + }, + }, + }, + }, + Required: []string{"service"}, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.CustomNetworkRef", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.GatewayTrafficRouting", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.IngressTrafficRouting"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "objectRef": { + SchemaProps: spec.SchemaProps{ + Description: "ObjectRef indicates trafficRouting ref", + 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.TrafficRoutingRef"), + }, + }, + }, + }, + }, + "strategy": { + SchemaProps: spec.SchemaProps{ + Description: "trafficrouting strategy", + Default: map[string]interface{}{}, + Ref: ref("github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingStrategy"), + }, + }, + }, + Required: []string{"objectRef", "strategy"}, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingRef", "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.TrafficRoutingStrategy"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration is the most recent generation observed for this Rollout.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Phase is the trafficRouting phase.", + 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: "", + }, + }, + }, + }, + }, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_TrafficRoutingStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "weight": { + SchemaProps: spec.SchemaProps{ + Description: "Weight indicate how many percentage of traffic the canary pods should receive", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "requestHeaderModifier": { + SchemaProps: spec.SchemaProps{ + Description: "Set overwrites the request with the given header (name, value) before the action.\n\nInput:\n GET /foo HTTP/1.1\n my-header: foo\n\nrequestHeaderModifier:\n set:\n - name: \"my-header\"\n value: \"bar\"\n\nOutput:\n GET /foo HTTP/1.1\n my-header: bar", + Ref: ref("sigs.k8s.io/gateway-api/apis/v1beta1.HTTPRequestHeaderFilter"), + }, + }, + "matches": { + SchemaProps: spec.SchemaProps{ + Description: "Matches define conditions used for matching the incoming HTTP requests to canary service. Each match is independent, i.e. this rule will be matched if **any** one of the matches is satisfied. If Gateway API, current only support one match. And cannot support both weight and matches, if both are configured, then matches takes precedence.", + 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.HttpRouteMatch"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1.HttpRouteMatch", "sigs.k8s.io/gateway-api/apis/v1beta1.HTTPRequestHeaderFilter"}, + } +} + +func schema_openkruise_kruise_rollout_api_rollouts_v1alpha1_WorkloadRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "WorkloadRef holds a references to the Kubernetes object", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "API Version of the referent", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind of the referent", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the referent", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name"}, + }, + }, } } diff --git a/pkg/rollouts/violation_exceptions.list b/pkg/rollouts/violation_exceptions.list index 429dfc8..9f54cee 100644 --- a/pkg/rollouts/violation_exceptions.list +++ b/pkg/rollouts/violation_exceptions.list @@ -1,3 +1,10 @@ +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,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,CanaryStrategy,Steps API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,TrafficRoutings @@ -6,4 +13,5 @@ API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/r 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,RolloutSpec,DeprecatedRolloutID API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BatchReleaseCanaryStatus,CurrentBatchState diff --git a/rollouts/addtoscheme_rollouts_v1alpha1.go b/rollouts/addtoscheme_rollouts_v1alpha1.go new file mode 100644 index 0000000..f512ae4 --- /dev/null +++ b/rollouts/addtoscheme_rollouts_v1alpha1.go @@ -0,0 +1,26 @@ +/* +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 rollouts + +import ( + "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) +} diff --git a/rollouts/apis.go b/rollouts/apis.go new file mode 100644 index 0000000..8ea923b --- /dev/null +++ b/rollouts/apis.go @@ -0,0 +1,29 @@ +/* +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 rollouts + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} diff --git a/rollouts/v1alpha1/doc.go b/rollouts/v1alpha1/doc.go new file mode 100644 index 0000000..888a80d --- /dev/null +++ b/rollouts/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The Kruise Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:openapi-gen=true +// +groupName=rollouts.kruise.io +package v1alpha1 diff --git a/rollouts/v1alpha1/groupversion_info.go b/rollouts/v1alpha1/groupversion_info.go new file mode 100644 index 0000000..a4d1bea --- /dev/null +++ b/rollouts/v1alpha1/groupversion_info.go @@ -0,0 +1,44 @@ +/* +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 contains API Schema definitions for the apps v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=rollouts.kruise.io +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/openkruise/kruise-rollout-api/utils/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "rollouts.kruise.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme + + SchemeGroupVersion = GroupVersion +) + +// Resource is required by pkg/client/listers/... +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/rollouts/v1alpha1/rollout_types.go b/rollouts/v1alpha1/rollout_types.go new file mode 100644 index 0000000..526c110 --- /dev/null +++ b/rollouts/v1alpha1/rollout_types.go @@ -0,0 +1,322 @@ +/* +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 ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// 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. + +const ( + // RolloutIDLabel is set to workload labels. + // RolloutIDLabel is designed to distinguish each workload revision publications. + // The value of RolloutIDLabel corresponds Rollout.Spec.RolloutID. + RolloutIDLabel = "rollouts.kruise.io/rollout-id" + + // RolloutBatchIDLabel is patched in pod labels. + // RolloutBatchIDLabel is the label key of batch id that will be patched to pods during rollout. + // Only when RolloutIDLabel is set, RolloutBatchIDLabel will be patched. + // Users can use RolloutIDLabel and RolloutBatchIDLabel to select the pods that are upgraded in some certain batch and release. + RolloutBatchIDLabel = "rollouts.kruise.io/rollout-batch-id" + + // RollbackInBatchAnnotation is set to rollout annotations. + // RollbackInBatchAnnotation allow use disable quick rollback, and will roll back in batch style. + RollbackInBatchAnnotation = "rollouts.kruise.io/rollback-in-batch" + + // RolloutStyleAnnotation define the rolling behavior for Deployment. + // must be "partition" or "canary": + // * "partition" means rolling in batches just like CloneSet, and will NOT create any extra Workload; + // * "canary" means rolling in canary way, and will create a canary Workload. + // Currently, only Deployment support both "partition" and "canary" rolling styles. + // For other workload types, they only support "partition" styles. + // Defaults to "canary" to Deployment. + // Defaults to "partition" to the others. + RolloutStyleAnnotation = "rollouts.kruise.io/rolling-style" + + // TrafficRoutingAnnotation is the TrafficRouting Name, and it is the Rollout's TrafficRouting. + // The Rollout release will trigger the TrafficRouting release. For example: + // A microservice consists of three applications, and the invocation relationship is as follows: a -> b -> c, + // and application(a, b, c)'s gateway is trafficRouting. Any application(a, b or b) release will trigger TrafficRouting release. + TrafficRoutingAnnotation = "rollouts.kruise.io/trafficrouting" +) + +// RolloutSpec defines the desired state of Rollout +type RolloutSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "make" to regenerate code after modifying this file + // ObjectRef indicates workload + ObjectRef ObjectRef `json:"objectRef"` + // rollout strategy + Strategy RolloutStrategy `json:"strategy"` + // DeprecatedRolloutID is the deprecated field. + // It is recommended that configure RolloutId in workload.annotations[rollouts.kruise.io/rollout-id]. + // RolloutID should be changed before each workload revision publication. + // It is to distinguish consecutive multiple workload publications and rollout progress. + DeprecatedRolloutID string `json:"rolloutID,omitempty"` + // if a rollout disabled, then the rollout would not watch changes of workload + //+kubebuilder:validation:Optional + //+kubebuilder:default=false + Disabled bool `json:"disabled"` +} + +type ObjectRef struct { + // WorkloadRef contains enough information to let you identify a workload for Rollout + // Batch release of the bypass + WorkloadRef *WorkloadRef `json:"workloadRef,omitempty"` +} + +// WorkloadRef holds a references to the Kubernetes object +type WorkloadRef struct { + // API Version of the referent + APIVersion string `json:"apiVersion"` + // Kind of the referent + Kind string `json:"kind"` + // Name of the referent + Name string `json:"name"` +} + +// RolloutStrategy defines strategy to apply during next rollout +type RolloutStrategy struct { + // Paused indicates that the Rollout is paused. + // Default value is false + Paused bool `json:"paused,omitempty"` + // +optional + Canary *CanaryStrategy `json:"canary,omitempty"` +} + +// CanaryStrategy defines parameters for a Replica Based Canary +type CanaryStrategy struct { + // Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%) + // +optional + Steps []CanaryStep `json:"steps,omitempty"` + // TrafficRoutings hosts all the supported service meshes supported to enable more fine-grained traffic routing + // and current only support one TrafficRouting + TrafficRoutings []TrafficRoutingRef `json:"trafficRoutings,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"` + // 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"` + // canary service will not be generated if DisableGenerateCanaryService is true + DisableGenerateCanaryService bool `json:"disableGenerateCanaryService,omitempty"` +} + +type PatchPodTemplateMetadata struct { + // annotations + Annotations map[string]string `json:"annotations,omitempty"` + // labels + Labels map[string]string `json:"labels,omitempty"` +} + +// CanaryStep defines a step of a canary workload. +type CanaryStep struct { + TrafficRoutingStrategy `json:",inline"` + // Replicas is the number of expected canary pods in this batch + // it can be an absolute number (ex: 5) or a percentage of total pods. + Replicas *intstr.IntOrString `json:"replicas,omitempty"` + // Pause defines a pause stage for a rollout, manual or auto + // +optional + Pause RolloutPause `json:"pause,omitempty"` +} + +type HttpRouteMatch struct { + // Headers specifies HTTP request header matchers. Multiple match values are + // ANDed together, meaning, a request must match all the specified headers + // to select the route. + // +kubebuilder:validation:MaxItems=16 + Headers []gatewayv1beta1.HTTPHeaderMatch `json:"headers,omitempty"` +} + +// RolloutPause defines a pause stage for a rollout +type RolloutPause struct { + // Duration the amount of time to wait before moving to the next step. + // +optional + Duration *int32 `json:"duration,omitempty"` +} + +// RolloutStatus defines the observed state of Rollout +type RolloutStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file + + // observedGeneration is the most recent generation observed for this Rollout. + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + // Canary describes the state of the canary rollout + // +optional + CanaryStatus *CanaryStatus `json:"canaryStatus,omitempty"` + // Conditions a list of conditions a rollout can have. + // +optional + Conditions []RolloutCondition `json:"conditions,omitempty"` + // Phase is the rollout phase. + Phase RolloutPhase `json:"phase,omitempty"` + // Message provides details on why the rollout is in its current phase + Message string `json:"message,omitempty"` +} + +// RolloutCondition describes the state of a rollout at a certain point. +type RolloutCondition struct { + // Type of rollout condition. + Type RolloutConditionType `json:"type"` + // Phase of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus `json:"status"` + // The last time this condition was updated. + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + // The reason for the condition's last transition. + Reason string `json:"reason"` + // A human readable message indicating details about the transition. + Message string `json:"message"` +} + +// RolloutConditionType defines the conditions of Rollout +type RolloutConditionType string + +// These are valid conditions of a rollout. +const ( + // RolloutConditionProgressing means the rollout is progressing. Progress for a rollout is + // considered when a new replica set is created or adopted, when pods scale + // up or old pods scale down, or when the services are updated. Progress is not estimated + // for paused rollouts. + RolloutConditionProgressing RolloutConditionType = "Progressing" + // Progressing Reason + ProgressingReasonInitializing = "Initializing" + ProgressingReasonInRolling = "InRolling" + ProgressingReasonFinalising = "Finalising" + ProgressingReasonCompleted = "Completed" + ProgressingReasonCancelling = "Cancelling" + ProgressingReasonPaused = "Paused" + + // RolloutConditionSucceeded indicates whether rollout is succeeded or failed. + RolloutConditionSucceeded RolloutConditionType = "Succeeded" + + // Terminating condition + RolloutConditionTerminating RolloutConditionType = "Terminating" + // Terminating Reason + TerminatingReasonInTerminating = "InTerminating" + TerminatingReasonCompleted = "Completed" +) + +// CanaryStatus status fields that only pertain to the canary rollout +type CanaryStatus struct { + // observedWorkloadGeneration is the most recent generation observed for this Rollout ref workload generation. + ObservedWorkloadGeneration int64 `json:"observedWorkloadGeneration,omitempty"` + // ObservedRolloutID will record the newest spec.RolloutID if status.canaryRevision equals to workload.updateRevision + ObservedRolloutID string `json:"observedRolloutID,omitempty"` + // RolloutHash from rollout.spec object + RolloutHash string `json:"rolloutHash,omitempty"` + // StableRevision indicates the revision of stable pods + StableRevision string `json:"stableRevision,omitempty"` + // CanaryRevision is calculated by rollout based on podTemplateHash, and the internal logic flow uses + // It may be different from rs podTemplateHash in different k8s versions, so it cannot be used as service selector label + CanaryRevision string `json:"canaryRevision"` + // pod template hash is used as service selector label + PodTemplateHash string `json:"podTemplateHash"` + // CanaryReplicas the numbers of canary revision pods + CanaryReplicas int32 `json:"canaryReplicas"` + // CanaryReadyReplicas the numbers of ready canary revision pods + CanaryReadyReplicas int32 `json:"canaryReadyReplicas"` + // NextStepIndex defines the next step of the rollout is on. + // In normal case, NextStepIndex is equal to CurrentStepIndex + 1 + // If the current step is the last step, NextStepIndex is equal to -1 + // Before the release, NextStepIndex is also equal to -1 + // 0 is not used and won't appear in any case + // It is allowed to patch NextStepIndex by design, + // e.g. if CurrentStepIndex is 2, user can patch NextStepIndex to 3 (if exists) to + // achieve batch jump, or patch NextStepIndex to 1 to implement a re-execution of step 1 + // Patching it with a non-positive value is meaningless, which will be corrected + // in the next reconciliation + // achieve batch jump, or patch NextStepIndex to 1 to implement a re-execution of step 1 + NextStepIndex int32 `json:"nextStepIndex"` + // +optional + CurrentStepIndex int32 `json:"currentStepIndex"` + CurrentStepState CanaryStepState `json:"currentStepState"` + Message string `json:"message,omitempty"` + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + FinalisingStep FinalizeStateType `json:"finalisingStep"` +} + +type CanaryStepState string +type FinalizeStateType string + +const ( + CanaryStepStateUpgrade CanaryStepState = "StepUpgrade" + CanaryStepStateTrafficRouting CanaryStepState = "StepTrafficRouting" + CanaryStepStateMetricsAnalysis CanaryStepState = "StepMetricsAnalysis" + CanaryStepStatePaused CanaryStepState = "StepPaused" + CanaryStepStateReady CanaryStepState = "StepReady" + CanaryStepStateCompleted CanaryStepState = "Completed" +) + +// RolloutPhase are a set of phases that this rollout +type RolloutPhase string + +const ( + // RolloutPhaseInitial indicates a rollout is Initial + RolloutPhaseInitial RolloutPhase = "Initial" + // RolloutPhaseHealthy indicates a rollout is healthy + RolloutPhaseHealthy RolloutPhase = "Healthy" + // RolloutPhaseProgressing indicates a rollout is not yet healthy but still making progress towards a healthy state + RolloutPhaseProgressing RolloutPhase = "Progressing" + // RolloutPhaseTerminating indicates a rollout is terminated + RolloutPhaseTerminating RolloutPhase = "Terminating" + // RolloutPhaseDisabled indicates a rollout is disabled + RolloutPhaseDisabled RolloutPhase = "Disabled" + // RolloutPhaseDisabling indicates a rollout is disabling and releasing resources + RolloutPhaseDisabling RolloutPhase = "Disabling" +) + +// +genclient +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.phase",description="The rollout status phase" +// +kubebuilder:printcolumn:name="CANARY_STEP",type="integer",JSONPath=".status.canaryStatus.currentStepIndex",description="The rollout canary status step" +// +kubebuilder:printcolumn:name="CANARY_STATE",type="string",JSONPath=".status.canaryStatus.currentStepState",description="The rollout canary status step state" +// +kubebuilder:printcolumn:name="MESSAGE",type="string",JSONPath=".status.message",description="The rollout canary status message" +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp" + +// Rollout is the Schema for the rollouts API +type Rollout struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RolloutSpec `json:"spec,omitempty"` + Status RolloutStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// RolloutList contains a list of Rollout +type RolloutList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Rollout `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Rollout{}, &RolloutList{}) +} diff --git a/rollouts/v1alpha1/trafficrouting_types.go b/rollouts/v1alpha1/trafficrouting_types.go new file mode 100644 index 0000000..4335635 --- /dev/null +++ b/rollouts/v1alpha1/trafficrouting_types.go @@ -0,0 +1,163 @@ +/* +Copyright 2023 The Kruise Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +const ( + ProgressingRolloutFinalizerPrefix = "progressing.rollouts.kruise.io" +) + +// TrafficRoutingRef hosts all the different configuration for supported service meshes to enable more fine-grained traffic routing +type TrafficRoutingRef struct { + // Service holds the name of a service which selects pods with stable version and don't select any pods with canary version. + Service string `json:"service"` + // Optional duration in seconds the traffic provider(e.g. nginx ingress controller) consumes the service, ingress configuration changes gracefully. + // +kubebuilder:default=3 + GracePeriodSeconds int32 `json:"gracePeriodSeconds,omitempty"` + // Ingress holds Ingress specific configuration to route traffic, e.g. Nginx, Alb. + Ingress *IngressTrafficRouting `json:"ingress,omitempty"` + // Gateway holds Gateway specific configuration to route traffic + // Gateway configuration only supports >= v0.4.0 (v1alpha2). + Gateway *GatewayTrafficRouting `json:"gateway,omitempty"` + // CustomNetworkRefs hold a list of custom providers to route traffic + CustomNetworkRefs []CustomNetworkRef `json:"customNetworkRefs,omitempty"` +} + +// IngressTrafficRouting configuration for ingress controller to control traffic routing +type IngressTrafficRouting struct { + // ClassType refers to the type of `Ingress`. + // current support nginx, aliyun-alb. default is nginx. + // +optional + ClassType string `json:"classType,omitempty"` + // Name refers to the name of an `Ingress` resource in the same namespace as the `Rollout` + Name string `json:"name"` +} + +// GatewayTrafficRouting configuration for gateway api +type GatewayTrafficRouting struct { + // HTTPRouteName refers to the name of an `HTTPRoute` resource in the same namespace as the `Rollout` + HTTPRouteName *string `json:"httpRouteName,omitempty"` + // TCPRouteName *string `json:"tcpRouteName,omitempty"` + // UDPRouteName *string `json:"udpRouteName,omitempty"` +} + +type TrafficRoutingSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "make" to regenerate code after modifying this file + + // ObjectRef indicates trafficRouting ref + ObjectRef []TrafficRoutingRef `json:"objectRef"` + // trafficrouting strategy + Strategy TrafficRoutingStrategy `json:"strategy"` +} + +type TrafficRoutingStrategy struct { + // Weight indicate how many percentage of traffic the canary pods should receive + // +optional + Weight *int32 `json:"weight,omitempty"` + // Set overwrites the request with the given header (name, value) + // before the action. + // + // Input: + // GET /foo HTTP/1.1 + // my-header: foo + // + // requestHeaderModifier: + // set: + // - name: "my-header" + // value: "bar" + // + // Output: + // GET /foo HTTP/1.1 + // my-header: bar + // + // +optional + RequestHeaderModifier *gatewayv1beta1.HTTPRequestHeaderFilter `json:"requestHeaderModifier,omitempty"` + // Matches define conditions used for matching the incoming HTTP requests to canary service. + // Each match is independent, i.e. this rule will be matched if **any** one of the matches is satisfied. + // If Gateway API, current only support one match. + // And cannot support both weight and matches, if both are configured, then matches takes precedence. + Matches []HttpRouteMatch `json:"matches,omitempty"` +} + +type TrafficRoutingStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file + + // observedGeneration is the most recent generation observed for this Rollout. + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + // Phase is the trafficRouting phase. + Phase TrafficRoutingPhase `json:"phase,omitempty"` + // Message provides details on why the rollout is in its current phase + Message string `json:"message,omitempty"` +} + +// TrafficRoutingPhase are a set of phases that this rollout +type TrafficRoutingPhase string + +const ( + // TrafficRoutingPhaseInitial indicates a traffic routing is Initial + TrafficRoutingPhaseInitial TrafficRoutingPhase = "Initial" + // TrafficRoutingPhaseHealthy indicates a traffic routing is healthy. + // This means that Ingress and Service Resources exist. + TrafficRoutingPhaseHealthy TrafficRoutingPhase = "Healthy" + // TrafficRoutingPhaseProgressing indicates a traffic routing is not yet healthy but still making progress towards a healthy state + TrafficRoutingPhaseProgressing TrafficRoutingPhase = "Progressing" + // TrafficRoutingPhaseFinalizing indicates the trafficRouting progress is complete, and is running recycle operations. + TrafficRoutingPhaseFinalizing TrafficRoutingPhase = "Finalizing" + // TrafficRoutingPhaseTerminating indicates a traffic routing is terminated + TrafficRoutingPhaseTerminating TrafficRoutingPhase = "Terminating" +) + +// +genclient +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.phase",description="The TrafficRouting status phase" +// +kubebuilder:printcolumn:name="MESSAGE",type="string",JSONPath=".status.message",description="The TrafficRouting canary status message" +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp" + +// TrafficRouting is the Schema for the TrafficRoutings API +type TrafficRouting struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TrafficRoutingSpec `json:"spec,omitempty"` + Status TrafficRoutingStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// TrafficRoutingList contains a list of TrafficRouting +type TrafficRoutingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TrafficRouting `json:"items"` +} + +type CustomNetworkRef struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` + Name string `json:"name"` +} + +func init() { + SchemeBuilder.Register(&TrafficRouting{}, &TrafficRoutingList{}) +} diff --git a/rollouts/v1alpha1/zz_generated.deepcopy.go b/rollouts/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..475fbbd --- /dev/null +++ b/rollouts/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,563 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +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 controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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 *CanaryStatus) DeepCopyInto(out *CanaryStatus) { + *out = *in + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStatus. +func (in *CanaryStatus) DeepCopy() *CanaryStatus { + if in == nil { + return nil + } + out := new(CanaryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CanaryStep) DeepCopyInto(out *CanaryStep) { + *out = *in + in.TrafficRoutingStrategy.DeepCopyInto(&out.TrafficRoutingStrategy) + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(intstr.IntOrString) + **out = **in + } + in.Pause.DeepCopyInto(&out.Pause) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStep. +func (in *CanaryStep) DeepCopy() *CanaryStep { + if in == nil { + return nil + } + out := new(CanaryStep) + 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 + if in.Steps != nil { + in, out := &in.Steps, &out.Steps + *out = make([]CanaryStep, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TrafficRoutings != nil { + in, out := &in.TrafficRoutings, &out.TrafficRoutings + *out = make([]TrafficRoutingRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 CanaryStrategy. +func (in *CanaryStrategy) DeepCopy() *CanaryStrategy { + if in == nil { + return nil + } + out := new(CanaryStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomNetworkRef) DeepCopyInto(out *CustomNetworkRef) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomNetworkRef. +func (in *CustomNetworkRef) DeepCopy() *CustomNetworkRef { + if in == nil { + return nil + } + out := new(CustomNetworkRef) + 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 + if in.HTTPRouteName != nil { + in, out := &in.HTTPRouteName, &out.HTTPRouteName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayTrafficRouting. +func (in *GatewayTrafficRouting) DeepCopy() *GatewayTrafficRouting { + if in == nil { + return nil + } + out := new(GatewayTrafficRouting) + 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 + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make([]v1beta1.HTTPHeaderMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HttpRouteMatch. +func (in *HttpRouteMatch) DeepCopy() *HttpRouteMatch { + if in == nil { + return nil + } + out := new(HttpRouteMatch) + 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 +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressTrafficRouting. +func (in *IngressTrafficRouting) DeepCopy() *IngressTrafficRouting { + if in == nil { + return nil + } + out := new(IngressTrafficRouting) + 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 + if in.WorkloadRef != nil { + in, out := &in.WorkloadRef, &out.WorkloadRef + *out = new(WorkloadRef) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectRef. +func (in *ObjectRef) DeepCopy() *ObjectRef { + if in == nil { + return nil + } + out := new(ObjectRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PatchPodTemplateMetadata) DeepCopyInto(out *PatchPodTemplateMetadata) { + *out = *in + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PatchPodTemplateMetadata. +func (in *PatchPodTemplateMetadata) DeepCopy() *PatchPodTemplateMetadata { + if in == nil { + return nil + } + out := new(PatchPodTemplateMetadata) + 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 + 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 Rollout. +func (in *Rollout) DeepCopy() *Rollout { + if in == nil { + return nil + } + out := new(Rollout) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Rollout) 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 *RolloutCondition) DeepCopyInto(out *RolloutCondition) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutCondition. +func (in *RolloutCondition) DeepCopy() *RolloutCondition { + if in == nil { + return nil + } + out := new(RolloutCondition) + 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 + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Rollout, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutList. +func (in *RolloutList) DeepCopy() *RolloutList { + if in == nil { + return nil + } + out := new(RolloutList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RolloutList) 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 *RolloutPause) DeepCopyInto(out *RolloutPause) { + *out = *in + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutPause. +func (in *RolloutPause) DeepCopy() *RolloutPause { + if in == nil { + return nil + } + out := new(RolloutPause) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutSpec) DeepCopyInto(out *RolloutSpec) { + *out = *in + in.ObjectRef.DeepCopyInto(&out.ObjectRef) + in.Strategy.DeepCopyInto(&out.Strategy) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutSpec. +func (in *RolloutSpec) DeepCopy() *RolloutSpec { + if in == nil { + return nil + } + out := new(RolloutSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutStatus) DeepCopyInto(out *RolloutStatus) { + *out = *in + if in.CanaryStatus != nil { + in, out := &in.CanaryStatus, &out.CanaryStatus + *out = new(CanaryStatus) + (*in).DeepCopyInto(*out) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]RolloutCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutStatus. +func (in *RolloutStatus) DeepCopy() *RolloutStatus { + if in == nil { + return nil + } + out := new(RolloutStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutStrategy) DeepCopyInto(out *RolloutStrategy) { + *out = *in + if in.Canary != nil { + in, out := &in.Canary, &out.Canary + *out = new(CanaryStrategy) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutStrategy. +func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { + if in == nil { + return nil + } + out := new(RolloutStrategy) + 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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRouting. +func (in *TrafficRouting) DeepCopy() *TrafficRouting { + if in == nil { + return nil + } + out := new(TrafficRouting) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TrafficRouting) 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 *TrafficRoutingList) DeepCopyInto(out *TrafficRoutingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TrafficRouting, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingList. +func (in *TrafficRoutingList) DeepCopy() *TrafficRoutingList { + if in == nil { + return nil + } + out := new(TrafficRoutingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TrafficRoutingList) 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 *TrafficRoutingRef) DeepCopyInto(out *TrafficRoutingRef) { + *out = *in + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = new(IngressTrafficRouting) + **out = **in + } + if in.Gateway != nil { + in, out := &in.Gateway, &out.Gateway + *out = new(GatewayTrafficRouting) + (*in).DeepCopyInto(*out) + } + if in.CustomNetworkRefs != nil { + in, out := &in.CustomNetworkRefs, &out.CustomNetworkRefs + *out = make([]CustomNetworkRef, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingRef. +func (in *TrafficRoutingRef) DeepCopy() *TrafficRoutingRef { + if in == nil { + return nil + } + out := new(TrafficRoutingRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrafficRoutingSpec) DeepCopyInto(out *TrafficRoutingSpec) { + *out = *in + if in.ObjectRef != nil { + in, out := &in.ObjectRef, &out.ObjectRef + *out = make([]TrafficRoutingRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Strategy.DeepCopyInto(&out.Strategy) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingSpec. +func (in *TrafficRoutingSpec) DeepCopy() *TrafficRoutingSpec { + if in == nil { + return nil + } + out := new(TrafficRoutingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrafficRoutingStatus) DeepCopyInto(out *TrafficRoutingStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingStatus. +func (in *TrafficRoutingStatus) DeepCopy() *TrafficRoutingStatus { + if in == nil { + return nil + } + out := new(TrafficRoutingStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TrafficRoutingStrategy) DeepCopyInto(out *TrafficRoutingStrategy) { + *out = *in + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int32) + **out = **in + } + if in.RequestHeaderModifier != nil { + in, out := &in.RequestHeaderModifier, &out.RequestHeaderModifier + *out = new(v1beta1.HTTPRequestHeaderFilter) + (*in).DeepCopyInto(*out) + } + if in.Matches != nil { + in, out := &in.Matches, &out.Matches + *out = make([]HttpRouteMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingStrategy. +func (in *TrafficRoutingStrategy) DeepCopy() *TrafficRoutingStrategy { + if in == nil { + return nil + } + out := new(TrafficRoutingStrategy) + 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 +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRef. +func (in *WorkloadRef) DeepCopy() *WorkloadRef { + if in == nil { + return nil + } + out := new(WorkloadRef) + in.DeepCopyInto(out) + return out +} diff --git a/rollouts/v1beta1/zz_generated.deepcopy.go b/rollouts/v1beta1/zz_generated.deepcopy.go index 408b544..8b327d3 100644 --- a/rollouts/v1beta1/zz_generated.deepcopy.go +++ b/rollouts/v1beta1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +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. diff --git a/schema/openkruise_rollouts_kustomize_schema.json b/schema/openkruise_rollouts_kustomize_schema.json index 238d79e..17afbf6 100644 --- a/schema/openkruise_rollouts_kustomize_schema.json +++ b/schema/openkruise_rollouts_kustomize_schema.json @@ -1,5 +1,762 @@ { "definitions": { + "io.kruise.rollouts.v1alpha1.CanaryStatus": { + "description": "CanaryStatus status fields that only pertain to the canary rollout", + "type": "object", + "required": [ + "canaryRevision", + "podTemplateHash", + "canaryReplicas", + "canaryReadyReplicas", + "nextStepIndex", + "currentStepState", + "finalisingStep" + ], + "properties": { + "canaryReadyReplicas": { + "description": "CanaryReadyReplicas the numbers of ready canary revision pods", + "type": "integer", + "format": "int32", + "default": 0 + }, + "canaryReplicas": { + "description": "CanaryReplicas the numbers of canary revision pods", + "type": "integer", + "format": "int32", + "default": 0 + }, + "canaryRevision": { + "description": "CanaryRevision is calculated by rollout based on podTemplateHash, and the internal logic flow uses It may be different from rs podTemplateHash in different k8s versions, so it cannot be used as service selector label", + "type": "string", + "default": "" + }, + "currentStepIndex": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "currentStepState": { + "type": "string", + "default": "" + }, + "finalisingStep": { + "type": "string", + "default": "" + }, + "lastUpdateTime": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "type": "string" + }, + "nextStepIndex": { + "description": "NextStepIndex defines the next step of the rollout is on. In normal case, NextStepIndex is equal to CurrentStepIndex + 1 If the current step is the last step, NextStepIndex is equal to -1 Before the release, NextStepIndex is also equal to -1 0 is not used and won't appear in any case It is allowed to patch NextStepIndex by design, e.g. if CurrentStepIndex is 2, user can patch NextStepIndex to 3 (if exists) to achieve batch jump, or patch NextStepIndex to 1 to implement a re-execution of step 1 Patching it with a non-positive value is meaningless, which will be corrected in the next reconciliation achieve batch jump, or patch NextStepIndex to 1 to implement a re-execution of step 1", + "type": "integer", + "format": "int32", + "default": 0 + }, + "observedRolloutID": { + "description": "ObservedRolloutID will record the newest spec.RolloutID if status.canaryRevision equals to workload.updateRevision", + "type": "string" + }, + "observedWorkloadGeneration": { + "description": "observedWorkloadGeneration is the most recent generation observed for this Rollout ref workload generation.", + "type": "integer", + "format": "int64" + }, + "podTemplateHash": { + "description": "pod template hash is used as service selector label", + "type": "string", + "default": "" + }, + "rolloutHash": { + "description": "RolloutHash from rollout.spec object", + "type": "string" + }, + "stableRevision": { + "description": "StableRevision indicates the revision of stable pods", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "CanaryStatus", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.CanaryStep": { + "description": "CanaryStep defines a step of a canary workload.", + "type": "object", + "properties": { + "matches": { + "description": "Matches define conditions used for matching the incoming HTTP requests to canary service. Each match is independent, i.e. this rule will be matched if **any** one of the matches is satisfied. If Gateway API, current only support one match. And cannot support both weight and matches, if both are configured, then matches takes precedence.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.HttpRouteMatch" + } + }, + "pause": { + "description": "Pause defines a pause stage for a rollout, manual or auto", + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutPause" + }, + "replicas": { + "description": "Replicas is the number of expected canary pods in this batch it can be an absolute number (ex: 5) or a percentage of total pods.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString" + }, + "requestHeaderModifier": { + "description": "Set overwrites the request with the given header (name, value) before the action.\n\nInput:\n GET /foo HTTP/1.1\n my-header: foo\n\nrequestHeaderModifier:\n set:\n - name: \"my-header\"\n value: \"bar\"\n\nOutput:\n GET /foo HTTP/1.1\n my-header: bar", + "$ref": "#/definitions/io.k8s.sigs.gateway-api.apis.v1beta1.HTTPRequestHeaderFilter" + }, + "weight": { + "description": "Weight indicate how many percentage of traffic the canary pods should receive", + "type": "integer", + "format": "int32" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "CanaryStep", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.CanaryStrategy": { + "description": "CanaryStrategy defines parameters for a Replica Based Canary", + "type": "object", + "properties": { + "disableGenerateCanaryService": { + "description": "canary service will not be generated if DisableGenerateCanaryService is true", + "type": "boolean" + }, + "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" + }, + "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" + }, + "steps": { + "description": "Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%)", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.CanaryStep" + } + }, + "trafficRoutings": { + "description": "TrafficRoutings hosts all the supported service meshes supported to enable more fine-grained traffic routing and current only support one TrafficRouting", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.TrafficRoutingRef" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "CanaryStrategy", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.CustomNetworkRef": { + "type": "object", + "required": [ + "apiVersion", + "kind", + "name" + ], + "properties": { + "apiVersion": { + "type": "string", + "default": "" + }, + "kind": { + "type": "string", + "default": "" + }, + "name": { + "type": "string", + "default": "" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "CustomNetworkRef", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.GatewayTrafficRouting": { + "description": "GatewayTrafficRouting configuration for gateway api", + "type": "object", + "properties": { + "httpRouteName": { + "description": "HTTPRouteName refers to the name of an `HTTPRoute` resource in the same namespace as the `Rollout`", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "GatewayTrafficRouting", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.HttpRouteMatch": { + "type": "object", + "properties": { + "headers": { + "description": "Headers specifies HTTP request header matchers. Multiple match values are ANDed together, meaning, a request must match all the specified headers to select the route.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.k8s.sigs.gateway-api.apis.v1beta1.HTTPHeaderMatch" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "HttpRouteMatch", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.IngressTrafficRouting": { + "description": "IngressTrafficRouting configuration for ingress controller to control traffic routing", + "type": "object", + "required": [ + "name" + ], + "properties": { + "classType": { + "description": "ClassType refers to the type of `Ingress`. current support nginx, aliyun-alb. default is nginx.", + "type": "string" + }, + "name": { + "description": "Name refers to the name of an `Ingress` resource in the same namespace as the `Rollout`", + "type": "string", + "default": "" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "IngressTrafficRouting", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.ObjectRef": { + "type": "object", + "properties": { + "workloadRef": { + "description": "WorkloadRef contains enough information to let you identify a workload for Rollout Batch release of the bypass", + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.WorkloadRef" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "ObjectRef", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.PatchPodTemplateMetadata": { + "type": "object", + "properties": { + "annotations": { + "description": "annotations", + "type": "object", + "additionalProperties": { + "type": "string", + "default": "" + } + }, + "labels": { + "description": "labels", + "type": "object", + "additionalProperties": { + "type": "string", + "default": "" + } + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "PatchPodTemplateMetadata", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.Rollout": { + "description": "Rollout is the Schema for the rollouts 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.RolloutSpec" + }, + "status": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "Rollout", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.RolloutCondition": { + "description": "RolloutCondition describes the state of a rollout at a certain point.", + "type": "object", + "required": [ + "type", + "status", + "reason", + "message" + ], + "properties": { + "lastTransitionTime": { + "description": "Last time the condition transitioned from one status to another.", + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "lastUpdateTime": { + "description": "The last time this condition was updated.", + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, + "message": { + "description": "A human readable message indicating details about the transition.", + "type": "string", + "default": "" + }, + "reason": { + "description": "The reason for the condition's last transition.", + "type": "string", + "default": "" + }, + "status": { + "description": "Phase of the condition, one of True, False, Unknown.", + "type": "string", + "default": "" + }, + "type": { + "description": "Type of rollout condition.", + "type": "string", + "default": "" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "RolloutCondition", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.RolloutList": { + "description": "RolloutList contains a list of Rollout", + "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.Rollout" + } + }, + "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": "RolloutList", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.RolloutPause": { + "description": "RolloutPause defines a pause stage for a rollout", + "type": "object", + "properties": { + "duration": { + "description": "Duration the amount of time to wait before moving to the next step.", + "type": "integer", + "format": "int32" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "RolloutPause", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.RolloutSpec": { + "description": "RolloutSpec defines the desired state of Rollout", + "type": "object", + "required": [ + "objectRef", + "strategy", + "disabled" + ], + "properties": { + "disabled": { + "description": "if a rollout disabled, then the rollout would not watch changes of workload", + "type": "boolean", + "default": false + }, + "objectRef": { + "description": "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file ObjectRef indicates workload", + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.ObjectRef" + }, + "rolloutID": { + "description": "DeprecatedRolloutID is the deprecated field. It is recommended that configure RolloutId in workload.annotations[rollouts.kruise.io/rollout-id]. RolloutID should be changed before each workload revision publication. It is to distinguish consecutive multiple workload publications and rollout progress.", + "type": "string" + }, + "strategy": { + "description": "rollout strategy", + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.RolloutStrategy" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "RolloutSpec", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.RolloutStatus": { + "description": "RolloutStatus defines the observed state of Rollout", + "type": "object", + "properties": { + "canaryStatus": { + "description": "Canary describes the state of the canary rollout", + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.CanaryStatus" + }, + "conditions": { + "description": "Conditions a list of conditions a rollout can have.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.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 Rollout.", + "type": "integer", + "format": "int64" + }, + "phase": { + "description": "Phase is the rollout phase.", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "RolloutStatus", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.RolloutStrategy": { + "description": "RolloutStrategy defines strategy to apply during next rollout", + "type": "object", + "properties": { + "canary": { + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.CanaryStrategy" + }, + "paused": { + "description": "Paused indicates that the Rollout is paused. Default value is false", + "type": "boolean" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "RolloutStrategy", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.TrafficRouting": { + "description": "TrafficRouting is the Schema for the TrafficRoutings 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.TrafficRoutingSpec" + }, + "status": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.TrafficRoutingStatus" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "TrafficRouting", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.TrafficRoutingList": { + "description": "TrafficRoutingList contains a list of TrafficRouting", + "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.TrafficRouting" + } + }, + "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": "TrafficRoutingList", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.TrafficRoutingRef": { + "description": "TrafficRoutingRef hosts all the different configuration for supported service meshes to enable more fine-grained traffic routing", + "type": "object", + "required": [ + "service" + ], + "properties": { + "customNetworkRefs": { + "description": "CustomNetworkRefs hold a list of custom providers to route traffic", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.CustomNetworkRef" + } + }, + "gateway": { + "description": "Gateway holds Gateway specific configuration to route traffic Gateway configuration only supports \u003e= v0.4.0 (v1alpha2).", + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.GatewayTrafficRouting" + }, + "gracePeriodSeconds": { + "description": "Optional duration in seconds the traffic provider(e.g. nginx ingress controller) consumes the service, ingress configuration changes gracefully.", + "type": "integer", + "format": "int32" + }, + "ingress": { + "description": "Ingress holds Ingress specific configuration to route traffic, e.g. Nginx, Alb.", + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.IngressTrafficRouting" + }, + "service": { + "description": "Service holds the name of a service which selects pods with stable version and don't select any pods with canary version.", + "type": "string", + "default": "" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "TrafficRoutingRef", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.TrafficRoutingSpec": { + "type": "object", + "required": [ + "objectRef", + "strategy" + ], + "properties": { + "objectRef": { + "description": "ObjectRef indicates trafficRouting ref", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.TrafficRoutingRef" + } + }, + "strategy": { + "description": "trafficrouting strategy", + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.TrafficRoutingStrategy" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "TrafficRoutingSpec", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.TrafficRoutingStatus": { + "type": "object", + "properties": { + "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 Rollout.", + "type": "integer", + "format": "int64" + }, + "phase": { + "description": "Phase is the trafficRouting phase.", + "type": "string" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "TrafficRoutingStatus", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.TrafficRoutingStrategy": { + "type": "object", + "properties": { + "matches": { + "description": "Matches define conditions used for matching the incoming HTTP requests to canary service. Each match is independent, i.e. this rule will be matched if **any** one of the matches is satisfied. If Gateway API, current only support one match. And cannot support both weight and matches, if both are configured, then matches takes precedence.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/io.kruise.rollouts.v1alpha1.HttpRouteMatch" + } + }, + "requestHeaderModifier": { + "description": "Set overwrites the request with the given header (name, value) before the action.\n\nInput:\n GET /foo HTTP/1.1\n my-header: foo\n\nrequestHeaderModifier:\n set:\n - name: \"my-header\"\n value: \"bar\"\n\nOutput:\n GET /foo HTTP/1.1\n my-header: bar", + "$ref": "#/definitions/io.k8s.sigs.gateway-api.apis.v1beta1.HTTPRequestHeaderFilter" + }, + "weight": { + "description": "Weight indicate how many percentage of traffic the canary pods should receive", + "type": "integer", + "format": "int32" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "TrafficRoutingStrategy", + "version": "v1alpha1" + } + ] + }, + "io.kruise.rollouts.v1alpha1.WorkloadRef": { + "description": "WorkloadRef holds a references to the Kubernetes object", + "type": "object", + "required": [ + "apiVersion", + "kind", + "name" + ], + "properties": { + "apiVersion": { + "description": "API Version of the referent", + "type": "string", + "default": "" + }, + "kind": { + "description": "Kind of the referent", + "type": "string", + "default": "" + }, + "name": { + "description": "Name of the referent", + "type": "string", + "default": "" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "rollouts.kruise.io", + "kind": "WorkloadRef", + "version": "v1alpha1" + } + ] + }, "io.kruise.rollouts.v1beta1.BatchRelease": { "type": "object", "properties": {