Skip to content

Commit

Permalink
Merge pull request #6 from amazeeio/fastly-controller
Browse files Browse the repository at this point in the history
Add fastly-controller chart
  • Loading branch information
smlx authored Feb 2, 2021
2 parents 56f45b5 + 7d3911f commit 3f1f7d9
Show file tree
Hide file tree
Showing 14 changed files with 401 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/fastly-controller/.helmignore
Original file line number Diff line number Diff line change
@@ -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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
20 changes: 20 additions & 0 deletions charts/fastly-controller/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: fastly-controller
description:
A Helm chart for Kubernetes which installs the Fastly Controller
(https://github.com/amazeeio/fastly-controller).
home: https://github.com/amazeeio/charts
icon: https://raw.githubusercontent.com/amazeeio/charts/main/icon.png
maintainers:
- name: shreddedbacon
email: ben.jackson@amazee.io
url: https://amazee.io
- name: smlx
email: scott.leggett@amazee.io
url: https://amazee.io

type: application

version: 0.1.0

appVersion: v0.0.1
3 changes: 3 additions & 0 deletions charts/fastly-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Fastly Controller Helm Chart

This chart installs the [Fastly Controller](https://github.com/amazeeio/fastly-controller).
4 changes: 4 additions & 0 deletions charts/fastly-controller/ci/linter-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fastly:
apiToken: 'a8ebfff7e54ebc786'
tlsConfigID: '42cd671d142d18bba26'
clusterName: 'region1'
1 change: 1 addition & 0 deletions charts/fastly-controller/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fastly controller has been installed.
59 changes: 59 additions & 0 deletions charts/fastly-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "fastly-controller.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 "fastly-controller.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 "fastly-controller.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Common labels
*/}}
{{- define "fastly-controller.labels" -}}
helm.sh/chart: {{ include "fastly-controller.chart" . }}
{{ include "fastly-controller.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "fastly-controller.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fastly-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "fastly-controller.serviceAccountName" -}}
{{ default "fastly-controller" .Values.serviceAccount.nameOverride }}
{{- end }}
67 changes: 67 additions & 0 deletions charts/fastly-controller/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "fastly-controller.fullname" . }}-manager
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
rules:
- apiGroups:
- '*'
resources:
- ingress
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- '*'
resources:
- ingress/status
verbs:
- get
- patch
- update
- apiGroups:
- '*'
resources:
- ingresses
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- '*'
resources:
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "fastly-controller.fullname" . }}-proxy
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
29 changes: 29 additions & 0 deletions charts/fastly-controller/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "fastly-controller.fullname" . }}-manager
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "fastly-controller.fullname" . }}-manager
subjects:
- kind: ServiceAccount
name: {{ include "fastly-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "fastly-controller.fullname" . }}-proxy
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "fastly-controller.fullname" . }}-proxy
subjects:
- kind: ServiceAccount
name: {{ include "fastly-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
70 changes: 70 additions & 0 deletions charts/fastly-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fastly-controller.fullname" . }}
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "fastly-controller.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "fastly-controller.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fastly-controller.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: kube-rbac-proxy
securityContext:
{{- toYaml .Values.kubeRBACProxy.securityContext | nindent 10 }}
image: "{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}"
imagePullPolicy: {{ .Values.kubeRBACProxy.image.pullPolicy }}
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=10"
ports:
- containerPort: 8443
name: https
resources:
{{- toYaml .Values.kubeRBACProxy.resources | nindent 10 }}
- name: manager
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion}}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: FASTLY_API_TOKEN
value: {{ .Values.fastly.apiToken }}
- name: FASTLY_PLATFORM_TLS_CONFIGURATION_ID
value: {{ .Values.fastly.tlsConfigID }}
- name: CLUSTER_NAME
value: {{ .Values.fastly.clusterName }}
command:
- /manager
{{- with .Values.extraArgs }}
args:
{{- toYaml . | nindent 8 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
33 changes: 33 additions & 0 deletions charts/fastly-controller/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "fastly-controller.fullname" . }}-leader-election
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- configmaps/status
verbs:
- get
- update
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- create
14 changes: 14 additions & 0 deletions charts/fastly-controller/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "fastly-controller.fullname" . }}-leader-election
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "fastly-controller.fullname" . }}-leader-election
subjects:
- kind: ServiceAccount
name: {{ include "fastly-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
15 changes: 15 additions & 0 deletions charts/fastly-controller/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "fastly-controller.fullname" . }}
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: https
port: {{ .Values.service.port }}
targetPort: https
protocol: TCP
selector:
{{- include "fastly-controller.selectorLabels" . | nindent 4 }}
10 changes: 10 additions & 0 deletions charts/fastly-controller/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "fastly-controller.serviceAccountName" . }}
labels:
{{- include "fastly-controller.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
Loading

0 comments on commit 3f1f7d9

Please sign in to comment.