From 9ae4f9e131c49d0f318c80e67084039be8a15525 Mon Sep 17 00:00:00 2001 From: BKK Date: Thu, 16 Jun 2022 17:57:06 -0400 Subject: [PATCH 1/2] service account support for drone server --- charts/drone/Chart.yaml | 2 +- charts/drone/templates/deployment.yaml | 1 + charts/drone/templates/serviceaccount.yaml | 12 ++++++++++++ charts/drone/values.schema.json | 19 ++++++++++++++++--- charts/drone/values.yaml | 22 +++++++++++++++++----- 5 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 charts/drone/templates/serviceaccount.yaml diff --git a/charts/drone/Chart.yaml b/charts/drone/Chart.yaml index 74e98b1..c26adb2 100644 --- a/charts/drone/Chart.yaml +++ b/charts/drone/Chart.yaml @@ -4,7 +4,7 @@ name: drone description: Drone is a self-service Continuous Delivery platform for busy development teams # TODO: Un-comment once we move back to apiVersion: v2. # type: application -version: 0.2.5 +version: 0.3.0 appVersion: 2.12.0 kubeVersion: "^1.13.0-0" home: https://drone.io/ diff --git a/charts/drone/templates/deployment.yaml b/charts/drone/templates/deployment.yaml index 20604ef..865d444 100644 --- a/charts/drone/templates/deployment.yaml +++ b/charts/drone/templates/deployment.yaml @@ -27,6 +27,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} + serviceAccountName: {{ include "drone.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: diff --git a/charts/drone/templates/serviceaccount.yaml b/charts/drone/templates/serviceaccount.yaml new file mode 100644 index 0000000..3defa1d --- /dev/null +++ b/charts/drone/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "drone.serviceAccountName" . }} + labels: + {{- include "drone.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/drone/values.schema.json b/charts/drone/values.schema.json index 8894ba7..777a420 100644 --- a/charts/drone/values.schema.json +++ b/charts/drone/values.schema.json @@ -42,7 +42,11 @@ "pullPolicy": { "$id": "#/properties/image/properties/pullPolicy", "type": "string", - "enum": ["Always", "IfNotPresent", "Never"] + "enum": [ + "Always", + "IfNotPresent", + "Never" + ] } } }, @@ -85,7 +89,12 @@ "type": { "$id": "#/properties/service/properties/type", "type": "string", - "enum": ["ClusterIP", "ExternalName", "LoadBalancer", "NodePort"] + "enum": [ + "ClusterIP", + "ExternalName", + "LoadBalancer", + "NodePort" + ] }, "port": { "$id": "#/properties/service/properties/port", @@ -125,6 +134,10 @@ "$id": "#/properties/resources", "type": "object" }, + "serviceAccount": { + "$id": "#/properties/serviceAccount", + "type": "object" + }, "nodeSelector": { "$id": "#/properties/nodeSelector", "type": "object" @@ -169,4 +182,4 @@ } } } -} +} \ No newline at end of file diff --git a/charts/drone/values.yaml b/charts/drone/values.yaml index 1d18d40..32d4ea2 100644 --- a/charts/drone/values.yaml +++ b/charts/drone/values.yaml @@ -13,13 +13,24 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + # Drone server does not interact with the Kubernetes API server automountServiceAccountToken: false -podSecurityContext: {} +podSecurityContext: + {} # fsGroup: 2000 -securityContext: {} +securityContext: + {} # capabilities: # drop: # - ALL @@ -40,14 +51,14 @@ service: type: ClusterIP port: 80 - ## If you'd like to create an ingress in front of the Drone server, you can enable it ## here. Please refer to your service provider's documenatation for any configuration ## that is specific to their ingress implementation. ## Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ ingress: enabled: false - annotations: {} + annotations: + {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" hosts: @@ -60,7 +71,8 @@ ingress: # hosts: # - chart-example.local -resources: {} +resources: + {} # limits: # cpu: 100m # memory: 128Mi From a5bd967b19a322a39f07ac3d78026fa1981001a8 Mon Sep 17 00:00:00 2001 From: BKK Date: Thu, 16 Jun 2022 19:50:10 -0400 Subject: [PATCH 2/2] vscode unformat --- charts/drone/values.schema.json | 23 +++++++---------------- charts/drone/values.yaml | 12 ++++-------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/charts/drone/values.schema.json b/charts/drone/values.schema.json index 777a420..80305e5 100644 --- a/charts/drone/values.schema.json +++ b/charts/drone/values.schema.json @@ -42,11 +42,7 @@ "pullPolicy": { "$id": "#/properties/image/properties/pullPolicy", "type": "string", - "enum": [ - "Always", - "IfNotPresent", - "Never" - ] + "enum": ["Always", "IfNotPresent", "Never"] } } }, @@ -89,12 +85,7 @@ "type": { "$id": "#/properties/service/properties/type", "type": "string", - "enum": [ - "ClusterIP", - "ExternalName", - "LoadBalancer", - "NodePort" - ] + "enum": ["ClusterIP", "ExternalName", "LoadBalancer", "NodePort"] }, "port": { "$id": "#/properties/service/properties/port", @@ -134,14 +125,14 @@ "$id": "#/properties/resources", "type": "object" }, - "serviceAccount": { - "$id": "#/properties/serviceAccount", - "type": "object" - }, "nodeSelector": { "$id": "#/properties/nodeSelector", "type": "object" }, + "serviceAccount": { + "$id": "#/properties/serviceAccount", + "type": "object" + }, "tolerations": { "$id": "#/properties/tolerations", "type": "array" @@ -182,4 +173,4 @@ } } } -} \ No newline at end of file +} diff --git a/charts/drone/values.yaml b/charts/drone/values.yaml index 32d4ea2..60fe8a4 100644 --- a/charts/drone/values.yaml +++ b/charts/drone/values.yaml @@ -25,12 +25,10 @@ serviceAccount: # Drone server does not interact with the Kubernetes API server automountServiceAccountToken: false -podSecurityContext: - {} +podSecurityContext: {} # fsGroup: 2000 -securityContext: - {} +securityContext: {} # capabilities: # drop: # - ALL @@ -57,8 +55,7 @@ service: ## Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ ingress: enabled: false - annotations: - {} + annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" hosts: @@ -71,8 +68,7 @@ ingress: # hosts: # - chart-example.local -resources: - {} +resources: {} # limits: # cpu: 100m # memory: 128Mi