re-organize helm deployment files as a helm chart

Signed-off-by: Taner Sener <tanersener@gmail.com>
This commit is contained in:
Taner Sener
2020-12-18 18:38:34 +00:00
parent 6f71e9c6b0
commit 995ec54aa5
9 changed files with 339 additions and 68 deletions

View File

@ -1,40 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kube-metrics-adapter
namespace: kube-system
labels:
application: kube-metrics-adapter
version: latest
spec:
replicas: 1
selector:
matchLabels:
application: kube-metrics-adapter
template:
metadata:
labels:
application: kube-metrics-adapter
version: latest
annotations:
iam.amazonaws.com/role: "kube-aws-test-1-app-zmon"
spec:
serviceAccountName: custom-metrics-apiserver
containers:
- name: kube-metrics-adapter
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter:latest
args:
# - --v=9
- --prometheus-server=http://prometheus.kube-system.svc.cluster.local
- --skipper-ingress-metrics
- --aws-external-metrics
env:
- name: AWS_REGION
value: eu-central-1
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi

9
helm/Chart.yaml Normal file
View File

@ -0,0 +1,9 @@
apiVersion: v2
name: kube-metrics-adapter
version: 0.1.9
description: kube-metrics-adapter helm chart
home: https://github.com/zalando-incubator/kube-metrics-adapter
maintainers:
- name: The Zalando Incubator
email: opensource@zalando.de
url: https://github.com/zalando-incubator

View File

@ -1,3 +1,4 @@
{{- if .Values.enableCustomMetricsApi }}
apiVersion: apiregistration.k8s.io/v1beta1 apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService kind: APIService
metadata: metadata:
@ -5,9 +6,10 @@ metadata:
spec: spec:
service: service:
name: kube-metrics-adapter name: kube-metrics-adapter
namespace: kube-system namespace: {{ .Values.namespace }}
group: custom.metrics.k8s.io group: custom.metrics.k8s.io
version: v1beta1 version: v1beta1
insecureSkipTLSVerify: true insecureSkipTLSVerify: {{ .Values.tls.skipTLSVerify }}
groupPriorityMinimum: 100 groupPriorityMinimum: 100
versionPriority: 100 versionPriority: 100
{{- end}}

View File

@ -0,0 +1,191 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kube-metrics-adapter
namespace: {{ .Values.namespace }}
labels:
application: kube-metrics-adapter
version: {{ .Values.registry.imageTag }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
application: kube-metrics-adapter
template:
metadata:
labels:
application: kube-metrics-adapter
version: {{ .Values.registry.imageTag }}
spec:
serviceAccountName: kube-metrics-adapter
containers:
- name: kube-metrics-adapter
image: {{ .Values.registry.image}}:{{ .Values.registry.imageTag }}
args:
{{- if .Values.addDirectoryHeader }}
- --add_dir_header={{ .Values.addDirectoryHeader }}
{{- end}}
{{- if .Values.log.alsoToStderr }}
- --alsologtostderr={{ .Values.log.alsoToStderr }}
{{- end}}
{{- if .Values.authentication.kubeConfig }}
- --authentication-kubeconfig={{ .Values.authentication.kubeConfig }}
{{- end}}
{{- if .Values.authentication.skipLookup }}
- --authentication-skip-lookup={{ .Values.authentication.skipLookup }}
{{- end}}
{{- if .Values.authentication.tokenWebhookCacheTtl }}
- --authentication-token-webhook-cache-ttl={{ .Values.authentication.tokenWebhookCacheTtl }}
{{- end}}
{{- if .Values.authentication.tolerateLookupFailure }}
- --authentication-tolerate-lookup-failure={{ .Values.authentication.tolerateLookupFailure }}
{{- end}}
{{- if .Values.authorization.alwaysAllowPaths }}
- --authorization-always-allow-paths={{ .Values.authorization.alwaysAllowPaths }}
{{- end}}
{{- if .Values.authorization.kubeConfig }}
- --authorization-kubeconfig={{ .Values.authorization.kubeConfig }}
{{- end}}
{{- if .Values.authorization.webhookCache.authorizedTtl }}
- --authorization-webhook-cache-authorized-ttl={{ .Values.authorization.webhookCache.authorizedTtl }}
{{- end}}
{{- if .Values.authorization.webhookCache.unauthorizedTtl }}
- --authorization-webhook-cache-unauthorized-ttl={{ .Values.authorization.webhookCache.unauthorizedTtl }}
{{- end}}
{{- if .Values.aws.externalMetrics }}
- --aws-external-metrics={{ .Values.aws.externalMetrics }}
{{- end}}
{{- if .Values.aws.region }}
- --aws-region={{ .Values.aws.region }}
{{- end}}
{{- if .Values.tls.certificateDirectory }}
- --cert-dir={{ .Values.tls.certificateDirectory }}
{{- end}}
{{- if .Values.tls.clientCaFile }}
- --client-ca-file={{ .Values.tls.clientCaFile }}
{{- end}}
{{- if .Values.contentionProfiling }}
- --contention-profiling={{ .Values.contentionProfiling }}
{{- end}}
{{- if .Values.credentialsDirectory }}
- --credentials-dir={{ .Values.credentialsDirectory }}
{{- end}}
{{- if .Values.disregardIncompatibleHPAs }}
- --disregard-incompatible-hpas={{ .Values.disregardIncompatibleHPAs }}
{{- end}}
{{- if .Values.enableCustomMetricsApi }}
- --enable-custom-metrics-api={{ .Values.enableCustomMetricsApi }}
{{- end}}
{{- if .Values.enableExternalMetricsApi }}
- --enable-external-metrics-api={{ .Values.enableExternalMetricsApi }}
{{- end}}
{{- if .Values.http2MaxStreamsPerConnection }}
- --http2-max-streams-per-connection={{ .Values.http2MaxStreamsPerConnection }}
{{- end}}
{{- if .Values.influxDB.address }}
- --influxdb-address={{ .Values.influxDB.address }}
{{- end}}
{{- if .Values.influxDB.organization }}
- --influxdb-org={{ .Values.influxDB.organization }}
{{- end}}
{{- if .Values.influxDB.token }}
- --influxdb-token={{ .Values.influxDB.token }}
{{- end}}
{{- if .Values.listerKubeConfig }}
- --lister-kubeconfig={{ .Values.listerKubeConfig }}
{{- end}}
{{- if .Values.log.flushFrequency }}
- --log-flush-frequency={{ .Values.log.flushFrequency }}
{{- end}}
{{- if .Values.log.backtraceAtTraceLocation }}
- --log_backtrace_at={{ .Values.log.backtraceAtTraceLocation }}
{{- end}}
{{- if .Values.log.directory }}
- --log_dir={{ .Values.log.directory }}
{{- end}}
{{- if .Values.log.file }}
- --log_file={{ .Values.log.file }}
{{- end}}
{{- if .Values.log.fileMaxSize }}
- --log_file_max_size={{ .Values.log.fileMaxSize }}
{{- end}}
{{- if .Values.log.toStderr }}
- --logtostderr={{ .Values.log.toStderr }}
{{- end}}
{{- if .Values.prometheus.metricsAddress }}
- --metrics-address={{ .Values.prometheus.metricsAddress }}
{{- end}}
{{- if .Values.profiling }}
- --profiling={{ .Values.profiling }}
{{- end}}
{{- if .Values.prometheus.server }}
- --prometheus-server={{ .Values.prometheus.server }}
{{- end}}
{{- if .Values.requestHeader.allowedNames }}
- --requestheader-allowed-names={{ .Values.requestHeader.allowedNames }}
{{- end}}
{{- if .Values.requestHeader.clientCaFile }}
- --requestheader-client-ca-file={{ .Values.requestHeader.clientCaFile }}
{{- end}}
{{- if .Values.requestHeader.extraHeadersPrefix }}
- --requestheader-extra-headers-prefix={{ .Values.requestHeader.extraHeadersPrefix }}
{{- end}}
{{- if .Values.requestHeader.groupHeaders }}
- --requestheader-group-headers={{ .Values.requestHeader.groupHeaders }}
{{- end}}
{{- if .Values.requestHeader.usernameHeaders }}
- --requestheader-username-headers={{ .Values.requestHeader.usernameHeaders }}
{{- end}}
- --secure-port={{ .Values.service.internalPort }}
{{- if .Values.log.skipHeaders }}
- --skip_headers={{ .Values.log.skipHeaders }}
{{- end}}
{{- if .Values.log.skipLogHeaders }}
- --skip_log_headers={{ .Values.log.skipLogHeaders }}
{{- end}}
{{- if .Values.skipperBackendsAnnotation }}
- --skipper-backends-annotation={{ .Values.skipperBackendsAnnotation }}
{{- end}}
{{- if .Values.skipperIngressMetrics }}
- --skipper-ingress-metrics={{ .Values.skipperIngressMetrics }}
{{- end}}
{{- if .Values.log.stderrThreshold }}
- --stderrthreshold={{ .Values.log.stderrThreshold }}
{{- end}}
{{- if .Values.tls.certFile }}
- --tls-cert-file={{ .Values.tls.certFile }}
{{- end}}
{{- if .Values.tls.cipherSuites }}
- --tls-cipher-suites={{ .Values.tls.cipherSuites }}
{{- end}}
{{- if .Values.tls.minVersion }}
- --tls-min-version={{ .Values.tls.minVersion }}
{{- end}}
{{- if .Values.tls.privateKeyFile }}
- --tls-private-key-file={{ .Values.tls.privateKeyFile }}
{{- end}}
{{- if .Values.tls.sniCertKey }}
- --tls-sni-cert-key={{ .Values.tls.sniCertKey }}
{{- end}}
{{- if .Values.token }}
- --token={{ .Values.token }}
{{- end}}
{{- if .Values.log.level }}
- --v={{ .Values.log.level }}
{{- end}}
{{- if .Values.vmodule }}
- --vmodule={{ .Values.vmodule }}
{{- end}}
{{- if .Values.zmon.kariosdbEndpoint }}
- --zmon-kariosdb-endpoint={{ .Values.zmon.kariosdbEndpoint }}
{{- end}}
{{- if .Values.zmon.tokenName }}
- --zmon-token-name={{ .Values.zmon.tokenName }}
{{- end}}
resources:
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}

View File

@ -1,3 +1,4 @@
{{- if .Values.enableExternalMetricsApi }}
apiVersion: apiregistration.k8s.io/v1beta1 apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService kind: APIService
metadata: metadata:
@ -5,9 +6,10 @@ metadata:
spec: spec:
service: service:
name: kube-metrics-adapter name: kube-metrics-adapter
namespace: kube-system namespace: {{ .Values.namespace }}
group: external.metrics.k8s.io group: external.metrics.k8s.io
version: v1beta1 version: v1beta1
insecureSkipTLSVerify: true insecureSkipTLSVerify: {{ .Values.tls.skipTLSVerify }}
groupPriorityMinimum: 100 groupPriorityMinimum: 100
versionPriority: 100 versionPriority: 100
{{- end}}

View File

@ -1,13 +1,7 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: custom-metrics-apiserver
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole
metadata: metadata:
name: custom-metrics-server-resources name: kube-metrics-adapter-server-resources
rules: rules:
- apiGroups: - apiGroups:
- custom.metrics.k8s.io - custom.metrics.k8s.io
@ -27,7 +21,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole
metadata: metadata:
name: custom-metrics-resource-reader name: kube-metrics-adapter-resource-reader
rules: rules:
- apiGroups: - apiGroups:
- "" - ""
@ -35,6 +29,7 @@ rules:
- namespaces - namespaces
- pods - pods
- services - services
- configmaps
verbs: verbs:
- get - get
- list - list
@ -42,7 +37,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole
metadata: metadata:
name: custom-metrics-resource-collector name: kube-metrics-adapter-resource-collector
rules: rules:
- apiGroups: - apiGroups:
- "" - ""
@ -86,11 +81,11 @@ metadata:
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: ClusterRole kind: ClusterRole
name: custom-metrics-server-resources name: kube-metrics-adapter-server-resources
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: horizontal-pod-autoscaler name: horizontal-pod-autoscaler
namespace: kube-system namespace: {{ .Values.namespace }}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
@ -103,12 +98,12 @@ roleRef:
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: horizontal-pod-autoscaler name: horizontal-pod-autoscaler
namespace: kube-system namespace: {{ .Values.namespace }}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding kind: RoleBinding
metadata: metadata:
name: custom-metrics-auth-reader name: kube-metrics-adapter-auth-reader
namespace: kube-system namespace: kube-system
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
@ -116,8 +111,8 @@ roleRef:
name: extension-apiserver-authentication-reader name: extension-apiserver-authentication-reader
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: custom-metrics-apiserver name: kube-metrics-adapter
namespace: kube-system namespace: {{ .Values.namespace }}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
@ -129,18 +124,31 @@ roleRef:
name: system:auth-delegator name: system:auth-delegator
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: custom-metrics-apiserver name: kube-metrics-adapter
namespace: kube-system namespace: {{ .Values.namespace }}
--- ---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:
name: custom-metrics-resource-collector name: kube-metrics-adapter-resource-collector
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: ClusterRole kind: ClusterRole
name: custom-metrics-resource-collector name: kube-metrics-adapter-resource-collector
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: custom-metrics-apiserver name: kube-metrics-adapter
namespace: kube-system namespace: {{ .Values.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kube-metrics-adapter-resource-reader
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kube-metrics-adapter-resource-reader
subjects:
- kind: ServiceAccount
name: kube-metrics-adapter
namespace: {{ .Values.namespace }}

View File

@ -0,0 +1,5 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: kube-metrics-adapter
namespace: {{ .Values.namespace }}

View File

@ -2,10 +2,10 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: kube-metrics-adapter name: kube-metrics-adapter
namespace: kube-system namespace: {{ .Values.namespace }}
spec: spec:
ports: ports:
- port: 443 - port: {{ .Values.service.port }}
targetPort: 443 targetPort: {{ .Values.service.internalPort }}
selector: selector:
application: kube-metrics-adapter application: kube-metrics-adapter

94
helm/values.yaml Normal file
View File

@ -0,0 +1,94 @@
namespace: kube-system
replicas: 1
registry:
image: registry.opensource.zalan.do/teapot/kube-metrics-adapter
imageTag: v0.1.9
imagePullPolicy: IfNotPresent
service:
port: 443
internalPort: 443
addDirectoryHeader:
contentionProfiling:
profiling:
enableCustomMetricsApi:
enableExternalMetricsApi:
credentialsDirectory:
disregardIncompatibleHPAs:
http2MaxStreamsPerConnection:
listerKubeConfig:
skipperBackendsAnnotation:
skipperIngressMetrics:
token:
vmodule:
authentication:
kubeConfig:
skipLookup:
tokenWebhookCacheTtl:
tolerateLookupFailure:
authorization:
kubeConfig:
alwaysAllowPaths:
webhookCache:
authorizedTtl:
unauthorizedTtl:
aws:
externalMetrics:
region:
influxDB:
address:
organization:
token:
log:
alsoToStderr:
toStderr:
flushFrequency:
backtraceAtTraceLocation:
directory:
file:
fileMaxSize:
level:
stderrThreshold:
skipHeaders:
skipLogHeaders:
prometheus:
server: http://prometheus.kube-system.svc.cluster.local
metricsAddress:
requestHeader:
allowedNames:
clientCaFile:
extraHeadersPrefix:
groupHeaders:
usernameHeaders:
tls:
skipTLSVerify: true
certificateDirectory:
clientCaFile:
certFile:
cipherSuites:
minVersion:
privateKeyFile:
sniCertKey:
zmon:
kariosdbEndpoint:
tokenName:
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi