moved
All checks were successful
Lint and Test Charts / lint-test (push) Successful in 17s
All checks were successful
Lint and Test Charts / lint-test (push) Successful in 17s
This commit is contained in:
62
charts/azure-agent/templates/_helpers.tpl
Normal file
62
charts/azure-agent/templates/_helpers.tpl
Normal file
@@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "az-agent.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "az-agent.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "az-agent.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "az-agent.labels" -}}
|
||||
helm.sh/chart: {{ include "az-agent.chart" . }}
|
||||
{{ include "az-agent.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "az-agent.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "az-agent.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "az-agent.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "az-agent.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
9
charts/azure-agent/templates/agent-secret.yaml
Normal file
9
charts/azure-agent/templates/agent-secret.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
stringData:
|
||||
AZP_POOL: {{ .Values.azure.pool }}
|
||||
AZP_TOKEN: {{ .Values.azure.token }}
|
||||
AZP_URL: {{ .Values.azure.url }}
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "az-agent.fullname" . }}
|
||||
type: Opaque
|
92
charts/azure-agent/templates/deployment.yaml
Normal file
92
charts/azure-agent/templates/deployment.yaml
Normal file
@@ -0,0 +1,92 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "az-agent.fullname" . }}
|
||||
labels:
|
||||
{{- include "az-agent.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "az-agent.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "az-agent.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "az-agent.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
- name: AZP_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "az-agent.fullname" . }}
|
||||
key: AZP_URL
|
||||
- name: AZP_POOL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "az-agent.fullname" . }}
|
||||
key: AZP_POOL
|
||||
- name: HARBOR_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "az-agent.fullname" . }}-harbor
|
||||
key: HARBOR_USERNAME
|
||||
- name: HARBOR_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "az-agent.fullname" . }}-harbor
|
||||
key: HARBOR_PASSWORD
|
||||
- name: HARBOR_HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "az-agent.fullname" . }}-harbor
|
||||
key: HARBOR_HOST
|
||||
- name: HARBOR_PORT
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "az-agent.fullname" . }}-harbor
|
||||
key: HARBOR_PORT
|
||||
volumeMounts:
|
||||
- name: azp-token
|
||||
mountPath: /home/agent/.token
|
||||
subPath: .token
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: azp-token
|
||||
secret:
|
||||
secretName: {{ include "az-agent.fullname" . }}
|
||||
items:
|
||||
- key: AZP_TOKEN
|
||||
path: .token
|
||||
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
10
charts/azure-agent/templates/harbor-secret.yaml
Normal file
10
charts/azure-agent/templates/harbor-secret.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
stringData:
|
||||
HARBOR_USERNAME: {{ .Values.harbor.username }}
|
||||
HARBOR_PASSWORD: {{ .Values.harbor.password }}
|
||||
HARBOR_HOST: {{ .Values.harbor.host }}
|
||||
HARBOR_PORT: "{{ .Values.harbor.port }}"
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "az-agent.fullname" . }}-harbor
|
||||
type: Opaque
|
6
charts/azure-agent/templates/required_values.yaml
Normal file
6
charts/azure-agent/templates/required_values.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
{{- $_ := required "azure.url is required" .Values.azure.url }}
|
||||
{{- $_ := required "azure.pool is required" .Values.azure.pool }}
|
||||
{{- $_ := required "azure.token is required" .Values.azure.token }}
|
||||
{{- $_ := required "harbor.username is required" .Values.harbor.username }}
|
||||
{{- $_ := required "harbor.password is required" .Values.harbor.password }}
|
||||
{{- $_ := required "harbor.host is required" .Values.harbor.host }}
|
20
charts/azure-agent/templates/rolebindings.yaml
Normal file
20
charts/azure-agent/templates/rolebindings.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
{{- $sa_namespace := .Release.Namespace -}}
|
||||
{{- $object_name := include "az-agent.serviceAccountName" . -}}
|
||||
{{- $labels := include "az-agent.labels" . | nindent 4 -}}
|
||||
{{- range .Values.build.namespaces }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ $object_name }}
|
||||
namespace: {{ . }}
|
||||
labels: {{ $labels }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ $object_name }}
|
||||
namespace: {{ $sa_namespace }}
|
||||
{{ end }}
|
13
charts/azure-agent/templates/serviceaccount.yaml
Normal file
13
charts/azure-agent/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "az-agent.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "az-agent.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user