diff --git a/examples/autoscaling/cron-portrait-sample.yaml b/examples/autoscaling/cron-portrait-sample.yaml deleted file mode 100644 index 9b93910..0000000 --- a/examples/autoscaling/cron-portrait-sample.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: autoscaling.kapacitystack.io/v1alpha1 -kind: IntelligentHorizontalPodAutoscaler -metadata: - name: cron-portrait-sample -spec: - paused: false - minReplicas: 0 - maxReplicas: 10 - portraitProviders: - - type: Cron - priority: 0 - cron: - crons: - - name: "cron-1" - start: "0 * * * *" - end: "10 * * * *" - replicas: 1 - - name: "cron-2" - start: "10 * * * *" - end: "20 * * * *" - replicas: 2 - - name: "cron-3" - start: "20 * * * *" - end: "30 * * * *" - replicas: 3 - - name: "cron-4" - start: "30 * * * *" - end: "40 * * * *" - replicas: 4 - - name: "cron-5" - start: "40 * * * *" - end: "50 * * * *" - replicas: 5 - scaleTargetRef: - kind: StatefulSet - name: nginx - apiVersion: apps/v1 \ No newline at end of file diff --git a/examples/autoscaling/dynamic-portrait-reactive-sample.yaml b/examples/autoscaling/dynamic-portrait-reactive-sample.yaml deleted file mode 100644 index a20ed7a..0000000 --- a/examples/autoscaling/dynamic-portrait-reactive-sample.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: autoscaling.kapacitystack.io/v1alpha1 -kind: IntelligentHorizontalPodAutoscaler -metadata: - name: dynamic-portrait-reactive-sample -spec: - paused: false - minReplicas: 0 - maxReplicas: 10 - portraitProviders: - - type: Dynamic - priority: 0 - dynamic: - portraitType: Reactive - metrics: - - name: metrics-scale-out - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 30 - algorithm: - type: KubeHPA - scaleTargetRef: - kind: StatefulSet - name: nginx - apiVersion: apps/v1 \ No newline at end of file diff --git a/examples/autoscaling/static-portrait-sample.yaml b/examples/autoscaling/static-portrait-sample.yaml deleted file mode 100644 index a1d4b09..0000000 --- a/examples/autoscaling/static-portrait-sample.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: autoscaling.kapacitystack.io/v1alpha1 -kind: IntelligentHorizontalPodAutoscaler -metadata: - name: static-portrait-sample -spec: - paused: false - minReplicas: 0 - maxReplicas: 10 - portraitProviders: - - type: Static - priority: 0 - static: - replicas: 2 - scaleTargetRef: - kind: StatefulSet - name: nginx - apiVersion: apps/v1 \ No newline at end of file diff --git a/examples/kapacity-deploy.yaml b/examples/kapacity-deploy.yaml deleted file mode 100644 index a7e2594..0000000 --- a/examples/kapacity-deploy.yaml +++ /dev/null @@ -1,2506 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: system - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: namespace - app.kubernetes.io/part-of: kapacity - control-plane: controller-manager - name: kapacity-system ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null - name: horizontalportraits.autoscaling.kapacitystack.io -spec: - group: autoscaling.kapacitystack.io - names: - kind: HorizontalPortrait - listKind: HorizontalPortraitList - plural: horizontalportraits - shortNames: - - hp - singular: horizontalportrait - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: HorizontalPortrait represents a horizontal portrait (the expectation of replicas) of a scale target with metrics and algorithm configurations that are used to generate the portrait. - 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: HorizontalPortraitSpec defines the desired state of HorizontalPortrait. - properties: - algorithm: - description: Algorithm is the algorithm for which to use to generate the portrait. - properties: - config: - additionalProperties: - type: string - description: 'Config is the general configuration data for arbitrary algorithm those used by external user-defined portraits. TODO: consider if we can make it structural' - type: object - kubeHPA: - description: KubeHPA is the configuration for KubeHPA algorithm. - properties: - cpuInitializationPeriod: - default: 5m - description: CPUInitializationPeriod is the period after pod start when CPU samples might be skipped. - type: string - initialReadinessDelay: - default: 30s - description: InitialReadinessDelay is period after pod start during which readiness changes are treated as readiness being set for the first time. The only effect of this is that HPA will disregard CPU samples from unready pods that had last readiness change during that period. - type: string - syncPeriod: - default: 15s - description: SyncPeriod is the period for syncing the portrait. - type: string - tolerance: - default: "0.1" - description: Tolerance is the tolerance for when resource usage suggests upscaling/downscaling. Should be a string formatted float64 number. - type: string - type: object - type: - description: Type is the type of algorithm. - type: string - required: - - type - type: object - metrics: - description: Metrics contains the specifications for which to use to generate the portrait. - items: - description: MetricSpec represents the configuration for a single metric. It is an extended autoscalingv2.MetricSpec. - properties: - containerResource: - description: containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. - properties: - container: - description: container is the name of the container in the pods of the scaling target - type: string - name: - description: name is the name of the resource in question. - type: string - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - container - - name - - target - type: object - external: - description: external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). - properties: - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - metric - - target - type: object - name: - description: Name is the name of this metric. It must be unique across all metrics. - type: string - object: - description: object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). - properties: - describedObject: - description: describedObject specifies the descriptions of a object,such as kind,name apiVersion - 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 - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - describedObject - - metric - - target - type: object - operator: - description: Operator is an optional binary arithmetic operator which is used to specify a custom comparison rule " " for the metric. Note that not all use cases support this. - enum: - - == - - '>' - - < - - '>=' - - <= - type: string - pods: - description: pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value. - properties: - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - metric - - target - type: object - resource: - description: resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. - properties: - name: - description: name is the name of the resource in question. - type: string - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - name - - target - type: object - type: - description: 'type is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled' - type: string - required: - - name - - type - type: object - type: array - portraitType: - description: PortraitType is the type of portrait. Different type has different portrait generating logic. - type: string - scaleTargetRef: - description: ScaleTargetRef points to the target resource to scale. - 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: - - algorithm - - portraitType - - scaleTargetRef - type: object - status: - description: HorizontalPortraitStatus defines the observed state of HorizontalPortrait. - properties: - conditions: - description: Conditions represents current conditions of the HorizontalPortrait. - items: - description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - 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 - portraitData: - description: PortraitData is the data of generated portrait. - properties: - cron: - description: Cron refers to cron portrait data. - properties: - crons: - description: Crons contains cron rule based replicas values. - items: - description: ReplicaCron defines the cron rule for a desired replicas value. - properties: - description: - description: Description is an additional description of this cron rule. - type: string - end: - description: End is the cron of time to which the rule takes effect. It must be a valid standard cron expression. - type: string - name: - description: Name is the name of this cron rule. It must be unique across all rules. - type: string - replicas: - description: Replicas is the desired number of online replicas within this cron rule. - format: int32 - minimum: 0 - type: integer - start: - description: Start is the cron of time from which the rule takes effect. It must be a valid standard cron expression. - type: string - timeZone: - default: UTC - description: TimeZone is the time zone in which the cron would run. Defaults to UTC. - type: string - required: - - end - - name - - replicas - - start - type: object - minItems: 1 - type: array - required: - - crons - type: object - expireTime: - description: ExpireTime indicates when this portrait data will expire. - format: date-time - type: string - static: - description: Static refers to static portrait data. - properties: - replicas: - description: Replicas is the desired number of online replicas. - format: int32 - minimum: 0 - type: integer - required: - - replicas - type: object - timeSeries: - description: TimeSeries refers to time series portrait data. - properties: - timeSeries: - description: TimeSeries is time series of replicas. The points of the series MUST be ordered by time. The specified replicas would take effect from that point to the next point. Thus, the last point could last forever until the whole portrait data become expired. - items: - description: ReplicaTimeSeriesPoint represents a specific point of the time series of replicas. - properties: - replicas: - description: Replicas is the desired number of online replicas from this point. - format: int32 - minimum: 0 - type: integer - timestamp: - description: Timestamp is the unix time stamp of this point. - format: int64 - minimum: 0 - type: integer - required: - - replicas - - timestamp - type: object - minItems: 1 - type: array - required: - - timeSeries - type: object - type: - description: Type is the type of this portrait data. - enum: - - Static - - Cron - - TimeSeries - type: string - required: - - type - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null - name: intelligenthorizontalpodautoscalers.autoscaling.kapacitystack.io -spec: - group: autoscaling.kapacitystack.io - names: - kind: IntelligentHorizontalPodAutoscaler - listKind: IntelligentHorizontalPodAutoscalerList - plural: intelligenthorizontalpodautoscalers - shortNames: - - ihpa - singular: intelligenthorizontalpodautoscaler - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: IntelligentHorizontalPodAutoscaler is the configuration for an intelligent horizontal pod autoscaler, which automatically manages the replica count of the target workload based on the horizontal portraits provided by specified portrait providers. - 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: IntelligentHorizontalPodAutoscalerSpec defines the desired state of IntelligentHorizontalPodAutoscaler. - properties: - behavior: - description: Behavior configures the scaling behavior of the autoscaler. - properties: - replicaProfile: - description: ReplicaProfile is used to configure the behavior of the underlying ReplicaProfile. - properties: - podSorter: - default: - type: WorkloadDefault - description: PodSorter is used to decide the priority of pods when scaling. If not set, default pod sorter will be set to WorkloadDefault. - properties: - external: - description: External refers to a user specified external pod sorter. - properties: - config: - additionalProperties: - type: string - description: Config is used to pass arbitrary config data to the sorter. - type: object - name: - description: Name is the name of the sorter. It must be unique across all external pod sorters of the ReplicaProfile. - type: string - required: - - name - type: object - type: - default: WorkloadDefault - description: Type is the type of pod sorter. It defaults to WorkloadDefault. - enum: - - WorkloadDefault - - External - type: string - type: object - podTrafficController: - default: - type: ReadinessGate - description: PodTrafficController is used to control pod traffic when scaling. If not set, default pod traffic controller will be set to ReadinessGate. - properties: - external: - description: External refers to a user specified external pod traffic controller. - properties: - config: - additionalProperties: - type: string - description: Config is used to pass arbitrary config to the controller. - type: object - name: - description: Name is the name of the controller. It must be unique across all external pod traffic controllers of the ReplicaProfile. - type: string - required: - - name - type: object - type: - default: ReadinessGate - description: Type is the type of pod traffic controller. It defaults to ReadinessGate. - enum: - - ReadinessGate - - External - type: string - type: object - type: object - scaleDown: - description: ScaleDown is the behavior configuration for scaling down. - properties: - grayStrategy: - description: GrayStrategy is the configuration of the strategy for gray change of replicas. If not set, gray change will be disabled. - properties: - changeIntervalSeconds: - description: ChangeIntervalSeconds is the interval time between each gray change. - format: int32 - minimum: 1 - type: integer - changePercent: - description: ChangePercent is the percentage of the total change of replica numbers which is used to calculate the amount of pods to change in each gray change. - format: int32 - maximum: 100 - minimum: 1 - type: integer - grayState: - description: GrayState is the desired state of pods that in gray stage. For scaling up, it can only be set to "Online". For scaling down, it can either be set to "Cutoff", "Standby" or "Deleted". - enum: - - Online - - Cutoff - - Standby - - Deleted - type: string - observationSeconds: - description: ObservationSeconds is the additional observation time after the gray change reaching 100%. During the observation time, all pods that in gray stage would be kept in GrayState and the stability ensurance mechanism for the gray change would continue to take effect. If not set, the gray change will not have observation time. - format: int32 - minimum: 0 - type: integer - required: - - changeIntervalSeconds - - changePercent - - grayState - type: object - type: object - scaleUp: - description: ScaleUp is the behavior configuration for scaling up. - properties: - grayStrategy: - description: GrayStrategy is the configuration of the strategy for gray change of replicas. If not set, gray change will be disabled. - properties: - changeIntervalSeconds: - description: ChangeIntervalSeconds is the interval time between each gray change. - format: int32 - minimum: 1 - type: integer - changePercent: - description: ChangePercent is the percentage of the total change of replica numbers which is used to calculate the amount of pods to change in each gray change. - format: int32 - maximum: 100 - minimum: 1 - type: integer - grayState: - description: GrayState is the desired state of pods that in gray stage. For scaling up, it can only be set to "Online". For scaling down, it can either be set to "Cutoff", "Standby" or "Deleted". - enum: - - Online - - Cutoff - - Standby - - Deleted - type: string - observationSeconds: - description: ObservationSeconds is the additional observation time after the gray change reaching 100%. During the observation time, all pods that in gray stage would be kept in GrayState and the stability ensurance mechanism for the gray change would continue to take effect. If not set, the gray change will not have observation time. - format: int32 - minimum: 0 - type: integer - required: - - changeIntervalSeconds - - changePercent - - grayState - type: object - type: object - type: object - maxReplicas: - description: MaxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less than MinReplicas. - format: int32 - minimum: 0 - type: integer - minReplicas: - description: MinReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. - format: int32 - minimum: 0 - type: integer - paused: - description: Paused means if the autoscaler is paused. - type: boolean - portraitProviders: - description: PortraitProviders contains configurations of portrait providers that are used to generate horizontal portraits for the scale target. - items: - description: HorizontalPortraitProvider defines a specific horizontal portrait provider. - properties: - cron: - description: Cron is the configuration for cron horizontal portrait provider. - properties: - crons: - description: Crons contains cron rule based replicas values. - items: - description: ReplicaCron defines the cron rule for a desired replicas value. - properties: - description: - description: Description is an additional description of this cron rule. - type: string - end: - description: End is the cron of time to which the rule takes effect. It must be a valid standard cron expression. - type: string - name: - description: Name is the name of this cron rule. It must be unique across all rules. - type: string - replicas: - description: Replicas is the desired number of online replicas within this cron rule. - format: int32 - minimum: 0 - type: integer - start: - description: Start is the cron of time from which the rule takes effect. It must be a valid standard cron expression. - type: string - timeZone: - default: UTC - description: TimeZone is the time zone in which the cron would run. Defaults to UTC. - type: string - required: - - end - - name - - replicas - - start - type: object - minItems: 1 - type: array - required: - - crons - type: object - dynamic: - description: Dynamic is the configuration for dynamic horizontal portrait provider. Note that the PortraitType must be unique across all dynamic horizontal portrait providers of the autoscaler. - properties: - algorithm: - description: Algorithm is the algorithm for which to use to generate the portrait. - properties: - config: - additionalProperties: - type: string - description: 'Config is the general configuration data for arbitrary algorithm those used by external user-defined portraits. TODO: consider if we can make it structural' - type: object - kubeHPA: - description: KubeHPA is the configuration for KubeHPA algorithm. - properties: - cpuInitializationPeriod: - default: 5m - description: CPUInitializationPeriod is the period after pod start when CPU samples might be skipped. - type: string - initialReadinessDelay: - default: 30s - description: InitialReadinessDelay is period after pod start during which readiness changes are treated as readiness being set for the first time. The only effect of this is that HPA will disregard CPU samples from unready pods that had last readiness change during that period. - type: string - syncPeriod: - default: 15s - description: SyncPeriod is the period for syncing the portrait. - type: string - tolerance: - default: "0.1" - description: Tolerance is the tolerance for when resource usage suggests upscaling/downscaling. Should be a string formatted float64 number. - type: string - type: object - type: - description: Type is the type of algorithm. - type: string - required: - - type - type: object - metrics: - description: Metrics contains the specifications for which to use to generate the portrait. - items: - description: MetricSpec represents the configuration for a single metric. It is an extended autoscalingv2.MetricSpec. - properties: - containerResource: - description: containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. - properties: - container: - description: container is the name of the container in the pods of the scaling target - type: string - name: - description: name is the name of the resource in question. - type: string - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - container - - name - - target - type: object - external: - description: external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). - properties: - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - metric - - target - type: object - name: - description: Name is the name of this metric. It must be unique across all metrics. - type: string - object: - description: object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). - properties: - describedObject: - description: describedObject specifies the descriptions of a object,such as kind,name apiVersion - 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 - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - describedObject - - metric - - target - type: object - operator: - description: Operator is an optional binary arithmetic operator which is used to specify a custom comparison rule " " for the metric. Note that not all use cases support this. - enum: - - == - - '>' - - < - - '>=' - - <= - type: string - pods: - description: pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value. - properties: - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - metric - - target - type: object - resource: - description: resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. - properties: - name: - description: name is the name of the resource in question. - type: string - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - name - - target - type: object - type: - description: 'type is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled' - type: string - required: - - name - - type - type: object - type: array - portraitType: - description: PortraitType is the type of portrait. Different type has different portrait generating logic. - type: string - required: - - algorithm - - portraitType - type: object - priority: - description: Priority is the priority of the horizontal portrait generated by this provider. A valid portrait with higher priority overrides ones with lower priority. The bigger the number, the higher the priority. If multiple portraits have the same priority, the one which desires most replicas at current time would override the other ones. - format: int32 - type: integer - static: - description: Static is the configuration for static horizontal portrait provider. - properties: - replicas: - description: Replicas is the desired number of online replicas. - format: int32 - minimum: 0 - type: integer - required: - - replicas - type: object - type: - description: Type is the type of the horizontal portrait provider. - enum: - - Static - - Cron - - Dynamic - type: string - required: - - priority - - type - type: object - type: array - scaleMode: - default: Auto - description: ScaleMode is the scaling mode of the autoscaler. - enum: - - Auto - - Preview - type: string - scaleTargetRef: - description: ScaleTargetRef points to the target resource to scale. - 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 - stabilityCheckers: - description: 'StabilityCheckers contains configurations of stability checkers that are used to ensure stability during autoscaling. TODO: reconsider the place of this field' - items: - description: StabilityChecker defines a stability checker which is used to ensure stability during autoscaling. - properties: - coolDownSeconds: - description: CoolDownSeconds is the cooldown time after the checker no longer detects anomalies after which the autoscaling process will resume normal. - format: int32 - minimum: 0 - type: integer - external: - description: External is the configuration for external stability checker. - properties: - config: - additionalProperties: - type: string - description: Config is used to pass arbitrary config to the checker. - type: object - name: - description: Name is the name of the checker. It must be unique across all external stability checkers of the autoscaler. - type: string - required: - - name - type: object - metrics: - description: Metrics is the configuration for metrics stability checker. - properties: - metrics: - description: Metrics contains metrics rules of the checker. - items: - description: MetricSpec represents the configuration for a single metric. It is an extended autoscalingv2.MetricSpec. - properties: - containerResource: - description: containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag. - properties: - container: - description: container is the name of the container in the pods of the scaling target - type: string - name: - description: name is the name of the resource in question. - type: string - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - container - - name - - target - type: object - external: - description: external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). - properties: - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - metric - - target - type: object - name: - description: Name is the name of this metric. It must be unique across all metrics. - type: string - object: - description: object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object). - properties: - describedObject: - description: describedObject specifies the descriptions of a object,such as kind,name apiVersion - 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 - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - describedObject - - metric - - target - type: object - operator: - description: Operator is an optional binary arithmetic operator which is used to specify a custom comparison rule " " for the metric. Note that not all use cases support this. - enum: - - == - - '>' - - < - - '>=' - - <= - type: string - pods: - description: pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value. - properties: - metric: - description: metric identifies the target metric by name and selector - properties: - name: - description: name is the name of the given metric - type: string - selector: - description: selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - properties: - key: - description: key is the label key that the selector applies to. - type: string - operator: - description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - required: - - name - type: object - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - metric - - target - type: object - resource: - description: resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. - properties: - name: - description: name is the name of the resource in question. - type: string - target: - description: target specifies the target value for the given metric - properties: - averageUtilization: - description: averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type - format: int32 - type: integer - averageValue: - anyOf: - - type: integer - - type: string - description: averageValue is the target value of the average of the metric across all relevant pods (as a quantity) - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: - description: type represents whether the metric type is Utilization, Value, or AverageValue - type: string - value: - anyOf: - - type: integer - - type: string - description: value is the target value of the metric (as a quantity). - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - required: - - type - type: object - required: - - name - - target - type: object - type: - description: 'type is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. Note: "ContainerResource" type is available on when the feature-gate HPAContainerMetrics is enabled' - type: string - required: - - name - - type - type: object - minItems: 1 - type: array - required: - - metrics - type: object - stabilizationAction: - description: StabilizationAction is the action to perform in order to ensure stability when the checker detects anomalies. - enum: - - Pause - - Rollback - type: string - type: - description: Type is the type of stability checker. - enum: - - Metrics - - External - type: string - required: - - stabilizationAction - - type - type: object - type: array - required: - - maxReplicas - - minReplicas - - portraitProviders - - scaleTargetRef - type: object - status: - description: IntelligentHorizontalPodAutoscalerStatus defines the observed state of IntelligentHorizontalPodAutoscaler. - properties: - conditions: - description: Conditions represents current conditions of the IntelligentHorizontalPodAutoscaler. - items: - description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - 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 - currentPortraitValue: - description: CurrentPortraitValue is the current valid portrait value produced by portrait providers. - properties: - expireTime: - description: ExpireTime indicates when this portrait value will expire. - format: date-time - type: string - provider: - description: Provider is the unique identification of the provider of the portrait from which this value is produced. - type: string - replicas: - description: Replicas is the desired number of online replicas. - format: int32 - minimum: 0 - type: integer - required: - - provider - - replicas - type: object - gray: - description: Gray represents the current gray status of replicas change. - properties: - grayPercent: - description: GrayPercent is the current gray percentage of the total change. - format: int32 - maximum: 100 - minimum: 0 - type: integer - lastUpdateTime: - description: LastUpdateTime is the last update time of GrayPercent. - format: date-time - type: string - required: - - grayPercent - - lastUpdateTime - type: object - previousPortraitValue: - description: PreviousPortraitValue is the last valid portrait value produced by portrait providers. - properties: - expireTime: - description: ExpireTime indicates when this portrait value will expire. - format: date-time - type: string - provider: - description: Provider is the unique identification of the provider of the portrait from which this value is produced. - type: string - replicas: - description: Replicas is the desired number of online replicas. - format: int32 - minimum: 0 - type: integer - required: - - provider - - replicas - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null - name: replicaprofiles.autoscaling.kapacitystack.io -spec: - group: autoscaling.kapacitystack.io - names: - kind: ReplicaProfile - listKind: ReplicaProfileList - plural: replicaprofiles - shortNames: - - rp - singular: replicaprofile - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: ReplicaProfile controls the number and state of replicas of the target workload. It is used by IntelligentHorizontalPodAutoscaler to do actual workload scaling. - 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: ReplicaProfileSpec defines the desired state of ReplicaProfile. - properties: - behavior: - default: - podSorter: - type: WorkloadDefault - podTrafficController: - type: ReadinessGate - description: Behavior configures the behavior of ReplicaProfile. If not set, default behavior will be set. - properties: - podSorter: - default: - type: WorkloadDefault - description: PodSorter is used to decide the priority of pods when scaling. If not set, default pod sorter will be set to WorkloadDefault. - properties: - external: - description: External refers to a user specified external pod sorter. - properties: - config: - additionalProperties: - type: string - description: Config is used to pass arbitrary config data to the sorter. - type: object - name: - description: Name is the name of the sorter. It must be unique across all external pod sorters of the ReplicaProfile. - type: string - required: - - name - type: object - type: - default: WorkloadDefault - description: Type is the type of pod sorter. It defaults to WorkloadDefault. - enum: - - WorkloadDefault - - External - type: string - type: object - podTrafficController: - default: - type: ReadinessGate - description: PodTrafficController is used to control pod traffic when scaling. If not set, default pod traffic controller will be set to ReadinessGate. - properties: - external: - description: External refers to a user specified external pod traffic controller. - properties: - config: - additionalProperties: - type: string - description: Config is used to pass arbitrary config to the controller. - type: object - name: - description: Name is the name of the controller. It must be unique across all external pod traffic controllers of the ReplicaProfile. - type: string - required: - - name - type: object - type: - default: ReadinessGate - description: Type is the type of pod traffic controller. It defaults to ReadinessGate. - enum: - - ReadinessGate - - External - type: string - type: object - type: object - cutoffReplicas: - description: CutoffReplicas is the desired number of cutoff replicas. - format: int32 - minimum: 0 - type: integer - onlineReplicas: - description: OnlineReplicas is the desired number of online replicas. - format: int32 - minimum: 0 - type: integer - paused: - description: Paused means if the replica control is paused. - type: boolean - scaleTargetRef: - description: ScaleTargetRef points to the target resource to scale. - 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 - standbyReplicas: - description: StandbyReplicas is the desired number of standby replicas. - format: int32 - minimum: 0 - type: integer - required: - - scaleTargetRef - type: object - status: - description: ReplicaProfileStatus defines the observed state of ReplicaProfile. - properties: - conditions: - description: Conditions represents current conditions of the ReplicaProfile. - items: - description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - 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 - cutoffReplicas: - description: CutoffReplicas is the current number of cutoff replicas. - format: int32 - minimum: 0 - type: integer - onlineReplicas: - description: OnlineReplicas is the current number of online replicas. - format: int32 - minimum: 0 - type: integer - standbyReplicas: - description: StandbyReplicas is the current number of standby replicas. - format: int32 - minimum: 0 - type: integer - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app.kuberentes.io/instance: controller-manager - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: serviceaccount - app.kubernetes.io/part-of: kapacity - name: kapacity-controller-manager - namespace: kapacity-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: leader-election-role - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: role - app.kubernetes.io/part-of: kapacity - name: kapacity-leader-election-role - namespace: kapacity-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - get - - list - - watch - - create - - update - - patch - - delete -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - creationTimestamp: null - name: kapacity-manager-role -rules: -- apiGroups: - - "" - resources: - - events - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - "" - resources: - - pods - verbs: - - get - - list - - patch - - watch -- apiGroups: - - "" - resources: - - pods/status - verbs: - - get - - patch -- apiGroups: - - '*' - resources: - - '*/scale' - verbs: - - get - - update -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - horizontalportraits - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - horizontalportraits/finalizers - verbs: - - update -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - horizontalportraits/status - verbs: - - get - - patch - - update -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - intelligenthorizontalpodautoscalers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - intelligenthorizontalpodautoscalers/finalizers - verbs: - - update -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - intelligenthorizontalpodautoscalers/status - verbs: - - get - - patch - - update -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - replicaprofiles - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - replicaprofiles/finalizers - verbs: - - update -- apiGroups: - - autoscaling.kapacitystack.io - resources: - - replicaprofiles/status - verbs: - - get - - patch - - update -- apiGroups: - - custom.metrics.k8s.io - resources: - - '*' - verbs: - - get - - list - - watch -- apiGroups: - - external.metrics.k8s.io - resources: - - '*' - verbs: - - get - - list - - watch -- apiGroups: - - metrics.k8s.io - resources: - - '*' - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: metrics-reader - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: clusterrole - app.kubernetes.io/part-of: kapacity - name: kapacity-metrics-reader -rules: -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: proxy-role - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: clusterrole - app.kubernetes.io/part-of: kapacity - name: kapacity-proxy-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: leader-election-rolebinding - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: rolebinding - app.kubernetes.io/part-of: kapacity - name: kapacity-leader-election-rolebinding - namespace: kapacity-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: kapacity-leader-election-role -subjects: -- kind: ServiceAccount - name: kapacity-controller-manager - namespace: kapacity-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: manager-rolebinding - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: clusterrolebinding - app.kubernetes.io/part-of: kapacity - name: kapacity-manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: kapacity-manager-role -subjects: -- kind: ServiceAccount - name: kapacity-controller-manager - namespace: kapacity-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: proxy-rolebinding - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: clusterrolebinding - app.kubernetes.io/part-of: kapacity - name: kapacity-proxy-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: kapacity-proxy-role -subjects: -- kind: ServiceAccount - name: kapacity-controller-manager - namespace: kapacity-system ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: controller-manager-metrics-service - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: service - app.kubernetes.io/part-of: kapacity - control-plane: controller-manager - name: kapacity-controller-manager-metrics-service - namespace: kapacity-system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - control-plane: controller-manager ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: project-v3 - app.kubernetes.io/instance: webhook-service - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: service - app.kubernetes.io/part-of: project-v3 - name: kapacity-webhook-service - namespace: kapacity-system -spec: - ports: - - port: 443 - protocol: TCP - targetPort: 9443 - selector: - control-plane: controller-manager ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/component: manager - app.kubernetes.io/created-by: kapacity - app.kubernetes.io/instance: controller-manager - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: deployment - app.kubernetes.io/part-of: kapacity - control-plane: controller-manager - name: kapacity-controller-manager - namespace: kapacity-system -spec: - replicas: 1 - selector: - matchLabels: - control-plane: controller-manager - template: - metadata: - annotations: - kubectl.kubernetes.io/default-container: manager - labels: - control-plane: controller-manager - spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/arch - operator: In - values: - - amd64 - - arm64 - - ppc64le - - s390x - - key: kubernetes.io/os - operator: In - values: - - linux - containers: - - args: - - --secure-listen-address=0.0.0.0:8443 - - --upstream=http://127.0.0.1:8080/ - - --logtostderr=true - - --v=0 - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0 - name: kube-rbac-proxy - ports: - - containerPort: 8443 - name: https - protocol: TCP - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 5m - memory: 64Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - - args: - - --health-probe-bind-address=:8081 - - --metrics-bind-address=127.0.0.1:8080 - - --leader-elect - command: - - /manager - image: kapacity:v0.2 - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - name: manager - ports: - - containerPort: 9443 - name: webhook-server - protocol: TCP - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: - limits: - cpu: 500m - memory: 128Mi - requests: - cpu: 10m - memory: 64Mi - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - volumeMounts: - - mountPath: /tmp/k8s-webhook-server/serving-certs - name: webhook-cert - readOnly: true - securityContext: - runAsNonRoot: true - serviceAccountName: kapacity-controller-manager - terminationGracePeriodSeconds: 10 - volumes: - - name: webhook-cert - secret: - defaultMode: 420 - secretName: webhook-server-cert ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - labels: - app.kubernetes.io/component: certificate - app.kubernetes.io/created-by: project-v3 - app.kubernetes.io/instance: serving-cert - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: certificate - app.kubernetes.io/part-of: project-v3 - name: kapacity-serving-cert - namespace: kapacity-system -spec: - dnsNames: - - kapacity-webhook-service.kapacity-system.svc - - kapacity-webhook-service.kapacity-system.svc.cluster.local - issuerRef: - kind: Issuer - name: kapacity-selfsigned-issuer - secretName: webhook-server-cert ---- -apiVersion: cert-manager.io/v1 -kind: Issuer -metadata: - labels: - app.kubernetes.io/component: certificate - app.kubernetes.io/created-by: project-v3 - app.kubernetes.io/instance: selfsigned-issuer - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: issuer - app.kubernetes.io/part-of: project-v3 - name: kapacity-selfsigned-issuer - namespace: kapacity-system -spec: - selfSigned: {} ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - annotations: - cert-manager.io/inject-ca-from: kapacity-system/kapacity-serving-cert - labels: - app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: project-v3 - app.kubernetes.io/instance: mutating-webhook-configuration - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/name: mutatingwebhookconfiguration - app.kubernetes.io/part-of: project-v3 - name: kapacity-mutating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - - v1beta1 - clientConfig: - service: - name: kapacity-webhook-service - namespace: kapacity-system - path: /mutate-v1-pod - failurePolicy: Fail - name: mpod.kb.io - namespaceSelector: - matchExpressions: - - key: kubernetes.io/metadata.name - operator: NotIn - values: - - kapacity-system - rules: - - apiGroups: - - "" - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - pods - - pods/status - sideEffects: None diff --git a/examples/metrics-server.yaml b/examples/metrics-server.yaml deleted file mode 100644 index 9db5c41..0000000 --- a/examples/metrics-server.yaml +++ /dev/null @@ -1,196 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - k8s-app: metrics-server - rbac.authorization.k8s.io/aggregate-to-admin: "true" - rbac.authorization.k8s.io/aggregate-to-edit: "true" - rbac.authorization.k8s.io/aggregate-to-view: "true" - name: system:aggregated-metrics-reader -rules: - - apiGroups: - - metrics.k8s.io - resources: - - pods - - nodes - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - k8s-app: metrics-server - name: system:metrics-server -rules: - - apiGroups: - - "" - resources: - - nodes/metrics - verbs: - - get - - apiGroups: - - "" - resources: - - pods - - nodes - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - k8s-app: metrics-server - name: metrics-server-auth-reader - namespace: kube-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: extension-apiserver-authentication-reader -subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - k8s-app: metrics-server - name: metrics-server:system:auth-delegator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:auth-delegator -subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - k8s-app: metrics-server - name: system:metrics-server -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:metrics-server -subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: v1 -kind: Service -metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system -spec: - ports: - - name: https - port: 443 - protocol: TCP - targetPort: https - selector: - k8s-app: metrics-server ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system -spec: - selector: - matchLabels: - k8s-app: metrics-server - strategy: - rollingUpdate: - maxUnavailable: 0 - template: - metadata: - labels: - k8s-app: metrics-server - spec: - containers: - - args: - - --cert-dir=/tmp - - --secure-port=4443 - - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname - - --kubelet-insecure-tls - - --metric-resolution=15s - image: registry.k8s.io/metrics-server/metrics-server:v0.6.3 - imagePullPolicy: IfNotPresent - livenessProbe: - failureThreshold: 3 - httpGet: - path: /livez - port: https - scheme: HTTPS - periodSeconds: 10 - name: metrics-server - ports: - - containerPort: 4443 - name: https - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /readyz - port: https - scheme: HTTPS - initialDelaySeconds: 20 - periodSeconds: 10 - resources: - requests: - cpu: 100m - memory: 200Mi - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - volumeMounts: - - mountPath: /tmp - name: tmp-dir - nodeSelector: - kubernetes.io/os: linux - priorityClassName: system-cluster-critical - serviceAccountName: metrics-server - volumes: - - emptyDir: {} - name: tmp-dir ---- -apiVersion: apiregistration.k8s.io/v1 -kind: APIService -metadata: - labels: - k8s-app: metrics-server - name: v1beta1.metrics.k8s.io -spec: - group: metrics.k8s.io - groupPriorityMinimum: 100 - insecureSkipTLSVerify: true - service: - name: metrics-server - namespace: kube-system - version: v1beta1 - versionPriority: 100 diff --git a/examples/nginx-deployment.yaml b/examples/nginx-deployment.yaml deleted file mode 100644 index 70c1b82..0000000 --- a/examples/nginx-deployment.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx -spec: - selector: - matchLabels: - app: nginx - replicas: 2 # tells deployment to run 2 pods matching the template - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 \ No newline at end of file diff --git a/examples/nginx-statefulset.yaml b/examples/nginx-statefulset.yaml deleted file mode 100644 index db8c27b..0000000 --- a/examples/nginx-statefulset.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: nginx - labels: - app: nginx -spec: - ports: - - port: 80 - name: nginx - clusterIP: None - selector: - app: nginx ---- -apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1 -kind: StatefulSet -metadata: - name: nginx - labels: - app: nginx -spec: - serviceName: "nginx" - selector: - matchLabels: - app: nginx - replicas: 1 - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 \ No newline at end of file