Skip to content

feat: enhancements for Helm #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,29 @@ $ helm upgrade --install azure-pipelines-agent emberstack/azure-pipelines-agent

You can customize the values of the helm deployment by using the following Values:

| Parameter | Description | Default |
| ------------------------------------ | ----------------------------------------------------------- | ------------------------------------------------------- |
| `nameOverride` | Overrides release name | `""` |
| `fullnameOverride` | Overrides release fullname | `""` |
| `image.repository` | Container image repository | `emberstack/azure-pipelines-agent` |
| `image.tag` | Container image tag | `""` (same version as the chart) |
| `image.pullPolicy` | Container image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent`|
| `pipelines.url` | The Azure base URL for your organization | `""` |
| `pipelines.pat` | Personal Access Token (PAT) used by the agent to connect. | `""` |
| `pipelines.pool` | Agent pool to which the Agent should register. | `""` |
| `pipelines.agent.mountDocker` | Enable to mount the host `docker.sock` | `false` |
| `pipelines.agent.workDir` | The work directory the agent should use | `_work` |
| `serviceAccount.create` | Create ServiceAccount | `true` |
| `serviceAccount.name` | ServiceAccount name | _release name_ |
| `serviceAccount.clusterAdmin` | Sets the service account as a cluster admin | _release name_ |
| `resources` | Resource limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Node affinity for pod assignment | `{}` |
| Parameter | Description | Default |
|-------------------------------|---------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| `nameOverride` | Overrides release name | `""` |
| `fullnameOverride` | Overrides release fullname | `""` |
| `image.repository` | Container image repository | `emberstack/azure-pipelines-agent` |
| `image.tag` | Container image tag | `""` (same version as the chart) |
| `image.pullPolicy` | Container image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent` |
| `pipelines.url` | The Azure base URL for your organization | `""` |
| `pipelines.pat.value` | Personal Access Token (PAT) used by the agent to connect. | `""` |
| `pipelines.pat.secretRef` | The reference to the secret storing the Personal Access Token (PAT) used by the agent to connect. | `""` |
| `pipelines.pool` | Agent pool to which the Agent should register. | `""` |
| `pipelines.agent.mountDocker` | Enable to mount the host `docker.sock` | `false` |
| `pipelines.agent.workDir` | The work directory the agent should use | `_work` |
| `serviceAccount.create` | Create ServiceAccount | `true` |
| `serviceAccount.name` | ServiceAccount name | _release name_ |
| `serviceAccount.clusterAdmin` | Sets the service account as a cluster admin | _release name_ |
| `resources` | Resource limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Node affinity for pod assignment | `{}` |
| `additionalEnv` | Additional environment variables for the agent container. | `[]` |
| `extraVolumes` | Additional volumes for the agent pod. | `[]` |
| `extraVolumeMounts` | Additional volume mounts for the agent container. | `[]` |
| `initContainers` | InitContainers for the agent pod. | `[]` |

> Find us on [Artifact Hub](https://artifacthub.io/packages/helm/emberstack/azure-pipelines-agent)
38 changes: 38 additions & 0 deletions src/helm/azure-pipelines-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,41 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Add volumes to the agent pod.
*/}}
{{- define "azure-pipelines-agent.volumes" -}}
{{- if or .Values.pipelines.agent.mountDocker .Values.extraVolumes -}}
volumes:
{{- if .Values.extraVolumes }}
{{- with .Values.extraVolumes }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{- if .Values.pipelines.agent.mountDocker }}
- name: dockersock
hostPath:
path: /var/run/docker.sock
{{- end }}
{{- end }}
{{- end }}


{{/*
Add volume mounts to the agent container.
*/}}
{{- define "azure-pipelines-agent.volumeMounts" -}}
{{- if or .Values.pipelines.agent.mountDocker .Values.extraVolumeMounts -}}
volumeMounts:
{{- if .Values.pipelines.agent.mountDocker }}
- name: dockersock
mountPath: /var/run/docker.sock
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{- with .Values.extraVolumeMounts }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
30 changes: 18 additions & 12 deletions src/helm/azure-pipelines-agent/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ spec:
serviceAccountName: {{ include "azure-pipelines-agent.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.pipelines.agent.mountDocker }}
Expand Down Expand Up @@ -58,20 +62,22 @@ spec:
- name: AZP_WORK
value: {{ .Values.pipelines.agent.workDir | quote }}
- name: AZP_TOKEN
value: {{ .Values.pipelines.pat | quote }}
{{- if .Values.pipelines.agent.mountDocker }}
volumeMounts:
- name: dockersock
mountPath: "/var/run/docker.sock"
{{- end }}
{{- if .Values.pipelines.pat.secretRef }}
{{- with .Values.pipelines.pat.secretRef }}
valueFrom:
secretKeyRef:
{{- toYaml . | nindent 18 }}
{{- end }}
{{- else }}
value: {{ .Values.pipelines.pat.value | quote }}
{{- end }}
{{- with .Values.additionalEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.pipelines.agent.mountDocker }}
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
{{- end }}
{{- include "azure-pipelines-agent.volumeMounts" . | nindent 10 -}}
{{- include "azure-pipelines-agent.volumes" . | nindent 6 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
61 changes: 57 additions & 4 deletions src/helm/azure-pipelines-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,21 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""


# Pat: Can be either a string or a reference to a secret.
# If it is a string, it is used as the value of the secret:
#
# value: "my-secret"
#
# If it is a reference to a secret:
# secretRef:
# name: my-secret
# key: my-key
pipelines:
url: ""
pat: ""
pat:
value: ""
#secretRef: {}
pool: "Default"
agent:
name: ""
Expand All @@ -33,15 +45,15 @@ serviceAccount:
name: ""

podSecurityContext: {}
# fsGroup: 2000
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# runAsUser: 1000


resources: {}
Expand All @@ -54,10 +66,51 @@ resources: {}
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

# Additional environment variables for the agent container.
# Like:
# - name: XXX
# value: "YYY"
#
# or reference to a secret or configmap:
# - name: SPECIAL_LEVEL_KEY
# valueFrom:
# configMapKeyRef:
# name: special-config
# key: special.how
#
# - name: SECRET_KEY
# valueFrom:
# secretKeyRef:
# name: secret-name
# key: secret.key
additionalEnv: []

# Additional volumes for the agent pod.
# extraVolumes:
# - name: config-volume
# configMap:
# name: special-config
extraVolumes: []

# Additional volume mounts for the agent container.
# extraVolumeMounts:
# - name: config-volume
# mountPath: /etc/special
# readOnly: true
extraVolumeMounts: []

# InitContainers for the agent pod.
#
# initContainers:
# - name: init-container
# image: busybox
# command: ["/bin/sh", "-c", "echo Hello World"]
initContainers: []