Skip to content

Commit

Permalink
Merge pull request #4 from tomtom-international/feat/secret-option-added
Browse files Browse the repository at this point in the history
feat: secret objects can be created
  • Loading branch information
SajadOrouji-TomTom authored Aug 16, 2023
2 parents 468b426 + 65ff022 commit b30a505
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/azure-devops-agents/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.4.0
version: 0.5.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
6 changes: 4 additions & 2 deletions charts/azure-devops-agents/templates/scaledjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- name: AZP_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.secretName | default (printf "%s" (include "azure-devops-agents.fullname" .)) }}
name: {{ .Values.secret.name | default (printf "%s" (include "azure-devops-agents.fullname" .)) }}
key: AZP_TOKEN
ports:
- name: http
Expand All @@ -44,8 +44,10 @@ spec:
nodeSelector:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.image.pullSecret }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- toYaml .Values.autoscaling | nindent 2 }}
scalingStrategy:
strategy: "default"
Expand Down
30 changes: 30 additions & 0 deletions charts/azure-devops-agents/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if .Values.secret.create -}}
---
apiVersion: v1
kind: Secret
type: "Opaque"
data:
AZP_TOKEN: {{ .Values.secret.token | b64enc | quote }}
metadata:
name: {{ .Values.secret.name | default (printf "%s" (include "azure-devops-agents.fullname" .)) }}
labels:
{{- include "azure-devops-agents.labels" . | nindent 4 }}
{{- with .Values.secret.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
---
apiVersion: v1
kind: Secret
type: "kubernetes.io/dockerconfigjson"
data:
.dockerconfigjson: {{ .Values.secret.pullsecret | b64enc | quote }}
metadata:
name: {{ .Values.secret.name | default (printf "%s" (include "azure-devops-agents.fullname" .)) }}
labels:
{{- include "azure-devops-agents.labels" . | nindent 4 }}
{{- with .Values.secret.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
7 changes: 5 additions & 2 deletions charts/azure-devops-agents/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
image:
repository: mcr.microsoft.com/azure-pipelines/vsts-agent
pullPolicy: IfNotPresent
pullSecret: "secret"
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"

Expand Down Expand Up @@ -48,7 +47,11 @@ workloadidentity:
parameters: ""
secretObjects: ""

secretName: "mysecret"
secret:
create: true
name: "mysecret"
token: "mytoken"
pullsecret: '{"auths":{"URL":{"username":"USERNAME","password":"TOKEN","auth":"AUTH"}}}'

volumeMounts:
- name: work-disk
Expand Down

0 comments on commit b30a505

Please sign in to comment.