2020-10-06 00:28:19 +00:00
|
|
|
#! Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
|
|
#! SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
#@ load("@ytt:data", "data")
|
2020-10-15 17:14:23 +00:00
|
|
|
#@ load("@ytt:json", "json")
|
2020-10-14 22:05:42 +00:00
|
|
|
#@ load("helpers.lib.yaml", "defaultLabel", "labels", "namespace", "defaultResourceName", "defaultResourceNameWithSuffix")
|
2020-10-06 00:28:19 +00:00
|
|
|
|
2020-10-14 22:05:42 +00:00
|
|
|
#@ if not data.values.into_namespace:
|
2020-10-06 00:28:19 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Namespace
|
|
|
|
metadata:
|
|
|
|
name: #@ data.values.namespace
|
2020-10-14 22:05:42 +00:00
|
|
|
labels: #@ labels()
|
|
|
|
#@ end
|
2020-10-06 00:28:19 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
2020-10-14 22:05:42 +00:00
|
|
|
name: #@ defaultResourceName()
|
|
|
|
namespace: #@ namespace()
|
|
|
|
labels: #@ labels()
|
2020-10-06 00:28:19 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
2020-10-14 22:05:42 +00:00
|
|
|
name: #@ defaultResourceNameWithSuffix("static-config")
|
|
|
|
namespace: #@ namespace()
|
|
|
|
labels: #@ labels()
|
2020-10-06 00:28:19 +00:00
|
|
|
data:
|
|
|
|
#@yaml/text-templated-strings
|
|
|
|
pinniped.yaml: |
|
2020-10-15 17:14:23 +00:00
|
|
|
labels: (@= json.encode(labels()).rstrip() @)
|
2020-10-06 00:28:19 +00:00
|
|
|
---
|
|
|
|
#@ if data.values.image_pull_dockerconfigjson and data.values.image_pull_dockerconfigjson != "":
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: image-pull-secret
|
2020-10-14 22:05:42 +00:00
|
|
|
namespace: #@ namespace()
|
|
|
|
labels: #@ labels()
|
2020-10-06 00:28:19 +00:00
|
|
|
type: kubernetes.io/dockerconfigjson
|
|
|
|
data:
|
|
|
|
.dockerconfigjson: #@ data.values.image_pull_dockerconfigjson
|
|
|
|
#@ end
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
2020-10-14 22:05:42 +00:00
|
|
|
name: #@ defaultResourceName()
|
|
|
|
namespace: #@ namespace()
|
|
|
|
labels: #@ labels()
|
2020-10-06 00:28:19 +00:00
|
|
|
spec:
|
|
|
|
replicas: #@ data.values.replicas
|
|
|
|
selector:
|
2020-10-14 22:05:42 +00:00
|
|
|
matchLabels: #@ defaultLabel()
|
2020-10-06 00:28:19 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
2020-10-14 22:05:42 +00:00
|
|
|
labels: #@ defaultLabel()
|
2020-10-06 00:28:19 +00:00
|
|
|
spec:
|
2020-10-14 22:05:42 +00:00
|
|
|
serviceAccountName: #@ defaultResourceName()
|
2020-10-06 00:28:19 +00:00
|
|
|
#@ if data.values.image_pull_dockerconfigjson and data.values.image_pull_dockerconfigjson != "":
|
|
|
|
imagePullSecrets:
|
|
|
|
- name: image-pull-secret
|
|
|
|
#@ end
|
|
|
|
containers:
|
2020-10-14 22:05:42 +00:00
|
|
|
- name: #@ defaultResourceName()
|
2020-10-06 00:28:19 +00:00
|
|
|
#@ if data.values.image_digest:
|
|
|
|
image: #@ data.values.image_repo + "@" + data.values.image_digest
|
|
|
|
#@ else:
|
|
|
|
image: #@ data.values.image_repo + ":" + data.values.image_tag
|
|
|
|
#@ end
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
command: #! override the default entrypoint
|
|
|
|
- /usr/local/bin/pinniped-supervisor
|
|
|
|
args:
|
2020-10-09 23:00:11 +00:00
|
|
|
- /etc/podinfo
|
|
|
|
- /etc/config/pinniped.yaml
|
2020-10-06 00:28:19 +00:00
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
memory: "128Mi"
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /etc/config
|
|
|
|
- name: podinfo
|
|
|
|
mountPath: /etc/podinfo
|
2020-10-21 22:24:48 +00:00
|
|
|
ports:
|
|
|
|
- containerPort: 80
|
|
|
|
protocol: TCP
|
2020-10-27 00:03:26 +00:00
|
|
|
- containerPort: 443
|
|
|
|
protocol: TCP
|
2020-10-21 18:51:31 +00:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
2020-10-21 22:24:48 +00:00
|
|
|
port: 80
|
2020-10-21 18:51:31 +00:00
|
|
|
scheme: HTTP
|
|
|
|
initialDelaySeconds: 2
|
|
|
|
timeoutSeconds: 15
|
|
|
|
periodSeconds: 10
|
|
|
|
failureThreshold: 5
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /healthz
|
2020-10-21 22:24:48 +00:00
|
|
|
port: 80
|
2020-10-21 18:51:31 +00:00
|
|
|
scheme: HTTP
|
|
|
|
initialDelaySeconds: 2
|
|
|
|
timeoutSeconds: 3
|
|
|
|
periodSeconds: 10
|
|
|
|
failureThreshold: 3
|
2020-10-06 00:28:19 +00:00
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
2020-10-14 22:05:42 +00:00
|
|
|
name: #@ defaultResourceNameWithSuffix("static-config")
|
2020-10-06 00:28:19 +00:00
|
|
|
- name: podinfo
|
|
|
|
downwardAPI:
|
|
|
|
items:
|
|
|
|
- path: "labels"
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.labels
|
|
|
|
- path: "namespace"
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
#! This will help make sure our multiple pods run on different nodes, making
|
|
|
|
#! our deployment "more" "HA".
|
|
|
|
affinity:
|
|
|
|
podAntiAffinity:
|
|
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- weight: 50
|
|
|
|
podAffinityTerm:
|
|
|
|
labelSelector:
|
2020-10-14 22:05:42 +00:00
|
|
|
matchLabels: #@ defaultLabel()
|
2020-10-06 00:28:19 +00:00
|
|
|
topologyKey: kubernetes.io/hostname
|