Merge pull request #3692 from RainbowMango/pr_cronfederatedhpa_api

Adding CronFederatedHPA API
This commit is contained in:
karmada-bot 2023-06-26 10:50:16 +08:00 committed by GitHub
commit cebb0caca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1619 additions and 0 deletions

View File

@ -0,0 +1,258 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: cronfederatedhpas.autoscaling.karmada.io
spec:
group: autoscaling.karmada.io
names:
categories:
- karmada-io
kind: CronFederatedHPA
listKind: CronFederatedHPAList
plural: cronfederatedhpas
shortNames:
- cronfhpa
singular: cronfederatedhpa
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.scaleTargetRef.kind
name: REFERENCE-KIND
type: string
- jsonPath: .spec.scaleTargetRef.name
name: REFERENCE-NAME
type: string
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: CronFederatedHPA represents a collection of repeating schedule
to scale replica number of a specific workload. It can scale any resource
implementing the scale subresource as well as FederatedHPA.
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 is the specification of the CronFederatedHPA.
properties:
rules:
description: Rules contains a collection of schedules that declares
when and how the referencing target resource should be scaled.
items:
description: CronFederatedHPARule declares a schedule as well as
scale actions.
properties:
failedHistoryLimit:
default: 3
description: FailedHistoryLimit represents the count of failed
execution items for each rule. The value must be a positive
integer. It defaults to 3.
format: int32
maximum: 32
minimum: 0
type: integer
name:
description: "Name of the rule. Each rule in a CronFederatedHPA
must have a unique name. \n Note: the name will be used as
an identifier to record its execution history. Changing the
name will be considered as deleting the old rule and adding
a new rule, that means the original execution history will
be discarded."
maxLength: 32
minLength: 1
type: string
schedule:
description: Schedule is the cron expression that represents
a periodical time. The syntax follows https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-syntax.
type: string
successfulHistoryLimit:
default: 3
description: SuccessfulHistoryLimit represents the count of
successful execution items for each rule. The value must be
a positive integer. It defaults to 3.
format: int32
maximum: 32
minimum: 1
type: integer
suspend:
default: false
description: Suspend tells the controller to suspend subsequent
executions. Defaults to false.
type: boolean
targetMaxReplicas:
description: TargetMaxReplicas is the target MaxReplicas to
be set for FederatedHPA. Only needed when referencing resource
is FederatedHPA. TargetMinReplicas and TargetMaxReplicas can
be specified together or either one can be specified alone.
nil means the MaxReplicas(.spec.maxReplicas) of the referencing
FederatedHPA will not be updated.
format: int32
type: integer
targetMinReplicas:
description: TargetMinReplicas is the target MinReplicas to
be set for FederatedHPA. Only needed when referencing resource
is FederatedHPA. TargetMinReplicas and TargetMaxReplicas can
be specified together or either one can be specified alone.
nil means the MinReplicas(.spec.minReplicas) of the referencing
FederatedHPA will not be updated.
format: int32
type: integer
targetReplicas:
description: TargetReplicas is the target replicas to be scaled
for resources referencing by ScaleTargetRef of this CronFederatedHPA.
Only needed when referencing resource is not FederatedHPA.
format: int32
type: integer
timeZone:
description: TimeZone for the giving schedule. If not specified,
this will default to the time zone of the karmada-controller-manager
process. Invalid TimeZone will be rejected when applying by
karmada-webhook. see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
for the all timezones.
type: string
required:
- name
- schedule
type: object
type: array
scaleTargetRef:
description: ScaleTargetRef points to the target resource to scale.
Target resource could be any resource that implementing the scale
subresource like Deployment, or FederatedHPA.
properties:
apiVersion:
description: API version of the referent
type: string
kind:
description: 'Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names'
type: string
required:
- kind
- name
type: object
required:
- rules
- scaleTargetRef
type: object
status:
description: Status is the current status of the CronFederatedHPA.
properties:
executionHistories:
description: ExecutionHistories record the execution histories of
CronFederatedHPARule.
items:
description: ExecutionHistory records the execution history of specific
CronFederatedHPARule.
properties:
failedExecutions:
description: FailedExecutions records failed executions.
items:
description: FailedExecution records a failed execution.
properties:
executionTime:
description: ExecutionTime is the actual execution time
of CronFederatedHPARule. Tasks may not always be executed
at ScheduleTime. ExecutionTime is used to evaluate the
efficiency of the controller's execution.
format: date-time
type: string
message:
description: Message is the human-readable message indicating
details about the failure.
type: string
scheduleTime:
description: ScheduleTime is the expected execution time
declared in CronFederatedHPARule.
format: date-time
type: string
required:
- executionTime
- message
- scheduleTime
type: object
type: array
nextExecutionTime:
description: NextExecutionTime is the next time to execute.
Nil means the rule has been suspended.
format: date-time
type: string
ruleName:
description: RuleName is the name of the CronFederatedHPARule.
type: string
successfulExecutions:
description: SuccessfulExecutions records successful executions.
items:
description: SuccessfulExecution records a successful execution.
properties:
appliedMaxReplicas:
description: AppliedMaxReplicas is the MaxReplicas have
been applied. It is required if .spec.rules[*].targetMaxReplicas
is not empty.
format: int32
type: integer
appliedMinReplicas:
description: AppliedMinReplicas is the MinReplicas have
been applied. It is required if .spec.rules[*].targetMinReplicas
is not empty.
format: int32
type: integer
appliedReplicas:
description: AppliedReplicas is the replicas have been
applied. It is required if .spec.rules[*].targetReplicas
is not empty.
format: int32
type: integer
executionTime:
description: ExecutionTime is the actual execution time
of CronFederatedHPARule. Tasks may not always be executed
at ScheduleTime. ExecutionTime is used to evaluate the
efficiency of the controller's execution.
format: date-time
type: string
scheduleTime:
description: ScheduleTime is the expected execution time
declared in CronFederatedHPARule.
format: date-time
type: string
required:
- executionTime
- scheduleTime
type: object
type: array
required:
- ruleName
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,218 @@
/*
Copyright 2023 The Karmada 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 (
autoscalingv2 "k8s.io/api/autoscaling/v2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=cronfhpa,categories={karmada-io}
// +kubebuilder:printcolumn:JSONPath=`.spec.scaleTargetRef.kind`,name=`REFERENCE-KIND`,type=string
// +kubebuilder:printcolumn:JSONPath=`.spec.scaleTargetRef.name`,name=`REFERENCE-NAME`,type=string
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name=`AGE`,type=date
// CronFederatedHPA represents a collection of repeating schedule to scale
// replica number of a specific workload. It can scale any resource implementing
// the scale subresource as well as FederatedHPA.
type CronFederatedHPA struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec is the specification of the CronFederatedHPA.
// +required
Spec CronFederatedHPASpec `json:"spec"`
// Status is the current status of the CronFederatedHPA.
// +optional
Status CronFederatedHPAStatus `json:"status"`
}
// CronFederatedHPASpec is the specification of the CronFederatedHPA.
type CronFederatedHPASpec struct {
// ScaleTargetRef points to the target resource to scale.
// Target resource could be any resource that implementing the scale
// subresource like Deployment, or FederatedHPA.
// +required
ScaleTargetRef autoscalingv2.CrossVersionObjectReference `json:"scaleTargetRef"`
// Rules contains a collection of schedules that declares when and how
// the referencing target resource should be scaled.
// +required
Rules []CronFederatedHPARule `json:"rules"`
}
// CronFederatedHPARule declares a schedule as well as scale actions.
type CronFederatedHPARule struct {
// Name of the rule.
// Each rule in a CronFederatedHPA must have a unique name.
//
// Note: the name will be used as an identifier to record its execution
// history. Changing the name will be considered as deleting the old rule
// and adding a new rule, that means the original execution history will be
// discarded.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=32
// +required
Name string `json:"name"`
// Schedule is the cron expression that represents a periodical time.
// The syntax follows https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-syntax.
// +required
Schedule string `json:"schedule"`
// TargetReplicas is the target replicas to be scaled for resources
// referencing by ScaleTargetRef of this CronFederatedHPA.
// Only needed when referencing resource is not FederatedHPA.
// +optional
TargetReplicas *int32 `json:"targetReplicas,omitempty"`
// TargetMinReplicas is the target MinReplicas to be set for FederatedHPA.
// Only needed when referencing resource is FederatedHPA.
// TargetMinReplicas and TargetMaxReplicas can be specified together or
// either one can be specified alone.
// nil means the MinReplicas(.spec.minReplicas) of the referencing FederatedHPA
// will not be updated.
// +optional
TargetMinReplicas *int32 `json:"targetMinReplicas,omitempty"`
// TargetMaxReplicas is the target MaxReplicas to be set for FederatedHPA.
// Only needed when referencing resource is FederatedHPA.
// TargetMinReplicas and TargetMaxReplicas can be specified together or
// either one can be specified alone.
// nil means the MaxReplicas(.spec.maxReplicas) of the referencing FederatedHPA
// will not be updated.
// +optional
TargetMaxReplicas *int32 `json:"targetMaxReplicas,omitempty"`
// Suspend tells the controller to suspend subsequent executions.
// Defaults to false.
//
// +kubebuilder:default=false
// +optional
Suspend *bool `json:"suspend,omitempty"`
// TimeZone for the giving schedule.
// If not specified, this will default to the time zone of the
// karmada-controller-manager process.
// Invalid TimeZone will be rejected when applying by karmada-webhook.
// see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for the
// all timezones.
// +optional
TimeZone *string `json:"timeZone,omitempty"`
// SuccessfulHistoryLimit represents the count of successful execution items
// for each rule.
// The value must be a positive integer. It defaults to 3.
//
// +kubebuilder:default=3
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=32
// +optional
SuccessfulHistoryLimit *int32 `json:"successfulHistoryLimit,omitempty"`
// FailedHistoryLimit represents the count of failed execution items for
// each rule.
// The value must be a positive integer. It defaults to 3.
//
// +kubebuilder:default=3
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
FailedHistoryLimit *int32 `json:"failedHistoryLimit,omitempty"`
}
// CronFederatedHPAStatus represents the current status of a CronFederatedHPA.
type CronFederatedHPAStatus struct {
// ExecutionHistories record the execution histories of CronFederatedHPARule.
// +optional
ExecutionHistories []ExecutionHistory `json:"executionHistories,omitempty"`
}
// ExecutionHistory records the execution history of specific CronFederatedHPARule.
type ExecutionHistory struct {
// RuleName is the name of the CronFederatedHPARule.
// +required
RuleName string `json:"ruleName"`
// NextExecutionTime is the next time to execute.
// Nil means the rule has been suspended.
// +optional
NextExecutionTime *metav1.Time `json:"nextExecutionTime,omitempty"`
// SuccessfulExecutions records successful executions.
// +optional
SuccessfulExecutions []SuccessfulExecution `json:"successfulExecutions,omitempty"`
// FailedExecutions records failed executions.
// +optional
FailedExecutions []FailedExecution `json:"failedExecutions,omitempty"`
}
// SuccessfulExecution records a successful execution.
type SuccessfulExecution struct {
// ScheduleTime is the expected execution time declared in CronFederatedHPARule.
// +required
ScheduleTime *metav1.Time `json:"scheduleTime"`
// ExecutionTime is the actual execution time of CronFederatedHPARule.
// Tasks may not always be executed at ScheduleTime. ExecutionTime is used
// to evaluate the efficiency of the controller's execution.
// +required
ExecutionTime *metav1.Time `json:"executionTime"`
// AppliedReplicas is the replicas have been applied.
// It is required if .spec.rules[*].targetReplicas is not empty.
// +optional
AppliedReplicas *int32 `json:"appliedReplicas,omitempty"`
// AppliedMaxReplicas is the MaxReplicas have been applied.
// It is required if .spec.rules[*].targetMaxReplicas is not empty.
// +optional
AppliedMaxReplicas *int32 `json:"appliedMaxReplicas,omitempty"`
// AppliedMinReplicas is the MinReplicas have been applied.
// It is required if .spec.rules[*].targetMinReplicas is not empty.
// +optional
AppliedMinReplicas *int32 `json:"appliedMinReplicas,omitempty"`
}
// FailedExecution records a failed execution.
type FailedExecution struct {
// ScheduleTime is the expected execution time declared in CronFederatedHPARule.
// +required
ScheduleTime *metav1.Time `json:"scheduleTime"`
// ExecutionTime is the actual execution time of CronFederatedHPARule.
// Tasks may not always be executed at ScheduleTime. ExecutionTime is used
// to evaluate the efficiency of the controller's execution.
// +required
ExecutionTime *metav1.Time `json:"executionTime"`
// Message is the human-readable message indicating details about the failure.
// +required
Message string `json:"message"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CronFederatedHPAList contains a list of CronFederatedHPA.
type CronFederatedHPAList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CronFederatedHPA `json:"items"`
}

View File

@ -10,6 +10,223 @@ import (
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 *CronFederatedHPA) DeepCopyInto(out *CronFederatedHPA) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronFederatedHPA.
func (in *CronFederatedHPA) DeepCopy() *CronFederatedHPA {
if in == nil {
return nil
}
out := new(CronFederatedHPA)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CronFederatedHPA) 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 *CronFederatedHPAList) DeepCopyInto(out *CronFederatedHPAList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CronFederatedHPA, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronFederatedHPAList.
func (in *CronFederatedHPAList) DeepCopy() *CronFederatedHPAList {
if in == nil {
return nil
}
out := new(CronFederatedHPAList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CronFederatedHPAList) 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 *CronFederatedHPARule) DeepCopyInto(out *CronFederatedHPARule) {
*out = *in
if in.TargetReplicas != nil {
in, out := &in.TargetReplicas, &out.TargetReplicas
*out = new(int32)
**out = **in
}
if in.TargetMinReplicas != nil {
in, out := &in.TargetMinReplicas, &out.TargetMinReplicas
*out = new(int32)
**out = **in
}
if in.TargetMaxReplicas != nil {
in, out := &in.TargetMaxReplicas, &out.TargetMaxReplicas
*out = new(int32)
**out = **in
}
if in.Suspend != nil {
in, out := &in.Suspend, &out.Suspend
*out = new(bool)
**out = **in
}
if in.TimeZone != nil {
in, out := &in.TimeZone, &out.TimeZone
*out = new(string)
**out = **in
}
if in.SuccessfulHistoryLimit != nil {
in, out := &in.SuccessfulHistoryLimit, &out.SuccessfulHistoryLimit
*out = new(int32)
**out = **in
}
if in.FailedHistoryLimit != nil {
in, out := &in.FailedHistoryLimit, &out.FailedHistoryLimit
*out = new(int32)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronFederatedHPARule.
func (in *CronFederatedHPARule) DeepCopy() *CronFederatedHPARule {
if in == nil {
return nil
}
out := new(CronFederatedHPARule)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CronFederatedHPASpec) DeepCopyInto(out *CronFederatedHPASpec) {
*out = *in
out.ScaleTargetRef = in.ScaleTargetRef
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]CronFederatedHPARule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronFederatedHPASpec.
func (in *CronFederatedHPASpec) DeepCopy() *CronFederatedHPASpec {
if in == nil {
return nil
}
out := new(CronFederatedHPASpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CronFederatedHPAStatus) DeepCopyInto(out *CronFederatedHPAStatus) {
*out = *in
if in.ExecutionHistories != nil {
in, out := &in.ExecutionHistories, &out.ExecutionHistories
*out = make([]ExecutionHistory, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronFederatedHPAStatus.
func (in *CronFederatedHPAStatus) DeepCopy() *CronFederatedHPAStatus {
if in == nil {
return nil
}
out := new(CronFederatedHPAStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExecutionHistory) DeepCopyInto(out *ExecutionHistory) {
*out = *in
if in.NextExecutionTime != nil {
in, out := &in.NextExecutionTime, &out.NextExecutionTime
*out = (*in).DeepCopy()
}
if in.SuccessfulExecutions != nil {
in, out := &in.SuccessfulExecutions, &out.SuccessfulExecutions
*out = make([]SuccessfulExecution, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.FailedExecutions != nil {
in, out := &in.FailedExecutions, &out.FailedExecutions
*out = make([]FailedExecution, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecutionHistory.
func (in *ExecutionHistory) DeepCopy() *ExecutionHistory {
if in == nil {
return nil
}
out := new(ExecutionHistory)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FailedExecution) DeepCopyInto(out *FailedExecution) {
*out = *in
if in.ScheduleTime != nil {
in, out := &in.ScheduleTime, &out.ScheduleTime
*out = (*in).DeepCopy()
}
if in.ExecutionTime != nil {
in, out := &in.ExecutionTime, &out.ExecutionTime
*out = (*in).DeepCopy()
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FailedExecution.
func (in *FailedExecution) DeepCopy() *FailedExecution {
if in == nil {
return nil
}
out := new(FailedExecution)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FederatedHPA) DeepCopyInto(out *FederatedHPA) {
*out = *in
@ -104,3 +321,42 @@ func (in *FederatedHPASpec) DeepCopy() *FederatedHPASpec {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SuccessfulExecution) DeepCopyInto(out *SuccessfulExecution) {
*out = *in
if in.ScheduleTime != nil {
in, out := &in.ScheduleTime, &out.ScheduleTime
*out = (*in).DeepCopy()
}
if in.ExecutionTime != nil {
in, out := &in.ExecutionTime, &out.ExecutionTime
*out = (*in).DeepCopy()
}
if in.AppliedReplicas != nil {
in, out := &in.AppliedReplicas, &out.AppliedReplicas
*out = new(int32)
**out = **in
}
if in.AppliedMaxReplicas != nil {
in, out := &in.AppliedMaxReplicas, &out.AppliedMaxReplicas
*out = new(int32)
**out = **in
}
if in.AppliedMinReplicas != nil {
in, out := &in.AppliedMinReplicas, &out.AppliedMinReplicas
*out = new(int32)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SuccessfulExecution.
func (in *SuccessfulExecution) DeepCopy() *SuccessfulExecution {
if in == nil {
return nil
}
out := new(SuccessfulExecution)
in.DeepCopyInto(out)
return out
}

View File

@ -42,6 +42,8 @@ func init() {
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&CronFederatedHPA{},
&CronFederatedHPAList{},
&FederatedHPA{},
&FederatedHPAList{},
)

View File

@ -12,6 +12,7 @@ import (
type AutoscalingV1alpha1Interface interface {
RESTClient() rest.Interface
CronFederatedHPAsGetter
FederatedHPAsGetter
}
@ -20,6 +21,10 @@ type AutoscalingV1alpha1Client struct {
restClient rest.Interface
}
func (c *AutoscalingV1alpha1Client) CronFederatedHPAs(namespace string) CronFederatedHPAInterface {
return newCronFederatedHPAs(c, namespace)
}
func (c *AutoscalingV1alpha1Client) FederatedHPAs(namespace string) FederatedHPAInterface {
return newFederatedHPAs(c, namespace)
}

View File

@ -0,0 +1,179 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1"
scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme"
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"
)
// CronFederatedHPAsGetter has a method to return a CronFederatedHPAInterface.
// A group's client should implement this interface.
type CronFederatedHPAsGetter interface {
CronFederatedHPAs(namespace string) CronFederatedHPAInterface
}
// CronFederatedHPAInterface has methods to work with CronFederatedHPA resources.
type CronFederatedHPAInterface interface {
Create(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.CreateOptions) (*v1alpha1.CronFederatedHPA, error)
Update(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.UpdateOptions) (*v1alpha1.CronFederatedHPA, error)
UpdateStatus(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.UpdateOptions) (*v1alpha1.CronFederatedHPA, 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.CronFederatedHPA, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.CronFederatedHPAList, 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.CronFederatedHPA, err error)
CronFederatedHPAExpansion
}
// cronFederatedHPAs implements CronFederatedHPAInterface
type cronFederatedHPAs struct {
client rest.Interface
ns string
}
// newCronFederatedHPAs returns a CronFederatedHPAs
func newCronFederatedHPAs(c *AutoscalingV1alpha1Client, namespace string) *cronFederatedHPAs {
return &cronFederatedHPAs{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the cronFederatedHPA, and returns the corresponding cronFederatedHPA object, and an error if there is any.
func (c *cronFederatedHPAs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CronFederatedHPA, err error) {
result = &v1alpha1.CronFederatedHPA{}
err = c.client.Get().
Namespace(c.ns).
Resource("cronfederatedhpas").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of CronFederatedHPAs that match those selectors.
func (c *cronFederatedHPAs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CronFederatedHPAList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.CronFederatedHPAList{}
err = c.client.Get().
Namespace(c.ns).
Resource("cronfederatedhpas").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested cronFederatedHPAs.
func (c *cronFederatedHPAs) 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("cronfederatedhpas").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a cronFederatedHPA and creates it. Returns the server's representation of the cronFederatedHPA, and an error, if there is any.
func (c *cronFederatedHPAs) Create(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.CreateOptions) (result *v1alpha1.CronFederatedHPA, err error) {
result = &v1alpha1.CronFederatedHPA{}
err = c.client.Post().
Namespace(c.ns).
Resource("cronfederatedhpas").
VersionedParams(&opts, scheme.ParameterCodec).
Body(cronFederatedHPA).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a cronFederatedHPA and updates it. Returns the server's representation of the cronFederatedHPA, and an error, if there is any.
func (c *cronFederatedHPAs) Update(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.UpdateOptions) (result *v1alpha1.CronFederatedHPA, err error) {
result = &v1alpha1.CronFederatedHPA{}
err = c.client.Put().
Namespace(c.ns).
Resource("cronfederatedhpas").
Name(cronFederatedHPA.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(cronFederatedHPA).
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 *cronFederatedHPAs) UpdateStatus(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.UpdateOptions) (result *v1alpha1.CronFederatedHPA, err error) {
result = &v1alpha1.CronFederatedHPA{}
err = c.client.Put().
Namespace(c.ns).
Resource("cronfederatedhpas").
Name(cronFederatedHPA.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(cronFederatedHPA).
Do(ctx).
Into(result)
return
}
// Delete takes name of the cronFederatedHPA and deletes it. Returns an error if one occurs.
func (c *cronFederatedHPAs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("cronfederatedhpas").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *cronFederatedHPAs) 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("cronfederatedhpas").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched cronFederatedHPA.
func (c *cronFederatedHPAs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CronFederatedHPA, err error) {
result = &v1alpha1.CronFederatedHPA{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("cronfederatedhpas").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -12,6 +12,10 @@ type FakeAutoscalingV1alpha1 struct {
*testing.Fake
}
func (c *FakeAutoscalingV1alpha1) CronFederatedHPAs(namespace string) v1alpha1.CronFederatedHPAInterface {
return &FakeCronFederatedHPAs{c, namespace}
}
func (c *FakeAutoscalingV1alpha1) FederatedHPAs(namespace string) v1alpha1.FederatedHPAInterface {
return &FakeFederatedHPAs{c, namespace}
}

View File

@ -0,0 +1,126 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/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"
)
// FakeCronFederatedHPAs implements CronFederatedHPAInterface
type FakeCronFederatedHPAs struct {
Fake *FakeAutoscalingV1alpha1
ns string
}
var cronfederatedhpasResource = schema.GroupVersionResource{Group: "autoscaling.karmada.io", Version: "v1alpha1", Resource: "cronfederatedhpas"}
var cronfederatedhpasKind = schema.GroupVersionKind{Group: "autoscaling.karmada.io", Version: "v1alpha1", Kind: "CronFederatedHPA"}
// Get takes name of the cronFederatedHPA, and returns the corresponding cronFederatedHPA object, and an error if there is any.
func (c *FakeCronFederatedHPAs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CronFederatedHPA, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(cronfederatedhpasResource, c.ns, name), &v1alpha1.CronFederatedHPA{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CronFederatedHPA), err
}
// List takes label and field selectors, and returns the list of CronFederatedHPAs that match those selectors.
func (c *FakeCronFederatedHPAs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CronFederatedHPAList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(cronfederatedhpasResource, cronfederatedhpasKind, c.ns, opts), &v1alpha1.CronFederatedHPAList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.CronFederatedHPAList{ListMeta: obj.(*v1alpha1.CronFederatedHPAList).ListMeta}
for _, item := range obj.(*v1alpha1.CronFederatedHPAList).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 cronFederatedHPAs.
func (c *FakeCronFederatedHPAs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(cronfederatedhpasResource, c.ns, opts))
}
// Create takes the representation of a cronFederatedHPA and creates it. Returns the server's representation of the cronFederatedHPA, and an error, if there is any.
func (c *FakeCronFederatedHPAs) Create(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.CreateOptions) (result *v1alpha1.CronFederatedHPA, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(cronfederatedhpasResource, c.ns, cronFederatedHPA), &v1alpha1.CronFederatedHPA{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CronFederatedHPA), err
}
// Update takes the representation of a cronFederatedHPA and updates it. Returns the server's representation of the cronFederatedHPA, and an error, if there is any.
func (c *FakeCronFederatedHPAs) Update(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.UpdateOptions) (result *v1alpha1.CronFederatedHPA, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(cronfederatedhpasResource, c.ns, cronFederatedHPA), &v1alpha1.CronFederatedHPA{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CronFederatedHPA), 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 *FakeCronFederatedHPAs) UpdateStatus(ctx context.Context, cronFederatedHPA *v1alpha1.CronFederatedHPA, opts v1.UpdateOptions) (*v1alpha1.CronFederatedHPA, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(cronfederatedhpasResource, "status", c.ns, cronFederatedHPA), &v1alpha1.CronFederatedHPA{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CronFederatedHPA), err
}
// Delete takes name of the cronFederatedHPA and deletes it. Returns an error if one occurs.
func (c *FakeCronFederatedHPAs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(cronfederatedhpasResource, c.ns, name, opts), &v1alpha1.CronFederatedHPA{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeCronFederatedHPAs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(cronfederatedhpasResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.CronFederatedHPAList{})
return err
}
// Patch applies the patch and returns the patched cronFederatedHPA.
func (c *FakeCronFederatedHPAs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CronFederatedHPA, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(cronfederatedhpasResource, c.ns, name, pt, data, subresources...), &v1alpha1.CronFederatedHPA{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.CronFederatedHPA), err
}

View File

@ -2,4 +2,6 @@
package v1alpha1
type CronFederatedHPAExpansion interface{}
type FederatedHPAExpansion interface{}

View File

@ -0,0 +1,74 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
time "time"
autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1"
versioned "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/listers/autoscaling/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"
)
// CronFederatedHPAInformer provides access to a shared informer and lister for
// CronFederatedHPAs.
type CronFederatedHPAInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.CronFederatedHPALister
}
type cronFederatedHPAInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewCronFederatedHPAInformer constructs a new informer for CronFederatedHPA 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 NewCronFederatedHPAInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredCronFederatedHPAInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredCronFederatedHPAInformer constructs a new informer for CronFederatedHPA 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 NewFilteredCronFederatedHPAInformer(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.AutoscalingV1alpha1().CronFederatedHPAs(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AutoscalingV1alpha1().CronFederatedHPAs(namespace).Watch(context.TODO(), options)
},
},
&autoscalingv1alpha1.CronFederatedHPA{},
resyncPeriod,
indexers,
)
}
func (f *cronFederatedHPAInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredCronFederatedHPAInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *cronFederatedHPAInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&autoscalingv1alpha1.CronFederatedHPA{}, f.defaultInformer)
}
func (f *cronFederatedHPAInformer) Lister() v1alpha1.CronFederatedHPALister {
return v1alpha1.NewCronFederatedHPALister(f.Informer().GetIndexer())
}

View File

@ -8,6 +8,8 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// CronFederatedHPAs returns a CronFederatedHPAInformer.
CronFederatedHPAs() CronFederatedHPAInformer
// FederatedHPAs returns a FederatedHPAInformer.
FederatedHPAs() FederatedHPAInformer
}
@ -23,6 +25,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// CronFederatedHPAs returns a CronFederatedHPAInformer.
func (v *version) CronFederatedHPAs() CronFederatedHPAInformer {
return &cronFederatedHPAInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// FederatedHPAs returns a FederatedHPAInformer.
func (v *version) FederatedHPAs() FederatedHPAInformer {
return &federatedHPAInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View File

@ -44,6 +44,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=autoscaling.karmada.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("cronfederatedhpas"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().CronFederatedHPAs().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("federatedhpas"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().FederatedHPAs().Informer()}, nil

View File

@ -0,0 +1,83 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// CronFederatedHPALister helps list CronFederatedHPAs.
// All objects returned here must be treated as read-only.
type CronFederatedHPALister interface {
// List lists all CronFederatedHPAs in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.CronFederatedHPA, err error)
// CronFederatedHPAs returns an object that can list and get CronFederatedHPAs.
CronFederatedHPAs(namespace string) CronFederatedHPANamespaceLister
CronFederatedHPAListerExpansion
}
// cronFederatedHPALister implements the CronFederatedHPALister interface.
type cronFederatedHPALister struct {
indexer cache.Indexer
}
// NewCronFederatedHPALister returns a new CronFederatedHPALister.
func NewCronFederatedHPALister(indexer cache.Indexer) CronFederatedHPALister {
return &cronFederatedHPALister{indexer: indexer}
}
// List lists all CronFederatedHPAs in the indexer.
func (s *cronFederatedHPALister) List(selector labels.Selector) (ret []*v1alpha1.CronFederatedHPA, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.CronFederatedHPA))
})
return ret, err
}
// CronFederatedHPAs returns an object that can list and get CronFederatedHPAs.
func (s *cronFederatedHPALister) CronFederatedHPAs(namespace string) CronFederatedHPANamespaceLister {
return cronFederatedHPANamespaceLister{indexer: s.indexer, namespace: namespace}
}
// CronFederatedHPANamespaceLister helps list and get CronFederatedHPAs.
// All objects returned here must be treated as read-only.
type CronFederatedHPANamespaceLister interface {
// List lists all CronFederatedHPAs in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.CronFederatedHPA, err error)
// Get retrieves the CronFederatedHPA from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.CronFederatedHPA, error)
CronFederatedHPANamespaceListerExpansion
}
// cronFederatedHPANamespaceLister implements the CronFederatedHPANamespaceLister
// interface.
type cronFederatedHPANamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all CronFederatedHPAs in the indexer for a given namespace.
func (s cronFederatedHPANamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CronFederatedHPA, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.CronFederatedHPA))
})
return ret, err
}
// Get retrieves the CronFederatedHPA from the indexer for a given namespace and name.
func (s cronFederatedHPANamespaceLister) Get(name string) (*v1alpha1.CronFederatedHPA, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("cronfederatedhpa"), name)
}
return obj.(*v1alpha1.CronFederatedHPA), nil
}

View File

@ -2,6 +2,14 @@
package v1alpha1
// CronFederatedHPAListerExpansion allows custom methods to be added to
// CronFederatedHPALister.
type CronFederatedHPAListerExpansion interface{}
// CronFederatedHPANamespaceListerExpansion allows custom methods to be added to
// CronFederatedHPANamespaceLister.
type CronFederatedHPANamespaceListerExpansion interface{}
// FederatedHPAListerExpansion allows custom methods to be added to
// FederatedHPALister.
type FederatedHPAListerExpansion interface{}

View File

@ -17,9 +17,17 @@ import (
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPA": schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPA(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPAList": schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPAList(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPARule": schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPARule(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPASpec": schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPASpec(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPAStatus": schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPAStatus(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.ExecutionHistory": schema_pkg_apis_autoscaling_v1alpha1_ExecutionHistory(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.FailedExecution": schema_pkg_apis_autoscaling_v1alpha1_FailedExecution(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.FederatedHPA": schema_pkg_apis_autoscaling_v1alpha1_FederatedHPA(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.FederatedHPAList": schema_pkg_apis_autoscaling_v1alpha1_FederatedHPAList(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.FederatedHPASpec": schema_pkg_apis_autoscaling_v1alpha1_FederatedHPASpec(ref),
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.SuccessfulExecution": schema_pkg_apis_autoscaling_v1alpha1_SuccessfulExecution(ref),
"github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.APIEnablement": schema_pkg_apis_cluster_v1alpha1_APIEnablement(ref),
"github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.APIResource": schema_pkg_apis_cluster_v1alpha1_APIResource(ref),
"github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.AllocatableModeling": schema_pkg_apis_cluster_v1alpha1_AllocatableModeling(ref),
@ -481,6 +489,344 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
}
}
func schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPA(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronFederatedHPA represents a collection of repeating schedule to scale replica number of a specific workload. It can scale any resource implementing the scale subresource as well as FederatedHPA.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "Spec is the specification of the CronFederatedHPA.",
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPASpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "Status is the current status of the CronFederatedHPA.",
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPAStatus"),
},
},
},
Required: []string{"spec"},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPASpec", "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPAStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPAList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronFederatedHPAList contains a list of CronFederatedHPA.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPA"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPA", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPARule(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronFederatedHPARule declares a schedule as well as scale actions.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"name": {
SchemaProps: spec.SchemaProps{
Description: "Name of the rule. Each rule in a CronFederatedHPA must have a unique name.\n\nNote: the name will be used as an identifier to record its execution history. Changing the name will be considered as deleting the old rule and adding a new rule, that means the original execution history will be discarded.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"schedule": {
SchemaProps: spec.SchemaProps{
Description: "Schedule is the cron expression that represents a periodical time. The syntax follows https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-syntax.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"targetReplicas": {
SchemaProps: spec.SchemaProps{
Description: "TargetReplicas is the target replicas to be scaled for resources referencing by ScaleTargetRef of this CronFederatedHPA. Only needed when referencing resource is not FederatedHPA.",
Type: []string{"integer"},
Format: "int32",
},
},
"targetMinReplicas": {
SchemaProps: spec.SchemaProps{
Description: "TargetMinReplicas is the target MinReplicas to be set for FederatedHPA. Only needed when referencing resource is FederatedHPA. TargetMinReplicas and TargetMaxReplicas can be specified together or either one can be specified alone. nil means the MinReplicas(.spec.minReplicas) of the referencing FederatedHPA will not be updated.",
Type: []string{"integer"},
Format: "int32",
},
},
"targetMaxReplicas": {
SchemaProps: spec.SchemaProps{
Description: "TargetMaxReplicas is the target MaxReplicas to be set for FederatedHPA. Only needed when referencing resource is FederatedHPA. TargetMinReplicas and TargetMaxReplicas can be specified together or either one can be specified alone. nil means the MaxReplicas(.spec.maxReplicas) of the referencing FederatedHPA will not be updated.",
Type: []string{"integer"},
Format: "int32",
},
},
"suspend": {
SchemaProps: spec.SchemaProps{
Description: "Suspend tells the controller to suspend subsequent executions. Defaults to false.",
Type: []string{"boolean"},
Format: "",
},
},
"timeZone": {
SchemaProps: spec.SchemaProps{
Description: "TimeZone for the giving schedule. If not specified, this will default to the time zone of the karmada-controller-manager process. Invalid TimeZone will be rejected when applying by karmada-webhook. see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for the all timezones.",
Type: []string{"string"},
Format: "",
},
},
"successfulHistoryLimit": {
SchemaProps: spec.SchemaProps{
Description: "SuccessfulHistoryLimit represents the count of successful execution items for each rule. The value must be a positive integer. It defaults to 3.",
Type: []string{"integer"},
Format: "int32",
},
},
"failedHistoryLimit": {
SchemaProps: spec.SchemaProps{
Description: "FailedHistoryLimit represents the count of failed execution items for each rule. The value must be a positive integer. It defaults to 3.",
Type: []string{"integer"},
Format: "int32",
},
},
},
Required: []string{"name", "schedule"},
},
},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPASpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronFederatedHPASpec is the specification of the CronFederatedHPA.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"scaleTargetRef": {
SchemaProps: spec.SchemaProps{
Description: "ScaleTargetRef points to the target resource to scale. Target resource could be any resource that implementing the scale subresource like Deployment, or FederatedHPA.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/autoscaling/v2.CrossVersionObjectReference"),
},
},
"rules": {
SchemaProps: spec.SchemaProps{
Description: "Rules contains a collection of schedules that declares when and how the referencing target resource should be scaled.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPARule"),
},
},
},
},
},
},
Required: []string{"scaleTargetRef", "rules"},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.CronFederatedHPARule", "k8s.io/api/autoscaling/v2.CrossVersionObjectReference"},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_CronFederatedHPAStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronFederatedHPAStatus represents the current status of a CronFederatedHPA.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"executionHistories": {
SchemaProps: spec.SchemaProps{
Description: "ExecutionHistories record the execution histories of CronFederatedHPARule.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.ExecutionHistory"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.ExecutionHistory"},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_ExecutionHistory(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ExecutionHistory records the execution history of specific CronFederatedHPARule.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"ruleName": {
SchemaProps: spec.SchemaProps{
Description: "RuleName is the name of the CronFederatedHPARule.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"nextExecutionTime": {
SchemaProps: spec.SchemaProps{
Description: "NextExecutionTime is the next time to execute. Nil means the rule has been suspended.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"successfulExecutions": {
SchemaProps: spec.SchemaProps{
Description: "SuccessfulExecutions records successful executions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.SuccessfulExecution"),
},
},
},
},
},
"failedExecutions": {
SchemaProps: spec.SchemaProps{
Description: "FailedExecutions records failed executions.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.FailedExecution"),
},
},
},
},
},
},
Required: []string{"ruleName"},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.FailedExecution", "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1.SuccessfulExecution", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_FailedExecution(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "FailedExecution records a failed execution.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"scheduleTime": {
SchemaProps: spec.SchemaProps{
Description: "ScheduleTime is the expected execution time declared in CronFederatedHPARule.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"executionTime": {
SchemaProps: spec.SchemaProps{
Description: "ExecutionTime is the actual execution time of CronFederatedHPARule. Tasks may not always be executed at ScheduleTime. ExecutionTime is used to evaluate the efficiency of the controller's execution.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "Message is the human-readable message indicating details about the failure.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"scheduleTime", "executionTime", "message"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_autoscaling_v1alpha1_FederatedHPA(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -638,6 +984,55 @@ func schema_pkg_apis_autoscaling_v1alpha1_FederatedHPASpec(ref common.ReferenceC
}
}
func schema_pkg_apis_autoscaling_v1alpha1_SuccessfulExecution(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "SuccessfulExecution records a successful execution.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"scheduleTime": {
SchemaProps: spec.SchemaProps{
Description: "ScheduleTime is the expected execution time declared in CronFederatedHPARule.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"executionTime": {
SchemaProps: spec.SchemaProps{
Description: "ExecutionTime is the actual execution time of CronFederatedHPARule. Tasks may not always be executed at ScheduleTime. ExecutionTime is used to evaluate the efficiency of the controller's execution.",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"appliedReplicas": {
SchemaProps: spec.SchemaProps{
Description: "AppliedReplicas is the replicas have been applied. It is required if .spec.rules[*].targetReplicas is not empty.",
Type: []string{"integer"},
Format: "int32",
},
},
"appliedMaxReplicas": {
SchemaProps: spec.SchemaProps{
Description: "AppliedMaxReplicas is the MaxReplicas have been applied. It is required if .spec.rules[*].targetMaxReplicas is not empty.",
Type: []string{"integer"},
Format: "int32",
},
},
"appliedMinReplicas": {
SchemaProps: spec.SchemaProps{
Description: "AppliedMinReplicas is the MinReplicas have been applied. It is required if .spec.rules[*].targetMinReplicas is not empty.",
Type: []string{"integer"},
Format: "int32",
},
},
},
Required: []string{"scheduleTime", "executionTime"},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
func schema_pkg_apis_cluster_v1alpha1_APIEnablement(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{