Skip to content

Commit

Permalink
🌱 refactor konnectivity chart (#97)
Browse files Browse the repository at this point in the history
refactor konnectivity chart

Signed-off-by: kranurag7 <[email protected]>
  • Loading branch information
kranurag7 authored Jun 28, 2024
1 parent d8e7f36 commit 6bcbe7f
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/konnectivity-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ dependencies:
alias: proportional-autoscaler
condition: proportional-autoscaler.enabled
appVersion: v1.8.9
version: 1.0.12
version: 1.0.13
13 changes: 12 additions & 1 deletion charts/konnectivity-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Selector labels for server
{{- define "konnectivity-server.selectorLabels" -}}
app.kubernetes.io/name: konnectivity-server
app.kubernetes.io/instance: konnectivity-server
k8s-app: konnectivity-agent
k8s-app: konnectivity-server
{{- end }}

{{/*
Expand All @@ -85,3 +85,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the service account to use for konnectivity-server
*/}}
{{- define "konnectivity-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default .Values.server.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.server.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ spec:
sources:
- serviceAccountToken:
path: konnectivity-agent-token
audience: system:konnectivity-server
audience: system:konnectivity-agent
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
15 changes: 15 additions & 0 deletions charts/konnectivity-agent/templates/agent/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: system:konnectivity-agent
namespace: {{ .Release.Namespace }}
labels:
{{ 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-agent
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "konnectivity-agent.fullname" . }}
name: konnectivity-agent
namespace: {{ .Release.Namespace }}
labels:
{{ include "konnectivity-agent.labels" . | indent 4}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: system:konnectivity-server
namespace: {{ .Release.Namespace }}
labels:
{{ include "konnectivity-agent.labels" . | indent 4 }}
{{ include "konnectivity-server.labels" . | indent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ metadata:
spec:
clusterIP: None
ports:
- name: agent-port
port: {{ .Values.ports.proxy }}
protocol: TCP
targetPort: {{ .Values.ports.proxy }}
{{- if .Values.server.serviceMonitor.enabled }}
- name: http-metrics
port: {{ .Values.ports.admin }}
protocol: TCP
targetPort: {{ .Values.ports.admin }}
{{- end }}
- name: agent-port
port: {{ .Values.ports.proxy }}
protocol: TCP
targetPort: {{ .Values.ports.proxy }}
selector:
{{- include "konnectivity-server.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "konnectivity-server.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "konnectivity-server.labels" . | nindent 4 }}
kubernetes.io/cluster-service: "true"
2 changes: 2 additions & 0 deletions charts/konnectivity-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ serviceMonitor:
# foo: bar

server:
serviceAccount:
name: "konnectivity-server"
serviceMonitor:
enabled: false
## Set extraLabels for the serviceMonitor object.
Expand Down

0 comments on commit 6bcbe7f

Please sign in to comment.