feat: add Vertical Pod Autoscaler components and scripts for deployment
Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
parent
c37b289bbd
commit
4bb5d6ee38
@ -0,0 +1,61 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vpa-admission-controller
|
||||
namespace: freeleaps-infra-system
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: vpa-admission-controller
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: vpa-admission-controller
|
||||
spec:
|
||||
serviceAccountName: vpa-admission-controller
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 65534 # nobody
|
||||
containers:
|
||||
- name: admission-controller
|
||||
image: registry.k8s.io/autoscaling/vpa-admission-controller:1.3.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
args: ["--v=4", "--stderrthreshold=info", "--reload-cert"]
|
||||
volumeMounts:
|
||||
- name: tls-certs
|
||||
mountPath: "/etc/tls-certs"
|
||||
readOnly: true
|
||||
resources:
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 500Mi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 200Mi
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
- name: prometheus
|
||||
containerPort: 8944
|
||||
volumes:
|
||||
- name: tls-certs
|
||||
secret:
|
||||
secretName: vpa-tls-certs
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: vpa-webhook
|
||||
namespace: freeleaps-infra-system
|
||||
spec:
|
||||
ports:
|
||||
- port: 443
|
||||
targetPort: 8000
|
||||
selector:
|
||||
app: vpa-admission-controller
|
||||
@ -0,0 +1,37 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: vpa-recommender
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: vpa-recommender
|
||||
spec:
|
||||
serviceAccountName: vpa-recommender
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 65534 # nobody
|
||||
containers:
|
||||
- name: recommender
|
||||
image: registry.k8s.io/autoscaling/vpa-recommender:1.3.0
|
||||
command: ["/recommender"]
|
||||
args:
|
||||
- --recommender-name=vpa-recommender
|
||||
imagePullPolicy: IfNotPresent
|
||||
resources:
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 1000Mi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 500Mi
|
||||
ports:
|
||||
- name: prometheus
|
||||
containerPort: 8942
|
||||
@ -0,0 +1,39 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: vpa-updater
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: vpa-updater
|
||||
spec:
|
||||
serviceAccountName: vpa-updater
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 65534 # nobody
|
||||
containers:
|
||||
- name: updater
|
||||
image: registry.k8s.io/autoscaling/vpa-updater:1.3.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
resources:
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 1000Mi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 500Mi
|
||||
ports:
|
||||
- name: prometheus
|
||||
containerPort: 8943
|
||||
@ -0,0 +1,435 @@
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:metrics-reader
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "metrics.k8s.io"
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:vpa-actor
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- nodes
|
||||
- limitranges
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- apiGroups:
|
||||
- "poc.autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- "autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:vpa-status-actor
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalers/status
|
||||
verbs:
|
||||
- get
|
||||
- patch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:vpa-checkpoint-actor
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "poc.autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalercheckpoints
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- patch
|
||||
- delete
|
||||
- apiGroups:
|
||||
- "autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalercheckpoints
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- patch
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- namespaces
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:evictioner
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "apps"
|
||||
- "extensions"
|
||||
resources:
|
||||
- replicasets
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/eviction
|
||||
verbs:
|
||||
- create
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:metrics-reader
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:metrics-reader
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-actor
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:vpa-actor
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
- kind: ServiceAccount
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-status-actor
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:vpa-status-actor
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-checkpoint-actor
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:vpa-checkpoint-actor
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:vpa-target-reader
|
||||
rules:
|
||||
- apiGroups:
|
||||
- '*'
|
||||
resources:
|
||||
- '*/scale'
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- replicationcontrollers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- daemonsets
|
||||
- deployments
|
||||
- replicasets
|
||||
- statefulsets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
- cronjobs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-target-reader-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:vpa-target-reader
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
- kind: ServiceAccount
|
||||
name: vpa-admission-controller
|
||||
namespace: freeleaps-infra-system
|
||||
- kind: ServiceAccount
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-evictioner-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:evictioner
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: vpa-admission-controller
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:vpa-admission-controller
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- configmaps
|
||||
- nodes
|
||||
- limitranges
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- "admissionregistration.k8s.io"
|
||||
resources:
|
||||
- mutatingwebhookconfigurations
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- apiGroups:
|
||||
- "poc.autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- "autoscaling.k8s.io"
|
||||
resources:
|
||||
- verticalpodautoscalers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- "coordination.k8s.io"
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- update
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-admission-controller
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:vpa-admission-controller
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-admission-controller
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:vpa-status-reader
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "coordination.k8s.io"
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:vpa-status-reader-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:vpa-status-reader
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: system:leader-locking-vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "coordination.k8s.io"
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- "coordination.k8s.io"
|
||||
resourceNames:
|
||||
- vpa-updater
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- update
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: system:leader-locking-vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: system:leader-locking-vpa-updater
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-updater
|
||||
namespace: freeleaps-infra-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: system:leader-locking-vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "coordination.k8s.io"
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- "coordination.k8s.io"
|
||||
resourceNames:
|
||||
# TODO: Clean vpa-recommender up once vpa-recommender-lease is used everywhere. See https://github.com/kubernetes/autoscaler/issues/7461.
|
||||
- vpa-recommender
|
||||
- vpa-recommender-lease
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- update
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: system:leader-locking-vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: system:leader-locking-vpa-recommender
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: vpa-recommender
|
||||
namespace: freeleaps-infra-system
|
||||
@ -0,0 +1,834 @@
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
api-approved.kubernetes.io: https://github.com/kubernetes/kubernetes/pull/63797
|
||||
controller-gen.kubebuilder.io/version: v0.16.5
|
||||
name: verticalpodautoscalercheckpoints.autoscaling.k8s.io
|
||||
spec:
|
||||
group: autoscaling.k8s.io
|
||||
names:
|
||||
kind: VerticalPodAutoscalerCheckpoint
|
||||
listKind: VerticalPodAutoscalerCheckpointList
|
||||
plural: verticalpodautoscalercheckpoints
|
||||
shortNames:
|
||||
- vpacheckpoint
|
||||
singular: verticalpodautoscalercheckpoint
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: |-
|
||||
VerticalPodAutoscalerCheckpoint is the checkpoint of the internal state of VPA that
|
||||
is used for recovery after recommender's restart.
|
||||
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: |-
|
||||
Specification of the checkpoint.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
|
||||
properties:
|
||||
containerName:
|
||||
description: Name of the checkpointed container.
|
||||
type: string
|
||||
vpaObjectName:
|
||||
description: Name of the VPA object that stored VerticalPodAutoscalerCheckpoint
|
||||
object.
|
||||
type: string
|
||||
type: object
|
||||
status:
|
||||
description: Data of the checkpoint.
|
||||
properties:
|
||||
cpuHistogram:
|
||||
description: Checkpoint of histogram for consumption of CPU.
|
||||
properties:
|
||||
bucketWeights:
|
||||
description: Map from bucket index to bucket weight.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
referenceTimestamp:
|
||||
description: Reference timestamp for samples collected within
|
||||
this histogram.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
totalWeight:
|
||||
description: Sum of samples to be used as denominator for weights
|
||||
from BucketWeights.
|
||||
type: number
|
||||
type: object
|
||||
firstSampleStart:
|
||||
description: Timestamp of the fist sample from the histograms.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
lastSampleStart:
|
||||
description: Timestamp of the last sample from the histograms.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
lastUpdateTime:
|
||||
description: The time when the status was last refreshed.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
memoryHistogram:
|
||||
description: Checkpoint of histogram for consumption of memory.
|
||||
properties:
|
||||
bucketWeights:
|
||||
description: Map from bucket index to bucket weight.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
referenceTimestamp:
|
||||
description: Reference timestamp for samples collected within
|
||||
this histogram.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
totalWeight:
|
||||
description: Sum of samples to be used as denominator for weights
|
||||
from BucketWeights.
|
||||
type: number
|
||||
type: object
|
||||
totalSamplesCount:
|
||||
description: Total number of samples in the histograms.
|
||||
type: integer
|
||||
version:
|
||||
description: Version of the format of the stored data.
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1beta2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: |-
|
||||
VerticalPodAutoscalerCheckpoint is the checkpoint of the internal state of VPA that
|
||||
is used for recovery after recommender's restart.
|
||||
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: |-
|
||||
Specification of the checkpoint.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
|
||||
properties:
|
||||
containerName:
|
||||
description: Name of the checkpointed container.
|
||||
type: string
|
||||
vpaObjectName:
|
||||
description: Name of the VPA object that stored VerticalPodAutoscalerCheckpoint
|
||||
object.
|
||||
type: string
|
||||
type: object
|
||||
status:
|
||||
description: Data of the checkpoint.
|
||||
properties:
|
||||
cpuHistogram:
|
||||
description: Checkpoint of histogram for consumption of CPU.
|
||||
properties:
|
||||
bucketWeights:
|
||||
description: Map from bucket index to bucket weight.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
referenceTimestamp:
|
||||
description: Reference timestamp for samples collected within
|
||||
this histogram.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
totalWeight:
|
||||
description: Sum of samples to be used as denominator for weights
|
||||
from BucketWeights.
|
||||
type: number
|
||||
type: object
|
||||
firstSampleStart:
|
||||
description: Timestamp of the fist sample from the histograms.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
lastSampleStart:
|
||||
description: Timestamp of the last sample from the histograms.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
lastUpdateTime:
|
||||
description: The time when the status was last refreshed.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
memoryHistogram:
|
||||
description: Checkpoint of histogram for consumption of memory.
|
||||
properties:
|
||||
bucketWeights:
|
||||
description: Map from bucket index to bucket weight.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
referenceTimestamp:
|
||||
description: Reference timestamp for samples collected within
|
||||
this histogram.
|
||||
format: date-time
|
||||
nullable: true
|
||||
type: string
|
||||
totalWeight:
|
||||
description: Sum of samples to be used as denominator for weights
|
||||
from BucketWeights.
|
||||
type: number
|
||||
type: object
|
||||
totalSamplesCount:
|
||||
description: Total number of samples in the histograms.
|
||||
type: integer
|
||||
version:
|
||||
description: Version of the format of the stored data.
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
served: false
|
||||
storage: false
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
api-approved.kubernetes.io: https://github.com/kubernetes/kubernetes/pull/63797
|
||||
controller-gen.kubebuilder.io/version: v0.16.5
|
||||
name: verticalpodautoscalers.autoscaling.k8s.io
|
||||
spec:
|
||||
group: autoscaling.k8s.io
|
||||
names:
|
||||
kind: VerticalPodAutoscaler
|
||||
listKind: VerticalPodAutoscalerList
|
||||
plural: verticalpodautoscalers
|
||||
shortNames:
|
||||
- vpa
|
||||
singular: verticalpodautoscaler
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- jsonPath: .spec.updatePolicy.updateMode
|
||||
name: Mode
|
||||
type: string
|
||||
- jsonPath: .status.recommendation.containerRecommendations[0].target.cpu
|
||||
name: CPU
|
||||
type: string
|
||||
- jsonPath: .status.recommendation.containerRecommendations[0].target.memory
|
||||
name: Mem
|
||||
type: string
|
||||
- jsonPath: .status.conditions[?(@.type=='RecommendationProvided')].status
|
||||
name: Provided
|
||||
type: string
|
||||
- jsonPath: .metadata.creationTimestamp
|
||||
name: Age
|
||||
type: date
|
||||
name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: |-
|
||||
VerticalPodAutoscaler is the configuration for a vertical pod
|
||||
autoscaler, which automatically manages pod resources based on historical and
|
||||
real time resource utilization.
|
||||
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: |-
|
||||
Specification of the behavior of the autoscaler.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
|
||||
properties:
|
||||
recommenders:
|
||||
description: |-
|
||||
Recommender responsible for generating recommendation for this object.
|
||||
List should be empty (then the default recommender will generate the
|
||||
recommendation) or contain exactly one recommender.
|
||||
items:
|
||||
description: |-
|
||||
VerticalPodAutoscalerRecommenderSelector points to a specific Vertical Pod Autoscaler recommender.
|
||||
In the future it might pass parameters to the recommender.
|
||||
properties:
|
||||
name:
|
||||
description: Name of the recommender responsible for generating
|
||||
recommendation for this object.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
resourcePolicy:
|
||||
description: |-
|
||||
Controls how the autoscaler computes recommended resources.
|
||||
The resource policy may be used to set constraints on the recommendations
|
||||
for individual containers.
|
||||
If any individual containers need to be excluded from getting the VPA recommendations, then
|
||||
it must be disabled explicitly by setting mode to "Off" under containerPolicies.
|
||||
If not specified, the autoscaler computes recommended resources for all containers in the pod,
|
||||
without additional constraints.
|
||||
properties:
|
||||
containerPolicies:
|
||||
description: Per-container resource policies.
|
||||
items:
|
||||
description: |-
|
||||
ContainerResourcePolicy controls how autoscaler computes the recommended
|
||||
resources for a specific container.
|
||||
properties:
|
||||
containerName:
|
||||
description: |-
|
||||
Name of the container or DefaultContainerResourcePolicy, in which
|
||||
case the policy is used by the containers that don't have their own
|
||||
policy specified.
|
||||
type: string
|
||||
controlledResources:
|
||||
description: |-
|
||||
Specifies the type of recommendations that will be computed
|
||||
(and possibly applied) by VPA.
|
||||
If not specified, the default of [ResourceCPU, ResourceMemory] will be used.
|
||||
items:
|
||||
description: ResourceName is the name identifying various
|
||||
resources in a ResourceList.
|
||||
type: string
|
||||
type: array
|
||||
controlledValues:
|
||||
description: |-
|
||||
Specifies which resource values should be controlled.
|
||||
The default is "RequestsAndLimits".
|
||||
enum:
|
||||
- RequestsAndLimits
|
||||
- RequestsOnly
|
||||
type: string
|
||||
maxAllowed:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Specifies the maximum amount of resources that will be recommended
|
||||
for the container. The default is no maximum.
|
||||
type: object
|
||||
minAllowed:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Specifies the minimal amount of resources that will be recommended
|
||||
for the container. The default is no minimum.
|
||||
type: object
|
||||
mode:
|
||||
description: Whether autoscaler is enabled for the container.
|
||||
The default is "Auto".
|
||||
enum:
|
||||
- Auto
|
||||
- "Off"
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
targetRef:
|
||||
description: |-
|
||||
TargetRef points to the controller managing the set of pods for the
|
||||
autoscaler to control - e.g. Deployment, StatefulSet. VerticalPodAutoscaler
|
||||
can be targeted at controller implementing scale subresource (the pod set is
|
||||
retrieved from the controller's ScaleStatus) or some well known controllers
|
||||
(e.g. for DaemonSet the pod set is read from the controller's spec).
|
||||
If VerticalPodAutoscaler cannot use specified target it will report
|
||||
ConfigUnsupported condition.
|
||||
Note that VerticalPodAutoscaler does not require full implementation
|
||||
of scale subresource - it will not use it to modify the replica count.
|
||||
The only thing retrieved is a label selector matching pods grouped by
|
||||
the target resource.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: apiVersion is the API version of the referent
|
||||
type: string
|
||||
kind:
|
||||
description: 'kind is the 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 is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
|
||||
type: string
|
||||
required:
|
||||
- kind
|
||||
- name
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
updatePolicy:
|
||||
description: |-
|
||||
Describes the rules on how changes are applied to the pods.
|
||||
If not specified, all fields in the `PodUpdatePolicy` are set to their
|
||||
default values.
|
||||
properties:
|
||||
evictionRequirements:
|
||||
description: |-
|
||||
EvictionRequirements is a list of EvictionRequirements that need to
|
||||
evaluate to true in order for a Pod to be evicted. If more than one
|
||||
EvictionRequirement is specified, all of them need to be fulfilled to allow eviction.
|
||||
items:
|
||||
description: |-
|
||||
EvictionRequirement defines a single condition which needs to be true in
|
||||
order to evict a Pod
|
||||
properties:
|
||||
changeRequirement:
|
||||
description: EvictionChangeRequirement refers to the relationship
|
||||
between the new target recommendation for a Pod and its
|
||||
current requests, what kind of change is necessary for
|
||||
the Pod to be evicted
|
||||
enum:
|
||||
- TargetHigherThanRequests
|
||||
- TargetLowerThanRequests
|
||||
type: string
|
||||
resources:
|
||||
description: |-
|
||||
Resources is a list of one or more resources that the condition applies
|
||||
to. If more than one resource is given, the EvictionRequirement is fulfilled
|
||||
if at least one resource meets `changeRequirement`.
|
||||
items:
|
||||
description: ResourceName is the name identifying various
|
||||
resources in a ResourceList.
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- changeRequirement
|
||||
- resources
|
||||
type: object
|
||||
type: array
|
||||
minReplicas:
|
||||
description: |-
|
||||
Minimal number of replicas which need to be alive for Updater to attempt
|
||||
pod eviction (pending other checks like PDB). Only positive values are
|
||||
allowed. Overrides global '--min-replicas' flag.
|
||||
format: int32
|
||||
type: integer
|
||||
updateMode:
|
||||
description: |-
|
||||
Controls when autoscaler applies changes to the pod resources.
|
||||
The default is 'Auto'.
|
||||
enum:
|
||||
- "Off"
|
||||
- Initial
|
||||
- Recreate
|
||||
- Auto
|
||||
type: string
|
||||
type: object
|
||||
required:
|
||||
- targetRef
|
||||
type: object
|
||||
status:
|
||||
description: Current information about the autoscaler.
|
||||
properties:
|
||||
conditions:
|
||||
description: |-
|
||||
Conditions is the set of conditions required for this autoscaler to scale its target,
|
||||
and indicates whether or not those conditions are met.
|
||||
items:
|
||||
description: |-
|
||||
VerticalPodAutoscalerCondition describes the state of
|
||||
a VerticalPodAutoscaler at a certain point.
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: |-
|
||||
lastTransitionTime is the last time the condition transitioned from
|
||||
one status to another
|
||||
format: date-time
|
||||
type: string
|
||||
message:
|
||||
description: |-
|
||||
message is a human-readable explanation containing details about
|
||||
the transition
|
||||
type: string
|
||||
reason:
|
||||
description: reason is the reason for the condition's last transition.
|
||||
type: string
|
||||
status:
|
||||
description: status is the status of the condition (True, False,
|
||||
Unknown)
|
||||
type: string
|
||||
type:
|
||||
description: type describes the current condition
|
||||
type: string
|
||||
required:
|
||||
- status
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
recommendation:
|
||||
description: |-
|
||||
The most recently computed amount of resources recommended by the
|
||||
autoscaler for the controlled pods.
|
||||
properties:
|
||||
containerRecommendations:
|
||||
description: Resources recommended by the autoscaler for each
|
||||
container.
|
||||
items:
|
||||
description: |-
|
||||
RecommendedContainerResources is the recommendation of resources computed by
|
||||
autoscaler for a specific container. Respects the container resource policy
|
||||
if present in the spec. In particular the recommendation is not produced for
|
||||
containers with `ContainerScalingMode` set to 'Off'.
|
||||
properties:
|
||||
containerName:
|
||||
description: Name of the container.
|
||||
type: string
|
||||
lowerBound:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Minimum recommended amount of resources. Observes ContainerResourcePolicy.
|
||||
This amount is not guaranteed to be sufficient for the application to operate in a stable way, however
|
||||
running with less resources is likely to have significant impact on performance/availability.
|
||||
type: object
|
||||
target:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: Recommended amount of resources. Observes ContainerResourcePolicy.
|
||||
type: object
|
||||
uncappedTarget:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
The most recent recommended resources target computed by the autoscaler
|
||||
for the controlled pods, based only on actual resource usage, not taking
|
||||
into account the ContainerResourcePolicy.
|
||||
May differ from the Recommendation if the actual resource usage causes
|
||||
the target to violate the ContainerResourcePolicy (lower than MinAllowed
|
||||
or higher that MaxAllowed).
|
||||
Used only as status indication, will not affect actual resource assignment.
|
||||
type: object
|
||||
upperBound:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Maximum recommended amount of resources. Observes ContainerResourcePolicy.
|
||||
Any resources allocated beyond this value are likely wasted. This value may be larger than the maximum
|
||||
amount of application is actually capable of consuming.
|
||||
type: object
|
||||
required:
|
||||
- target
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
- deprecated: true
|
||||
deprecationWarning: autoscaling.k8s.io/v1beta2 API is deprecated
|
||||
name: v1beta2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: |-
|
||||
VerticalPodAutoscaler is the configuration for a vertical pod
|
||||
autoscaler, which automatically manages pod resources based on historical and
|
||||
real time resource utilization.
|
||||
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: |-
|
||||
Specification of the behavior of the autoscaler.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
|
||||
properties:
|
||||
resourcePolicy:
|
||||
description: |-
|
||||
Controls how the autoscaler computes recommended resources.
|
||||
The resource policy may be used to set constraints on the recommendations
|
||||
for individual containers. If not specified, the autoscaler computes recommended
|
||||
resources for all containers in the pod, without additional constraints.
|
||||
properties:
|
||||
containerPolicies:
|
||||
description: Per-container resource policies.
|
||||
items:
|
||||
description: |-
|
||||
ContainerResourcePolicy controls how autoscaler computes the recommended
|
||||
resources for a specific container.
|
||||
properties:
|
||||
containerName:
|
||||
description: |-
|
||||
Name of the container or DefaultContainerResourcePolicy, in which
|
||||
case the policy is used by the containers that don't have their own
|
||||
policy specified.
|
||||
type: string
|
||||
maxAllowed:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Specifies the maximum amount of resources that will be recommended
|
||||
for the container. The default is no maximum.
|
||||
type: object
|
||||
minAllowed:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Specifies the minimal amount of resources that will be recommended
|
||||
for the container. The default is no minimum.
|
||||
type: object
|
||||
mode:
|
||||
description: Whether autoscaler is enabled for the container.
|
||||
The default is "Auto".
|
||||
enum:
|
||||
- Auto
|
||||
- "Off"
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
targetRef:
|
||||
description: |-
|
||||
TargetRef points to the controller managing the set of pods for the
|
||||
autoscaler to control - e.g. Deployment, StatefulSet. VerticalPodAutoscaler
|
||||
can be targeted at controller implementing scale subresource (the pod set is
|
||||
retrieved from the controller's ScaleStatus) or some well known controllers
|
||||
(e.g. for DaemonSet the pod set is read from the controller's spec).
|
||||
If VerticalPodAutoscaler cannot use specified target it will report
|
||||
ConfigUnsupported condition.
|
||||
Note that VerticalPodAutoscaler does not require full implementation
|
||||
of scale subresource - it will not use it to modify the replica count.
|
||||
The only thing retrieved is a label selector matching pods grouped by
|
||||
the target resource.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: apiVersion is the API version of the referent
|
||||
type: string
|
||||
kind:
|
||||
description: 'kind is the 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 is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
|
||||
type: string
|
||||
required:
|
||||
- kind
|
||||
- name
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
updatePolicy:
|
||||
description: |-
|
||||
Describes the rules on how changes are applied to the pods.
|
||||
If not specified, all fields in the `PodUpdatePolicy` are set to their
|
||||
default values.
|
||||
properties:
|
||||
updateMode:
|
||||
description: |-
|
||||
Controls when autoscaler applies changes to the pod resources.
|
||||
The default is 'Auto'.
|
||||
enum:
|
||||
- "Off"
|
||||
- Initial
|
||||
- Recreate
|
||||
- Auto
|
||||
type: string
|
||||
type: object
|
||||
required:
|
||||
- targetRef
|
||||
type: object
|
||||
status:
|
||||
description: Current information about the autoscaler.
|
||||
properties:
|
||||
conditions:
|
||||
description: |-
|
||||
Conditions is the set of conditions required for this autoscaler to scale its target,
|
||||
and indicates whether or not those conditions are met.
|
||||
items:
|
||||
description: |-
|
||||
VerticalPodAutoscalerCondition describes the state of
|
||||
a VerticalPodAutoscaler at a certain point.
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: |-
|
||||
lastTransitionTime is the last time the condition transitioned from
|
||||
one status to another
|
||||
format: date-time
|
||||
type: string
|
||||
message:
|
||||
description: |-
|
||||
message is a human-readable explanation containing details about
|
||||
the transition
|
||||
type: string
|
||||
reason:
|
||||
description: reason is the reason for the condition's last transition.
|
||||
type: string
|
||||
status:
|
||||
description: status is the status of the condition (True, False,
|
||||
Unknown)
|
||||
type: string
|
||||
type:
|
||||
description: type describes the current condition
|
||||
type: string
|
||||
required:
|
||||
- status
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
recommendation:
|
||||
description: |-
|
||||
The most recently computed amount of resources recommended by the
|
||||
autoscaler for the controlled pods.
|
||||
properties:
|
||||
containerRecommendations:
|
||||
description: Resources recommended by the autoscaler for each
|
||||
container.
|
||||
items:
|
||||
description: |-
|
||||
RecommendedContainerResources is the recommendation of resources computed by
|
||||
autoscaler for a specific container. Respects the container resource policy
|
||||
if present in the spec. In particular the recommendation is not produced for
|
||||
containers with `ContainerScalingMode` set to 'Off'.
|
||||
properties:
|
||||
containerName:
|
||||
description: Name of the container.
|
||||
type: string
|
||||
lowerBound:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Minimum recommended amount of resources. Observes ContainerResourcePolicy.
|
||||
This amount is not guaranteed to be sufficient for the application to operate in a stable way, however
|
||||
running with less resources is likely to have significant impact on performance/availability.
|
||||
type: object
|
||||
target:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: Recommended amount of resources. Observes ContainerResourcePolicy.
|
||||
type: object
|
||||
uncappedTarget:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
The most recent recommended resources target computed by the autoscaler
|
||||
for the controlled pods, based only on actual resource usage, not taking
|
||||
into account the ContainerResourcePolicy.
|
||||
May differ from the Recommendation if the actual resource usage causes
|
||||
the target to violate the ContainerResourcePolicy (lower than MinAllowed
|
||||
or higher that MaxAllowed).
|
||||
Used only as status indication, will not affect actual resource assignment.
|
||||
type: object
|
||||
upperBound:
|
||||
additionalProperties:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
description: |-
|
||||
Maximum recommended amount of resources. Observes ContainerResourcePolicy.
|
||||
Any resources allocated beyond this value are likely wasted. This value may be larger than the maximum
|
||||
amount of application is actually capable of consuming.
|
||||
type: object
|
||||
required:
|
||||
- target
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: false
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
||||
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Unregisters the admission controller webhook.
|
||||
set -e
|
||||
|
||||
echo "Unregistering VPA admission controller webhook"
|
||||
|
||||
kubectl delete -n freeleaps-infra-system mutatingwebhookconfiguration.v1.admissionregistration.k8s.io vpa-webhook-config
|
||||
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Generates the a CA cert, a server key, and a server cert signed by the CA.
|
||||
# reference:
|
||||
# https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/admission/webhook/gencerts.sh
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
CN_BASE="vpa_webhook"
|
||||
TMP_DIR="/tmp/vpa-certs"
|
||||
|
||||
echo "Generating certs for the VPA Admission Controller in ${TMP_DIR}."
|
||||
mkdir -p ${TMP_DIR}
|
||||
cat > ${TMP_DIR}/server.conf << EOF
|
||||
[req]
|
||||
req_extensions = v3_req
|
||||
distinguished_name = req_distinguished_name
|
||||
[req_distinguished_name]
|
||||
[ v3_req ]
|
||||
basicConstraints = CA:FALSE
|
||||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
extendedKeyUsage = clientAuth, serverAuth
|
||||
subjectAltName = DNS:vpa-webhook.freeleaps-infra-system.svc
|
||||
EOF
|
||||
|
||||
# Create a certificate authority
|
||||
openssl genrsa -out ${TMP_DIR}/caKey.pem 2048
|
||||
set +o errexit
|
||||
openssl req -x509 -new -nodes -key ${TMP_DIR}/caKey.pem -days 100000 -out ${TMP_DIR}/caCert.pem -subj "/CN=${CN_BASE}_ca" -addext "subjectAltName = DNS:${CN_BASE}_ca"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "ERROR: Failed to create CA certificate for self-signing. If the error is \"unknown option -addext\", update your openssl version or deploy VPA from the vpa-release-0.8 branch."
|
||||
exit 1
|
||||
fi
|
||||
set -o errexit
|
||||
|
||||
# Create a server certificate
|
||||
openssl genrsa -out ${TMP_DIR}/serverKey.pem 2048
|
||||
# Note the CN is the DNS name of the service of the webhook.
|
||||
openssl req -new -key ${TMP_DIR}/serverKey.pem -out ${TMP_DIR}/server.csr -subj "/CN=vpa-webhook.freeleaps-infra-system.svc" -config ${TMP_DIR}/server.conf
|
||||
openssl x509 -req -in ${TMP_DIR}/server.csr -CA ${TMP_DIR}/caCert.pem -CAkey ${TMP_DIR}/caKey.pem -CAcreateserial -out ${TMP_DIR}/serverCert.pem -days 100000 -extensions SAN -extensions v3_req -extfile ${TMP_DIR}/server.conf
|
||||
|
||||
echo "Uploading certs to the cluster."
|
||||
kubectl create secret --namespace=freeleaps-infra-system generic vpa-tls-certs --from-file=${TMP_DIR}/caKey.pem --from-file=${TMP_DIR}/caCert.pem --from-file=${TMP_DIR}/serverKey.pem --from-file=${TMP_DIR}/serverCert.pem
|
||||
|
||||
if [ "${1:-unset}" = "e2e" ]; then
|
||||
openssl genrsa -out ${TMP_DIR}/e2eKey.pem 2048
|
||||
openssl req -new -key ${TMP_DIR}/e2eKey.pem -out ${TMP_DIR}/e2e.csr -subj "/CN=vpa-webhook.freeleaps-infra-system.svc" -config ${TMP_DIR}/server.conf
|
||||
openssl x509 -req -in ${TMP_DIR}/e2e.csr -CA ${TMP_DIR}/caCert.pem -CAkey ${TMP_DIR}/caKey.pem -CAcreateserial -out ${TMP_DIR}/e2eCert.pem -days 100000 -extensions SAN -extensions v3_req -extfile ${TMP_DIR}/server.conf
|
||||
echo "Uploading rotation e2e test certs to the cluster."
|
||||
kubectl create secret --namespace=freeleaps-infra-system generic vpa-e2e-certs --from-file=${TMP_DIR}/e2eKey.pem --from-file=${TMP_DIR}/e2eCert.pem
|
||||
fi
|
||||
|
||||
# Clean up after we're done.
|
||||
echo "Deleting ${TMP_DIR}."
|
||||
rm -rf ${TMP_DIR}
|
||||
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
||||
|
||||
function print_help {
|
||||
echo "ERROR! Usage: vpa-process-yaml.sh <YAML files>+"
|
||||
echo "Script will output content of YAML files separated with YAML document"
|
||||
echo "separator and substituting REGISTRY and TAG for pod images"
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEFAULT_REGISTRY="registry.k8s.io/autoscaling"
|
||||
DEFAULT_TAG="1.3.0"
|
||||
|
||||
REGISTRY_TO_APPLY=${REGISTRY-$DEFAULT_REGISTRY}
|
||||
TAG_TO_APPLY=${TAG-$DEFAULT_TAG}
|
||||
|
||||
if [ "${REGISTRY_TO_APPLY}" != "${DEFAULT_REGISTRY}" ]; then
|
||||
(>&2 echo "WARNING! Using image repository from REGISTRY env variable (${REGISTRY_TO_APPLY}) instead of ${DEFAULT_REGISTRY}.")
|
||||
fi
|
||||
|
||||
if [ "${TAG_TO_APPLY}" != "${DEFAULT_TAG}" ]; then
|
||||
(>&2 echo "WARNING! Using tag from TAG env variable (${TAG_TO_APPLY}) instead of the default (${DEFAULT_TAG}).")
|
||||
fi
|
||||
|
||||
for i in $*; do
|
||||
sed -e "s,${DEFAULT_REGISTRY}/\([a-z-]*\):.*,${REGISTRY_TO_APPLY}/\1:${TAG_TO_APPLY}," $i
|
||||
echo ""
|
||||
echo "---"
|
||||
done
|
||||
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Generates the a CA cert, a server key, and a server cert signed by the CA.
|
||||
# reference:
|
||||
# https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/admission/webhook/gencerts.sh
|
||||
set -e
|
||||
|
||||
echo "Deleting VPA Admission Controller certs."
|
||||
kubectl delete secret --namespace=freeleaps-infra-system vpa-tls-certs
|
||||
kubectl delete secret --namespace=freeleaps-infra-system --ignore-not-found=true vpa-e2e-certs
|
||||
51
cluster/manifests/freeleaps-infra-system/vertical-pod-autoscaler/install.sh
Executable file
51
cluster/manifests/freeleaps-infra-system/vertical-pod-autoscaler/install.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
VERSION="1.3.0"
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/${VERSION}
|
||||
|
||||
ACTION=$1
|
||||
COMPONENTS="vpa-v1-crd-gen vpa-rbac updater-deployment recommender-deployment admission-controller-deployment"
|
||||
|
||||
function script_path {
|
||||
if test -f "${SCRIPT_ROOT}/${1}.yaml"; then
|
||||
echo "${SCRIPT_ROOT}/${1}.yaml"
|
||||
else
|
||||
echo "${1}.yaml not found in ${SCRIPT_ROOT}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
COMPONENTS="$2-deployment"
|
||||
fi
|
||||
|
||||
for i in $COMPONENTS; do
|
||||
if [ $i == admission-controller-deployment ] ; then
|
||||
if [[ ${ACTION} == create || ${ACTION} == apply ]] ; then
|
||||
# Allow gencerts to fail silently if certs already exist
|
||||
(bash ${SCRIPT_ROOT}/../hack/gencerts.sh || true)
|
||||
elif [ ${ACTION} == delete ] ; then
|
||||
(bash ${SCRIPT_ROOT}/../hack/rmcerts.sh || true)
|
||||
(bash ${SCRIPT_ROOT}/../hack/delete-webhook.sh || true)
|
||||
fi
|
||||
fi
|
||||
${SCRIPT_ROOT}/../hack/process-yaml.sh $(script_path $i) | kubectl ${ACTION} -f - || true
|
||||
done
|
||||
@ -164,7 +164,7 @@ rules:
|
||||
cpu:
|
||||
containerQuery: |
|
||||
sum by (<<.GroupBy>>) (
|
||||
rate(container_cpu_usage_seconds_total{container!="",<<.LabelMatchers>>}[3m])
|
||||
rate(container_cpu_usage_seconds_total{container!="POD",<<.LabelMatchers>>}[3m])
|
||||
)
|
||||
nodeQuery: |
|
||||
sum by (<<.GroupBy>>) (
|
||||
@ -182,7 +182,7 @@ rules:
|
||||
memory:
|
||||
containerQuery: |
|
||||
sum by (<<.GroupBy>>) (
|
||||
avg_over_time(container_memory_working_set_bytes{container!="",<<.LabelMatchers>>}[3m])
|
||||
avg_over_time(container_memory_working_set_bytes{container!="POD",<<.LabelMatchers>>}[3m])
|
||||
)
|
||||
nodeQuery: |
|
||||
sum by (<<.GroupBy>>) (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user