remove inner apis
Signed-off-by: AiRanthem <zhongtianyun.zty@alibaba-inc.com>
This commit is contained in:
parent
40020eedec
commit
ff879e6ab0
|
|
@ -13,23 +13,32 @@ on:
|
||||||
- master
|
- master
|
||||||
- release-*
|
- release-*
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Common versions
|
||||||
|
GO_VERSION: '1.20'
|
||||||
|
KIND_VERSION: 'v0.18.0'
|
||||||
|
KIND_IMAGE: 'kindest/node:v1.26.3'
|
||||||
|
KIND_CLUSTER_NAME: 'ci-testing'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e-test:
|
e2e-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo snap install kubectl --classic
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
with:
|
||||||
go-version: 1.19
|
submodules: true
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
- name: Setup Kind Cluster
|
||||||
|
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
|
||||||
|
with:
|
||||||
|
node_image: ${{ env.KIND_IMAGE }}
|
||||||
|
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
|
||||||
|
config: ./test/kind-conf.yaml
|
||||||
|
version: ${{ env.KIND_VERSION }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
|
||||||
11
Makefile
11
Makefile
|
|
@ -9,21 +9,24 @@ endif
|
||||||
KIND_VERSION ?= v0.18.0
|
KIND_VERSION ?= v0.18.0
|
||||||
CLUSTER_NAME ?= rollout-ci-testing
|
CLUSTER_NAME ?= rollout-ci-testing
|
||||||
|
|
||||||
|
all: generate gen-openapi-schema
|
||||||
|
|
||||||
# Run go vet against code
|
# Run go vet against code
|
||||||
vet:
|
vet:
|
||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
# Generate code
|
# Generate code
|
||||||
generate: controller-gen
|
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
|
||||||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./rollouts"
|
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./rollouts/..."
|
||||||
@hack/generate_client.sh
|
@hack/generate_client.sh
|
||||||
|
|
||||||
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
|
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
|
||||||
|
CONTROLLER_GEN_VERSION = v0.16.0
|
||||||
controller-gen: ## Download controller-gen locally if necessary.
|
controller-gen: ## Download controller-gen locally if necessary.
|
||||||
ifeq ("$(shell $(CONTROLLER_GEN) --version 2> /dev/null)", "Version: v0.7.0")
|
ifeq ("$(shell $(CONTROLLER_GEN) --version)", "Version: ${CONTROLLER_GEN_VERSION}")
|
||||||
else
|
else
|
||||||
rm -rf $(CONTROLLER_GEN)
|
rm -rf $(CONTROLLER_GEN)
|
||||||
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)
|
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OPENAPI_GEN = $(shell pwd)/bin/openapi-gen
|
OPENAPI_GEN = $(shell pwd)/bin/openapi-gen
|
||||||
|
|
|
||||||
|
|
@ -1,195 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
scheme "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme"
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BatchReleasesGetter has a method to return a BatchReleaseInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type BatchReleasesGetter interface {
|
|
||||||
BatchReleases(namespace string) BatchReleaseInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseInterface has methods to work with BatchRelease resources.
|
|
||||||
type BatchReleaseInterface interface {
|
|
||||||
Create(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.CreateOptions) (*v1alpha1.BatchRelease, error)
|
|
||||||
Update(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (*v1alpha1.BatchRelease, error)
|
|
||||||
UpdateStatus(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (*v1alpha1.BatchRelease, error)
|
|
||||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
|
||||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
|
||||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.BatchRelease, error)
|
|
||||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BatchReleaseList, error)
|
|
||||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BatchRelease, err error)
|
|
||||||
BatchReleaseExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// batchReleases implements BatchReleaseInterface
|
|
||||||
type batchReleases struct {
|
|
||||||
client rest.Interface
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
// newBatchReleases returns a BatchReleases
|
|
||||||
func newBatchReleases(c *RolloutsV1alpha1Client, namespace string) *batchReleases {
|
|
||||||
return &batchReleases{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
ns: namespace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the batchRelease, and returns the corresponding batchRelease object, and an error if there is any.
|
|
||||||
func (c *batchReleases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
result = &v1alpha1.BatchRelease{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of BatchReleases that match those selectors.
|
|
||||||
func (c *batchReleases) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BatchReleaseList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1alpha1.BatchReleaseList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested batchReleases.
|
|
||||||
func (c *batchReleases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a batchRelease and creates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *batchReleases) Create(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.CreateOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
result = &v1alpha1.BatchRelease{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(batchRelease).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a batchRelease and updates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *batchReleases) Update(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
result = &v1alpha1.BatchRelease{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(batchRelease.Name).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(batchRelease).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *batchReleases) UpdateStatus(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
result = &v1alpha1.BatchRelease{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(batchRelease.Name).
|
|
||||||
SubResource("status").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(batchRelease).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the batchRelease and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *batchReleases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(name).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *batchReleases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOpts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched batchRelease.
|
|
||||||
func (c *batchReleases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
result = &v1alpha1.BatchRelease{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(name).
|
|
||||||
SubResource(subresources...).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(data).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
testing "k8s.io/client-go/testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FakeBatchReleases implements BatchReleaseInterface
|
|
||||||
type FakeBatchReleases struct {
|
|
||||||
Fake *FakeRolloutsV1alpha1
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
var batchreleasesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "batchreleases"}
|
|
||||||
|
|
||||||
var batchreleasesKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "BatchRelease"}
|
|
||||||
|
|
||||||
// Get takes name of the batchRelease, and returns the corresponding batchRelease object, and an error if there is any.
|
|
||||||
func (c *FakeBatchReleases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewGetAction(batchreleasesResource, c.ns, name), &v1alpha1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of BatchReleases that match those selectors.
|
|
||||||
func (c *FakeBatchReleases) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BatchReleaseList, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewListAction(batchreleasesResource, batchreleasesKind, c.ns, opts), &v1alpha1.BatchReleaseList{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
|
||||||
if label == nil {
|
|
||||||
label = labels.Everything()
|
|
||||||
}
|
|
||||||
list := &v1alpha1.BatchReleaseList{ListMeta: obj.(*v1alpha1.BatchReleaseList).ListMeta}
|
|
||||||
for _, item := range obj.(*v1alpha1.BatchReleaseList).Items {
|
|
||||||
if label.Matches(labels.Set(item.Labels)) {
|
|
||||||
list.Items = append(list.Items, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested batchReleases.
|
|
||||||
func (c *FakeBatchReleases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
return c.Fake.
|
|
||||||
InvokesWatch(testing.NewWatchAction(batchreleasesResource, c.ns, opts))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a batchRelease and creates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *FakeBatchReleases) Create(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.CreateOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewCreateAction(batchreleasesResource, c.ns, batchRelease), &v1alpha1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a batchRelease and updates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *FakeBatchReleases) Update(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateAction(batchreleasesResource, c.ns, batchRelease), &v1alpha1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *FakeBatchReleases) UpdateStatus(ctx context.Context, batchRelease *v1alpha1.BatchRelease, opts v1.UpdateOptions) (*v1alpha1.BatchRelease, error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateSubresourceAction(batchreleasesResource, "status", c.ns, batchRelease), &v1alpha1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the batchRelease and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *FakeBatchReleases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
|
||||||
_, err := c.Fake.
|
|
||||||
Invokes(testing.NewDeleteActionWithOptions(batchreleasesResource, c.ns, name, opts), &v1alpha1.BatchRelease{})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *FakeBatchReleases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
|
||||||
action := testing.NewDeleteCollectionAction(batchreleasesResource, c.ns, listOpts)
|
|
||||||
|
|
||||||
_, err := c.Fake.Invokes(action, &v1alpha1.BatchReleaseList{})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched batchRelease.
|
|
||||||
func (c *FakeBatchReleases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewPatchSubresourceAction(batchreleasesResource, c.ns, name, pt, data, subresources...), &v1alpha1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
testing "k8s.io/client-go/testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FakeRolloutHistories implements RolloutHistoryInterface
|
|
||||||
type FakeRolloutHistories struct {
|
|
||||||
Fake *FakeRolloutsV1alpha1
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
var rollouthistoriesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1alpha1", Resource: "rollouthistories"}
|
|
||||||
|
|
||||||
var rollouthistoriesKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1alpha1", Kind: "RolloutHistory"}
|
|
||||||
|
|
||||||
// Get takes name of the rolloutHistory, and returns the corresponding rolloutHistory object, and an error if there is any.
|
|
||||||
func (c *FakeRolloutHistories) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewGetAction(rollouthistoriesResource, c.ns, name), &v1alpha1.RolloutHistory{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.RolloutHistory), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of RolloutHistories that match those selectors.
|
|
||||||
func (c *FakeRolloutHistories) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutHistoryList, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewListAction(rollouthistoriesResource, rollouthistoriesKind, c.ns, opts), &v1alpha1.RolloutHistoryList{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
|
||||||
if label == nil {
|
|
||||||
label = labels.Everything()
|
|
||||||
}
|
|
||||||
list := &v1alpha1.RolloutHistoryList{ListMeta: obj.(*v1alpha1.RolloutHistoryList).ListMeta}
|
|
||||||
for _, item := range obj.(*v1alpha1.RolloutHistoryList).Items {
|
|
||||||
if label.Matches(labels.Set(item.Labels)) {
|
|
||||||
list.Items = append(list.Items, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested rolloutHistories.
|
|
||||||
func (c *FakeRolloutHistories) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
return c.Fake.
|
|
||||||
InvokesWatch(testing.NewWatchAction(rollouthistoriesResource, c.ns, opts))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a rolloutHistory and creates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
|
|
||||||
func (c *FakeRolloutHistories) Create(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.CreateOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewCreateAction(rollouthistoriesResource, c.ns, rolloutHistory), &v1alpha1.RolloutHistory{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.RolloutHistory), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a rolloutHistory and updates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
|
|
||||||
func (c *FakeRolloutHistories) Update(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateAction(rollouthistoriesResource, c.ns, rolloutHistory), &v1alpha1.RolloutHistory{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.RolloutHistory), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *FakeRolloutHistories) UpdateStatus(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (*v1alpha1.RolloutHistory, error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateSubresourceAction(rollouthistoriesResource, "status", c.ns, rolloutHistory), &v1alpha1.RolloutHistory{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.RolloutHistory), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the rolloutHistory and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *FakeRolloutHistories) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
|
||||||
_, err := c.Fake.
|
|
||||||
Invokes(testing.NewDeleteActionWithOptions(rollouthistoriesResource, c.ns, name, opts), &v1alpha1.RolloutHistory{})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *FakeRolloutHistories) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
|
||||||
action := testing.NewDeleteCollectionAction(rollouthistoriesResource, c.ns, listOpts)
|
|
||||||
|
|
||||||
_, err := c.Fake.Invokes(action, &v1alpha1.RolloutHistoryList{})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched rolloutHistory.
|
|
||||||
func (c *FakeRolloutHistories) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewPatchSubresourceAction(rollouthistoriesResource, c.ns, name, pt, data, subresources...), &v1alpha1.RolloutHistory{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.RolloutHistory), err
|
|
||||||
}
|
|
||||||
|
|
@ -28,18 +28,10 @@ type FakeRolloutsV1alpha1 struct {
|
||||||
*testing.Fake
|
*testing.Fake
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeRolloutsV1alpha1) BatchReleases(namespace string) v1alpha1.BatchReleaseInterface {
|
|
||||||
return &FakeBatchReleases{c, namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeRolloutsV1alpha1) Rollouts(namespace string) v1alpha1.RolloutInterface {
|
func (c *FakeRolloutsV1alpha1) Rollouts(namespace string) v1alpha1.RolloutInterface {
|
||||||
return &FakeRollouts{c, namespace}
|
return &FakeRollouts{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeRolloutsV1alpha1) RolloutHistories(namespace string) v1alpha1.RolloutHistoryInterface {
|
|
||||||
return &FakeRolloutHistories{c, namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeRolloutsV1alpha1) TrafficRoutings(namespace string) v1alpha1.TrafficRoutingInterface {
|
func (c *FakeRolloutsV1alpha1) TrafficRoutings(namespace string) v1alpha1.TrafficRoutingInterface {
|
||||||
return &FakeTrafficRoutings{c, namespace}
|
return &FakeTrafficRoutings{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ limitations under the License.
|
||||||
|
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
type BatchReleaseExpansion interface{}
|
|
||||||
|
|
||||||
type RolloutExpansion interface{}
|
type RolloutExpansion interface{}
|
||||||
|
|
||||||
type RolloutHistoryExpansion interface{}
|
|
||||||
|
|
||||||
type TrafficRoutingExpansion interface{}
|
type TrafficRoutingExpansion interface{}
|
||||||
|
|
|
||||||
|
|
@ -1,195 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
scheme "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme"
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// RolloutHistoriesGetter has a method to return a RolloutHistoryInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type RolloutHistoriesGetter interface {
|
|
||||||
RolloutHistories(namespace string) RolloutHistoryInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// RolloutHistoryInterface has methods to work with RolloutHistory resources.
|
|
||||||
type RolloutHistoryInterface interface {
|
|
||||||
Create(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.CreateOptions) (*v1alpha1.RolloutHistory, error)
|
|
||||||
Update(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (*v1alpha1.RolloutHistory, error)
|
|
||||||
UpdateStatus(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (*v1alpha1.RolloutHistory, error)
|
|
||||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
|
||||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
|
||||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.RolloutHistory, error)
|
|
||||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RolloutHistoryList, error)
|
|
||||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RolloutHistory, err error)
|
|
||||||
RolloutHistoryExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// rolloutHistories implements RolloutHistoryInterface
|
|
||||||
type rolloutHistories struct {
|
|
||||||
client rest.Interface
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
// newRolloutHistories returns a RolloutHistories
|
|
||||||
func newRolloutHistories(c *RolloutsV1alpha1Client, namespace string) *rolloutHistories {
|
|
||||||
return &rolloutHistories{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
ns: namespace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the rolloutHistory, and returns the corresponding rolloutHistory object, and an error if there is any.
|
|
||||||
func (c *rolloutHistories) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
result = &v1alpha1.RolloutHistory{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of RolloutHistories that match those selectors.
|
|
||||||
func (c *rolloutHistories) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RolloutHistoryList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1alpha1.RolloutHistoryList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested rolloutHistories.
|
|
||||||
func (c *rolloutHistories) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a rolloutHistory and creates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
|
|
||||||
func (c *rolloutHistories) Create(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.CreateOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
result = &v1alpha1.RolloutHistory{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(rolloutHistory).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a rolloutHistory and updates it. Returns the server's representation of the rolloutHistory, and an error, if there is any.
|
|
||||||
func (c *rolloutHistories) Update(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
result = &v1alpha1.RolloutHistory{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
Name(rolloutHistory.Name).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(rolloutHistory).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *rolloutHistories) UpdateStatus(ctx context.Context, rolloutHistory *v1alpha1.RolloutHistory, opts v1.UpdateOptions) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
result = &v1alpha1.RolloutHistory{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
Name(rolloutHistory.Name).
|
|
||||||
SubResource("status").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(rolloutHistory).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the rolloutHistory and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *rolloutHistories) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
Name(name).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *rolloutHistories) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOpts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched rolloutHistory.
|
|
||||||
func (c *rolloutHistories) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.RolloutHistory, err error) {
|
|
||||||
result = &v1alpha1.RolloutHistory{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("rollouthistories").
|
|
||||||
Name(name).
|
|
||||||
SubResource(subresources...).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(data).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
@ -28,9 +28,7 @@ import (
|
||||||
|
|
||||||
type RolloutsV1alpha1Interface interface {
|
type RolloutsV1alpha1Interface interface {
|
||||||
RESTClient() rest.Interface
|
RESTClient() rest.Interface
|
||||||
BatchReleasesGetter
|
|
||||||
RolloutsGetter
|
RolloutsGetter
|
||||||
RolloutHistoriesGetter
|
|
||||||
TrafficRoutingsGetter
|
TrafficRoutingsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,18 +37,10 @@ type RolloutsV1alpha1Client struct {
|
||||||
restClient rest.Interface
|
restClient rest.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RolloutsV1alpha1Client) BatchReleases(namespace string) BatchReleaseInterface {
|
|
||||||
return newBatchReleases(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RolloutsV1alpha1Client) Rollouts(namespace string) RolloutInterface {
|
func (c *RolloutsV1alpha1Client) Rollouts(namespace string) RolloutInterface {
|
||||||
return newRollouts(c, namespace)
|
return newRollouts(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RolloutsV1alpha1Client) RolloutHistories(namespace string) RolloutHistoryInterface {
|
|
||||||
return newRolloutHistories(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RolloutsV1alpha1Client) TrafficRoutings(namespace string) TrafficRoutingInterface {
|
func (c *RolloutsV1alpha1Client) TrafficRoutings(namespace string) TrafficRoutingInterface {
|
||||||
return newTrafficRoutings(c, namespace)
|
return newTrafficRoutings(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,195 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
scheme "github.com/openkruise/kruise-rollout-api/client/clientset/versioned/scheme"
|
|
||||||
v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BatchReleasesGetter has a method to return a BatchReleaseInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type BatchReleasesGetter interface {
|
|
||||||
BatchReleases(namespace string) BatchReleaseInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseInterface has methods to work with BatchRelease resources.
|
|
||||||
type BatchReleaseInterface interface {
|
|
||||||
Create(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.CreateOptions) (*v1beta1.BatchRelease, error)
|
|
||||||
Update(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (*v1beta1.BatchRelease, error)
|
|
||||||
UpdateStatus(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (*v1beta1.BatchRelease, error)
|
|
||||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
|
||||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
|
||||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.BatchRelease, error)
|
|
||||||
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.BatchReleaseList, error)
|
|
||||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.BatchRelease, err error)
|
|
||||||
BatchReleaseExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// batchReleases implements BatchReleaseInterface
|
|
||||||
type batchReleases struct {
|
|
||||||
client rest.Interface
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
// newBatchReleases returns a BatchReleases
|
|
||||||
func newBatchReleases(c *RolloutsV1beta1Client, namespace string) *batchReleases {
|
|
||||||
return &batchReleases{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
ns: namespace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the batchRelease, and returns the corresponding batchRelease object, and an error if there is any.
|
|
||||||
func (c *batchReleases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
result = &v1beta1.BatchRelease{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of BatchReleases that match those selectors.
|
|
||||||
func (c *batchReleases) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.BatchReleaseList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1beta1.BatchReleaseList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested batchReleases.
|
|
||||||
func (c *batchReleases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a batchRelease and creates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *batchReleases) Create(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.CreateOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
result = &v1beta1.BatchRelease{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(batchRelease).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a batchRelease and updates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *batchReleases) Update(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
result = &v1beta1.BatchRelease{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(batchRelease.Name).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(batchRelease).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *batchReleases) UpdateStatus(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
result = &v1beta1.BatchRelease{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(batchRelease.Name).
|
|
||||||
SubResource("status").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(batchRelease).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the batchRelease and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *batchReleases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(name).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *batchReleases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOpts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(&opts).
|
|
||||||
Do(ctx).
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched batchRelease.
|
|
||||||
func (c *batchReleases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
result = &v1beta1.BatchRelease{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("batchreleases").
|
|
||||||
Name(name).
|
|
||||||
SubResource(subresources...).
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Body(data).
|
|
||||||
Do(ctx).
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
testing "k8s.io/client-go/testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FakeBatchReleases implements BatchReleaseInterface
|
|
||||||
type FakeBatchReleases struct {
|
|
||||||
Fake *FakeRolloutsV1beta1
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
var batchreleasesResource = schema.GroupVersionResource{Group: "rollouts.kruise.io", Version: "v1beta1", Resource: "batchreleases"}
|
|
||||||
|
|
||||||
var batchreleasesKind = schema.GroupVersionKind{Group: "rollouts.kruise.io", Version: "v1beta1", Kind: "BatchRelease"}
|
|
||||||
|
|
||||||
// Get takes name of the batchRelease, and returns the corresponding batchRelease object, and an error if there is any.
|
|
||||||
func (c *FakeBatchReleases) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewGetAction(batchreleasesResource, c.ns, name), &v1beta1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of BatchReleases that match those selectors.
|
|
||||||
func (c *FakeBatchReleases) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.BatchReleaseList, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewListAction(batchreleasesResource, batchreleasesKind, c.ns, opts), &v1beta1.BatchReleaseList{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
|
||||||
if label == nil {
|
|
||||||
label = labels.Everything()
|
|
||||||
}
|
|
||||||
list := &v1beta1.BatchReleaseList{ListMeta: obj.(*v1beta1.BatchReleaseList).ListMeta}
|
|
||||||
for _, item := range obj.(*v1beta1.BatchReleaseList).Items {
|
|
||||||
if label.Matches(labels.Set(item.Labels)) {
|
|
||||||
list.Items = append(list.Items, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested batchReleases.
|
|
||||||
func (c *FakeBatchReleases) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
return c.Fake.
|
|
||||||
InvokesWatch(testing.NewWatchAction(batchreleasesResource, c.ns, opts))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a batchRelease and creates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *FakeBatchReleases) Create(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.CreateOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewCreateAction(batchreleasesResource, c.ns, batchRelease), &v1beta1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a batchRelease and updates it. Returns the server's representation of the batchRelease, and an error, if there is any.
|
|
||||||
func (c *FakeBatchReleases) Update(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateAction(batchreleasesResource, c.ns, batchRelease), &v1beta1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
func (c *FakeBatchReleases) UpdateStatus(ctx context.Context, batchRelease *v1beta1.BatchRelease, opts v1.UpdateOptions) (*v1beta1.BatchRelease, error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateSubresourceAction(batchreleasesResource, "status", c.ns, batchRelease), &v1beta1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the batchRelease and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *FakeBatchReleases) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
|
||||||
_, err := c.Fake.
|
|
||||||
Invokes(testing.NewDeleteActionWithOptions(batchreleasesResource, c.ns, name, opts), &v1beta1.BatchRelease{})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *FakeBatchReleases) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
|
||||||
action := testing.NewDeleteCollectionAction(batchreleasesResource, c.ns, listOpts)
|
|
||||||
|
|
||||||
_, err := c.Fake.Invokes(action, &v1beta1.BatchReleaseList{})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched batchRelease.
|
|
||||||
func (c *FakeBatchReleases) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.BatchRelease, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewPatchSubresourceAction(batchreleasesResource, c.ns, name, pt, data, subresources...), &v1beta1.BatchRelease{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.BatchRelease), err
|
|
||||||
}
|
|
||||||
|
|
@ -28,10 +28,6 @@ type FakeRolloutsV1beta1 struct {
|
||||||
*testing.Fake
|
*testing.Fake
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeRolloutsV1beta1) BatchReleases(namespace string) v1beta1.BatchReleaseInterface {
|
|
||||||
return &FakeBatchReleases{c, namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeRolloutsV1beta1) Rollouts(namespace string) v1beta1.RolloutInterface {
|
func (c *FakeRolloutsV1beta1) Rollouts(namespace string) v1beta1.RolloutInterface {
|
||||||
return &FakeRollouts{c, namespace}
|
return &FakeRollouts{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,4 @@ limitations under the License.
|
||||||
|
|
||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
type BatchReleaseExpansion interface{}
|
|
||||||
|
|
||||||
type RolloutExpansion interface{}
|
type RolloutExpansion interface{}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import (
|
||||||
|
|
||||||
type RolloutsV1beta1Interface interface {
|
type RolloutsV1beta1Interface interface {
|
||||||
RESTClient() rest.Interface
|
RESTClient() rest.Interface
|
||||||
BatchReleasesGetter
|
|
||||||
RolloutsGetter
|
RolloutsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,10 +36,6 @@ type RolloutsV1beta1Client struct {
|
||||||
restClient rest.Interface
|
restClient rest.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RolloutsV1beta1Client) BatchReleases(namespace string) BatchReleaseInterface {
|
|
||||||
return newBatchReleases(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *RolloutsV1beta1Client) Rollouts(namespace string) RolloutInterface {
|
func (c *RolloutsV1beta1Client) Rollouts(namespace string) RolloutInterface {
|
||||||
return newRollouts(c, namespace)
|
return newRollouts(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,18 +54,12 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
||||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||||
switch resource {
|
switch resource {
|
||||||
// Group=rollouts.kruise.io, Version=v1alpha1
|
// Group=rollouts.kruise.io, Version=v1alpha1
|
||||||
case v1alpha1.SchemeGroupVersion.WithResource("batchreleases"):
|
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().BatchReleases().Informer()}, nil
|
|
||||||
case v1alpha1.SchemeGroupVersion.WithResource("rollouts"):
|
case v1alpha1.SchemeGroupVersion.WithResource("rollouts"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().Rollouts().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().Rollouts().Informer()}, nil
|
||||||
case v1alpha1.SchemeGroupVersion.WithResource("rollouthistories"):
|
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().RolloutHistories().Informer()}, nil
|
|
||||||
case v1alpha1.SchemeGroupVersion.WithResource("trafficroutings"):
|
case v1alpha1.SchemeGroupVersion.WithResource("trafficroutings"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().TrafficRoutings().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1alpha1().TrafficRoutings().Informer()}, nil
|
||||||
|
|
||||||
// Group=rollouts.kruise.io, Version=v1beta1
|
// 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"):
|
case v1beta1.SchemeGroupVersion.WithResource("rollouts"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1beta1().Rollouts().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Rollouts().V1beta1().Rollouts().Informer()}, nil
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
versioned "github.com/openkruise/kruise-rollout-api/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/client/listers/rollouts/v1alpha1"
|
|
||||||
rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
cache "k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BatchReleaseInformer provides access to a shared informer and lister for
|
|
||||||
// BatchReleases.
|
|
||||||
type BatchReleaseInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1alpha1.BatchReleaseLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type batchReleaseInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBatchReleaseInformer constructs a new informer for BatchRelease type.
|
|
||||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
|
||||||
// one. This reduces memory footprint and number of connections to the server.
|
|
||||||
func NewBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredBatchReleaseInformer(client, namespace, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredBatchReleaseInformer constructs a new informer for BatchRelease type.
|
|
||||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
|
||||||
// one. This reduces memory footprint and number of connections to the server.
|
|
||||||
func NewFilteredBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.RolloutsV1alpha1().BatchReleases(namespace).List(context.TODO(), options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.RolloutsV1alpha1().BatchReleases(namespace).Watch(context.TODO(), options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&rolloutsv1alpha1.BatchRelease{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *batchReleaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredBatchReleaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *batchReleaseInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&rolloutsv1alpha1.BatchRelease{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *batchReleaseInformer) Lister() v1alpha1.BatchReleaseLister {
|
|
||||||
return v1alpha1.NewBatchReleaseLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
||||||
|
|
@ -24,12 +24,8 @@ import (
|
||||||
|
|
||||||
// Interface provides access to all the informers in this group version.
|
// Interface provides access to all the informers in this group version.
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
// BatchReleases returns a BatchReleaseInformer.
|
|
||||||
BatchReleases() BatchReleaseInformer
|
|
||||||
// Rollouts returns a RolloutInformer.
|
// Rollouts returns a RolloutInformer.
|
||||||
Rollouts() RolloutInformer
|
Rollouts() RolloutInformer
|
||||||
// RolloutHistories returns a RolloutHistoryInformer.
|
|
||||||
RolloutHistories() RolloutHistoryInformer
|
|
||||||
// TrafficRoutings returns a TrafficRoutingInformer.
|
// TrafficRoutings returns a TrafficRoutingInformer.
|
||||||
TrafficRoutings() TrafficRoutingInformer
|
TrafficRoutings() TrafficRoutingInformer
|
||||||
}
|
}
|
||||||
|
|
@ -45,21 +41,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BatchReleases returns a BatchReleaseInformer.
|
|
||||||
func (v *version) BatchReleases() BatchReleaseInformer {
|
|
||||||
return &batchReleaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rollouts returns a RolloutInformer.
|
// Rollouts returns a RolloutInformer.
|
||||||
func (v *version) Rollouts() RolloutInformer {
|
func (v *version) Rollouts() RolloutInformer {
|
||||||
return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RolloutHistories returns a RolloutHistoryInformer.
|
|
||||||
func (v *version) RolloutHistories() RolloutHistoryInformer {
|
|
||||||
return &rolloutHistoryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TrafficRoutings returns a TrafficRoutingInformer.
|
// TrafficRoutings returns a TrafficRoutingInformer.
|
||||||
func (v *version) TrafficRoutings() TrafficRoutingInformer {
|
func (v *version) TrafficRoutings() TrafficRoutingInformer {
|
||||||
return &trafficRoutingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &trafficRoutingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
versioned "github.com/openkruise/kruise-rollout-api/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/client/listers/rollouts/v1alpha1"
|
|
||||||
rolloutsv1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
cache "k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// RolloutHistoryInformer provides access to a shared informer and lister for
|
|
||||||
// RolloutHistories.
|
|
||||||
type RolloutHistoryInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1alpha1.RolloutHistoryLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type rolloutHistoryInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRolloutHistoryInformer constructs a new informer for RolloutHistory type.
|
|
||||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
|
||||||
// one. This reduces memory footprint and number of connections to the server.
|
|
||||||
func NewRolloutHistoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredRolloutHistoryInformer(client, namespace, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredRolloutHistoryInformer constructs a new informer for RolloutHistory type.
|
|
||||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
|
||||||
// one. This reduces memory footprint and number of connections to the server.
|
|
||||||
func NewFilteredRolloutHistoryInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.RolloutsV1alpha1().RolloutHistories(namespace).List(context.TODO(), options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.RolloutsV1alpha1().RolloutHistories(namespace).Watch(context.TODO(), options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&rolloutsv1alpha1.RolloutHistory{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *rolloutHistoryInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredRolloutHistoryInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *rolloutHistoryInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&rolloutsv1alpha1.RolloutHistory{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *rolloutHistoryInformer) Lister() v1alpha1.RolloutHistoryLister {
|
|
||||||
return v1alpha1.NewRolloutHistoryLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
versioned "github.com/openkruise/kruise-rollout-api/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/openkruise/kruise-rollout-api/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1beta1 "github.com/openkruise/kruise-rollout-api/client/listers/rollouts/v1beta1"
|
|
||||||
rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
cache "k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BatchReleaseInformer provides access to a shared informer and lister for
|
|
||||||
// BatchReleases.
|
|
||||||
type BatchReleaseInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1beta1.BatchReleaseLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type batchReleaseInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBatchReleaseInformer constructs a new informer for BatchRelease type.
|
|
||||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
|
||||||
// one. This reduces memory footprint and number of connections to the server.
|
|
||||||
func NewBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredBatchReleaseInformer(client, namespace, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredBatchReleaseInformer constructs a new informer for BatchRelease type.
|
|
||||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
|
||||||
// one. This reduces memory footprint and number of connections to the server.
|
|
||||||
func NewFilteredBatchReleaseInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.RolloutsV1beta1().BatchReleases(namespace).List(context.TODO(), options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.RolloutsV1beta1().BatchReleases(namespace).Watch(context.TODO(), options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&rolloutsv1beta1.BatchRelease{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *batchReleaseInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredBatchReleaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *batchReleaseInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&rolloutsv1beta1.BatchRelease{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *batchReleaseInformer) Lister() v1beta1.BatchReleaseLister {
|
|
||||||
return v1beta1.NewBatchReleaseLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
||||||
|
|
@ -24,8 +24,6 @@ import (
|
||||||
|
|
||||||
// Interface provides access to all the informers in this group version.
|
// Interface provides access to all the informers in this group version.
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
// BatchReleases returns a BatchReleaseInformer.
|
|
||||||
BatchReleases() BatchReleaseInformer
|
|
||||||
// Rollouts returns a RolloutInformer.
|
// Rollouts returns a RolloutInformer.
|
||||||
Rollouts() RolloutInformer
|
Rollouts() RolloutInformer
|
||||||
}
|
}
|
||||||
|
|
@ -41,11 +39,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BatchReleases returns a BatchReleaseInformer.
|
|
||||||
func (v *version) BatchReleases() BatchReleaseInformer {
|
|
||||||
return &batchReleaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rollouts returns a RolloutInformer.
|
// Rollouts returns a RolloutInformer.
|
||||||
func (v *version) Rollouts() RolloutInformer {
|
func (v *version) Rollouts() RolloutInformer {
|
||||||
return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &rolloutInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BatchReleaseLister helps list BatchReleases.
|
|
||||||
// All objects returned here must be treated as read-only.
|
|
||||||
type BatchReleaseLister interface {
|
|
||||||
// List lists all BatchReleases in the indexer.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error)
|
|
||||||
// BatchReleases returns an object that can list and get BatchReleases.
|
|
||||||
BatchReleases(namespace string) BatchReleaseNamespaceLister
|
|
||||||
BatchReleaseListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// batchReleaseLister implements the BatchReleaseLister interface.
|
|
||||||
type batchReleaseLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBatchReleaseLister returns a new BatchReleaseLister.
|
|
||||||
func NewBatchReleaseLister(indexer cache.Indexer) BatchReleaseLister {
|
|
||||||
return &batchReleaseLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all BatchReleases in the indexer.
|
|
||||||
func (s *batchReleaseLister) List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1alpha1.BatchRelease))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleases returns an object that can list and get BatchReleases.
|
|
||||||
func (s *batchReleaseLister) BatchReleases(namespace string) BatchReleaseNamespaceLister {
|
|
||||||
return batchReleaseNamespaceLister{indexer: s.indexer, namespace: namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseNamespaceLister helps list and get BatchReleases.
|
|
||||||
// All objects returned here must be treated as read-only.
|
|
||||||
type BatchReleaseNamespaceLister interface {
|
|
||||||
// List lists all BatchReleases in the indexer for a given namespace.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error)
|
|
||||||
// Get retrieves the BatchRelease from the indexer for a given namespace and name.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
Get(name string) (*v1alpha1.BatchRelease, error)
|
|
||||||
BatchReleaseNamespaceListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// batchReleaseNamespaceLister implements the BatchReleaseNamespaceLister
|
|
||||||
// interface.
|
|
||||||
type batchReleaseNamespaceLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all BatchReleases in the indexer for a given namespace.
|
|
||||||
func (s batchReleaseNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.BatchRelease, err error) {
|
|
||||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1alpha1.BatchRelease))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the BatchRelease from the indexer for a given namespace and name.
|
|
||||||
func (s batchReleaseNamespaceLister) Get(name string) (*v1alpha1.BatchRelease, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1alpha1.Resource("batchrelease"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.BatchRelease), nil
|
|
||||||
}
|
|
||||||
|
|
@ -18,14 +18,6 @@ limitations under the License.
|
||||||
|
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
// BatchReleaseListerExpansion allows custom methods to be added to
|
|
||||||
// BatchReleaseLister.
|
|
||||||
type BatchReleaseListerExpansion interface{}
|
|
||||||
|
|
||||||
// BatchReleaseNamespaceListerExpansion allows custom methods to be added to
|
|
||||||
// BatchReleaseNamespaceLister.
|
|
||||||
type BatchReleaseNamespaceListerExpansion interface{}
|
|
||||||
|
|
||||||
// RolloutListerExpansion allows custom methods to be added to
|
// RolloutListerExpansion allows custom methods to be added to
|
||||||
// RolloutLister.
|
// RolloutLister.
|
||||||
type RolloutListerExpansion interface{}
|
type RolloutListerExpansion interface{}
|
||||||
|
|
@ -34,14 +26,6 @@ type RolloutListerExpansion interface{}
|
||||||
// RolloutNamespaceLister.
|
// RolloutNamespaceLister.
|
||||||
type RolloutNamespaceListerExpansion interface{}
|
type RolloutNamespaceListerExpansion interface{}
|
||||||
|
|
||||||
// RolloutHistoryListerExpansion allows custom methods to be added to
|
|
||||||
// RolloutHistoryLister.
|
|
||||||
type RolloutHistoryListerExpansion interface{}
|
|
||||||
|
|
||||||
// RolloutHistoryNamespaceListerExpansion allows custom methods to be added to
|
|
||||||
// RolloutHistoryNamespaceLister.
|
|
||||||
type RolloutHistoryNamespaceListerExpansion interface{}
|
|
||||||
|
|
||||||
// TrafficRoutingListerExpansion allows custom methods to be added to
|
// TrafficRoutingListerExpansion allows custom methods to be added to
|
||||||
// TrafficRoutingLister.
|
// TrafficRoutingLister.
|
||||||
type TrafficRoutingListerExpansion interface{}
|
type TrafficRoutingListerExpansion interface{}
|
||||||
|
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1alpha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// RolloutHistoryLister helps list RolloutHistories.
|
|
||||||
// All objects returned here must be treated as read-only.
|
|
||||||
type RolloutHistoryLister interface {
|
|
||||||
// List lists all RolloutHistories in the indexer.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error)
|
|
||||||
// RolloutHistories returns an object that can list and get RolloutHistories.
|
|
||||||
RolloutHistories(namespace string) RolloutHistoryNamespaceLister
|
|
||||||
RolloutHistoryListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// rolloutHistoryLister implements the RolloutHistoryLister interface.
|
|
||||||
type rolloutHistoryLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRolloutHistoryLister returns a new RolloutHistoryLister.
|
|
||||||
func NewRolloutHistoryLister(indexer cache.Indexer) RolloutHistoryLister {
|
|
||||||
return &rolloutHistoryLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all RolloutHistories in the indexer.
|
|
||||||
func (s *rolloutHistoryLister) List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1alpha1.RolloutHistory))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// RolloutHistories returns an object that can list and get RolloutHistories.
|
|
||||||
func (s *rolloutHistoryLister) RolloutHistories(namespace string) RolloutHistoryNamespaceLister {
|
|
||||||
return rolloutHistoryNamespaceLister{indexer: s.indexer, namespace: namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
// RolloutHistoryNamespaceLister helps list and get RolloutHistories.
|
|
||||||
// All objects returned here must be treated as read-only.
|
|
||||||
type RolloutHistoryNamespaceLister interface {
|
|
||||||
// List lists all RolloutHistories in the indexer for a given namespace.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error)
|
|
||||||
// Get retrieves the RolloutHistory from the indexer for a given namespace and name.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
Get(name string) (*v1alpha1.RolloutHistory, error)
|
|
||||||
RolloutHistoryNamespaceListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// rolloutHistoryNamespaceLister implements the RolloutHistoryNamespaceLister
|
|
||||||
// interface.
|
|
||||||
type rolloutHistoryNamespaceLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all RolloutHistories in the indexer for a given namespace.
|
|
||||||
func (s rolloutHistoryNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RolloutHistory, err error) {
|
|
||||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1alpha1.RolloutHistory))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the RolloutHistory from the indexer for a given namespace and name.
|
|
||||||
func (s rolloutHistoryNamespaceLister) Get(name string) (*v1alpha1.RolloutHistory, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1alpha1.Resource("rollouthistory"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1alpha1.RolloutHistory), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2024 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1beta1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BatchReleaseLister helps list BatchReleases.
|
|
||||||
// All objects returned here must be treated as read-only.
|
|
||||||
type BatchReleaseLister interface {
|
|
||||||
// List lists all BatchReleases in the indexer.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error)
|
|
||||||
// BatchReleases returns an object that can list and get BatchReleases.
|
|
||||||
BatchReleases(namespace string) BatchReleaseNamespaceLister
|
|
||||||
BatchReleaseListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// batchReleaseLister implements the BatchReleaseLister interface.
|
|
||||||
type batchReleaseLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewBatchReleaseLister returns a new BatchReleaseLister.
|
|
||||||
func NewBatchReleaseLister(indexer cache.Indexer) BatchReleaseLister {
|
|
||||||
return &batchReleaseLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all BatchReleases in the indexer.
|
|
||||||
func (s *batchReleaseLister) List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1beta1.BatchRelease))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleases returns an object that can list and get BatchReleases.
|
|
||||||
func (s *batchReleaseLister) BatchReleases(namespace string) BatchReleaseNamespaceLister {
|
|
||||||
return batchReleaseNamespaceLister{indexer: s.indexer, namespace: namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseNamespaceLister helps list and get BatchReleases.
|
|
||||||
// All objects returned here must be treated as read-only.
|
|
||||||
type BatchReleaseNamespaceLister interface {
|
|
||||||
// List lists all BatchReleases in the indexer for a given namespace.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error)
|
|
||||||
// Get retrieves the BatchRelease from the indexer for a given namespace and name.
|
|
||||||
// Objects returned here must be treated as read-only.
|
|
||||||
Get(name string) (*v1beta1.BatchRelease, error)
|
|
||||||
BatchReleaseNamespaceListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// batchReleaseNamespaceLister implements the BatchReleaseNamespaceLister
|
|
||||||
// interface.
|
|
||||||
type batchReleaseNamespaceLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all BatchReleases in the indexer for a given namespace.
|
|
||||||
func (s batchReleaseNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.BatchRelease, err error) {
|
|
||||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1beta1.BatchRelease))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the BatchRelease from the indexer for a given namespace and name.
|
|
||||||
func (s batchReleaseNamespaceLister) Get(name string) (*v1beta1.BatchRelease, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1beta1.Resource("batchrelease"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.BatchRelease), nil
|
|
||||||
}
|
|
||||||
|
|
@ -18,14 +18,6 @@ limitations under the License.
|
||||||
|
|
||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
// BatchReleaseListerExpansion allows custom methods to be added to
|
|
||||||
// BatchReleaseLister.
|
|
||||||
type BatchReleaseListerExpansion interface{}
|
|
||||||
|
|
||||||
// BatchReleaseNamespaceListerExpansion allows custom methods to be added to
|
|
||||||
// BatchReleaseNamespaceLister.
|
|
||||||
type BatchReleaseNamespaceListerExpansion interface{}
|
|
||||||
|
|
||||||
// RolloutListerExpansion allows custom methods to be added to
|
// RolloutListerExpansion allows custom methods to be added to
|
||||||
// RolloutLister.
|
// RolloutLister.
|
||||||
type RolloutListerExpansion interface{}
|
type RolloutListerExpansion interface{}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,24 +1,15 @@
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,BatchReleaseStatus,Conditions
|
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,CanaryStepInfo,Pods
|
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,CanaryStrategy,Steps
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,CanaryStrategy,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,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,HttpRouteMatch,Headers
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,ReleasePlan,Batches
|
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutHistoryStatus,CanarySteps
|
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutStatus,Conditions
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,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,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,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/v1alpha1,TrafficRoutingStrategy,Matches
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BatchReleaseStatus,Conditions
|
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BlueGreenStrategy,Steps
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BlueGreenStrategy,Steps
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BlueGreenStrategy,TrafficRoutings
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BlueGreenStrategy,TrafficRoutings
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,Steps
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,Steps
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,TrafficRoutings
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,CanaryStrategy,TrafficRoutings
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,ReleasePlan,Batches
|
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,RolloutStatus,Conditions
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,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,TrafficRoutingRef,CustomNetworkRefs
|
||||||
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,TrafficRoutingStrategy,Matches
|
API rule violation: list_type_missing,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,TrafficRoutingStrategy,Matches
|
||||||
API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,BatchReleaseCanaryStatus,CurrentBatchState
|
|
||||||
API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,BatchReleaseSpec,TargetRef
|
|
||||||
API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutSpec,DeprecatedRolloutID
|
API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1,RolloutSpec,DeprecatedRolloutID
|
||||||
API rule violation: names_match,github.com/openkruise/kruise-rollout-api/rollouts/v1beta1,BatchReleaseCanaryStatus,CurrentBatchState
|
|
||||||
|
|
|
||||||
|
|
@ -1,157 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2022 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ReleasePlan fines the details of the release plan
|
|
||||||
type ReleasePlan struct {
|
|
||||||
// Batches is the details on each batch of the ReleasePlan.
|
|
||||||
//Users can specify their batch plan in this field, such as:
|
|
||||||
// batches:
|
|
||||||
// - canaryReplicas: 1 # batches 0
|
|
||||||
// - canaryReplicas: 2 # batches 1
|
|
||||||
// - canaryReplicas: 5 # batches 2
|
|
||||||
// Not that these canaryReplicas should be a non-decreasing sequence.
|
|
||||||
// +optional
|
|
||||||
Batches []ReleaseBatch `json:"batches"`
|
|
||||||
// All pods in the batches up to the batchPartition (included) will have
|
|
||||||
// the target resource specification while the rest still is the stable revision.
|
|
||||||
// This is designed for the operators to manually rollout.
|
|
||||||
// Default is nil, which means no partition and will release all batches.
|
|
||||||
// BatchPartition start from 0.
|
|
||||||
// +optional
|
|
||||||
BatchPartition *int32 `json:"batchPartition,omitempty"`
|
|
||||||
// RolloutID indicates an id for each rollout progress
|
|
||||||
RolloutID string `json:"rolloutID,omitempty"`
|
|
||||||
// FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods.
|
|
||||||
// Only when FailureThreshold are satisfied, Rollout can enter ready state.
|
|
||||||
// If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its
|
|
||||||
// FailureThreshold.
|
|
||||||
// Defaults to nil.
|
|
||||||
FailureThreshold *intstr.IntOrString `json:"failureThreshold,omitempty"`
|
|
||||||
// FinalizingPolicy define the behavior of controller when phase enter Finalizing
|
|
||||||
// Defaults to "Immediate"
|
|
||||||
FinalizingPolicy FinalizingPolicyType `json:"finalizingPolicy,omitempty"`
|
|
||||||
// PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata
|
|
||||||
// only support for canary deployment
|
|
||||||
// +optional
|
|
||||||
PatchPodTemplateMetadata *PatchPodTemplateMetadata `json:"patchPodTemplateMetadata,omitempty"`
|
|
||||||
// RollingStyle can be "Canary", "Partiton" or "BlueGreen"
|
|
||||||
RollingStyle RollingStyleType `json:"rollingStyle,omitempty"`
|
|
||||||
// EnableExtraWorkloadForCanary indicates whether to create extra workload for canary
|
|
||||||
// True corresponds to RollingStyle "Canary".
|
|
||||||
// False corresponds to RollingStyle "Partiton".
|
|
||||||
// Ignored in BlueGreen-style.
|
|
||||||
// This field is about to deprecate, use RollingStyle instead.
|
|
||||||
// If both of them are set, controller will only consider this
|
|
||||||
// filed when RollingStyle is empty
|
|
||||||
EnableExtraWorkloadForCanary bool `json:"enableExtraWorkloadForCanary"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FinalizingPolicyType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// WaitResumeFinalizingPolicyType will wait workload to be resumed, which means
|
|
||||||
// controller will be hold at Finalizing phase util all pods of workload is upgraded.
|
|
||||||
// WaitResumeFinalizingPolicyType only works in canary-style BatchRelease controller.
|
|
||||||
WaitResumeFinalizingPolicyType FinalizingPolicyType = "WaitResume"
|
|
||||||
// ImmediateFinalizingPolicyType will not to wait workload to be resumed.
|
|
||||||
ImmediateFinalizingPolicyType FinalizingPolicyType = "Immediate"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ReleaseBatch is used to describe how each batch release should be
|
|
||||||
type ReleaseBatch struct {
|
|
||||||
// CanaryReplicas is the number of upgraded pods that should have in this batch.
|
|
||||||
// it can be an absolute number (ex: 5) or a percentage of workload replicas.
|
|
||||||
// batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j.
|
|
||||||
CanaryReplicas intstr.IntOrString `json:"canaryReplicas"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseStatus defines the observed state of a release plan
|
|
||||||
type BatchReleaseStatus struct {
|
|
||||||
// Conditions represents the observed process state of each phase during executing the release plan.
|
|
||||||
Conditions []RolloutCondition `json:"conditions,omitempty"`
|
|
||||||
// CanaryStatus describes the state of the canary rollout.
|
|
||||||
CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"`
|
|
||||||
// StableRevision is the pod-template-hash of stable revision pod template.
|
|
||||||
StableRevision string `json:"stableRevision,omitempty"`
|
|
||||||
// UpdateRevision is the pod-template-hash of update revision pod template.
|
|
||||||
UpdateRevision string `json:"updateRevision,omitempty"`
|
|
||||||
// ObservedGeneration is the most recent generation observed for this BatchRelease.
|
|
||||||
// It corresponds to this BatchRelease's generation, which is updated on mutation
|
|
||||||
// by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1.
|
|
||||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
|
||||||
// ObservedRolloutID is the most recent rollout-id observed for this BatchRelease.
|
|
||||||
// If RolloutID was changed, we will restart to roll out from batch 0,
|
|
||||||
// to ensure the batch-id and rollout-id labels of Pods are correct.
|
|
||||||
ObservedRolloutID string `json:"observedRolloutID,omitempty"`
|
|
||||||
// ObservedWorkloadReplicas is observed replicas of target referenced workload.
|
|
||||||
// This field is designed to deal with scaling event during rollout, if this field changed,
|
|
||||||
// it means that the workload is scaling during rollout.
|
|
||||||
ObservedWorkloadReplicas int32 `json:"observedWorkloadReplicas,omitempty"`
|
|
||||||
// Count of hash collisions for creating canary Deployment. The controller uses this
|
|
||||||
// field as a collision avoidance mechanism when it needs to create the name for the
|
|
||||||
// newest canary Deployment.
|
|
||||||
// +optional
|
|
||||||
CollisionCount *int32 `json:"collisionCount,omitempty"`
|
|
||||||
// ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan.
|
|
||||||
ObservedReleasePlanHash string `json:"observedReleasePlanHash,omitempty"`
|
|
||||||
// Phase is the release plan phase, which indicates the current state of release
|
|
||||||
// plan state machine in BatchRelease controller.
|
|
||||||
Phase RolloutPhase `json:"phase,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BatchReleaseCanaryStatus struct {
|
|
||||||
// CurrentBatchState indicates the release state of the current batch.
|
|
||||||
CurrentBatchState BatchReleaseBatchStateType `json:"batchState,omitempty"`
|
|
||||||
// The current batch the rollout is working on/blocked, it starts from 0
|
|
||||||
CurrentBatch int32 `json:"currentBatch"`
|
|
||||||
// BatchReadyTime is the ready timestamp of the current batch or the last batch.
|
|
||||||
// This field is updated once a batch ready, and the batches[x].pausedSeconds
|
|
||||||
// relies on this field to calculate the real-time duration.
|
|
||||||
BatchReadyTime *metav1.Time `json:"batchReadyTime,omitempty"`
|
|
||||||
// UpdatedReplicas is the number of upgraded Pods.
|
|
||||||
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
|
|
||||||
// UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition.
|
|
||||||
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"`
|
|
||||||
// the number of pods that no need to rollback in rollback scene.
|
|
||||||
NoNeedUpdateReplicas *int32 `json:"noNeedUpdateReplicas,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BatchReleaseBatchStateType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// UpgradingBatchState indicates that current batch is at upgrading pod state
|
|
||||||
UpgradingBatchState BatchReleaseBatchStateType = "Upgrading"
|
|
||||||
// VerifyingBatchState indicates that current batch is at verifying whether it's ready state
|
|
||||||
VerifyingBatchState BatchReleaseBatchStateType = "Verifying"
|
|
||||||
// ReadyBatchState indicates that current batch is at batch ready state
|
|
||||||
ReadyBatchState BatchReleaseBatchStateType = "Ready"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// RolloutPhasePreparing indicates a rollout is preparing for next progress.
|
|
||||||
RolloutPhasePreparing RolloutPhase = "Preparing"
|
|
||||||
// RolloutPhaseFinalizing indicates a rollout is finalizing
|
|
||||||
RolloutPhaseFinalizing RolloutPhase = "Finalizing"
|
|
||||||
// RolloutPhaseCompleted indicates a rollout is completed/cancelled/terminated
|
|
||||||
RolloutPhaseCompleted RolloutPhase = "Completed"
|
|
||||||
)
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2022 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +k8s:openapi-gen=true
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
// +kubebuilder:subresource:status
|
|
||||||
// +kubebuilder:printcolumn:name="KIND",type=string,JSONPath=`.spec.targetReference.workloadRef.kind`
|
|
||||||
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
|
|
||||||
// +kubebuilder:printcolumn:name="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch`
|
|
||||||
// +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState`
|
|
||||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
|
||||||
|
|
||||||
type BatchRelease struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
|
||||||
|
|
||||||
Spec BatchReleaseSpec `json:"spec,omitempty"`
|
|
||||||
Status BatchReleaseStatus `json:"status,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseSpec defines how to describe an update between different compRevision
|
|
||||||
type BatchReleaseSpec struct {
|
|
||||||
// TargetRef contains the GVK and name of the workload that we need to upgrade to.
|
|
||||||
TargetRef ObjectRef `json:"targetReference"`
|
|
||||||
// ReleasePlan is the details on how to rollout the resources
|
|
||||||
ReleasePlan ReleasePlan `json:"releasePlan"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseList contains a list of BatchRelease
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
type BatchReleaseList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ListMeta `json:"metadata,omitempty"`
|
|
||||||
Items []BatchRelease `json:"items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
SchemeBuilder.Register(&BatchRelease{}, &BatchReleaseList{})
|
|
||||||
}
|
|
||||||
|
|
@ -1,477 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2023 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
|
||||||
"github.com/openkruise/kruise-rollout-api/utils/conversion"
|
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
|
||||||
utilpointer "k8s.io/utils/pointer"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (src *Rollout) ConvertTo(dst conversion.Hub) error {
|
|
||||||
switch t := dst.(type) {
|
|
||||||
case *v1beta1.Rollout:
|
|
||||||
obj := dst.(*v1beta1.Rollout)
|
|
||||||
obj.ObjectMeta = src.ObjectMeta
|
|
||||||
obj.Spec = v1beta1.RolloutSpec{}
|
|
||||||
srcSpec := src.Spec
|
|
||||||
obj.Spec.WorkloadRef = v1beta1.ObjectRef{
|
|
||||||
APIVersion: srcSpec.ObjectRef.WorkloadRef.APIVersion,
|
|
||||||
Kind: srcSpec.ObjectRef.WorkloadRef.Kind,
|
|
||||||
Name: srcSpec.ObjectRef.WorkloadRef.Name,
|
|
||||||
}
|
|
||||||
obj.Spec.Disabled = srcSpec.Disabled
|
|
||||||
obj.Spec.Strategy = v1beta1.RolloutStrategy{
|
|
||||||
Paused: srcSpec.Strategy.Paused,
|
|
||||||
Canary: &v1beta1.CanaryStrategy{
|
|
||||||
FailureThreshold: srcSpec.Strategy.Canary.FailureThreshold,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, step := range srcSpec.Strategy.Canary.Steps {
|
|
||||||
o := v1beta1.CanaryStep{
|
|
||||||
TrafficRoutingStrategy: ConversionToV1beta1TrafficRoutingStrategy(step.TrafficRoutingStrategy),
|
|
||||||
Replicas: step.Replicas,
|
|
||||||
Pause: v1beta1.RolloutPause{Duration: step.Pause.Duration},
|
|
||||||
}
|
|
||||||
if step.Replicas == nil && step.Weight != nil {
|
|
||||||
o.Replicas = &intstr.IntOrString{
|
|
||||||
Type: intstr.String,
|
|
||||||
StrVal: fmt.Sprintf("%d", *step.Weight) + "%",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
obj.Spec.Strategy.Canary.Steps = append(obj.Spec.Strategy.Canary.Steps, o)
|
|
||||||
}
|
|
||||||
for _, ref := range srcSpec.Strategy.Canary.TrafficRoutings {
|
|
||||||
o := ConversionToV1beta1TrafficRoutingRef(ref)
|
|
||||||
obj.Spec.Strategy.Canary.TrafficRoutings = append(obj.Spec.Strategy.Canary.TrafficRoutings, o)
|
|
||||||
}
|
|
||||||
if srcSpec.Strategy.Canary.PatchPodTemplateMetadata != nil {
|
|
||||||
obj.Spec.Strategy.Canary.PatchPodTemplateMetadata = &v1beta1.PatchPodTemplateMetadata{
|
|
||||||
Annotations: map[string]string{},
|
|
||||||
Labels: map[string]string{},
|
|
||||||
}
|
|
||||||
for k, v := range srcSpec.Strategy.Canary.PatchPodTemplateMetadata.Annotations {
|
|
||||||
obj.Spec.Strategy.Canary.PatchPodTemplateMetadata.Annotations[k] = v
|
|
||||||
}
|
|
||||||
for k, v := range srcSpec.Strategy.Canary.PatchPodTemplateMetadata.Labels {
|
|
||||||
obj.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(PartitionRollingStyle)) {
|
|
||||||
obj.Spec.Strategy.Canary.EnableExtraWorkloadForCanary = true
|
|
||||||
}
|
|
||||||
if src.Annotations[TrafficRoutingAnnotation] != "" {
|
|
||||||
obj.Spec.Strategy.Canary.TrafficRoutingRef = src.Annotations[TrafficRoutingAnnotation]
|
|
||||||
}
|
|
||||||
|
|
||||||
// status
|
|
||||||
obj.Status = v1beta1.RolloutStatus{
|
|
||||||
ObservedGeneration: src.Status.ObservedGeneration,
|
|
||||||
Phase: v1beta1.RolloutPhase(src.Status.Phase),
|
|
||||||
Message: src.Status.Message,
|
|
||||||
}
|
|
||||||
for _, cond := range src.Status.Conditions {
|
|
||||||
o := v1beta1.RolloutCondition{
|
|
||||||
Type: v1beta1.RolloutConditionType(cond.Type),
|
|
||||||
Status: cond.Status,
|
|
||||||
LastUpdateTime: cond.LastUpdateTime,
|
|
||||||
LastTransitionTime: cond.LastTransitionTime,
|
|
||||||
Reason: cond.Reason,
|
|
||||||
Message: cond.Message,
|
|
||||||
}
|
|
||||||
obj.Status.Conditions = append(obj.Status.Conditions, o)
|
|
||||||
}
|
|
||||||
if src.Status.CanaryStatus == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
obj.Status.CanaryStatus = &v1beta1.CanaryStatus{
|
|
||||||
CommonStatus: v1beta1.CommonStatus{
|
|
||||||
ObservedWorkloadGeneration: src.Status.CanaryStatus.ObservedWorkloadGeneration,
|
|
||||||
ObservedRolloutID: src.Status.CanaryStatus.ObservedRolloutID,
|
|
||||||
RolloutHash: src.Status.CanaryStatus.RolloutHash,
|
|
||||||
StableRevision: src.Status.CanaryStatus.StableRevision,
|
|
||||||
PodTemplateHash: src.Status.CanaryStatus.PodTemplateHash,
|
|
||||||
CurrentStepIndex: src.Status.CanaryStatus.CurrentStepIndex,
|
|
||||||
CurrentStepState: v1beta1.CanaryStepState(src.Status.CanaryStatus.CurrentStepState),
|
|
||||||
Message: src.Status.CanaryStatus.Message,
|
|
||||||
LastUpdateTime: src.Status.CanaryStatus.LastUpdateTime,
|
|
||||||
FinalisingStep: v1beta1.FinalisingStepType(src.Status.CanaryStatus.FinalisingStep),
|
|
||||||
NextStepIndex: src.Status.CanaryStatus.NextStepIndex,
|
|
||||||
},
|
|
||||||
CanaryRevision: src.Status.CanaryStatus.CanaryRevision,
|
|
||||||
CanaryReplicas: src.Status.CanaryStatus.CanaryReplicas,
|
|
||||||
CanaryReadyReplicas: src.Status.CanaryStatus.CanaryReadyReplicas,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unsupported type %v", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConversionToV1beta1TrafficRoutingRef(src TrafficRoutingRef) (dst v1beta1.TrafficRoutingRef) {
|
|
||||||
dst.Service = src.Service
|
|
||||||
dst.GracePeriodSeconds = src.GracePeriodSeconds
|
|
||||||
if src.Ingress != nil {
|
|
||||||
dst.Ingress = &v1beta1.IngressTrafficRouting{
|
|
||||||
ClassType: src.Ingress.ClassType,
|
|
||||||
Name: src.Ingress.Name,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if src.Gateway != nil {
|
|
||||||
dst.Gateway = &v1beta1.GatewayTrafficRouting{
|
|
||||||
HTTPRouteName: src.Gateway.HTTPRouteName,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, ref := range src.CustomNetworkRefs {
|
|
||||||
obj := v1beta1.ObjectRef{
|
|
||||||
APIVersion: ref.APIVersion,
|
|
||||||
Kind: ref.Kind,
|
|
||||||
Name: ref.Name,
|
|
||||||
}
|
|
||||||
dst.CustomNetworkRefs = append(dst.CustomNetworkRefs, obj)
|
|
||||||
}
|
|
||||||
return dst
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConversionToV1beta1TrafficRoutingStrategy(src TrafficRoutingStrategy) (dst v1beta1.TrafficRoutingStrategy) {
|
|
||||||
if src.Weight != nil {
|
|
||||||
dst.Traffic = utilpointer.String(fmt.Sprintf("%d", *src.Weight) + "%")
|
|
||||||
}
|
|
||||||
dst.RequestHeaderModifier = src.RequestHeaderModifier
|
|
||||||
for _, match := range src.Matches {
|
|
||||||
obj := v1beta1.HttpRouteMatch{
|
|
||||||
Headers: match.Headers,
|
|
||||||
}
|
|
||||||
dst.Matches = append(dst.Matches, obj)
|
|
||||||
}
|
|
||||||
return dst
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *Rollout) ConvertFrom(src conversion.Hub) error {
|
|
||||||
switch t := src.(type) {
|
|
||||||
case *v1beta1.Rollout:
|
|
||||||
srcV1beta1 := src.(*v1beta1.Rollout)
|
|
||||||
dst.ObjectMeta = srcV1beta1.ObjectMeta
|
|
||||||
if !srcV1beta1.Spec.Strategy.IsCanaryStragegy() {
|
|
||||||
// only v1beta1 supports bluegreen strategy
|
|
||||||
// Don't log the message because it will print too often
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
// spec
|
|
||||||
dst.Spec = RolloutSpec{
|
|
||||||
ObjectRef: ObjectRef{
|
|
||||||
WorkloadRef: &WorkloadRef{
|
|
||||||
APIVersion: srcV1beta1.Spec.WorkloadRef.APIVersion,
|
|
||||||
Kind: srcV1beta1.Spec.WorkloadRef.Kind,
|
|
||||||
Name: srcV1beta1.Spec.WorkloadRef.Name,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Strategy: RolloutStrategy{
|
|
||||||
Paused: srcV1beta1.Spec.Strategy.Paused,
|
|
||||||
Canary: &CanaryStrategy{
|
|
||||||
FailureThreshold: srcV1beta1.Spec.Strategy.Canary.FailureThreshold,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Disabled: srcV1beta1.Spec.Disabled,
|
|
||||||
}
|
|
||||||
for _, step := range srcV1beta1.Spec.Strategy.Canary.Steps {
|
|
||||||
obj := CanaryStep{
|
|
||||||
TrafficRoutingStrategy: ConversionToV1alpha1TrafficRoutingStrategy(step.TrafficRoutingStrategy),
|
|
||||||
Replicas: step.Replicas,
|
|
||||||
Pause: RolloutPause{Duration: step.Pause.Duration},
|
|
||||||
}
|
|
||||||
dst.Spec.Strategy.Canary.Steps = append(dst.Spec.Strategy.Canary.Steps, obj)
|
|
||||||
}
|
|
||||||
for _, ref := range srcV1beta1.Spec.Strategy.Canary.TrafficRoutings {
|
|
||||||
obj := ConversionToV1alpha1TrafficRoutingRef(ref)
|
|
||||||
dst.Spec.Strategy.Canary.TrafficRoutings = append(dst.Spec.Strategy.Canary.TrafficRoutings, obj)
|
|
||||||
}
|
|
||||||
if srcV1beta1.Spec.Strategy.Canary.PatchPodTemplateMetadata != nil {
|
|
||||||
dst.Spec.Strategy.Canary.PatchPodTemplateMetadata = &PatchPodTemplateMetadata{
|
|
||||||
Annotations: map[string]string{},
|
|
||||||
Labels: map[string]string{},
|
|
||||||
}
|
|
||||||
for k, v := range srcV1beta1.Spec.Strategy.Canary.PatchPodTemplateMetadata.Annotations {
|
|
||||||
dst.Spec.Strategy.Canary.PatchPodTemplateMetadata.Annotations[k] = v
|
|
||||||
}
|
|
||||||
for k, v := range srcV1beta1.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels {
|
|
||||||
dst.Spec.Strategy.Canary.PatchPodTemplateMetadata.Labels[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if dst.Annotations == nil {
|
|
||||||
dst.Annotations = map[string]string{}
|
|
||||||
}
|
|
||||||
if srcV1beta1.Spec.Strategy.Canary.EnableExtraWorkloadForCanary {
|
|
||||||
dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(CanaryRollingStyle))
|
|
||||||
} else {
|
|
||||||
dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(PartitionRollingStyle))
|
|
||||||
}
|
|
||||||
if srcV1beta1.Spec.Strategy.Canary.TrafficRoutingRef != "" {
|
|
||||||
dst.Annotations[TrafficRoutingAnnotation] = srcV1beta1.Spec.Strategy.Canary.TrafficRoutingRef
|
|
||||||
}
|
|
||||||
|
|
||||||
// status
|
|
||||||
dst.Status = RolloutStatus{
|
|
||||||
ObservedGeneration: srcV1beta1.Status.ObservedGeneration,
|
|
||||||
Phase: RolloutPhase(srcV1beta1.Status.Phase),
|
|
||||||
Message: srcV1beta1.Status.Message,
|
|
||||||
}
|
|
||||||
for _, cond := range srcV1beta1.Status.Conditions {
|
|
||||||
obj := RolloutCondition{
|
|
||||||
Type: RolloutConditionType(cond.Type),
|
|
||||||
Status: cond.Status,
|
|
||||||
LastUpdateTime: cond.LastUpdateTime,
|
|
||||||
LastTransitionTime: cond.LastTransitionTime,
|
|
||||||
Reason: cond.Reason,
|
|
||||||
Message: cond.Message,
|
|
||||||
}
|
|
||||||
dst.Status.Conditions = append(dst.Status.Conditions, obj)
|
|
||||||
}
|
|
||||||
if srcV1beta1.Status.CanaryStatus == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
dst.Status.CanaryStatus = &CanaryStatus{
|
|
||||||
ObservedWorkloadGeneration: srcV1beta1.Status.CanaryStatus.ObservedWorkloadGeneration,
|
|
||||||
ObservedRolloutID: srcV1beta1.Status.CanaryStatus.ObservedRolloutID,
|
|
||||||
RolloutHash: srcV1beta1.Status.CanaryStatus.RolloutHash,
|
|
||||||
StableRevision: srcV1beta1.Status.CanaryStatus.StableRevision,
|
|
||||||
CanaryRevision: srcV1beta1.Status.CanaryStatus.CanaryRevision,
|
|
||||||
PodTemplateHash: srcV1beta1.Status.CanaryStatus.PodTemplateHash,
|
|
||||||
CanaryReplicas: srcV1beta1.Status.CanaryStatus.CanaryReplicas,
|
|
||||||
CanaryReadyReplicas: srcV1beta1.Status.CanaryStatus.CanaryReadyReplicas,
|
|
||||||
CurrentStepIndex: srcV1beta1.Status.CanaryStatus.CurrentStepIndex,
|
|
||||||
CurrentStepState: CanaryStepState(srcV1beta1.Status.CanaryStatus.CurrentStepState),
|
|
||||||
Message: srcV1beta1.Status.CanaryStatus.Message,
|
|
||||||
LastUpdateTime: srcV1beta1.Status.CanaryStatus.LastUpdateTime,
|
|
||||||
FinalisingStep: FinalizeStateType(srcV1beta1.Status.CanaryStatus.FinalisingStep),
|
|
||||||
NextStepIndex: srcV1beta1.Status.CanaryStatus.NextStepIndex,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unsupported type %v", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConversionToV1alpha1TrafficRoutingStrategy(src v1beta1.TrafficRoutingStrategy) (dst TrafficRoutingStrategy) {
|
|
||||||
if src.Traffic != nil {
|
|
||||||
is := intstr.FromString(*src.Traffic)
|
|
||||||
weight, _ := intstr.GetScaledValueFromIntOrPercent(&is, 100, true)
|
|
||||||
dst.Weight = utilpointer.Int32(int32(weight))
|
|
||||||
}
|
|
||||||
dst.RequestHeaderModifier = src.RequestHeaderModifier
|
|
||||||
for _, match := range src.Matches {
|
|
||||||
obj := HttpRouteMatch{
|
|
||||||
Headers: match.Headers,
|
|
||||||
}
|
|
||||||
dst.Matches = append(dst.Matches, obj)
|
|
||||||
}
|
|
||||||
return dst
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConversionToV1alpha1TrafficRoutingRef(src v1beta1.TrafficRoutingRef) (dst TrafficRoutingRef) {
|
|
||||||
dst.Service = src.Service
|
|
||||||
dst.GracePeriodSeconds = src.GracePeriodSeconds
|
|
||||||
if src.Ingress != nil {
|
|
||||||
dst.Ingress = &IngressTrafficRouting{
|
|
||||||
ClassType: src.Ingress.ClassType,
|
|
||||||
Name: src.Ingress.Name,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if src.Gateway != nil {
|
|
||||||
dst.Gateway = &GatewayTrafficRouting{
|
|
||||||
HTTPRouteName: src.Gateway.HTTPRouteName,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, ref := range src.CustomNetworkRefs {
|
|
||||||
obj := CustomNetworkRef{
|
|
||||||
APIVersion: ref.APIVersion,
|
|
||||||
Kind: ref.Kind,
|
|
||||||
Name: ref.Name,
|
|
||||||
}
|
|
||||||
dst.CustomNetworkRefs = append(dst.CustomNetworkRefs, obj)
|
|
||||||
}
|
|
||||||
return dst
|
|
||||||
}
|
|
||||||
|
|
||||||
func (src *BatchRelease) ConvertTo(dst conversion.Hub) error {
|
|
||||||
switch t := dst.(type) {
|
|
||||||
case *v1beta1.BatchRelease:
|
|
||||||
obj := dst.(*v1beta1.BatchRelease)
|
|
||||||
obj.ObjectMeta = src.ObjectMeta
|
|
||||||
obj.Spec = v1beta1.BatchReleaseSpec{}
|
|
||||||
srcSpec := src.Spec
|
|
||||||
obj.Spec.WorkloadRef = v1beta1.ObjectRef{
|
|
||||||
APIVersion: srcSpec.TargetRef.WorkloadRef.APIVersion,
|
|
||||||
Kind: srcSpec.TargetRef.WorkloadRef.Kind,
|
|
||||||
Name: srcSpec.TargetRef.WorkloadRef.Name,
|
|
||||||
}
|
|
||||||
obj.Spec.ReleasePlan = v1beta1.ReleasePlan{
|
|
||||||
BatchPartition: srcSpec.ReleasePlan.BatchPartition,
|
|
||||||
RolloutID: srcSpec.ReleasePlan.RolloutID,
|
|
||||||
FailureThreshold: srcSpec.ReleasePlan.FailureThreshold,
|
|
||||||
FinalizingPolicy: v1beta1.FinalizingPolicyType(srcSpec.ReleasePlan.FinalizingPolicy),
|
|
||||||
}
|
|
||||||
for _, batch := range srcSpec.ReleasePlan.Batches {
|
|
||||||
o := v1beta1.ReleaseBatch{
|
|
||||||
CanaryReplicas: batch.CanaryReplicas,
|
|
||||||
}
|
|
||||||
obj.Spec.ReleasePlan.Batches = append(obj.Spec.ReleasePlan.Batches, o)
|
|
||||||
}
|
|
||||||
if srcSpec.ReleasePlan.PatchPodTemplateMetadata != nil {
|
|
||||||
obj.Spec.ReleasePlan.PatchPodTemplateMetadata = &v1beta1.PatchPodTemplateMetadata{
|
|
||||||
Annotations: map[string]string{},
|
|
||||||
Labels: map[string]string{},
|
|
||||||
}
|
|
||||||
for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Annotations {
|
|
||||||
obj.Spec.ReleasePlan.PatchPodTemplateMetadata.Annotations[k] = v
|
|
||||||
}
|
|
||||||
for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Labels {
|
|
||||||
obj.Spec.ReleasePlan.PatchPodTemplateMetadata.Labels[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(PartitionRollingStyle)) {
|
|
||||||
obj.Spec.ReleasePlan.RollingStyle = v1beta1.PartitionRollingStyle
|
|
||||||
}
|
|
||||||
if strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(CanaryRollingStyle)) {
|
|
||||||
obj.Spec.ReleasePlan.RollingStyle = v1beta1.CanaryRollingStyle
|
|
||||||
}
|
|
||||||
if strings.EqualFold(src.Annotations[RolloutStyleAnnotation], string(BlueGreenRollingStyle)) {
|
|
||||||
obj.Spec.ReleasePlan.RollingStyle = v1beta1.BlueGreenRollingStyle
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.Spec.ReleasePlan.EnableExtraWorkloadForCanary = srcSpec.ReleasePlan.EnableExtraWorkloadForCanary
|
|
||||||
|
|
||||||
// status
|
|
||||||
obj.Status = v1beta1.BatchReleaseStatus{
|
|
||||||
StableRevision: src.Status.StableRevision,
|
|
||||||
UpdateRevision: src.Status.UpdateRevision,
|
|
||||||
ObservedGeneration: src.Status.ObservedGeneration,
|
|
||||||
ObservedRolloutID: src.Status.ObservedRolloutID,
|
|
||||||
ObservedWorkloadReplicas: src.Status.ObservedWorkloadReplicas,
|
|
||||||
ObservedReleasePlanHash: src.Status.ObservedReleasePlanHash,
|
|
||||||
CollisionCount: src.Status.CollisionCount,
|
|
||||||
Phase: v1beta1.RolloutPhase(src.Status.Phase),
|
|
||||||
}
|
|
||||||
for _, cond := range src.Status.Conditions {
|
|
||||||
o := v1beta1.RolloutCondition{
|
|
||||||
Type: v1beta1.RolloutConditionType(cond.Type),
|
|
||||||
Status: cond.Status,
|
|
||||||
LastUpdateTime: cond.LastUpdateTime,
|
|
||||||
LastTransitionTime: cond.LastTransitionTime,
|
|
||||||
Reason: cond.Reason,
|
|
||||||
Message: cond.Message,
|
|
||||||
}
|
|
||||||
obj.Status.Conditions = append(obj.Status.Conditions, o)
|
|
||||||
}
|
|
||||||
obj.Status.CanaryStatus = v1beta1.BatchReleaseCanaryStatus{
|
|
||||||
CurrentBatchState: v1beta1.BatchReleaseBatchStateType(src.Status.CanaryStatus.CurrentBatchState),
|
|
||||||
CurrentBatch: src.Status.CanaryStatus.CurrentBatch,
|
|
||||||
BatchReadyTime: src.Status.CanaryStatus.BatchReadyTime,
|
|
||||||
UpdatedReplicas: src.Status.CanaryStatus.UpdatedReplicas,
|
|
||||||
UpdatedReadyReplicas: src.Status.CanaryStatus.UpdatedReadyReplicas,
|
|
||||||
NoNeedUpdateReplicas: src.Status.CanaryStatus.NoNeedUpdateReplicas,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unsupported type %v", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *BatchRelease) ConvertFrom(src conversion.Hub) error {
|
|
||||||
switch t := src.(type) {
|
|
||||||
case *v1beta1.BatchRelease:
|
|
||||||
srcV1beta1 := src.(*v1beta1.BatchRelease)
|
|
||||||
dst.ObjectMeta = srcV1beta1.ObjectMeta
|
|
||||||
dst.Spec = BatchReleaseSpec{}
|
|
||||||
srcSpec := srcV1beta1.Spec
|
|
||||||
dst.Spec.TargetRef.WorkloadRef = &WorkloadRef{
|
|
||||||
APIVersion: srcSpec.WorkloadRef.APIVersion,
|
|
||||||
Kind: srcSpec.WorkloadRef.Kind,
|
|
||||||
Name: srcSpec.WorkloadRef.Name,
|
|
||||||
}
|
|
||||||
dst.Spec.ReleasePlan = ReleasePlan{
|
|
||||||
BatchPartition: srcSpec.ReleasePlan.BatchPartition,
|
|
||||||
RolloutID: srcSpec.ReleasePlan.RolloutID,
|
|
||||||
FailureThreshold: srcSpec.ReleasePlan.FailureThreshold,
|
|
||||||
FinalizingPolicy: FinalizingPolicyType(srcSpec.ReleasePlan.FinalizingPolicy),
|
|
||||||
}
|
|
||||||
for _, batch := range srcSpec.ReleasePlan.Batches {
|
|
||||||
obj := ReleaseBatch{
|
|
||||||
CanaryReplicas: batch.CanaryReplicas,
|
|
||||||
}
|
|
||||||
dst.Spec.ReleasePlan.Batches = append(dst.Spec.ReleasePlan.Batches, obj)
|
|
||||||
}
|
|
||||||
if srcSpec.ReleasePlan.PatchPodTemplateMetadata != nil {
|
|
||||||
dst.Spec.ReleasePlan.PatchPodTemplateMetadata = &PatchPodTemplateMetadata{
|
|
||||||
Annotations: map[string]string{},
|
|
||||||
Labels: map[string]string{},
|
|
||||||
}
|
|
||||||
for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Annotations {
|
|
||||||
dst.Spec.ReleasePlan.PatchPodTemplateMetadata.Annotations[k] = v
|
|
||||||
}
|
|
||||||
for k, v := range srcSpec.ReleasePlan.PatchPodTemplateMetadata.Labels {
|
|
||||||
dst.Spec.ReleasePlan.PatchPodTemplateMetadata.Labels[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if dst.Annotations == nil {
|
|
||||||
dst.Annotations = map[string]string{}
|
|
||||||
}
|
|
||||||
dst.Annotations[RolloutStyleAnnotation] = strings.ToLower(string(srcV1beta1.Spec.ReleasePlan.RollingStyle))
|
|
||||||
dst.Spec.ReleasePlan.RollingStyle = RollingStyleType(srcV1beta1.Spec.ReleasePlan.RollingStyle)
|
|
||||||
dst.Spec.ReleasePlan.EnableExtraWorkloadForCanary = srcV1beta1.Spec.ReleasePlan.EnableExtraWorkloadForCanary
|
|
||||||
|
|
||||||
// status
|
|
||||||
dst.Status = BatchReleaseStatus{
|
|
||||||
StableRevision: srcV1beta1.Status.StableRevision,
|
|
||||||
UpdateRevision: srcV1beta1.Status.UpdateRevision,
|
|
||||||
ObservedGeneration: srcV1beta1.Status.ObservedGeneration,
|
|
||||||
ObservedRolloutID: srcV1beta1.Status.ObservedRolloutID,
|
|
||||||
ObservedWorkloadReplicas: srcV1beta1.Status.ObservedWorkloadReplicas,
|
|
||||||
ObservedReleasePlanHash: srcV1beta1.Status.ObservedReleasePlanHash,
|
|
||||||
CollisionCount: srcV1beta1.Status.CollisionCount,
|
|
||||||
Phase: RolloutPhase(srcV1beta1.Status.Phase),
|
|
||||||
}
|
|
||||||
for _, cond := range srcV1beta1.Status.Conditions {
|
|
||||||
obj := RolloutCondition{
|
|
||||||
Type: RolloutConditionType(cond.Type),
|
|
||||||
Status: cond.Status,
|
|
||||||
LastUpdateTime: cond.LastUpdateTime,
|
|
||||||
LastTransitionTime: cond.LastTransitionTime,
|
|
||||||
Reason: cond.Reason,
|
|
||||||
Message: cond.Message,
|
|
||||||
}
|
|
||||||
dst.Status.Conditions = append(dst.Status.Conditions, obj)
|
|
||||||
}
|
|
||||||
dst.Status.CanaryStatus = BatchReleaseCanaryStatus{
|
|
||||||
CurrentBatchState: BatchReleaseBatchStateType(srcV1beta1.Status.CanaryStatus.CurrentBatchState),
|
|
||||||
CurrentBatch: srcV1beta1.Status.CanaryStatus.CurrentBatch,
|
|
||||||
BatchReadyTime: srcV1beta1.Status.CanaryStatus.BatchReadyTime,
|
|
||||||
UpdatedReplicas: srcV1beta1.Status.CanaryStatus.UpdatedReplicas,
|
|
||||||
UpdatedReadyReplicas: srcV1beta1.Status.CanaryStatus.UpdatedReadyReplicas,
|
|
||||||
NoNeedUpdateReplicas: srcV1beta1.Status.CanaryStatus.NoNeedUpdateReplicas,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unsupported type %v", t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2023 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
apps "k8s.io/api/apps/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// DeploymentStrategyAnnotation is annotation for deployment,
|
|
||||||
// which is strategy fields of Advanced Deployment.
|
|
||||||
DeploymentStrategyAnnotation = "rollouts.kruise.io/deployment-strategy"
|
|
||||||
|
|
||||||
// DeploymentExtraStatusAnnotation is annotation for deployment,
|
|
||||||
// which is extra status field of Advanced Deployment.
|
|
||||||
DeploymentExtraStatusAnnotation = "rollouts.kruise.io/deployment-extra-status"
|
|
||||||
|
|
||||||
// DeploymentStableRevisionLabel is label for deployment,
|
|
||||||
// which record the stable revision during the current rolling process.
|
|
||||||
DeploymentStableRevisionLabel = "rollouts.kruise.io/stable-revision"
|
|
||||||
|
|
||||||
// AdvancedDeploymentControlLabel is label for deployment,
|
|
||||||
// which labels whether the deployment is controlled by advanced-deployment-controller.
|
|
||||||
AdvancedDeploymentControlLabel = "rollouts.kruise.io/controlled-by-advanced-deployment-controller"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeploymentStrategy is strategy field for Advanced Deployment
|
|
||||||
type DeploymentStrategy struct {
|
|
||||||
// RollingStyle define the behavior of rolling for deployment.
|
|
||||||
RollingStyle RollingStyleType `json:"rollingStyle,omitempty"`
|
|
||||||
// original deployment strategy rolling update fields
|
|
||||||
RollingUpdate *apps.RollingUpdateDeployment `json:"rollingUpdate,omitempty"`
|
|
||||||
// Paused = true will block the upgrade of Pods
|
|
||||||
Paused bool `json:"paused,omitempty"`
|
|
||||||
// Partition describe how many Pods should be updated during rollout.
|
|
||||||
// We use this field to implement partition-style rolling update.
|
|
||||||
Partition intstr.IntOrString `json:"partition,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RollingStyleType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// PartitionRollingStyle means rolling in batches just like CloneSet, and will NOT create any extra Deployment;
|
|
||||||
PartitionRollingStyle RollingStyleType = "Partition"
|
|
||||||
// CanaryRollingStyle means rolling in canary way, and will create a canary Deployment.
|
|
||||||
CanaryRollingStyle RollingStyleType = "Canary"
|
|
||||||
// BlueGreenRollingStyle means rolling in blue-green way, and will NOT create a canary Deployment.
|
|
||||||
BlueGreenRollingStyle RollingStyleType = "BlueGreen"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeploymentExtraStatus is extra status field for Advanced Deployment
|
|
||||||
type DeploymentExtraStatus struct {
|
|
||||||
// UpdatedReadyReplicas the number of pods that has been updated and ready.
|
|
||||||
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"`
|
|
||||||
// ExpectedUpdatedReplicas is an absolute number calculated based on Partition
|
|
||||||
// and Deployment.Spec.Replicas, means how many pods are expected be updated under
|
|
||||||
// current strategy.
|
|
||||||
// This field is designed to avoid users to fall into the details of algorithm
|
|
||||||
// for Partition calculation.
|
|
||||||
ExpectedUpdatedReplicas int32 `json:"expectedUpdatedReplicas,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetDefaultDeploymentStrategy(strategy *DeploymentStrategy) {
|
|
||||||
if strategy.RollingStyle != PartitionRollingStyle {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if strategy.RollingUpdate == nil {
|
|
||||||
strategy.RollingUpdate = &apps.RollingUpdateDeployment{}
|
|
||||||
}
|
|
||||||
if strategy.RollingUpdate.MaxUnavailable == nil {
|
|
||||||
// Set MaxUnavailable as 25% by default
|
|
||||||
maxUnavailable := intstr.FromString("25%")
|
|
||||||
strategy.RollingUpdate.MaxUnavailable = &maxUnavailable
|
|
||||||
}
|
|
||||||
if strategy.RollingUpdate.MaxSurge == nil {
|
|
||||||
// Set MaxSurge as 25% by default
|
|
||||||
maxSurge := intstr.FromString("25%")
|
|
||||||
strategy.RollingUpdate.MaxUnavailable = &maxSurge
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cannot allow maxSurge==0 && MaxUnavailable==0, otherwise, no pod can be updated when rolling update.
|
|
||||||
maxSurge, _ := intstr.GetScaledValueFromIntOrPercent(strategy.RollingUpdate.MaxSurge, 100, true)
|
|
||||||
maxUnavailable, _ := intstr.GetScaledValueFromIntOrPercent(strategy.RollingUpdate.MaxUnavailable, 100, true)
|
|
||||||
if maxSurge == 0 && maxUnavailable == 0 {
|
|
||||||
strategy.RollingUpdate = &apps.RollingUpdateDeployment{
|
|
||||||
MaxSurge: &intstr.IntOrString{Type: intstr.Int, IntVal: 0},
|
|
||||||
MaxUnavailable: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,151 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2022 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
|
||||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
|
||||||
|
|
||||||
// RolloutHistorySpec defines the desired state of RolloutHistory
|
|
||||||
type RolloutHistorySpec struct {
|
|
||||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
|
||||||
// Important: Run "make" to regenerate code after modifying this file
|
|
||||||
|
|
||||||
// Rollout indicates information of the rollout related with rollouthistory
|
|
||||||
Rollout RolloutInfo `json:"rollout,omitempty"`
|
|
||||||
// Workload indicates information of the workload, such as cloneset, deployment, advanced statefulset
|
|
||||||
Workload WorkloadInfo `json:"workload,omitempty"`
|
|
||||||
// Service indicates information of the service related with workload
|
|
||||||
Service ServiceInfo `json:"service,omitempty"`
|
|
||||||
// TrafficRouting indicates information of traffic route related with workload
|
|
||||||
TrafficRouting TrafficRoutingInfo `json:"trafficRouting,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NameAndSpecData struct {
|
|
||||||
// Name indicates the name of object ref, such as rollout name, workload name, ingress name, etc.
|
|
||||||
Name string `json:"name"`
|
|
||||||
// Data indecates the spec of object ref
|
|
||||||
// +kubebuilder:pruning:PreserveUnknownFields
|
|
||||||
// +kubebuilder:validation:Schemaless
|
|
||||||
Data runtime.RawExtension `json:"data,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// RolloutInfo indicates information of the rollout related
|
|
||||||
type RolloutInfo struct {
|
|
||||||
// RolloutID indicates the new rollout
|
|
||||||
// if there is no new RolloutID this time, ignore it and not execute RolloutHistory
|
|
||||||
RolloutID string `json:"rolloutID"`
|
|
||||||
NameAndSpecData `json:",inline"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceInfo indicates information of the service related
|
|
||||||
type ServiceInfo struct {
|
|
||||||
NameAndSpecData `json:",inline"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TrafficRoutingInfo indicates information of Gateway API or Ingress
|
|
||||||
type TrafficRoutingInfo struct {
|
|
||||||
// IngressRef indicates information of ingress
|
|
||||||
// +optional
|
|
||||||
Ingress *IngressInfo `json:"ingress,omitempty"`
|
|
||||||
// HTTPRouteRef indacates information of Gateway API
|
|
||||||
// +optional
|
|
||||||
HTTPRoute *HTTPRouteInfo `json:"httpRoute,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// IngressInfo indicates information of the ingress related
|
|
||||||
type IngressInfo struct {
|
|
||||||
NameAndSpecData `json:",inline"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTPRouteInfo indicates information of gateway API
|
|
||||||
type HTTPRouteInfo struct {
|
|
||||||
NameAndSpecData `json:",inline"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// WorkloadInfo indicates information of the workload, such as cloneset, deployment, advanced statefulset
|
|
||||||
type WorkloadInfo struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
NameAndSpecData `json:",inline"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// RolloutHistoryStatus defines the observed state of RolloutHistory
|
|
||||||
type RolloutHistoryStatus struct {
|
|
||||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
|
||||||
// Important: Run "make" to regenerate code after modifying this file
|
|
||||||
|
|
||||||
// Phase indicates phase of RolloutHistory, just "" or "completed"
|
|
||||||
Phase string `json:"phase,omitempty"`
|
|
||||||
// CanarySteps indicates the pods released each step
|
|
||||||
CanarySteps []CanaryStepInfo `json:"canarySteps,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CanaryStepInfo indicates the pods for a revision
|
|
||||||
type CanaryStepInfo struct {
|
|
||||||
// CanaryStepIndex indicates step this revision
|
|
||||||
CanaryStepIndex int32 `json:"canaryStepIndex,omitempty"`
|
|
||||||
// Pods indicates the pods information
|
|
||||||
Pods []Pod `json:"pods,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pod indicates the information of a pod, including name, ip, node_name.
|
|
||||||
type Pod struct {
|
|
||||||
// Name indicates the node name
|
|
||||||
Name string `json:"name,omitempty"`
|
|
||||||
// IP indicates the pod ip
|
|
||||||
IP string `json:"ip,omitempty"`
|
|
||||||
// NodeName indicates the node which pod is located at
|
|
||||||
NodeName string `json:"nodeName,omitempty"`
|
|
||||||
// todo
|
|
||||||
// State indicates whether the pod is ready or not
|
|
||||||
// State string `json:"state, omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Phase indicates rollouthistory phase
|
|
||||||
const (
|
|
||||||
PhaseCompleted string = "completed"
|
|
||||||
)
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
//+kubebuilder:object:root=true
|
|
||||||
//+kubebuilder:subresource:status
|
|
||||||
|
|
||||||
// RolloutHistory is the Schema for the rollouthistories API
|
|
||||||
type RolloutHistory struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
|
||||||
|
|
||||||
Spec RolloutHistorySpec `json:"spec,omitempty"`
|
|
||||||
Status RolloutHistoryStatus `json:"status,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
//+kubebuilder:object:root=true
|
|
||||||
|
|
||||||
// RolloutHistoryList contains a list of RolloutHistory
|
|
||||||
type RolloutHistoryList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ListMeta `json:"metadata,omitempty"`
|
|
||||||
Items []RolloutHistory `json:"items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
SchemeBuilder.Register(&RolloutHistory{}, &RolloutHistoryList{})
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
//go:build !ignore_autogenerated
|
//go:build !ignore_autogenerated
|
||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2023 The Kruise Authors.
|
Copyright 2024 The Kruise Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|
@ -22,140 +21,11 @@ limitations under the License.
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/apps/v1"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"sigs.k8s.io/gateway-api/apis/v1beta1"
|
"sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchRelease) DeepCopyInto(out *BatchRelease) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchRelease.
|
|
||||||
func (in *BatchRelease) DeepCopy() *BatchRelease {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchRelease)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *BatchRelease) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseCanaryStatus) DeepCopyInto(out *BatchReleaseCanaryStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.BatchReadyTime != nil {
|
|
||||||
in, out := &in.BatchReadyTime, &out.BatchReadyTime
|
|
||||||
*out = (*in).DeepCopy()
|
|
||||||
}
|
|
||||||
if in.NoNeedUpdateReplicas != nil {
|
|
||||||
in, out := &in.NoNeedUpdateReplicas, &out.NoNeedUpdateReplicas
|
|
||||||
*out = new(int32)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseCanaryStatus.
|
|
||||||
func (in *BatchReleaseCanaryStatus) DeepCopy() *BatchReleaseCanaryStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseCanaryStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseList) DeepCopyInto(out *BatchReleaseList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]BatchRelease, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseList.
|
|
||||||
func (in *BatchReleaseList) DeepCopy() *BatchReleaseList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *BatchReleaseList) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) {
|
|
||||||
*out = *in
|
|
||||||
in.TargetRef.DeepCopyInto(&out.TargetRef)
|
|
||||||
in.ReleasePlan.DeepCopyInto(&out.ReleasePlan)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseSpec.
|
|
||||||
func (in *BatchReleaseSpec) DeepCopy() *BatchReleaseSpec {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseSpec)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseStatus) DeepCopyInto(out *BatchReleaseStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.Conditions != nil {
|
|
||||||
in, out := &in.Conditions, &out.Conditions
|
|
||||||
*out = make([]RolloutCondition, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
in.CanaryStatus.DeepCopyInto(&out.CanaryStatus)
|
|
||||||
if in.CollisionCount != nil {
|
|
||||||
in, out := &in.CollisionCount, &out.CollisionCount
|
|
||||||
*out = new(int32)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseStatus.
|
|
||||||
func (in *BatchReleaseStatus) DeepCopy() *BatchReleaseStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) {
|
func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -197,26 +67,6 @@ func (in *CanaryStep) DeepCopy() *CanaryStep {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *CanaryStepInfo) DeepCopyInto(out *CanaryStepInfo) {
|
|
||||||
*out = *in
|
|
||||||
if in.Pods != nil {
|
|
||||||
in, out := &in.Pods, &out.Pods
|
|
||||||
*out = make([]Pod, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStepInfo.
|
|
||||||
func (in *CanaryStepInfo) DeepCopy() *CanaryStepInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(CanaryStepInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *CanaryStrategy) DeepCopyInto(out *CanaryStrategy) {
|
func (in *CanaryStrategy) DeepCopyInto(out *CanaryStrategy) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -271,42 +121,6 @@ func (in *CustomNetworkRef) DeepCopy() *CustomNetworkRef {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *DeploymentExtraStatus) DeepCopyInto(out *DeploymentExtraStatus) {
|
|
||||||
*out = *in
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentExtraStatus.
|
|
||||||
func (in *DeploymentExtraStatus) DeepCopy() *DeploymentExtraStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(DeploymentExtraStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *DeploymentStrategy) DeepCopyInto(out *DeploymentStrategy) {
|
|
||||||
*out = *in
|
|
||||||
if in.RollingUpdate != nil {
|
|
||||||
in, out := &in.RollingUpdate, &out.RollingUpdate
|
|
||||||
*out = new(v1.RollingUpdateDeployment)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
out.Partition = in.Partition
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStrategy.
|
|
||||||
func (in *DeploymentStrategy) DeepCopy() *DeploymentStrategy {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(DeploymentStrategy)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *GatewayTrafficRouting) DeepCopyInto(out *GatewayTrafficRouting) {
|
func (in *GatewayTrafficRouting) DeepCopyInto(out *GatewayTrafficRouting) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -327,22 +141,6 @@ func (in *GatewayTrafficRouting) DeepCopy() *GatewayTrafficRouting {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *HTTPRouteInfo) DeepCopyInto(out *HTTPRouteInfo) {
|
|
||||||
*out = *in
|
|
||||||
in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteInfo.
|
|
||||||
func (in *HTTPRouteInfo) DeepCopy() *HTTPRouteInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(HTTPRouteInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *HttpRouteMatch) DeepCopyInto(out *HttpRouteMatch) {
|
func (in *HttpRouteMatch) DeepCopyInto(out *HttpRouteMatch) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -365,22 +163,6 @@ func (in *HttpRouteMatch) DeepCopy() *HttpRouteMatch {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *IngressInfo) DeepCopyInto(out *IngressInfo) {
|
|
||||||
*out = *in
|
|
||||||
in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressInfo.
|
|
||||||
func (in *IngressInfo) DeepCopy() *IngressInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(IngressInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *IngressTrafficRouting) DeepCopyInto(out *IngressTrafficRouting) {
|
func (in *IngressTrafficRouting) DeepCopyInto(out *IngressTrafficRouting) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -396,22 +178,6 @@ func (in *IngressTrafficRouting) DeepCopy() *IngressTrafficRouting {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *NameAndSpecData) DeepCopyInto(out *NameAndSpecData) {
|
|
||||||
*out = *in
|
|
||||||
in.Data.DeepCopyInto(&out.Data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameAndSpecData.
|
|
||||||
func (in *NameAndSpecData) DeepCopy() *NameAndSpecData {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(NameAndSpecData)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {
|
func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -461,72 +227,6 @@ func (in *PatchPodTemplateMetadata) DeepCopy() *PatchPodTemplateMetadata {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *Pod) DeepCopyInto(out *Pod) {
|
|
||||||
*out = *in
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pod.
|
|
||||||
func (in *Pod) DeepCopy() *Pod {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(Pod)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ReleaseBatch) DeepCopyInto(out *ReleaseBatch) {
|
|
||||||
*out = *in
|
|
||||||
out.CanaryReplicas = in.CanaryReplicas
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseBatch.
|
|
||||||
func (in *ReleaseBatch) DeepCopy() *ReleaseBatch {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ReleaseBatch)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ReleasePlan) DeepCopyInto(out *ReleasePlan) {
|
|
||||||
*out = *in
|
|
||||||
if in.Batches != nil {
|
|
||||||
in, out := &in.Batches, &out.Batches
|
|
||||||
*out = make([]ReleaseBatch, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
if in.BatchPartition != nil {
|
|
||||||
in, out := &in.BatchPartition, &out.BatchPartition
|
|
||||||
*out = new(int32)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.FailureThreshold != nil {
|
|
||||||
in, out := &in.FailureThreshold, &out.FailureThreshold
|
|
||||||
*out = new(intstr.IntOrString)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.PatchPodTemplateMetadata != nil {
|
|
||||||
in, out := &in.PatchPodTemplateMetadata, &out.PatchPodTemplateMetadata
|
|
||||||
*out = new(PatchPodTemplateMetadata)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleasePlan.
|
|
||||||
func (in *ReleasePlan) DeepCopy() *ReleasePlan {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ReleasePlan)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Rollout) DeepCopyInto(out *Rollout) {
|
func (in *Rollout) DeepCopyInto(out *Rollout) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -571,122 +271,6 @@ func (in *RolloutCondition) DeepCopy() *RolloutCondition {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *RolloutHistory) DeepCopyInto(out *RolloutHistory) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistory.
|
|
||||||
func (in *RolloutHistory) DeepCopy() *RolloutHistory {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(RolloutHistory)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *RolloutHistory) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *RolloutHistoryList) DeepCopyInto(out *RolloutHistoryList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]RolloutHistory, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistoryList.
|
|
||||||
func (in *RolloutHistoryList) DeepCopy() *RolloutHistoryList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(RolloutHistoryList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *RolloutHistoryList) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *RolloutHistorySpec) DeepCopyInto(out *RolloutHistorySpec) {
|
|
||||||
*out = *in
|
|
||||||
in.Rollout.DeepCopyInto(&out.Rollout)
|
|
||||||
in.Workload.DeepCopyInto(&out.Workload)
|
|
||||||
in.Service.DeepCopyInto(&out.Service)
|
|
||||||
in.TrafficRouting.DeepCopyInto(&out.TrafficRouting)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistorySpec.
|
|
||||||
func (in *RolloutHistorySpec) DeepCopy() *RolloutHistorySpec {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(RolloutHistorySpec)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *RolloutHistoryStatus) DeepCopyInto(out *RolloutHistoryStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.CanarySteps != nil {
|
|
||||||
in, out := &in.CanarySteps, &out.CanarySteps
|
|
||||||
*out = make([]CanaryStepInfo, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutHistoryStatus.
|
|
||||||
func (in *RolloutHistoryStatus) DeepCopy() *RolloutHistoryStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(RolloutHistoryStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *RolloutInfo) DeepCopyInto(out *RolloutInfo) {
|
|
||||||
*out = *in
|
|
||||||
in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutInfo.
|
|
||||||
func (in *RolloutInfo) DeepCopy() *RolloutInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(RolloutInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *RolloutList) DeepCopyInto(out *RolloutList) {
|
func (in *RolloutList) DeepCopyInto(out *RolloutList) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -803,22 +387,6 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ServiceInfo) DeepCopyInto(out *ServiceInfo) {
|
|
||||||
*out = *in
|
|
||||||
in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceInfo.
|
|
||||||
func (in *ServiceInfo) DeepCopy() *ServiceInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ServiceInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *TrafficRouting) DeepCopyInto(out *TrafficRouting) {
|
func (in *TrafficRouting) DeepCopyInto(out *TrafficRouting) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -846,31 +414,6 @@ func (in *TrafficRouting) DeepCopyObject() runtime.Object {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *TrafficRoutingInfo) DeepCopyInto(out *TrafficRoutingInfo) {
|
|
||||||
*out = *in
|
|
||||||
if in.Ingress != nil {
|
|
||||||
in, out := &in.Ingress, &out.Ingress
|
|
||||||
*out = new(IngressInfo)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
if in.HTTPRoute != nil {
|
|
||||||
in, out := &in.HTTPRoute, &out.HTTPRoute
|
|
||||||
*out = new(HTTPRouteInfo)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficRoutingInfo.
|
|
||||||
func (in *TrafficRoutingInfo) DeepCopy() *TrafficRoutingInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(TrafficRoutingInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *TrafficRoutingList) DeepCopyInto(out *TrafficRoutingList) {
|
func (in *TrafficRoutingList) DeepCopyInto(out *TrafficRoutingList) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -1003,23 +546,6 @@ func (in *TrafficRoutingStrategy) DeepCopy() *TrafficRoutingStrategy {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *WorkloadInfo) DeepCopyInto(out *WorkloadInfo) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.NameAndSpecData.DeepCopyInto(&out.NameAndSpecData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadInfo.
|
|
||||||
func (in *WorkloadInfo) DeepCopy() *WorkloadInfo {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(WorkloadInfo)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *WorkloadRef) DeepCopyInto(out *WorkloadRef) {
|
func (in *WorkloadRef) DeepCopyInto(out *WorkloadRef) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
||||||
|
|
@ -1,159 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2023 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ReleasePlan fines the details of the release plan
|
|
||||||
type ReleasePlan struct {
|
|
||||||
// Batches is the details on each batch of the ReleasePlan.
|
|
||||||
//Users can specify their batch plan in this field, such as:
|
|
||||||
// batches:
|
|
||||||
// - canaryReplicas: 1 # batches 0
|
|
||||||
// - canaryReplicas: 2 # batches 1
|
|
||||||
// - canaryReplicas: 5 # batches 2
|
|
||||||
// Not that these canaryReplicas should be a non-decreasing sequence.
|
|
||||||
// +optional
|
|
||||||
Batches []ReleaseBatch `json:"batches"`
|
|
||||||
// All pods in the batches up to the batchPartition (included) will have
|
|
||||||
// the target resource specification while the rest still is the stable revision.
|
|
||||||
// This is designed for the operators to manually rollout.
|
|
||||||
// Default is nil, which means no partition and will release all batches.
|
|
||||||
// BatchPartition start from 0.
|
|
||||||
// +optional
|
|
||||||
BatchPartition *int32 `json:"batchPartition,omitempty"`
|
|
||||||
// RolloutID indicates an id for each rollout progress
|
|
||||||
RolloutID string `json:"rolloutID,omitempty"`
|
|
||||||
// FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods.
|
|
||||||
// Only when FailureThreshold are satisfied, Rollout can enter ready state.
|
|
||||||
// If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its
|
|
||||||
// FailureThreshold.
|
|
||||||
// Defaults to nil.
|
|
||||||
FailureThreshold *intstr.IntOrString `json:"failureThreshold,omitempty"`
|
|
||||||
// FinalizingPolicy define the behavior of controller when phase enter Finalizing
|
|
||||||
// Defaults to "Immediate"
|
|
||||||
FinalizingPolicy FinalizingPolicyType `json:"finalizingPolicy,omitempty"`
|
|
||||||
// PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata
|
|
||||||
// only support for canary deployment
|
|
||||||
// +optional
|
|
||||||
PatchPodTemplateMetadata *PatchPodTemplateMetadata `json:"patchPodTemplateMetadata,omitempty"`
|
|
||||||
// RollingStyle can be "Canary", "Partiton" or "BlueGreen"
|
|
||||||
RollingStyle RollingStyleType `json:"rollingStyle,omitempty"`
|
|
||||||
// EnableExtraWorkloadForCanary indicates whether to create extra workload for canary
|
|
||||||
// True corresponds to RollingStyle "Canary".
|
|
||||||
// False corresponds to RollingStyle "Partiton".
|
|
||||||
// Ignored in BlueGreen-style.
|
|
||||||
// This field is about to deprecate, use RollingStyle instead.
|
|
||||||
// If both of them are set, controller will only consider this
|
|
||||||
// filed when RollingStyle is empty
|
|
||||||
EnableExtraWorkloadForCanary bool `json:"enableExtraWorkloadForCanary"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FinalizingPolicyType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// WaitResumeFinalizingPolicyType will wait workload to be resumed, which means
|
|
||||||
// controller will be hold at Finalizing phase until all pods of workload is upgraded.
|
|
||||||
// WaitResumeFinalizingPolicyType only works in canary-style BatchRelease controller.
|
|
||||||
WaitResumeFinalizingPolicyType FinalizingPolicyType = "WaitResume"
|
|
||||||
// ImmediateFinalizingPolicyType will not to wait workload to be resumed.
|
|
||||||
ImmediateFinalizingPolicyType FinalizingPolicyType = "Immediate"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ReleaseBatch is used to describe how each batch release should be
|
|
||||||
type ReleaseBatch struct {
|
|
||||||
// CanaryReplicas is the number of upgraded pods that should have in this batch.
|
|
||||||
// it can be an absolute number (ex: 5) or a percentage of workload replicas.
|
|
||||||
// batches[i].canaryReplicas should less than or equal to batches[j].canaryReplicas if i < j.
|
|
||||||
CanaryReplicas intstr.IntOrString `json:"canaryReplicas"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseStatus defines the observed state of a release plan
|
|
||||||
type BatchReleaseStatus struct {
|
|
||||||
// Conditions represents the observed process state of each phase during executing the release plan.
|
|
||||||
Conditions []RolloutCondition `json:"conditions,omitempty"`
|
|
||||||
// CanaryStatus describes the state of the canary rollout.
|
|
||||||
CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"`
|
|
||||||
// StableRevision is the pod-template-hash of stable revision pod template.
|
|
||||||
StableRevision string `json:"stableRevision,omitempty"`
|
|
||||||
// UpdateRevision is the pod-template-hash of update revision pod template.
|
|
||||||
UpdateRevision string `json:"updateRevision,omitempty"`
|
|
||||||
// ObservedGeneration is the most recent generation observed for this BatchRelease.
|
|
||||||
// It corresponds to this BatchRelease's generation, which is updated on mutation
|
|
||||||
// by the API Server, and only if BatchRelease Spec was changed, its generation will increase 1.
|
|
||||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
|
||||||
// ObservedRolloutID is the most recent rollout-id observed for this BatchRelease.
|
|
||||||
// If RolloutID was changed, we will restart to roll out from batch 0,
|
|
||||||
// to ensure the batch-id and rollout-id labels of Pods are correct.
|
|
||||||
ObservedRolloutID string `json:"observedRolloutID,omitempty"`
|
|
||||||
// ObservedWorkloadReplicas is observed replicas of target referenced workload.
|
|
||||||
// This field is designed to deal with scaling event during rollout, if this field changed,
|
|
||||||
// it means that the workload is scaling during rollout.
|
|
||||||
ObservedWorkloadReplicas int32 `json:"observedWorkloadReplicas,omitempty"`
|
|
||||||
// Count of hash collisions for creating canary Deployment. The controller uses this
|
|
||||||
// field as a collision avoidance mechanism when it needs to create the name for the
|
|
||||||
// newest canary Deployment.
|
|
||||||
// +optional
|
|
||||||
CollisionCount *int32 `json:"collisionCount,omitempty"`
|
|
||||||
// ObservedReleasePlanHash is a hash code of observed itself spec.releasePlan.
|
|
||||||
ObservedReleasePlanHash string `json:"observedReleasePlanHash,omitempty"`
|
|
||||||
// Phase is the release plan phase, which indicates the current state of release
|
|
||||||
// plan state machine in BatchRelease controller.
|
|
||||||
Phase RolloutPhase `json:"phase,omitempty"`
|
|
||||||
// Message provides details on why the rollout is in its current phase
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BatchReleaseCanaryStatus struct {
|
|
||||||
// CurrentBatchState indicates the release state of the current batch.
|
|
||||||
CurrentBatchState BatchReleaseBatchStateType `json:"batchState,omitempty"`
|
|
||||||
// The current batch the rollout is working on/blocked, it starts from 0
|
|
||||||
CurrentBatch int32 `json:"currentBatch"`
|
|
||||||
// BatchReadyTime is the ready timestamp of the current batch or the last batch.
|
|
||||||
// This field is updated once a batch ready, and the batches[x].pausedSeconds
|
|
||||||
// relies on this field to calculate the real-time duration.
|
|
||||||
BatchReadyTime *metav1.Time `json:"batchReadyTime,omitempty"`
|
|
||||||
// UpdatedReplicas is the number of upgraded Pods.
|
|
||||||
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
|
|
||||||
// UpdatedReadyReplicas is the number upgraded Pods that have a Ready Condition.
|
|
||||||
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"`
|
|
||||||
// the number of pods that no need to rollback in rollback scene.
|
|
||||||
NoNeedUpdateReplicas *int32 `json:"noNeedUpdateReplicas,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BatchReleaseBatchStateType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// UpgradingBatchState indicates that current batch is at upgrading pod state
|
|
||||||
UpgradingBatchState BatchReleaseBatchStateType = "Upgrading"
|
|
||||||
// VerifyingBatchState indicates that current batch is at verifying whether it's ready state
|
|
||||||
VerifyingBatchState BatchReleaseBatchStateType = "Verifying"
|
|
||||||
// ReadyBatchState indicates that current batch is at batch ready state
|
|
||||||
ReadyBatchState BatchReleaseBatchStateType = "Ready"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// RolloutPhasePreparing indicates a rollout is preparing for next progress.
|
|
||||||
RolloutPhasePreparing RolloutPhase = "Preparing"
|
|
||||||
// RolloutPhaseFinalizing indicates a rollout is finalizing
|
|
||||||
RolloutPhaseFinalizing RolloutPhase = "Finalizing"
|
|
||||||
// RolloutPhaseCompleted indicates a rollout is completed/cancelled/terminated
|
|
||||||
RolloutPhaseCompleted RolloutPhase = "Completed"
|
|
||||||
)
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2023 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +k8s:openapi-gen=true
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
// +kubebuilder:subresource:status
|
|
||||||
// +kubebuilder:storageversion
|
|
||||||
// +kubebuilder:printcolumn:name="KIND",type=string,JSONPath=`.spec.targetReference.workloadRef.kind`
|
|
||||||
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
|
|
||||||
// +kubebuilder:printcolumn:name="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch`
|
|
||||||
// +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState`
|
|
||||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
|
||||||
|
|
||||||
type BatchRelease struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
|
||||||
|
|
||||||
Spec BatchReleaseSpec `json:"spec,omitempty"`
|
|
||||||
Status BatchReleaseStatus `json:"status,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseSpec defines how to describe an update between different compRevision
|
|
||||||
type BatchReleaseSpec struct {
|
|
||||||
// WorkloadRef contains enough information to let you identify a workload for Rollout
|
|
||||||
// Batch release of the bypass
|
|
||||||
WorkloadRef ObjectRef `json:"workloadRef,omitempty"`
|
|
||||||
// ReleasePlan is the details on how to rollout the resources
|
|
||||||
ReleasePlan ReleasePlan `json:"releasePlan"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BatchReleaseList contains a list of BatchRelease
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
type BatchReleaseList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ListMeta `json:"metadata,omitempty"`
|
|
||||||
Items []BatchRelease `json:"items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
SchemeBuilder.Register(&BatchRelease{}, &BatchReleaseList{})
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2023 The Kruise Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
func (*Rollout) Hub() {}
|
|
||||||
|
|
||||||
func (*BatchRelease) Hub() {}
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
//go:build !ignore_autogenerated
|
//go:build !ignore_autogenerated
|
||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2023 The Kruise Authors.
|
Copyright 2024 The Kruise Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,134 +27,6 @@ import (
|
||||||
apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchRelease) DeepCopyInto(out *BatchRelease) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchRelease.
|
|
||||||
func (in *BatchRelease) DeepCopy() *BatchRelease {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchRelease)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *BatchRelease) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseCanaryStatus) DeepCopyInto(out *BatchReleaseCanaryStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.BatchReadyTime != nil {
|
|
||||||
in, out := &in.BatchReadyTime, &out.BatchReadyTime
|
|
||||||
*out = (*in).DeepCopy()
|
|
||||||
}
|
|
||||||
if in.NoNeedUpdateReplicas != nil {
|
|
||||||
in, out := &in.NoNeedUpdateReplicas, &out.NoNeedUpdateReplicas
|
|
||||||
*out = new(int32)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseCanaryStatus.
|
|
||||||
func (in *BatchReleaseCanaryStatus) DeepCopy() *BatchReleaseCanaryStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseCanaryStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseList) DeepCopyInto(out *BatchReleaseList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]BatchRelease, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseList.
|
|
||||||
func (in *BatchReleaseList) DeepCopy() *BatchReleaseList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *BatchReleaseList) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) {
|
|
||||||
*out = *in
|
|
||||||
out.WorkloadRef = in.WorkloadRef
|
|
||||||
in.ReleasePlan.DeepCopyInto(&out.ReleasePlan)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseSpec.
|
|
||||||
func (in *BatchReleaseSpec) DeepCopy() *BatchReleaseSpec {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseSpec)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *BatchReleaseStatus) DeepCopyInto(out *BatchReleaseStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.Conditions != nil {
|
|
||||||
in, out := &in.Conditions, &out.Conditions
|
|
||||||
*out = make([]RolloutCondition, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
in.CanaryStatus.DeepCopyInto(&out.CanaryStatus)
|
|
||||||
if in.CollisionCount != nil {
|
|
||||||
in, out := &in.CollisionCount, &out.CollisionCount
|
|
||||||
*out = new(int32)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseStatus.
|
|
||||||
func (in *BatchReleaseStatus) DeepCopy() *BatchReleaseStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(BatchReleaseStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *BlueGreenStatus) DeepCopyInto(out *BlueGreenStatus) {
|
func (in *BlueGreenStatus) DeepCopyInto(out *BlueGreenStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
@ -451,57 +322,6 @@ func (in *PatchPodTemplateMetadata) DeepCopy() *PatchPodTemplateMetadata {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ReleaseBatch) DeepCopyInto(out *ReleaseBatch) {
|
|
||||||
*out = *in
|
|
||||||
out.CanaryReplicas = in.CanaryReplicas
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseBatch.
|
|
||||||
func (in *ReleaseBatch) DeepCopy() *ReleaseBatch {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ReleaseBatch)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ReleasePlan) DeepCopyInto(out *ReleasePlan) {
|
|
||||||
*out = *in
|
|
||||||
if in.Batches != nil {
|
|
||||||
in, out := &in.Batches, &out.Batches
|
|
||||||
*out = make([]ReleaseBatch, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
if in.BatchPartition != nil {
|
|
||||||
in, out := &in.BatchPartition, &out.BatchPartition
|
|
||||||
*out = new(int32)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.FailureThreshold != nil {
|
|
||||||
in, out := &in.FailureThreshold, &out.FailureThreshold
|
|
||||||
*out = new(intstr.IntOrString)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.PatchPodTemplateMetadata != nil {
|
|
||||||
in, out := &in.PatchPodTemplateMetadata, &out.PatchPodTemplateMetadata
|
|
||||||
*out = new(PatchPodTemplateMetadata)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleasePlan.
|
|
||||||
func (in *ReleasePlan) DeepCopy() *ReleasePlan {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ReleasePlan)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Rollout) DeepCopyInto(out *Rollout) {
|
func (in *Rollout) DeepCopyInto(out *Rollout) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -8,7 +8,8 @@ import (
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
rolloutsv1beta1 "github.com/openkruise/kruise-rollout-api/client/clientset/versioned"
|
rollouts "github.com/openkruise/kruise-rollout-api/client/clientset/versioned"
|
||||||
|
"github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
|
||||||
"github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
"github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
|
|
@ -18,7 +19,7 @@ import (
|
||||||
|
|
||||||
var _ = Describe("Rollout E2E Tests", func() {
|
var _ = Describe("Rollout E2E Tests", func() {
|
||||||
var (
|
var (
|
||||||
clientset *rolloutsv1beta1.Clientset
|
clientset *rollouts.Clientset
|
||||||
namespace = "default"
|
namespace = "default"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -33,10 +34,10 @@ var _ = Describe("Rollout E2E Tests", func() {
|
||||||
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
|
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
clientset, err = rolloutsv1beta1.NewForConfig(config)
|
clientset, err = rollouts.NewForConfig(config)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
Context("Rollout Operations", func() {
|
Context("v1beta1", func() {
|
||||||
var rolloutDemo *v1beta1.Rollout
|
var rolloutDemo *v1beta1.Rollout
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
|
|
@ -67,7 +68,7 @@ var _ = Describe("Rollout E2E Tests", func() {
|
||||||
|
|
||||||
It("should create a Rollout", func() {
|
It("should create a Rollout", func() {
|
||||||
rollout := rolloutDemo.DeepCopy()
|
rollout := rolloutDemo.DeepCopy()
|
||||||
rollout.Name = "test-create"
|
rollout.Name = "test-create-v1beta1"
|
||||||
result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(result.Name).To(Equal(rollout.Name))
|
Expect(result.Name).To(Equal(rollout.Name))
|
||||||
|
|
@ -75,7 +76,7 @@ var _ = Describe("Rollout E2E Tests", func() {
|
||||||
|
|
||||||
It("should update a Rollout", func() {
|
It("should update a Rollout", func() {
|
||||||
rollout := rolloutDemo.DeepCopy()
|
rollout := rolloutDemo.DeepCopy()
|
||||||
rollout.Name = "test-update"
|
rollout.Name = "test-update-v1beta1"
|
||||||
result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
|
@ -90,7 +91,7 @@ var _ = Describe("Rollout E2E Tests", func() {
|
||||||
|
|
||||||
It("should delete a Rollout", func() {
|
It("should delete a Rollout", func() {
|
||||||
rollout := rolloutDemo.DeepCopy()
|
rollout := rolloutDemo.DeepCopy()
|
||||||
rollout.Name = "test-delete"
|
rollout.Name = "test-delete-v1beta1"
|
||||||
result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
result, err := clientset.RolloutsV1beta1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
|
@ -101,6 +102,75 @@ var _ = Describe("Rollout E2E Tests", func() {
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Context("v1alpha1", func() {
|
||||||
|
var rolloutDemo *v1alpha1.Rollout
|
||||||
|
|
||||||
|
BeforeEach(func() {
|
||||||
|
firststep := intstr.FromString("10%")
|
||||||
|
|
||||||
|
rolloutDemo = &v1alpha1.Rollout{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "test-create",
|
||||||
|
Namespace: namespace,
|
||||||
|
},
|
||||||
|
Spec: v1alpha1.RolloutSpec{
|
||||||
|
ObjectRef: v1alpha1.ObjectRef{
|
||||||
|
WorkloadRef: &v1alpha1.WorkloadRef{
|
||||||
|
APIVersion: "apps/v1",
|
||||||
|
Kind: "Deployment",
|
||||||
|
Name: "demo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Strategy: v1alpha1.RolloutStrategy{
|
||||||
|
Canary: &v1alpha1.CanaryStrategy{
|
||||||
|
Steps: []v1alpha1.CanaryStep{
|
||||||
|
{
|
||||||
|
Replicas: &firststep,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
It("should create a Rollout", func() {
|
||||||
|
rollout := rolloutDemo.DeepCopy()
|
||||||
|
rollout.Name = "test-create-v1alpha1"
|
||||||
|
result, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(result.Name).To(Equal(rollout.Name))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("should update a Rollout", func() {
|
||||||
|
rollout := rolloutDemo.DeepCopy()
|
||||||
|
rollout.Name = "test-update-v1alpha1"
|
||||||
|
result, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
result.Spec.Strategy.Canary.Steps[0].Replicas = &intstr.IntOrString{
|
||||||
|
Type: intstr.String,
|
||||||
|
StrVal: "20%",
|
||||||
|
}
|
||||||
|
updatedResult, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Update(context.TODO(), result, metav1.UpdateOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(updatedResult.Spec.Strategy.Canary.Steps[0].Replicas.StrVal).To(Equal("20%"))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("should delete a Rollout", func() {
|
||||||
|
rollout := rolloutDemo.DeepCopy()
|
||||||
|
rollout.Name = "test-delete-v1alpha1"
|
||||||
|
result, err := clientset.RolloutsV1alpha1().Rollouts(namespace).Create(context.TODO(), rollout, metav1.CreateOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
err = clientset.RolloutsV1alpha1().Rollouts(namespace).Delete(context.TODO(), result.Name, metav1.DeleteOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
_, err = clientset.RolloutsV1alpha1().Rollouts(namespace).Get(context.TODO(), result.Name, metav1.GetOptions{})
|
||||||
|
Expect(err).To(HaveOccurred())
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
func TestRolloutE2E(t *testing.T) {
|
func TestRolloutE2E(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue