Skip to content

Commit

Permalink
Merge pull request #55 from syself/update-konnectivity-agent
Browse files Browse the repository at this point in the history
🌱 update konnectivity-agent
  • Loading branch information
batistein authored Apr 15, 2023
2 parents 5b29b40 + d99b0c7 commit ffdfb3f
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/konnectivity-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ dependencies:
version: 1.0.0
alias: proportional-autoscaler
condition: proportional-autoscaler.enabled
appVersion: v0.0.32
version: 1.0.3
appVersion: v0.1.2
version: 1.0.5
23 changes: 23 additions & 0 deletions charts/konnectivity-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
addonmanager.kubernetes.io/mode: Reconcile
{{- end }}

{{/*
Common labels for server
*/}}
{{- define "konnectivity-server.labels" -}}
helm.sh/chart: {{ include "konnectivity-agent.chart" . }}
{{ include "konnectivity-server.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
addonmanager.kubernetes.io/mode: Reconcile
{{- end }}


{{/*
Selector labels for server
*/}}
{{- define "konnectivity-server.selectorLabels" -}}
app.kubernetes.io/name: konnectivity-server
app.kubernetes.io/instance: konnectivity-server
k8s-app: konnectivity-agent
{{- end }}

{{/*
Selector labels
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/konnectivity-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ spec:
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
5 changes: 2 additions & 3 deletions charts/konnectivity-agent/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ metadata:
name: system:konnectivity-server
namespace: {{ .Release.Namespace }}
labels:
{{- include "konnectivity-agent.labels" . | nindent 4 }}
kubernetes.io/cluster-service: "true"
{{ include "konnectivity-agent.labels" . | indent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: system:konnectivity-server
name: system:konnectivity-server
18 changes: 18 additions & 0 deletions charts/konnectivity-agent/templates/server-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.server.serviceMonitor.enabled }}
apiVersion: v1
kind: Service
metadata:
name: konnectivity-server
namespace: {{ .Release.Namespace }}
labels:
{{ include "konnectivity-server.labels" . | indent 4}}
spec:
clusterIP: None
ports:
- name: http-metrics
port: {{ .Values.ports.admin }}
protocol: TCP
targetPort: {{ .Values.ports.admin }}
selector:
{{- include "konnectivity-server.selectorLabels" . | nindent 4 }}
{{- end }}
38 changes: 38 additions & 0 deletions charts/konnectivity-agent/templates/server-serviceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.server.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: konnectivity-server
namespace: {{ .Release.Namespace }}
labels:
{{ include "konnectivity-server.labels" . | indent 4 }}
{{- if .Values.server.serviceMonitor.extraLabels }}
{{ toYaml .Values.server.serviceMonitor.extraLabels | indent 4 }}
{{- end }}
spec:
jobLabel: jobLabel
selector:
matchLabels:
{{ include "konnectivity-server.selectorLabels" . | indent 6}}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.server.serviceMonitor.interval}}
interval: {{ .Values.server.serviceMonitor.interval }}
{{- end }}
{{- if .Values.server.serviceMonitor.proxyUrl }}
proxyUrl: {{ .Values.server.serviceMonitor.proxyUrl}}
{{- end }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
{{- if .Values.server.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.server.serviceMonitor.metricRelabelings | indent 4) . }}
{{- end }}
{{- if .Values.server.serviceMonitor.relabelings }}
relabelings:
{{ tpl (toYaml .Values.server.serviceMonitor.relabelings | indent 4) . }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/konnectivity-agent/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "konnectivity-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "konnectivity-agent.labels" . | indent 4}}
spec:
clusterIP: None
ports:
- name: http-metrics
port: {{ .Values.ports.admin }}
protocol: TCP
targetPort: {{ .Values.ports.admin }}
selector:
{{- include "konnectivity-agent.selectorLabels" . | nindent 4 }}
{{- end }}
38 changes: 38 additions & 0 deletions charts/konnectivity-agent/templates/serviceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "konnectivity-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "konnectivity-agent.labels" . | indent 4 }}
{{- if .Values.serviceMonitor.extraLabels }}
{{ toYaml .Values.serviceMonitor.extraLabels | indent 4 }}
{{- end }}
spec:
jobLabel: jobLabel
selector:
matchLabels:
{{- include "konnectivity-agent.selectorLabels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: http-metrics
path: /metrics
{{- if .Values.serviceMonitor.interval}}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.proxyUrl }}
proxyUrl: {{ .Values.serviceMonitor.proxyUrl}}
{{- end }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.serviceMonitor.metricRelabelings | indent 4) . }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{ tpl (toYaml .Values.serviceMonitor.relabelings | indent 4) . }}
{{- end }}
{{- end }}
76 changes: 75 additions & 1 deletion charts/konnectivity-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ image:
pullPolicy: Always

nameOverride: ""
fullnameOverride: ""

cluster:
host:
Expand Down Expand Up @@ -57,8 +56,83 @@ nodeSelector: {}

affinity: {}

serviceMonitor:
enabled: false
## Set extraLabels for the serviceMonitor object.
extraLabels: {}
## Scrape interval. If not set, the Prometheus default scrape interval is used.
##
interval: ""

## proxyUrl: URL of a proxy that should be used for scraping.
##
proxyUrl: ""

## MetricRelabelConfigs to apply to samples after scraping, but before ingestion.
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
##
metricRelabelings: []
# - action: keep
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
# sourceLabels: [__name__]

## RelabelConfigs to apply to samples before scraping
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
##
relabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
# regex: ^(.*)$
# targetLabel: nodename
# replacement: $1
# action: replace

## Additional labels
##
additionalLabels: {}
# foo: bar

server:
serviceMonitor:
enabled: false
## Set extraLabels for the serviceMonitor object.
extraLabels: {}
## Scrape interval. If not set, the Prometheus default scrape interval is used.
##
interval: ""

## proxyUrl: URL of a proxy that should be used for scraping.
##
proxyUrl: ""

## MetricRelabelConfigs to apply to samples after scraping, but before ingestion.
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
##
metricRelabelings: []
# - action: keep
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
# sourceLabels: [__name__]

## RelabelConfigs to apply to samples before scraping
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
##
relabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
# regex: ^(.*)$
# targetLabel: nodename
# replacement: $1
# action: replace

## Additional labels
##
additionalLabels: {}
# foo: bar

proportional-autoscaler:
enabled: true
image:
tag: 1.8.6
fullnameOverride: konnectivity-agent-proportional-autoscaler
options:
target: deployment/konnectivity-agent
Expand Down

0 comments on commit ffdfb3f

Please sign in to comment.