From ee7a894e8b0f58abef889a4bc607fe1407266bd5 Mon Sep 17 00:00:00 2001 From: Christian Roggia Date: Tue, 12 Jun 2018 21:24:31 +0200 Subject: [PATCH] [incubator/drone] Move drone from incubator to stable (#5780) * Move drone from incubator to stable * Restore incubator/drone for the deprecation process * Bump version of incubator/drone * Remove maintainers from deprecated chart * Add comments about deprecation in the README, NOTES and Chart.yaml * Revert file permission for repo-sync.sh and build.sh --- incubator/drone/Chart.yaml | 10 +- incubator/drone/README.md | 1 + incubator/drone/templates/NOTES.txt | 2 + stable/drone/.helmignore | 23 ++ stable/drone/Chart.yaml | 19 ++ stable/drone/OWNERS | 4 + stable/drone/README.md | 80 ++++++ stable/drone/templates/NOTES.txt | 69 ++++++ stable/drone/templates/_helpers.tpl | 26 ++ stable/drone/templates/deployment-agent.yaml | 92 +++++++ stable/drone/templates/deployment-server.yaml | 87 +++++++ stable/drone/templates/ingress.yaml | 40 +++ stable/drone/templates/pvc.yaml | 19 ++ stable/drone/templates/role-binding.yaml | 19 ++ stable/drone/templates/role.yaml | 21 ++ stable/drone/templates/secrets.yaml | 16 ++ stable/drone/templates/service-account.yaml | 11 + stable/drone/templates/service.yaml | 25 ++ stable/drone/values.yaml | 234 ++++++++++++++++++ 19 files changed, 793 insertions(+), 5 deletions(-) mode change 100755 => 100644 incubator/drone/Chart.yaml create mode 100644 stable/drone/.helmignore create mode 100644 stable/drone/Chart.yaml create mode 100644 stable/drone/OWNERS create mode 100644 stable/drone/README.md create mode 100644 stable/drone/templates/NOTES.txt create mode 100644 stable/drone/templates/_helpers.tpl create mode 100644 stable/drone/templates/deployment-agent.yaml create mode 100644 stable/drone/templates/deployment-server.yaml create mode 100644 stable/drone/templates/ingress.yaml create mode 100644 stable/drone/templates/pvc.yaml create mode 100644 stable/drone/templates/role-binding.yaml create mode 100644 stable/drone/templates/role.yaml create mode 100644 stable/drone/templates/secrets.yaml create mode 100644 stable/drone/templates/service-account.yaml create mode 100644 stable/drone/templates/service.yaml create mode 100644 stable/drone/values.yaml diff --git a/incubator/drone/Chart.yaml b/incubator/drone/Chart.yaml old mode 100755 new mode 100644 index 3fbd6e66b5..e2c4f15676 --- a/incubator/drone/Chart.yaml +++ b/incubator/drone/Chart.yaml @@ -1,9 +1,12 @@ name: drone home: https://drone.io/ icon: https://drone.io/apple-touch-icon.png -version: 1.1.0 +version: 1.1.1 appVersion: 0.8.5 -description: Drone is a Continuous Delivery system built on container technology +# The incubator/drone chart is deprecated and no longer maintained. Please use +# the stable chart you can find at stable/drone. +deprecated: true +description: DEPRECATED Drone is a Continuous Delivery system built on container technology keywords: - continuous-delivery - continuous-deployment @@ -14,6 +17,3 @@ keywords: - go sources: - https://github.com/drone/drone -maintainers: -- name: christian-roggia - email: christian.roggia@gmail.com diff --git a/incubator/drone/README.md b/incubator/drone/README.md index df3878ea73..3d4edf500d 100644 --- a/incubator/drone/README.md +++ b/incubator/drone/README.md @@ -1,6 +1,7 @@ # Drone.io [Drone](http://readme.drone.io/) is a Continuous Integration platform built on container technology. +**NOTE: this chart has been DEPRECATED. Please see stable/drone.** ## TL;DR; diff --git a/incubator/drone/templates/NOTES.txt b/incubator/drone/templates/NOTES.txt index 8ae5a532da..031af256ae 100644 --- a/incubator/drone/templates/NOTES.txt +++ b/incubator/drone/templates/NOTES.txt @@ -1,3 +1,5 @@ +NOTE: this chart has been DEPRECATED. Please see stable/drone. + {{- if hasKey .Values.server.env "DRONE_PROVIDER" }} ********************************************************************************* *** PLEASE BE PATIENT: drone may take a few minutes to install *** diff --git a/stable/drone/.helmignore b/stable/drone/.helmignore new file mode 100644 index 0000000000..46fd899656 --- /dev/null +++ b/stable/drone/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +# OWNERS file for Kubernetes +OWNERS diff --git a/stable/drone/Chart.yaml b/stable/drone/Chart.yaml new file mode 100644 index 0000000000..ce01d273a1 --- /dev/null +++ b/stable/drone/Chart.yaml @@ -0,0 +1,19 @@ +name: drone +home: https://drone.io/ +icon: https://drone.io/apple-touch-icon.png +version: 1.2.0 +appVersion: 0.8.5 +description: Drone is a Continuous Delivery system built on container technology +keywords: +- continuous-delivery +- continuous-deployment +- continuous-integration +- docker +- drone +- drone.io +- go +sources: +- https://github.com/drone/drone +maintainers: +- name: christian-roggia + email: christian.roggia@gmail.com diff --git a/stable/drone/OWNERS b/stable/drone/OWNERS new file mode 100644 index 0000000000..ce90a4a7c0 --- /dev/null +++ b/stable/drone/OWNERS @@ -0,0 +1,4 @@ +approvers: +- christian-roggia +reviewers: +- christian-roggia diff --git a/stable/drone/README.md b/stable/drone/README.md new file mode 100644 index 0000000000..3449c91ec0 --- /dev/null +++ b/stable/drone/README.md @@ -0,0 +1,80 @@ +# Drone.io + +[Drone](http://readme.drone.io/) is a Continuous Integration platform built on container technology. + +## TL;DR; + +```console +$ helm install stable/drone +``` + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release stable/drone +``` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes nearly all the Kubernetes components associated with the +chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the drone charts and their default values. + +| Parameter | Description | Default | +|-----------------------------|-----------------------------------------------------------------------------------------------|-----------------------------| +| `images.server.repository` | Drone **server** image | `docker.io/drone/drone` | +| `images.server.tag` | Drone **server** image tag | `0.8.5` | +| `images.server.pullPolicy` | Drone **server** image pull policy | `IfNotPresent` | +| `images.agent.repository` | Drone **agent** image | `docker.io/drone/agent` | +| `images.agent.tag` | Drone **agent** image tag | `0.8.5` | +| `images.agent.pullPolicy` | Drone **agent** image pull policy | `IfNotPresent` | +| `images.dind.repository` | Docker **dind** image | `docker.io/library/docker` | +| `images.dind.tag` | Docker **dind** image tag | `17.12.0-ce-dind` | +| `images.dind.pullPolicy` | Docker **dind** image pull policy | `IfNotPresent` | +| `service.httpPort` | Drone's Web GUI HTTP port | `80` | +| `service.nodePort` | If `service.type` is `NodePort` and this is non-empty, sets the http node port of the service | `32015` | +| `service.type` | Service type (ClusterIP, NodePort or LoadBalancer) | `ClusterIP` | +| `ingress.enabled` | Enables Ingress for Drone | `false` | +| `ingress.annotations` | Ingress annotations | `{}` | +| `ingress.hosts` | Ingress accepted hostnames | `nil` | +| `ingress.tls` | Ingress TLS configuration | `[]` | +| `server.host` | Drone **server** scheme and hostname | `(internal hostname)` | +| `server.env` | Drone **server** environment variables | `(default values)` | +| `server.envSecrets`        | Drone **server** secret environment variables                                                 | `(default values)`         | +| `server.annotations` | Drone **server** annotations | `{}` | +| `server.resources` | Drone **server** pod resource requests & limits | `{}` | +| `server.schedulerName` | Drone **server** alternate scheduler name | `nil` | +| `server.affinity` | Drone **server** scheduling preferences | `{}` | +| `agent.env` | Drone **agent** environment variables | `(default values)` | +| `agent.replicas` | Drone **agent** replicas | `1` | +| `agent.annotations` | Drone **agent** annotations | `{}` | +| `agent.resources` | Drone **agent** pod resource requests & limits | `{}` | +| `agent.schedulerName` | Drone **agent** alternate scheduler name | `nil` | +| `agent.affinity` | Drone **agent** scheduling preferences | `{}` | +| `dind.enabled` | Enable or disable **DinD** | `true` | +| `dind.driver` | **DinD** storage driver | `overlay2` | +| `dind.resources` | **DinD** pod resource requests & limits | `{}` | +| `dind.env` | **DinD** environment variables | `nil` | +| `dind.command` | **DinD** custom command instead of default entry point | `nil` | +| `dind.args` | **DinD** arguments for custom command or entry point | `nil` | +| `persistence.enabled` | Use a PVC to persist data | `true` | +| `persistence.existingClaim` | Use an existing PVC to persist data | `nil` | +| `persistence.storageClass` | Storage class of backing PVC | `nil` | +| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` | +| `persistence.size` | Size of data volume | `1Gi` | +| `sharedSecret` | Drone server and agent shared secret (Note: The Default random value changes on every `helm upgrade` causing a rolling update of server and agents) | `(random value)` | +| `rbac.create` | Specifies whether RBAC resources should be created. | `true` | +| `rbac.apiVersion` | RBAC API version | `v1` | +| `serviceAccount.create` | Specifies whether a ServiceAccount should be created. | `true` | +| `serviceAccount.name` | The name of the ServiceAccount to use. If not set and create is true, a name is generated using the fullname template. | `(fullname template)` | diff --git a/stable/drone/templates/NOTES.txt b/stable/drone/templates/NOTES.txt new file mode 100644 index 0000000000..8ae5a532da --- /dev/null +++ b/stable/drone/templates/NOTES.txt @@ -0,0 +1,69 @@ +{{- if hasKey .Values.server.env "DRONE_PROVIDER" }} +********************************************************************************* +*** PLEASE BE PATIENT: drone may take a few minutes to install *** +********************************************************************************* + +{{- if .Values.ingress.enabled }} +From outside the cluster, the server URL(s) are: +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} + +{{- else if contains "NodePort" .Values.service.type }} + +Get the Drone URL by running: + export NODE_PORT=$(kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "drone.fullname" . }}) + export NODE_IP=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT/ + +{{- else if contains "LoadBalancer" .Values.service.type }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc -w {{ template "drone.fullname" . }}' + +Get the Drone URL by running: + export SERVICE_IP=$(kubectl get svc {{ template "drone.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP/ +{{- else if contains "ClusterIP" .Values.service.type }} + +Get the Drone URL by running: + export POD_NAME=$(kubectl get pods -n {{ .Release.Namespace }} -l "component=server,app={{ template "drone.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo http://127.0.0.1:8000/ + kubectl -n {{ .Release.Namespace }} port-forward $POD_NAME 8000:8000 +{{- end }} +{{- else -}} +############################################################################## +#### ERROR: You did not set a valid version control provider #### +############################################################################## + +This deployment will be incomplete until you configure a valid version +control provider: + + kubectl create secret generic drone-server-secrets \ + --namespace={{ .Release.Namespace }} \ + --from-literal=DRONE_GITHUB_SECRET="github-oauth2-client-secret" + + helm upgrade {{ .Release.Name }} \ + --reuse-values \ + --set server.env.DRONE_PROVIDER="github" \ + --set server.env.DRONE_GITHUB="true" \ + --set server.env.DRONE_ORGS="my-github-org" \ + --set server.env.DRONE_GITHUB_CLIENT="github-oauth2-client-id" \ + --set server.envSecrets.drone-server-secrets[0]=DRONE_GITHUB_SECRET \ + incubator/drone + +Currently supported providers: + + - GitHub + - GitLab + - Gitea + - Gogs + - Bitbucket Cloud + - Bitbucket Server (Stash) + - Coding + +If you are having trouble with the configuration of a provider please visit +the official documentation: + + http://docs.drone.io/installation/ +{{- end }} diff --git a/stable/drone/templates/_helpers.tpl b/stable/drone/templates/_helpers.tpl new file mode 100644 index 0000000000..4c0c1122d9 --- /dev/null +++ b/stable/drone/templates/_helpers.tpl @@ -0,0 +1,26 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{ define "drone.name" }}{{ default "drone" .Values.nameOverride | trunc 63 }}{{ 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). +*/}} +{{ define "drone.fullname" }} +{{- $name := default "drone" .Values.nameOverride -}} +{{ printf "%s-%s" .Release.Name $name | trunc 63 -}} +{{ end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "drone.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "drone.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/stable/drone/templates/deployment-agent.yaml b/stable/drone/templates/deployment-agent.yaml new file mode 100644 index 0000000000..570249eb18 --- /dev/null +++ b/stable/drone/templates/deployment-agent.yaml @@ -0,0 +1,92 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "drone.fullname" . }}-agent + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + component: agent +spec: + replicas: {{ .Values.agent.replicas }} + template: + metadata: + annotations: + checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} +{{- if .Values.agent.annotations }} +{{ toYaml .Values.agent.annotations | indent 8 }} +{{- end }} + labels: + app: {{ template "drone.name" . }} + release: "{{ .Release.Name }}" + component: agent + spec: +{{- if .Values.agent.schedulerName }} + schedulerName: "{{ .Values.agent.schedulerName }}" +{{- end }} +{{- if .Values.agent.affinity }} + affinity: +{{ toYaml .Values.agent.affinity | indent 8 }} +{{- end }} + serviceAccountName: {{ template "drone.serviceAccountName" . }} + containers: + - name: {{ template "drone.fullname" . }}-agent + image: "{{ .Values.images.agent.repository }}:{{ .Values.images.agent.tag }}" + imagePullPolicy: {{ .Values.images.agent.pullPolicy }} + env: + - name: DRONE_SERVER + value: {{ template "drone.fullname" . }}:9000 + - name: DRONE_SECRET + valueFrom: + secretKeyRef: + name: {{ template "drone.fullname" . }} + key: secret +{{- if .Values.dind.enabled }} + - name: DOCKER_HOST + value: tcp://localhost:2375 +{{- end }} + {{- range $key, $value := .Values.agent.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + resources: +{{ toYaml .Values.agent.resources | indent 10 }} +{{- if not .Values.dind.enabled }} + securityContext: + privileged: true + volumeMounts: + - mountPath: /var/run/docker.sock + name: docker-socket + volumes: + - name: docker-socket + hostPath: + path: /var/run/docker.sock +{{- else }} + - name: {{ template "drone.fullname" . }}-dind + image: "{{ .Values.images.dind.repository }}:{{ .Values.images.dind.tag }}" + imagePullPolicy: {{ .Values.images.dind.pullPolicy }} +{{- if .Values.dind.command }} + command: {{ .Values.dind.command }} +{{ end }} +{{- if .Values.dind.args }} + args: {{ .Values.dind.args }} +{{ end }} + env: + - name: DOCKER_DRIVER + value: {{ .Values.dind.driver }} + {{ range $key, $value := .Values.dind.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{ end }} + securityContext: + privileged: true + resources: +{{ toYaml .Values.dind.resources | indent 10 }} + volumeMounts: + - name: docker-graph-storage + mountPath: /var/lib/docker + volumes: + - name: docker-graph-storage + emptyDir: {} +{{- end }} diff --git a/stable/drone/templates/deployment-server.yaml b/stable/drone/templates/deployment-server.yaml new file mode 100644 index 0000000000..d33ae7fa1a --- /dev/null +++ b/stable/drone/templates/deployment-server.yaml @@ -0,0 +1,87 @@ +{{- if hasKey .Values.server.env "DRONE_PROVIDER" }} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "drone.fullname" . }}-server + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + component: server +spec: + replicas: 1 + template: + metadata: + annotations: + checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} +{{- if .Values.server.annotations }} +{{ toYaml .Values.server.annotations | indent 8 }} +{{- end }} + labels: + app: {{ template "drone.name" . }} + release: "{{ .Release.Name }}" + component: server + spec: +{{- if .Values.server.schedulerName }} + schedulerName: "{{ .Values.server.schedulerName }}" +{{- end }} +{{- if .Values.server.affinity }} + affinity: +{{ toYaml .Values.server.affinity | indent 8 }} +{{- end }} + serviceAccountName: {{ template "drone.serviceAccountName" . }} + containers: + - name: {{ template "drone.fullname" . }}-server + image: "{{ .Values.images.server.repository }}:{{ .Values.images.server.tag }}" + imagePullPolicy: {{ .Values.images.server.pullPolicy }} + env: + - name: DRONE_SECRET + valueFrom: + secretKeyRef: + name: {{ template "drone.fullname" . }} + key: secret + {{- range $secret, $keys := .Values.server.envSecrets }} + {{- range $keys }} + - name: {{ . }} + valueFrom: + secretKeyRef: + name: {{ $secret }} + key: {{ . | quote }} + {{- end }} + {{- end }} + - name: DRONE_HOST + {{- if hasKey .Values.server "host" }} + value: "{{ .Values.server.host }}" + {{- else }} + value: "http://{{ template "drone.fullname" . }}" + {{- end }} + {{- range $key, $value := .Values.server.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + ports: + - name: http + containerPort: 8000 + protocol: TCP + - name: grpc + containerPort: 9000 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + resources: +{{ toYaml .Values.server.resources | indent 10 }} + volumeMounts: + - name: data + mountPath: /var/lib/drone + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "drone.fullname" .) }} + {{- else }} + emptyDir: {} + {{- end -}} +{{ end }} diff --git a/stable/drone/templates/ingress.yaml b/stable/drone/templates/ingress.yaml new file mode 100644 index 0000000000..b72fca6748 --- /dev/null +++ b/stable/drone/templates/ingress.yaml @@ -0,0 +1,40 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "drone.fullname" . }} +{{- $httpPort := .Values.service.httpPort }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + labels: + app: {{ template "drone.name" . }} + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + name: {{ template "drone.fullname" . }} +spec: + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + {{- if index $.Values.ingress "annotations" }} + {{- if eq (index $.Values.ingress.annotations "kubernetes.io/ingress.class" | default "") "gce" }} + - path: /* + {{- else }}{{/* Has annotations but ingress class is not "gce" */}} + - path: / + {{- end }} + {{- else}}{{/* Has no annotations */}} + - path: / + {{- end }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $httpPort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/stable/drone/templates/pvc.yaml b/stable/drone/templates/pvc.yaml new file mode 100644 index 0000000000..22c4cbfe39 --- /dev/null +++ b/stable/drone/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "drone.fullname" . }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/stable/drone/templates/role-binding.yaml b/stable/drone/templates/role-binding.yaml new file mode 100644 index 0000000000..b1f654748e --- /dev/null +++ b/stable/drone/templates/role-binding.yaml @@ -0,0 +1,19 @@ +{{ if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/{{ required "A valid .Values.rbac.apiVersion entry required!" .Values.rbac.apiVersion }} +kind: RoleBinding +metadata: + name: {{ template "drone.fullname" . }} + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ template "drone.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ template "drone.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{ end }} diff --git a/stable/drone/templates/role.yaml b/stable/drone/templates/role.yaml new file mode 100644 index 0000000000..f69b4a7f52 --- /dev/null +++ b/stable/drone/templates/role.yaml @@ -0,0 +1,21 @@ +{{ if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/{{ required "A valid .Values.rbac.apiVersion entry required!" .Values.rbac.apiVersion }} +kind: Role +metadata: + name: {{ template "drone.fullname" . }} + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +rules: + - apiGroups: + - extensions + resources: + - deployments + verbs: + - get + - list + - patch + - update +{{ end }} diff --git a/stable/drone/templates/secrets.yaml b/stable/drone/templates/secrets.yaml new file mode 100644 index 0000000000..a3a899c173 --- /dev/null +++ b/stable/drone/templates/secrets.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "drone.fullname" . }} + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + {{ if .Values.sharedSecret }} + secret: "{{ .Values.sharedSecret | b64enc }}" + {{ else }} + secret: "{{ randAlphaNum 24 | b64enc }}" + {{ end }} diff --git a/stable/drone/templates/service-account.yaml b/stable/drone/templates/service-account.yaml new file mode 100644 index 0000000000..068b0dc57d --- /dev/null +++ b/stable/drone/templates/service-account.yaml @@ -0,0 +1,11 @@ +{{ if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "drone.serviceAccountName" . }} + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{ end }} diff --git a/stable/drone/templates/service.yaml b/stable/drone/templates/service.yaml new file mode 100644 index 0000000000..419773c8cf --- /dev/null +++ b/stable/drone/templates/service.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "drone.fullname" . }} + labels: + app: {{ template "drone.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + type: {{ .Values.service.type }} + ports: + - name: http + port: {{ .Values.service.httpPort }} + targetPort: 8000 +{{- if hasKey .Values.service "nodePort" }} + nodePort: {{ .Values.service.nodePort }} +{{- end }} + - name: grpc + port: 9000 + targetPort: 9000 + selector: + app: {{ template "drone.name" . }} + release: {{ .Release.Name | quote }} + component: server diff --git a/stable/drone/values.yaml b/stable/drone/values.yaml new file mode 100644 index 0000000000..9ccb7861e3 --- /dev/null +++ b/stable/drone/values.yaml @@ -0,0 +1,234 @@ +appVersion: "0.8.5" + +images: + ## The official drone (server) image, change tag to use a different version. + ## ref: https://hub.docker.com/r/drone/drone/tags/ + ## + server: + repository: "docker.io/drone/drone" + tag: 0.8.5 + pullPolicy: IfNotPresent + + ## The official drone (agent) image, change tag to use a different version. + ## ref: https://hub.docker.com/r/drone/agent/tags/ + ## + agent: + repository: "docker.io/drone/agent" + tag: 0.8.5 + pullPolicy: IfNotPresent + + ## The official docker (dind) image, change tag to use a different version. + ## ref: https://hub.docker.com/r/library/docker/tags/ + ## + dind: + repository: "docker.io/library/docker" + tag: 17.12.0-ce-dind + pullPolicy: IfNotPresent + +service: + httpPort: 80 + + ## If service.type is not set to NodePort, the following statement + ## will be ignored. + ## + # nodePort: 32015 + + ## Service type can be set to ClusterIP, NodePort or LoadBalancer. + ## + type: ClusterIP + +ingress: + ## If true, Drone Ingress will be created. + ## + enabled: false + + ## Drone Ingress annotations + ## + # annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: 'true' + + ## Drone hostnames must be provided if Ingress is enabled + ## + # hosts: + # - drone.domain.io + + ## Drone Ingress TLS configuration secrets + ## Must be manually created in the namespace + ## + # tls: + # - secretName: drone-tls + # hosts: + # - drone.domain.io + +server: + ## If not set, it will be autofilled with the cluster host. + ## Host must be in "://" format. + ## + # host: "https://drone.domain.io" + + ## Drone server configuration. + ## Values in here get injected as environment variables. + ## ref: http://readme.drone.io/admin/installation-reference + ## + env: + DRONE_DEBUG: "false" + DRONE_DATABASE_DRIVER: "sqlite3" + DRONE_DATABASE_DATASOURCE: "/var/lib/drone/drone.sqlite" + + ## Drone requires some environment variables to bootstrap the + ## git service or it won't start up. + ## Uncomment this and add your own custom configuration. + ## + # DRONE_PROVIDER: "github" + # DRONE_OPEN: "true" + # DRONE_GITHUB: "true" + # DRONE_ORGS: "my-github-org,my-other-github-org" + # DRONE_ADMIN:"admin-1,admin-2" + # DRONE_GITHUB_CLIENT: "github-oauth2-client-id" + + ## Secret environment variables are configured in `server.envSecrets`. + ## Each item in `server.envSecrets` references a Kubernetes Secret. + ## These Secrets should be created before they are referenced. + ## + # envSecrets: + # # The name of a Kubernetes Secret + # drone-server-secrets: + # # A list of Secret keys to include as environment variables + # - DRONE_GITHUB_SECRET + + ## Additional server annotations. + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + annotations: {} + + ## CPU and memory limits for drone server + ## + resources: {} + # requests: + # memory: 32Mi + # cpu: 40m + # limits: + # memory: 2Gi + # cpu: 1 + + ## Use an alternate scheduler, e.g. "stork". + ## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ + ## + # schedulerName: + + ## Pod scheduling preferences. + ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + +agent: + ## Drone agent configuration. + ## Values in here get injected as environment variables. + ## ref: http://readme.drone.io/admin/installation-reference + ## + env: + DRONE_DEBUG: "false" + + ## Number of drone agent replicas + replicas: 1 + + ## Additional agent annotations. + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + annotations: {} + + ## CPU and memory limits for drone agent + ## + resources: {} + # requests: + # memory: 32Mi + # cpu: 40m + # limits: + # memory: 2Gi + # cpu: 1 + + ## Use an alternate scheduler, e.g. "stork". + ## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ + ## + # schedulerName: + + ## Pod scheduling preferences. + ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + +dind: + ## Enable or disable DinD + ## If disabled, the drone agent will spawn docker containers on the host. Pay + ## attention to the fact that we can't enforce resource constraints in that case. + ## + enabled: true + + ## Values in here get injected as environment variables to DinD. + ## ref: http://readme.drone.io/admin/installation-reference + ## + # env: + # DRONE_DEBUG: "false" + + ## Allowing custom command and args to DinD + ## ref: https://discourse.drone.io/t/docker-mtu-problem/1207 + ## + # command: '["/bin/sh"]' + # args: '["-c", "dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --mtu=1350"]' + + ## Docker storage driver. + ## Your DinD instance should be using the same driver as your host. + ## ref: https://docs.docker.com/engine/userguide/storagedriver/selectadriver/ + ## + driver: overlay2 + + ## CPU and memory limits for dind + ## + resources: {} + # requests: + # memory: 32Mi + # cpu: 40m + # limits: + # memory: 2Gi + # cpu: 1 + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + + ## rabbitmq data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 1Gi + +## Uncomment this if you want to set a specific shared secret between +## the agents and servers, otherwise this will be auto-generated. +## +# sharedSecret: supersecret + +rbac: + ## Specifies whether RBAC resources should be created + create: true + ## RBAC api version (v1, v1beta1, or v1alpha1) + apiVersion: v1 + +serviceAccount: + ## Specifies whether a ServiceAccount should be created + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + name: