Skip to content

Commit

Permalink
update kruise rollout dependency to v0.5.0 (#90)
Browse files Browse the repository at this point in the history
Signed-off-by: 守辰 <[email protected]>
  • Loading branch information
furykerry authored Jan 27, 2024
1 parent 515401d commit ce1b663
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 195 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ require (
github.com/lithammer/dedent v1.1.0
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
github.com/openkruise/kruise-api v1.5.0
github.com/openkruise/kruise-rollout-api v0.4.1
github.com/openkruise/kruise-rollout-api v0.5.0
github.com/spf13/cobra v1.4.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.2
k8s.io/api v0.24.16
k8s.io/apimachinery v0.24.16
k8s.io/cli-runtime v0.24.0
k8s.io/client-go v0.24.0
k8s.io/client-go v0.24.1
k8s.io/component-base v0.24.0
k8s.io/klog/v2 v2.80.1
k8s.io/kubectl v0.24.0
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d
sigs.k8s.io/controller-runtime v0.11.0
sigs.k8s.io/controller-runtime v0.12.1
sigs.k8s.io/kustomize/api v0.11.4
sigs.k8s.io/kustomize/kyaml v0.13.6
)
Expand All @@ -29,25 +29,25 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.23 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/fvbommel/sortorder v1.0.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
Expand Down Expand Up @@ -89,7 +89,7 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
sigs.k8s.io/gateway-api v0.4.3 // indirect
sigs.k8s.io/gateway-api v0.5.1 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/kustomize/v4 v4.5.4 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
206 changes: 34 additions & 172 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package api
import (
kruiseappsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
kruiseappsv1beta1 "github.com/openkruise/kruise-api/apps/v1beta1"
kruiserolloutsv1apha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
kruiserolloutsv1apha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
apps "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/rollout/rollout_undo.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package rollout
import (
"fmt"

kruiserolloutsv1apha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
rolloutsapi "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
internalapi "github.com/openkruise/kruise-tools/pkg/api"
internalpolymorphichelpers "github.com/openkruise/kruise-tools/pkg/internal/polymorphichelpers"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -208,11 +208,11 @@ func (o *UndoOptions) RunUndo() error {
if obj == nil {
return fmt.Errorf("Rollout object not found")
}
ro, ok := obj.(*kruiserolloutsv1apha1.Rollout)
ro, ok := obj.(*rolloutsapi.Rollout)
if !ok {
return fmt.Errorf("unsupported version of Rollout")
}
workloadRef := ro.Spec.ObjectRef.WorkloadRef
workloadRef := ro.Spec.WorkloadRef
gv, err := schema.ParseGroupVersion(workloadRef.APIVersion)
if err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions pkg/internal/polymorphichelpers/objectapprover.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ import (
"errors"
"fmt"

kruiserolloutsv1apha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
rolloutsapi "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubectl/pkg/scheme"
)

// defaultObjectApprover currently only support Kruise Rollout.
func defaultObjectApprover(obj runtime.Object) ([]byte, error) {
switch obj := obj.(type) {
case *kruiserolloutsv1apha1.Rollout:
if obj.Status.CanaryStatus == nil || obj.Status.CanaryStatus.CurrentStepState != kruiserolloutsv1apha1.CanaryStepStatePaused {
case *rolloutsapi.Rollout:
if obj.Status.CanaryStatus == nil || obj.Status.CanaryStatus.CurrentStepState != rolloutsapi.CanaryStepStatePaused {
return nil, errors.New("does not allow to approve, because current canary state is not 'StepPaused'")
}
obj.Status.CanaryStatus.CurrentStepState = kruiserolloutsv1apha1.CanaryStepStateReady
return runtime.Encode(scheme.Codecs.LegacyCodec(kruiserolloutsv1apha1.GroupVersion), obj)
obj.Status.CanaryStatus.CurrentStepState = rolloutsapi.CanaryStepStateReady
return runtime.Encode(scheme.Codecs.LegacyCodec(rolloutsapi.GroupVersion), obj)

default:
return nil, fmt.Errorf("approving is not supported")
Expand Down
6 changes: 3 additions & 3 deletions pkg/internal/polymorphichelpers/objectpauser.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"

kruiseappsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
kruiserolloutsv1apha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
rolloutsapi "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
appsv1 "k8s.io/api/apps/v1"
appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1beta2 "k8s.io/api/apps/v1beta2"
Expand Down Expand Up @@ -69,12 +69,12 @@ func defaultObjectPauser(obj runtime.Object) ([]byte, error) {
obj.Spec.UpdateStrategy.Paused = true
return runtime.Encode(scheme.Codecs.LegacyCodec(kruiseappsv1alpha1.SchemeGroupVersion), obj)

case *kruiserolloutsv1apha1.Rollout:
case *rolloutsapi.Rollout:
if obj.Spec.Strategy.Paused {
return nil, errors.New("is already paused")
}
obj.Spec.Strategy.Paused = true
return runtime.Encode(scheme.Codecs.LegacyCodec(kruiserolloutsv1apha1.SchemeGroupVersion), obj)
return runtime.Encode(scheme.Codecs.LegacyCodec(rolloutsapi.SchemeGroupVersion), obj)

default:
return nil, fmt.Errorf("pausing is not supported")
Expand Down
6 changes: 3 additions & 3 deletions pkg/internal/polymorphichelpers/objectresumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"

kruiseappsv1alpha1 "github.com/openkruise/kruise-api/apps/v1alpha1"
kruiserolloutsv1apha1 "github.com/openkruise/kruise-rollout-api/rollouts/v1alpha1"
rolloutsapi "github.com/openkruise/kruise-rollout-api/rollouts/v1beta1"
appsv1 "k8s.io/api/apps/v1"
appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1beta2 "k8s.io/api/apps/v1beta2"
Expand Down Expand Up @@ -69,12 +69,12 @@ func defaultObjectResumer(obj runtime.Object) ([]byte, error) {
obj.Spec.UpdateStrategy.Paused = false
return runtime.Encode(scheme.Codecs.LegacyCodec(kruiseappsv1alpha1.SchemeGroupVersion), obj)

case *kruiserolloutsv1apha1.Rollout:
case *rolloutsapi.Rollout:
if !obj.Spec.Strategy.Paused {
return nil, errors.New("is not paused")
}
obj.Spec.Strategy.Paused = false
return runtime.Encode(scheme.Codecs.LegacyCodec(kruiserolloutsv1apha1.SchemeGroupVersion), obj)
return runtime.Encode(scheme.Codecs.LegacyCodec(rolloutsapi.SchemeGroupVersion), obj)

default:
return nil, fmt.Errorf("resuming is not supported")
Expand Down

0 comments on commit ce1b663

Please sign in to comment.