-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Significant changes to the Kubernetes Tentacle chart (#13)
* Add job roles + service account and some cleanup * Add job service account & permissions * Add NFS deployment & a heap of changes * Change NFS port to be configurable and have a better default * Make clear can be multiple environments or roles * Don't expose api key or bearer token in plain text in envs
- Loading branch information
Showing
12 changed files
with
258 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
charts/kubernetes-tentacle/templates/job-clusterbinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "kubernetes-tentacle.jobServiceAccountName" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "kubernetes-tentacle.jobServiceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ include "kubernetes-tentacle.jobServiceAccountName" . }} | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "kubernetes-tentacle.jobServiceAccountName" . }} | ||
rules: | ||
- apiGroups: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- '*' | ||
- nonResourceURLs: | ||
- '*' | ||
verbs: | ||
- '*' |
12 changes: 12 additions & 0 deletions
12
charts/kubernetes-tentacle/templates/job-serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "kubernetes-tentacle.jobServiceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "kubernetes-tentacle.labels" . | nindent 4 }} | ||
{{- with .Values.jobServiceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
automountServiceAccountToken: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{- if .Values.storage.useNFSContainer }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ printf "%s-nfs" (include "kubernetes-tentacle.fullname" .) }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
app.kubernetes.io/name: {{ printf "%s-nfs" (include "kubernetes-tentacle.fullname" .) }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ printf "%s-nfs" (include "kubernetes-tentacle.fullname" .) }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ printf "%s-nfs" (include "kubernetes-tentacle.fullname" .) }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ include "kubernetes-tentacle.serviceAccountName" . }} | ||
containers: | ||
- name: {{ printf "%s-nfs" .Chart.Name }} | ||
image: itsthenetwork/nfs-server-alpine:latest | ||
securityContext: | ||
privileged: true | ||
env: | ||
- name: "SHARED_DIRECTORY" | ||
value: "/octopus" | ||
- name: "SYNC" | ||
value: "true" | ||
ports: | ||
- containerPort: 2049 | ||
volumeMounts: | ||
- mountPath: /octopus | ||
name: octopus-volume | ||
volumes: | ||
- name: octopus-volume | ||
emptyDir: | ||
sizeLimit: 1Gi | ||
|
||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- if .Values.storage.useNFSContainer }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ printf "%s-nfs-svc" (include "kubernetes-tentacle.fullname" .) }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
type: ClusterIP | ||
clusterIP: {{ .Values.storage.nfsPort }} | ||
selector: | ||
app.kubernetes.io/name: {{ printf "%s-nfs" (include "kubernetes-tentacle.fullname" .) }} | ||
ports: | ||
- name: nfs | ||
port: 2049 | ||
protocol: TCP | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "kubernetes-tentacle.secrets.serverAuth" . }} | ||
type: Opaque | ||
data: | ||
{{- with .Values.tentacle.bearerToken }} | ||
bearer-token: {{ . | b64enc }} | ||
{{- end }} | ||
{{- with .Values.tentacle.serverApiKey }} | ||
api-key: {{ . | b64enc }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "kubernetes-tentacle.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "kubernetes-tentacle.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }} | ||
{{- end }} | ||
automountServiceAccountToken: true | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ printf "%s-role" (include "kubernetes-tentacle.serviceAccountName" .) }} | ||
namespace: {{ .Release.Namespace }} | ||
rules: | ||
- apiGroups: ["*"] | ||
resources: ["jobs"] | ||
verbs: ["*"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ printf "%s-binding" (include "kubernetes-tentacle.serviceAccountName" .) }} | ||
namespace: {{ .Release.Namespace }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "kubernetes-tentacle.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: Role | ||
name: {{ printf "%s-role" (include "kubernetes-tentacle.serviceAccountName" .) }} | ||
apiGroup: rbac.authorization.k8s.io |
Oops, something went wrong.