diff --git a/go.mod b/go.mod index 38ab216585..8b6d04722c 100644 --- a/go.mod +++ b/go.mod @@ -43,9 +43,10 @@ require ( k8s.io/klog/v2 v2.130.1 k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f k8s.io/kube-state-metrics/v2 v2.12.0 + k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 kmodules.xyz/apiversion v0.2.0 kmodules.xyz/authorizer v0.29.1 - kmodules.xyz/client-go v0.30.34 + kmodules.xyz/client-go v0.30.37 kmodules.xyz/custom-resources v0.30.0 kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/monitoring-agent-api v0.30.2 @@ -57,6 +58,7 @@ require ( kubeops.dev/falco-ui-server v0.0.4 kubeops.dev/scanner v0.0.18 kubepack.dev/lib-helm v0.29.13 + open-cluster-management.io/api v0.15.0 sigs.k8s.io/cli-utils v0.37.2 sigs.k8s.io/controller-runtime v0.18.4 sigs.k8s.io/yaml v1.4.0 @@ -240,7 +242,6 @@ require ( k8s.io/cli-runtime v0.30.1 // indirect k8s.io/component-helpers v0.29.0 // indirect k8s.io/kms v0.30.3 // indirect - k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect kubevault.dev/apimachinery v0.18.3 // indirect moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect diff --git a/go.sum b/go.sum index 89bd958af9..69795436fc 100644 --- a/go.sum +++ b/go.sum @@ -922,8 +922,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= kmodules.xyz/authorizer v0.29.1 h1:uByGGoryKbZcfiEAhjcK/Y345I9mygNQP7DVpkMbNQQ= kmodules.xyz/authorizer v0.29.1/go.mod h1:kZRhclL8twzyt2bQuJQJbpYww2sc+qFr8I5PPoq/sWY= -kmodules.xyz/client-go v0.30.34 h1:AsmdB6/6jK1MxD+4VgibHA1vTbW1U56I+lPAhO2xf+0= -kmodules.xyz/client-go v0.30.34/go.mod h1:CAu+JlA8RVGtj6LQHu0Q1w2mnFUajuti49c7T1AvGdM= +kmodules.xyz/client-go v0.30.37 h1:hj4BMsNDgRVc2aDPB6Y3x5iCylXTZDZeQPJp/oA6lxs= +kmodules.xyz/client-go v0.30.37/go.mod h1:CAu+JlA8RVGtj6LQHu0Q1w2mnFUajuti49c7T1AvGdM= kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs= kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE= kmodules.xyz/custom-resources v0.30.0 h1:vR3CbseHMLwR4GvtcJJuRuwIV8voKqFqNii27rMcm1o= @@ -952,6 +952,8 @@ kubevault.dev/apimachinery v0.18.3 h1:Bq180AGBYnRXXNWbJ6Zg82+8/3M1Y8WYPez32uTry8 kubevault.dev/apimachinery v0.18.3/go.mod h1:b9uUVFx3a3ThDziL2J2O4xQL+muY1/pGavAhDdJC99E= moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 h1:NykkTlRB+X40z86cLHdEmuoTxhNKhQebLT379b1EumA= moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7/go.mod h1:RW4hyBjTWSYDOxapodpNEtX0g5Eb16sxklBqmd2RHcE= +open-cluster-management.io/api v0.15.0 h1:lRee1KOlGHZb2scTA7ff9E9Fxt2hJc7jpkHnaCbvkOU= +open-cluster-management.io/api v0.15.0/go.mod h1:9erZEWEn4bEqh0nIX2wA7f/s3KCuFycQdBrPrRzi0QM= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 h1:/U5vjBbQn3RChhv7P11uhYvCSm5G2GaIi5AIGBS6r4c= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0/go.mod h1:z7+wmGM2dfIiLRfrC6jb5kV2Mq/sK1ZP303cxzkV5Y4= diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 37bdf1c0b2..ccca091fc2 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -33,6 +33,7 @@ import ( policyinstall "kubeops.dev/ui-server/apis/policy/install" policyapi "kubeops.dev/ui-server/apis/policy/v1alpha1" clustermetacontroller "kubeops.dev/ui-server/pkg/controllers/clustermetadata" + clusterclaimcontroller "kubeops.dev/ui-server/pkg/controllers/feature" projectquotacontroller "kubeops.dev/ui-server/pkg/controllers/projectquota" "kubeops.dev/ui-server/pkg/graph" "kubeops.dev/ui-server/pkg/metricshandler" @@ -89,7 +90,6 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" "k8s.io/klog/v2" - "k8s.io/klog/v2/klogr" "kmodules.xyz/authorizer" kmapi "kmodules.xyz/client-go/api/v1" cu "kmodules.xyz/client-go/client" @@ -107,6 +107,7 @@ import ( uiinstall "kmodules.xyz/resource-metadata/apis/ui/install" uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" identitylib "kmodules.xyz/resource-metadata/pkg/identity" + clusterv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -140,6 +141,7 @@ func init() { utilruntime.Must(fluxsrc.AddToScheme(Scheme)) utilruntime.Must(monitoringv1.AddToScheme(Scheme)) utilruntime.Must(falco.AddToScheme(Scheme)) + utilruntime.Must(clusterv1alpha1.Install(Scheme)) // we need to add the options to empty v1 // TODO fix the server code to avoid this @@ -210,8 +212,7 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { return nil, err } - // ctrl.SetLogger(...) - log.SetLogger(klogr.New()) // nolint:staticcheck + log.SetLogger(klog.NewKlogr()) setupLog := log.Log.WithName("setup") cfg := c.ExtraConfig.ClientConfig @@ -298,6 +299,14 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) { } } + if clustermeta.DetectClusterManager(mgr.GetClient()).ManagedByOCMSpoke() { + err = clusterclaimcontroller.NewClusterClaimReconciler(mgr.GetClient()).SetupWithManager(mgr) + if err != nil { + klog.Error(err, "unable to create controller", "controller", "ClusterClaim") + os.Exit(1) + } + } + s := &UIServer{ GenericAPIServer: genericServer, Manager: mgr, diff --git a/pkg/controllers/feature/clusterclaim_reconciler.go b/pkg/controllers/feature/clusterclaim_reconciler.go new file mode 100644 index 0000000000..c85a8b6eeb --- /dev/null +++ b/pkg/controllers/feature/clusterclaim_reconciler.go @@ -0,0 +1,107 @@ +/* +Copyright AppsCode Inc. and Contributors. + +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 feature + +import ( + "context" + "fmt" + "sort" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" + kmapi "kmodules.xyz/client-go/api/v1" + cu "kmodules.xyz/client-go/client" + uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" + clusterv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/yaml" +) + +type ClusterClaimReconciler struct { + kc client.Client +} + +var _ reconcile.Reconciler = &ClusterClaimReconciler{} + +func NewClusterClaimReconciler(kc client.Client) *ClusterClaimReconciler { + return &ClusterClaimReconciler{ + kc: kc, + } +} + +func (r *ClusterClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + var err error + var featureList uiapi.FeatureList + if err = r.kc.List(ctx, &featureList); err != nil { + return ctrl.Result{}, err + } + + var enabledFeatures, extFeatures, disabledFeatures []string + for _, feature := range featureList.Items { + if feature.Status.Enabled == nil { + return ctrl.Result{}, fmt.Errorf("feature %s is not reconciled yet", feature.Name) + } + if ptr.Deref(feature.Status.Enabled, false) { + enabledFeatures = append(enabledFeatures, feature.Name) + if !ptr.Deref(feature.Status.Managed, false) { + extFeatures = append(extFeatures, feature.Name) + } + } + + if feature.Spec.Disabled { + disabledFeatures = append(disabledFeatures, feature.Name) + } + } + + sort.Strings(enabledFeatures) + sort.Strings(extFeatures) + sort.Strings(disabledFeatures) + + data, err := yaml.Marshal(kmapi.ClusterClaimFeatures{ + EnabledFeatures: enabledFeatures, + ExternallyManagedFeatures: extFeatures, + DisabledFeatures: disabledFeatures, + }) + if err != nil { + return ctrl.Result{}, err + } + + obj := &clusterv1alpha1.ClusterClaim{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: kmapi.ClusterClaimKeyFeatures, + }, + } + _, err = cu.CreateOrPatch(context.TODO(), r.kc, obj, func(o client.Object, createOp bool) client.Object { + in := o.(*clusterv1alpha1.ClusterClaim) + in.Spec.Value = string(data) + return in + }) + if err != nil { + return ctrl.Result{}, err + } + return ctrl.Result{}, nil +} + +// SetupWithManager sets up the controller with the Manager. +func (r *ClusterClaimReconciler) SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewControllerManagedBy(mgr). + For(&uiapi.Feature{}). + Complete(r) +} diff --git a/pkg/controllers/feature/feature_controller.go b/pkg/controllers/feature/feature_controller.go index 49c8bc50ba..f6b258bcb6 100644 --- a/pkg/controllers/feature/feature_controller.go +++ b/pkg/controllers/feature/feature_controller.go @@ -32,6 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" cu "kmodules.xyz/client-go/client" meta_util "kmodules.xyz/client-go/meta" uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1" @@ -102,6 +103,12 @@ func (r *FeatureReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct return ctrl.Result{}, err } + if fr.feature.Spec.FeatureExclusionGroup != "" { + if err = fr.handleFeatureExclusionGroups(); err != nil { + return ctrl.Result{}, err + } + } + err = fr.updateFeatureSetEntry(ctx) if err != nil && !apierrors.IsNotFound(err) { return ctrl.Result{}, err @@ -553,3 +560,45 @@ func (r *FeatureReconciler) findFeatureForHelmRelease(ctx context.Context, relea }, } } + +func (r *frReconciler) handleFeatureExclusionGroups() error { + var err error + exclusionGroupName := r.feature.Spec.FeatureExclusionGroup + + var fs uiapi.FeatureSet + err = r.client.Get(context.Background(), types.NamespacedName{Name: r.feature.Spec.FeatureSet}, &fs) + if err != nil { + return err + } + + var exclusionGrp bool + for _, f := range fs.Status.Features { + var otherFeature uiapi.Feature + err = r.client.Get(context.Background(), types.NamespacedName{Name: f.Name}, &otherFeature) + if err != nil { + return err + } + + if otherFeature.Spec.FeatureExclusionGroup != exclusionGroupName || otherFeature.Name == r.feature.Name { + continue + } + + // Mark the exclusion group as active if this feature is enabled + if ptr.Deref(otherFeature.Status.Enabled, false) { + exclusionGrp = true + } + } + + // If feature is in an exclusion group and another feature in that group is enabled, + // disable this feature if it’s not already enabled + if exclusionGrp { + r.feature.Spec.Disabled = !ptr.Deref(r.feature.Status.Enabled, false) + } else { + r.feature.Spec.Disabled = false + } + + if err := r.client.Update(context.Background(), r.feature); err != nil { + return err + } + return nil +} diff --git a/vendor/k8s.io/klog/v2/klogr/README.md b/vendor/k8s.io/klog/v2/klogr/README.md deleted file mode 100644 index c43fa81b13..0000000000 --- a/vendor/k8s.io/klog/v2/klogr/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Minimal Go logging using klog - -This package implements the [logr interface](https://github.com/go-logr/logr) -in terms of Kubernetes' [klog](https://github.com/kubernetes/klog). This -provides a relatively minimalist API to logging in Go, backed by a well-proven -implementation. - -Because klogr was implemented before klog itself added supported for -structured logging, the default in klogr is to serialize key/value -pairs with JSON and log the result as text messages via klog. This -does not work well when klog itself forwards output to a structured -logger. - -Therefore the recommended approach is to let klogr pass all log -messages through to klog and deal with structured logging there. Just -beware that the output of klog without a structured logger is meant to -be human-readable, in contrast to the JSON-based traditional format. - -This is a BETA grade implementation. diff --git a/vendor/k8s.io/klog/v2/klogr/klogr.go b/vendor/k8s.io/klog/v2/klogr/klogr.go deleted file mode 100644 index a154960cd3..0000000000 --- a/vendor/k8s.io/klog/v2/klogr/klogr.go +++ /dev/null @@ -1,208 +0,0 @@ -// Package klogr implements github.com/go-logr/logr.Logger in terms of -// k8s.io/klog. -package klogr - -import ( - "bytes" - "encoding/json" - "fmt" - "sort" - "strings" - - "github.com/go-logr/logr" - - "k8s.io/klog/v2" - "k8s.io/klog/v2/internal/serialize" -) - -const ( - // nameKey is used to log the `WithName` values as an additional attribute. - nameKey = "logger" -) - -// Option is a functional option that reconfigures the logger created with New. -type Option func(*klogger) - -// Format defines how log output is produced. -type Format string - -const ( - // FormatSerialize tells klogr to turn key/value pairs into text itself - // before invoking klog. Key/value pairs are sorted by key. - FormatSerialize Format = "Serialize" - - // FormatKlog tells klogr to pass all text messages and key/value pairs - // directly to klog. Klog itself then serializes in a human-readable - // format and optionally passes on to a structure logging backend. - FormatKlog Format = "Klog" -) - -// WithFormat selects the output format. -func WithFormat(format Format) Option { - return func(l *klogger) { - l.format = format - } -} - -// New returns a logr.Logger which serializes output itself -// and writes it via klog. -// -// Deprecated: this uses a custom, out-dated output format. Use textlogger.NewLogger instead. -func New() logr.Logger { - return NewWithOptions(WithFormat(FormatSerialize)) -} - -// NewWithOptions returns a logr.Logger which serializes as determined -// by the WithFormat option and writes via klog. The default is -// FormatKlog. -// -// Deprecated: FormatSerialize is out-dated. For FormatKlog, use textlogger.NewLogger instead. -func NewWithOptions(options ...Option) logr.Logger { - l := klogger{ - level: 0, - values: nil, - format: FormatKlog, - } - for _, option := range options { - option(&l) - } - return logr.New(&l) -} - -type klogger struct { - level int - callDepth int - - // hasPrefix is true if the first entry in values is the special - // nameKey key/value. Such an entry gets added and later updated in - // WithName. - hasPrefix bool - - values []interface{} - format Format -} - -func (l *klogger) Init(info logr.RuntimeInfo) { - l.callDepth += info.CallDepth -} - -func flatten(kvList ...interface{}) string { - keys := make([]string, 0, len(kvList)) - vals := make(map[string]interface{}, len(kvList)) - for i := 0; i < len(kvList); i += 2 { - k, ok := kvList[i].(string) - if !ok { - panic(fmt.Sprintf("key is not a string: %s", pretty(kvList[i]))) - } - var v interface{} - if i+1 < len(kvList) { - v = kvList[i+1] - } - // Only print each key once... - if _, seen := vals[k]; !seen { - keys = append(keys, k) - } - // ... with the latest value. - vals[k] = v - } - sort.Strings(keys) - buf := bytes.Buffer{} - for i, k := range keys { - v := vals[k] - if i > 0 { - buf.WriteRune(' ') - } - buf.WriteString(pretty(k)) - buf.WriteString("=") - buf.WriteString(pretty(v)) - } - return buf.String() -} - -func pretty(value interface{}) string { - if err, ok := value.(error); ok { - if _, ok := value.(json.Marshaler); !ok { - value = err.Error() - } - } - buffer := &bytes.Buffer{} - encoder := json.NewEncoder(buffer) - encoder.SetEscapeHTML(false) - if err := encoder.Encode(value); err != nil { - return fmt.Sprintf("<>", err) - } - return strings.TrimSpace(buffer.String()) -} - -func (l *klogger) Info(level int, msg string, kvList ...interface{}) { - switch l.format { - case FormatSerialize: - msgStr := flatten("msg", msg) - merged := serialize.MergeKVs(l.values, kvList) - kvStr := flatten(merged...) - klog.VDepth(l.callDepth+1, klog.Level(level)).InfoDepth(l.callDepth+1, msgStr, " ", kvStr) - case FormatKlog: - merged := serialize.MergeKVs(l.values, kvList) - klog.VDepth(l.callDepth+1, klog.Level(level)).InfoSDepth(l.callDepth+1, msg, merged...) - } -} - -func (l *klogger) Enabled(level int) bool { - return klog.VDepth(l.callDepth+1, klog.Level(level)).Enabled() -} - -func (l *klogger) Error(err error, msg string, kvList ...interface{}) { - msgStr := flatten("msg", msg) - var loggableErr interface{} - if err != nil { - loggableErr = serialize.ErrorToString(err) - } - switch l.format { - case FormatSerialize: - errStr := flatten("error", loggableErr) - merged := serialize.MergeKVs(l.values, kvList) - kvStr := flatten(merged...) - klog.ErrorDepth(l.callDepth+1, msgStr, " ", errStr, " ", kvStr) - case FormatKlog: - merged := serialize.MergeKVs(l.values, kvList) - klog.ErrorSDepth(l.callDepth+1, err, msg, merged...) - } -} - -// WithName returns a new logr.Logger with the specified name appended. klogr -// uses '.' characters to separate name elements. Callers should not pass '.' -// in the provided name string, but this library does not actually enforce that. -func (l klogger) WithName(name string) logr.LogSink { - if l.hasPrefix { - // Copy slice and modify value. No length checks and type - // assertions are needed because hasPrefix is only true if the - // first two elements exist and are key/value strings. - v := make([]interface{}, 0, len(l.values)) - v = append(v, l.values...) - prefix, _ := v[1].(string) - prefix = prefix + "." + name - v[1] = prefix - l.values = v - } else { - // Preprend new key/value pair. - v := make([]interface{}, 0, 2+len(l.values)) - v = append(v, nameKey, name) - v = append(v, l.values...) - l.values = v - l.hasPrefix = true - } - return &l -} - -func (l klogger) WithValues(kvList ...interface{}) logr.LogSink { - l.values = serialize.WithValues(l.values, kvList) - return &l -} - -func (l klogger) WithCallDepth(depth int) logr.LogSink { - l.callDepth += depth - return &l -} - -var _ logr.LogSink = &klogger{} -var _ logr.CallDepthLogSink = &klogger{} diff --git a/vendor/kmodules.xyz/client-go/api/v1/cluster.go b/vendor/kmodules.xyz/client-go/api/v1/cluster.go index e979e964b3..079bceb34d 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/cluster.go +++ b/vendor/kmodules.xyz/client-go/api/v1/cluster.go @@ -51,6 +51,10 @@ const ( AceOrgIDKey string = "ace.appscode.com/org-id" ClientOrgKey string = "ace.appscode.com/client-org" ClientKeyPrefix string = "client.ace.appscode.com/" + + ClusterClaimKeyID string = "id.k8s.io" + ClusterClaimKeyInfo string = "cluster.ace.info" + ClusterClaimKeyFeatures string = "features.ace.info" ) type ClusterMetadata struct { @@ -187,3 +191,13 @@ const ( CAPIProviderCAPZ CAPIProvider = "capz" CAPIProviderCAPH CAPIProvider = "caph" ) + +type ClusterClaimInfo struct { + ClusterMetadata ClusterInfo `json:"clusterMetadata"` +} + +type ClusterClaimFeatures struct { + EnabledFeatures []string `json:"enabledFeatures,omitempty"` + ExternallyManagedFeatures []string `json:"externallyManagedFeatures,omitempty"` + DisabledFeatures []string `json:"disabledFeatures,omitempty"` +} diff --git a/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go b/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go index f44550fbdc..dcf3b711cb 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go +++ b/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go @@ -119,6 +119,54 @@ func (in *CertificateSpec) DeepCopy() *CertificateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterClaimFeatures) DeepCopyInto(out *ClusterClaimFeatures) { + *out = *in + if in.EnabledFeatures != nil { + in, out := &in.EnabledFeatures, &out.EnabledFeatures + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExternallyManagedFeatures != nil { + in, out := &in.ExternallyManagedFeatures, &out.ExternallyManagedFeatures + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.DisabledFeatures != nil { + in, out := &in.DisabledFeatures, &out.DisabledFeatures + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimFeatures. +func (in *ClusterClaimFeatures) DeepCopy() *ClusterClaimFeatures { + if in == nil { + return nil + } + out := new(ClusterClaimFeatures) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterClaimInfo) DeepCopyInto(out *ClusterClaimInfo) { + *out = *in + in.ClusterMetadata.DeepCopyInto(&out.ClusterMetadata) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimInfo. +func (in *ClusterClaimInfo) DeepCopy() *ClusterClaimInfo { + if in == nil { + return nil + } + out := new(ClusterClaimInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterInfo) DeepCopyInto(out *ClusterInfo) { *out = *in diff --git a/vendor/modules.txt b/vendor/modules.txt index caeb39c318..7ab162c2cc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1949,7 +1949,6 @@ k8s.io/klog/v2/internal/dbg k8s.io/klog/v2/internal/serialize k8s.io/klog/v2/internal/severity k8s.io/klog/v2/internal/sloghandler -k8s.io/klog/v2/klogr # k8s.io/kms v0.30.3 ## explicit; go 1.22.0 k8s.io/kms/apis/v1beta1 @@ -2006,7 +2005,7 @@ kmodules.xyz/authorizer/apiserver kmodules.xyz/authorizer/rbac kmodules.xyz/authorizer/rbac/helpers kmodules.xyz/authorizer/rbac/validation -# kmodules.xyz/client-go v0.30.34 +# kmodules.xyz/client-go v0.30.37 ## explicit; go 1.22.0 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1 @@ -2112,6 +2111,9 @@ kubevault.dev/apimachinery/apis # moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 ## explicit; go 1.13 moul.io/http2curl/v2 +# open-cluster-management.io/api v0.15.0 +## explicit; go 1.22.0 +open-cluster-management.io/api/cluster/v1alpha1 # sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 ## explicit; go 1.20 sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client diff --git a/vendor/open-cluster-management.io/api/LICENSE b/vendor/open-cluster-management.io/api/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/open-cluster-management.io/api/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml new file mode 100644 index 0000000000..4359dcadb8 --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml @@ -0,0 +1,63 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: clusterclaims.cluster.open-cluster-management.io +spec: + group: cluster.open-cluster-management.io + names: + kind: ClusterClaim + listKind: ClusterClaimList + plural: clusterclaims + singular: clusterclaim + preserveUnknownFields: false + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + ClusterClaim represents cluster information that a managed cluster claims + ClusterClaims with well known names include, + 1. id.k8s.io, it contains a unique identifier for the cluster. + 2. clusterset.k8s.io, it contains an identifier that relates the cluster + to the ClusterSet in which it belongs. + + + ClusterClaims created on a managed cluster will be collected and saved into + the status of the corresponding ManagedCluster on hub. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Spec defines the attributes of the ClusterClaim. + properties: + value: + description: Value is a claim-dependent string + maxLength: 1024 + minLength: 1 + type: string + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_05_clusters.open-cluster-management.io_addonplacementscores.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_05_clusters.open-cluster-management.io_addonplacementscores.crd.yaml new file mode 100644 index 0000000000..24d2d6c01d --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_05_clusters.open-cluster-management.io_addonplacementscores.crd.yaml @@ -0,0 +1,159 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: addonplacementscores.cluster.open-cluster-management.io +spec: + group: cluster.open-cluster-management.io + names: + kind: AddOnPlacementScore + listKind: AddOnPlacementScoreList + plural: addonplacementscores + singular: addonplacementscore + preserveUnknownFields: false + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + AddOnPlacementScore represents a bundle of scores of one managed cluster, which could be used by placement. + AddOnPlacementScore is a namespace scoped resource. The namespace of the resource is the cluster namespace. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + status: + description: Status represents the status of the AddOnPlacementScore. + properties: + conditions: + description: Conditions contain the different condition statuses for + this AddOnPlacementScore. + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + scores: + description: Scores contain a list of score name and value of this + managed cluster. + items: + description: AddOnPlacementScoreItem represents the score name and + value. + properties: + name: + description: Name is the name of the score + type: string + value: + description: Value is the value of the score. The score range + is from -100 to 100. + format: int32 + maximum: 100 + minimum: -100 + type: integer + required: + - name + - value + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + validUntil: + description: |- + ValidUntil defines the valid time of the scores. + After this time, the scores are considered to be invalid by placement. nil means never expire. + The controller owning this resource should keep the scores up-to-date. + format: date-time + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go new file mode 100644 index 0000000000..93f37581ca --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go @@ -0,0 +1,7 @@ +// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +k8s:openapi-gen=true + +// +kubebuilder:validation:Optional +// +groupName=cluster.open-cluster-management.io +package v1alpha1 diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/register.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/register.go new file mode 100644 index 0000000000..36b73ce2ff --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/register.go @@ -0,0 +1,40 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + GroupName = "cluster.open-cluster-management.io" + GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // Install is a function which adds this version to a scheme + Install = schemeBuilder.AddToScheme + + // SchemeGroupVersion generated code relies on this name + // Deprecated + SchemeGroupVersion = GroupVersion + // AddToScheme exists solely to keep the old generators creating valid code + // DEPRECATED + AddToScheme = schemeBuilder.AddToScheme +) + +// Resource generated code relies on this being here, but it logically belongs to the group +// DEPRECATED +func Resource(resource string) schema.GroupResource { + return schema.GroupResource{Group: GroupName, Resource: resource} +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, + &AddOnPlacementScore{}, + &AddOnPlacementScoreList{}, + &ClusterClaim{}, + &ClusterClaimList{}, + ) + metav1.AddToGroupVersion(scheme, GroupVersion) + return nil +} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go new file mode 100644 index 0000000000..6cb57bc3b4 --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go @@ -0,0 +1,61 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope="Cluster" + +// ClusterClaim represents cluster information that a managed cluster claims +// ClusterClaims with well known names include, +// 1. id.k8s.io, it contains a unique identifier for the cluster. +// 2. clusterset.k8s.io, it contains an identifier that relates the cluster +// to the ClusterSet in which it belongs. +// +// ClusterClaims created on a managed cluster will be collected and saved into +// the status of the corresponding ManagedCluster on hub. +type ClusterClaim struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the attributes of the ClusterClaim. + Spec ClusterClaimSpec `json:"spec,omitempty"` +} + +type ClusterClaimSpec struct { + // Value is a claim-dependent string + // +kubebuilder:validation:MaxLength=1024 + // +kubebuilder:validation:MinLength=1 + Value string `json:"value,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterClaimList is a collection of ClusterClaim. +type ClusterClaimList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a list of ClusterClaim. + Items []ClusterClaim `json:"items"` +} + +// ReservedClusterClaimNames includes a list of reserved names for ClusterNames. +// When exposing ClusterClaims created on managed cluster, the registration agent gives high +// priority to the reserved ClusterClaims. +var ReservedClusterClaimNames = [...]string{ + // unique identifier for the cluster + "id.k8s.io", + // kubernetes version + "kubeversion.open-cluster-management.io", + // platform the managed cluster is running on, like AWS, GCE, and Equinix Metal + "platform.open-cluster-management.io", + // product name, like OpenShift, Anthos, EKS and GKE + "product.open-cluster-management.io", +} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go new file mode 100644 index 0000000000..1ce73580bd --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go @@ -0,0 +1,75 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope="Namespaced" +// +kubebuilder:subresource:status + +// AddOnPlacementScore represents a bundle of scores of one managed cluster, which could be used by placement. +// AddOnPlacementScore is a namespace scoped resource. The namespace of the resource is the cluster namespace. +type AddOnPlacementScore struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Status represents the status of the AddOnPlacementScore. + // +optional + Status AddOnPlacementScoreStatus `json:"status,omitempty"` +} + +// AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore. +type AddOnPlacementScoreStatus struct { + // Conditions contain the different condition statuses for this AddOnPlacementScore. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // Scores contain a list of score name and value of this managed cluster. + // +listType=map + // +listMapKey=name + // +optional + Scores []AddOnPlacementScoreItem `json:"scores,omitempty"` + + // ValidUntil defines the valid time of the scores. + // After this time, the scores are considered to be invalid by placement. nil means never expire. + // The controller owning this resource should keep the scores up-to-date. + // +kubebuilder:validation:Type=string + // +kubebuilder:validation:Format=date-time + // +optional + ValidUntil *metav1.Time `json:"validUntil"` +} + +// AddOnPlacementScoreItem represents the score name and value. +type AddOnPlacementScoreItem struct { + // Name is the name of the score + // +kubebuilder:validation:Required + // +required + Name string `json:"name"` + + // Value is the value of the score. The score range is from -100 to 100. + // +kubebuilder:validation:Required + // +kubebuilder:validation:Minimum:=-100 + // +kubebuilder:validation:Maximum:=100 + // +required + Value int32 `json:"value"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AddOnPlacementScoreList is a collection of AddOnPlacementScore. +type AddOnPlacementScoreList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + // Items is a list of AddOnPlacementScore + Items []AddOnPlacementScore `json:"items"` +} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go new file mode 100644 index 0000000000..2c863bb50e --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go @@ -0,0 +1,148 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// +k8s:deepcopy-gen=true + +// RolloutStrategy API used by workload applier APIs to define how the workload will be applied to +// the selected clusters by the Placement and DecisionStrategy. + +type RolloutType string + +const ( + //All means apply the workload to all clusters in the decision groups at once. + All RolloutType = "All" + //Progressive means apply the workload to the selected clusters progressively per cluster. + Progressive RolloutType = "Progressive" + //ProgressivePerGroup means apply the workload to the selected clusters progressively per group. + ProgressivePerGroup RolloutType = "ProgressivePerGroup" +) + +// Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy. +type RolloutStrategy struct { + // Rollout strategy Types are All, Progressive and ProgressivePerGroup + // 1) All means apply the workload to all clusters in the decision groups at once. + // 2) Progressive means apply the workload to the selected clusters progressively per cluster. The + // workload will not be applied to the next cluster unless one of the current applied clusters + // reach the successful state and haven't breached the MaxFailures configuration. + // 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per + // group. The workload will not be applied to the next decisionGroup unless all clusters in the + // current group reach the successful state and haven't breached the MaxFailures configuration. + + // +kubebuilder:validation:Enum=All;Progressive;ProgressivePerGroup + // +kubebuilder:default:=All + // +optional + Type RolloutType `json:"type,omitempty"` + + // All defines required fields for RolloutStrategy type All + // +optional + All *RolloutAll `json:"all,omitempty"` + + // Progressive defines required fields for RolloutStrategy type Progressive + // +optional + Progressive *RolloutProgressive `json:"progressive,omitempty"` + + // ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup + // +optional + ProgressivePerGroup *RolloutProgressivePerGroup `json:"progressivePerGroup,omitempty"` +} + +// Timeout to consider while applying the workload. +type RolloutConfig struct { + // MinSuccessTime is a "soak" time. In other words, the minimum amount of time the workload + // applier controller will wait from the start of each rollout before proceeding (assuming a + // successful state has been reached and MaxFailures wasn't breached). + // MinSuccessTime is only considered for rollout types Progressive and ProgressivePerGroup. + // The default value is 0 meaning the workload applier proceeds immediately after a successful + // state is reached. + // MinSuccessTime must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + // +kubebuilder:default:="0" + // +optional + MinSuccessTime metav1.Duration `json:"minSuccessTime,omitempty"` + // ProgressDeadline defines how long workload applier controller will wait for the workload to + // reach a successful state in the cluster. + // If the workload does not reach a successful state after ProgressDeadline, will stop waiting + // and workload will be treated as "timeout" and be counted into MaxFailures. Once the MaxFailures + // is breached, the rollout will stop. + // ProgressDeadline default value is "None", meaning the workload applier will wait for a + // successful state indefinitely. + // ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + // +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" + // +kubebuilder:default:="None" + // +optional + ProgressDeadline string `json:"progressDeadline,omitempty"` + // MaxFailures is a percentage or number of clusters in the current rollout that can fail before + // proceeding to the next rollout. Fail means the cluster has a failed status or timeout status + // (does not reach successful status after ProgressDeadline). + // Once the MaxFailures is breached, the rollout will stop. + // MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For + // Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, + // this is considered according to the size of the current group. For both Progressive and + // ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate + // no failures. + // Default is that no failures are tolerated. + // +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$" + // +kubebuilder:validation:XIntOrString + // +kubebuilder:default=0 + // +optional + MaxFailures intstr.IntOrString `json:"maxFailures,omitempty"` +} + +// MandatoryDecisionGroup set the decision group name or group index. +// GroupName is considered first to select the decisionGroups then GroupIndex. +type MandatoryDecisionGroup struct { + // GroupName of the decision group should match the placementDecisions label value with label key + // cluster.open-cluster-management.io/decision-group-name + // +optional + GroupName string `json:"groupName,omitempty"` + + // GroupIndex of the decision group should match the placementDecisions label value with label key + // cluster.open-cluster-management.io/decision-group-index + // +optional + GroupIndex int32 `json:"groupIndex,omitempty"` +} + +// MandatoryDecisionGroups +type MandatoryDecisionGroups struct { + // List of the decision groups names or indexes to apply the workload first and fail if workload + // did not reach successful state. + // GroupName or GroupIndex must match with the decisionGroups defined in the placement's + // decisionStrategy + // +optional + MandatoryDecisionGroups []MandatoryDecisionGroup `json:"mandatoryDecisionGroups,omitempty"` +} + +// RolloutAll is a RolloutStrategy Type +type RolloutAll struct { + // +optional + RolloutConfig `json:",inline"` +} + +// RolloutProgressivePerGroup is a RolloutStrategy Type +type RolloutProgressivePerGroup struct { + // +optional + RolloutConfig `json:",inline"` + + // +optional + MandatoryDecisionGroups `json:",inline"` +} + +// RolloutProgressive is a RolloutStrategy Type +type RolloutProgressive struct { + // +optional + RolloutConfig `json:",inline"` + + // +optional + MandatoryDecisionGroups `json:",inline"` + + // MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value + // for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the + // placement->DecisionStrategy. + // +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$" + // +kubebuilder:validation:XIntOrString + // +optional + MaxConcurrency intstr.IntOrString `json:"maxConcurrency,omitempty"` +} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..e40f74e4d2 --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,335 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddOnPlacementScore) DeepCopyInto(out *AddOnPlacementScore) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnPlacementScore. +func (in *AddOnPlacementScore) DeepCopy() *AddOnPlacementScore { + if in == nil { + return nil + } + out := new(AddOnPlacementScore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AddOnPlacementScore) 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 *AddOnPlacementScoreItem) DeepCopyInto(out *AddOnPlacementScoreItem) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnPlacementScoreItem. +func (in *AddOnPlacementScoreItem) DeepCopy() *AddOnPlacementScoreItem { + if in == nil { + return nil + } + out := new(AddOnPlacementScoreItem) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddOnPlacementScoreList) DeepCopyInto(out *AddOnPlacementScoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AddOnPlacementScore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnPlacementScoreList. +func (in *AddOnPlacementScoreList) DeepCopy() *AddOnPlacementScoreList { + if in == nil { + return nil + } + out := new(AddOnPlacementScoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AddOnPlacementScoreList) 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 *AddOnPlacementScoreStatus) DeepCopyInto(out *AddOnPlacementScoreStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Scores != nil { + in, out := &in.Scores, &out.Scores + *out = make([]AddOnPlacementScoreItem, len(*in)) + copy(*out, *in) + } + if in.ValidUntil != nil { + in, out := &in.ValidUntil, &out.ValidUntil + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnPlacementScoreStatus. +func (in *AddOnPlacementScoreStatus) DeepCopy() *AddOnPlacementScoreStatus { + if in == nil { + return nil + } + out := new(AddOnPlacementScoreStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterClaim) DeepCopyInto(out *ClusterClaim) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaim. +func (in *ClusterClaim) DeepCopy() *ClusterClaim { + if in == nil { + return nil + } + out := new(ClusterClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterClaim) 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 *ClusterClaimList) DeepCopyInto(out *ClusterClaimList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimList. +func (in *ClusterClaimList) DeepCopy() *ClusterClaimList { + if in == nil { + return nil + } + out := new(ClusterClaimList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterClaimList) 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 *ClusterClaimSpec) DeepCopyInto(out *ClusterClaimSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimSpec. +func (in *ClusterClaimSpec) DeepCopy() *ClusterClaimSpec { + if in == nil { + return nil + } + out := new(ClusterClaimSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MandatoryDecisionGroup) DeepCopyInto(out *MandatoryDecisionGroup) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MandatoryDecisionGroup. +func (in *MandatoryDecisionGroup) DeepCopy() *MandatoryDecisionGroup { + if in == nil { + return nil + } + out := new(MandatoryDecisionGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MandatoryDecisionGroups) DeepCopyInto(out *MandatoryDecisionGroups) { + *out = *in + if in.MandatoryDecisionGroups != nil { + in, out := &in.MandatoryDecisionGroups, &out.MandatoryDecisionGroups + *out = make([]MandatoryDecisionGroup, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MandatoryDecisionGroups. +func (in *MandatoryDecisionGroups) DeepCopy() *MandatoryDecisionGroups { + if in == nil { + return nil + } + out := new(MandatoryDecisionGroups) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutAll) DeepCopyInto(out *RolloutAll) { + *out = *in + out.RolloutConfig = in.RolloutConfig + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutAll. +func (in *RolloutAll) DeepCopy() *RolloutAll { + if in == nil { + return nil + } + out := new(RolloutAll) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutConfig) DeepCopyInto(out *RolloutConfig) { + *out = *in + out.MinSuccessTime = in.MinSuccessTime + out.MaxFailures = in.MaxFailures + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutConfig. +func (in *RolloutConfig) DeepCopy() *RolloutConfig { + if in == nil { + return nil + } + out := new(RolloutConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutProgressive) DeepCopyInto(out *RolloutProgressive) { + *out = *in + out.RolloutConfig = in.RolloutConfig + in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) + out.MaxConcurrency = in.MaxConcurrency + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutProgressive. +func (in *RolloutProgressive) DeepCopy() *RolloutProgressive { + if in == nil { + return nil + } + out := new(RolloutProgressive) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutProgressivePerGroup) DeepCopyInto(out *RolloutProgressivePerGroup) { + *out = *in + out.RolloutConfig = in.RolloutConfig + in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutProgressivePerGroup. +func (in *RolloutProgressivePerGroup) DeepCopy() *RolloutProgressivePerGroup { + if in == nil { + return nil + } + out := new(RolloutProgressivePerGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutStrategy) DeepCopyInto(out *RolloutStrategy) { + *out = *in + if in.All != nil { + in, out := &in.All, &out.All + *out = new(RolloutAll) + **out = **in + } + if in.Progressive != nil { + in, out := &in.Progressive, &out.Progressive + *out = new(RolloutProgressive) + (*in).DeepCopyInto(*out) + } + if in.ProgressivePerGroup != nil { + in, out := &in.ProgressivePerGroup, &out.ProgressivePerGroup + *out = new(RolloutProgressivePerGroup) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutStrategy. +func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { + if in == nil { + return nil + } + out := new(RolloutStrategy) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go new file mode 100644 index 0000000000..64c51d2466 --- /dev/null +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -0,0 +1,147 @@ +package v1alpha1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE +var map_ClusterClaim = map[string]string{ + "": "ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include,\n 1. id.k8s.io, it contains a unique identifier for the cluster.\n 2. clusterset.k8s.io, it contains an identifier that relates the cluster\n to the ClusterSet in which it belongs.\n\nClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub.", + "spec": "Spec defines the attributes of the ClusterClaim.", +} + +func (ClusterClaim) SwaggerDoc() map[string]string { + return map_ClusterClaim +} + +var map_ClusterClaimList = map[string]string{ + "": "ClusterClaimList is a collection of ClusterClaim.", + "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "items": "Items is a list of ClusterClaim.", +} + +func (ClusterClaimList) SwaggerDoc() map[string]string { + return map_ClusterClaimList +} + +var map_ClusterClaimSpec = map[string]string{ + "value": "Value is a claim-dependent string", +} + +func (ClusterClaimSpec) SwaggerDoc() map[string]string { + return map_ClusterClaimSpec +} + +var map_AddOnPlacementScore = map[string]string{ + "": "AddOnPlacementScore represents a bundle of scores of one managed cluster, which could be used by placement. AddOnPlacementScore is a namespace scoped resource. The namespace of the resource is the cluster namespace.", + "status": "Status represents the status of the AddOnPlacementScore.", +} + +func (AddOnPlacementScore) SwaggerDoc() map[string]string { + return map_AddOnPlacementScore +} + +var map_AddOnPlacementScoreItem = map[string]string{ + "": "AddOnPlacementScoreItem represents the score name and value.", + "name": "Name is the name of the score", + "value": "Value is the value of the score. The score range is from -100 to 100.", +} + +func (AddOnPlacementScoreItem) SwaggerDoc() map[string]string { + return map_AddOnPlacementScoreItem +} + +var map_AddOnPlacementScoreList = map[string]string{ + "": "AddOnPlacementScoreList is a collection of AddOnPlacementScore.", + "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", + "items": "Items is a list of AddOnPlacementScore", +} + +func (AddOnPlacementScoreList) SwaggerDoc() map[string]string { + return map_AddOnPlacementScoreList +} + +var map_AddOnPlacementScoreStatus = map[string]string{ + "": "AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore.", + "conditions": "Conditions contain the different condition statuses for this AddOnPlacementScore.", + "scores": "Scores contain a list of score name and value of this managed cluster.", + "validUntil": "ValidUntil defines the valid time of the scores. After this time, the scores are considered to be invalid by placement. nil means never expire. The controller owning this resource should keep the scores up-to-date.", +} + +func (AddOnPlacementScoreStatus) SwaggerDoc() map[string]string { + return map_AddOnPlacementScoreStatus +} + +var map_MandatoryDecisionGroup = map[string]string{ + "": "MandatoryDecisionGroup set the decision group name or group index. GroupName is considered first to select the decisionGroups then GroupIndex.", + "groupName": "GroupName of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-name", + "groupIndex": "GroupIndex of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-index", +} + +func (MandatoryDecisionGroup) SwaggerDoc() map[string]string { + return map_MandatoryDecisionGroup +} + +var map_MandatoryDecisionGroups = map[string]string{ + "": "MandatoryDecisionGroups", + "mandatoryDecisionGroups": "List of the decision groups names or indexes to apply the workload first and fail if workload did not reach successful state. GroupName or GroupIndex must match with the decisionGroups defined in the placement's decisionStrategy", +} + +func (MandatoryDecisionGroups) SwaggerDoc() map[string]string { + return map_MandatoryDecisionGroups +} + +var map_RolloutAll = map[string]string{ + "": "RolloutAll is a RolloutStrategy Type", +} + +func (RolloutAll) SwaggerDoc() map[string]string { + return map_RolloutAll +} + +var map_RolloutConfig = map[string]string{ + "": "Timeout to consider while applying the workload.", + "minSuccessTime": "MinSuccessTime is a \"soak\" time. In other words, the minimum amount of time the workload applier controller will wait from the start of each rollout before proceeding (assuming a successful state has been reached and MaxFailures wasn't breached). MinSuccessTime is only considered for rollout types Progressive and ProgressivePerGroup. The default value is 0 meaning the workload applier proceeds immediately after a successful state is reached. MinSuccessTime must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", + "progressDeadline": "ProgressDeadline defines how long workload applier controller will wait for the workload to reach a successful state in the cluster. If the workload does not reach a successful state after ProgressDeadline, will stop waiting and workload will be treated as \"timeout\" and be counted into MaxFailures. Once the MaxFailures is breached, the rollout will stop. ProgressDeadline default value is \"None\", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", + "maxFailures": "MaxFailures is a percentage or number of clusters in the current rollout that can fail before proceeding to the next rollout. Fail means the cluster has a failed status or timeout status (does not reach successful status after ProgressDeadline). Once the MaxFailures is breached, the rollout will stop. MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures are tolerated.", +} + +func (RolloutConfig) SwaggerDoc() map[string]string { + return map_RolloutConfig +} + +var map_RolloutProgressive = map[string]string{ + "": "RolloutProgressive is a RolloutStrategy Type", + "maxConcurrency": "MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the placement->DecisionStrategy.", +} + +func (RolloutProgressive) SwaggerDoc() map[string]string { + return map_RolloutProgressive +} + +var map_RolloutProgressivePerGroup = map[string]string{ + "": "RolloutProgressivePerGroup is a RolloutStrategy Type", +} + +func (RolloutProgressivePerGroup) SwaggerDoc() map[string]string { + return map_RolloutProgressivePerGroup +} + +var map_RolloutStrategy = map[string]string{ + "": "Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy.", + "all": "All defines required fields for RolloutStrategy type All", + "progressive": "Progressive defines required fields for RolloutStrategy type Progressive", + "progressivePerGroup": "ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup", +} + +func (RolloutStrategy) SwaggerDoc() map[string]string { + return map_RolloutStrategy +} + +// AUTO-GENERATED FUNCTIONS END HERE