2020-09-16 14:05:51 +00:00
#! Copyright 2020 the Pinniped contributors. All Rights Reserved.
2020-08-25 01:07:34 +00:00
#! SPDX-License-Identifier: Apache-2.0
2020-07-07 20:17:34 +00:00
#@ load("@ytt:data", "data")
---
apiVersion : v1
kind : Namespace
metadata :
name : #@ data.values.namespace
labels :
name : #@ data.values.namespace
2020-07-09 16:42:31 +00:00
---
apiVersion : v1
2020-07-17 21:42:02 +00:00
kind : ServiceAccount
metadata :
Rename many of resources that are created in Kubernetes by Pinniped
New resource naming conventions:
- Do not repeat the Kind in the name,
e.g. do not call it foo-cluster-role-binding, just call it foo
- Names will generally start with a prefix to identify our component,
so when a user lists all objects of that kind, they can tell to which
component it is related,
e.g. `kubectl get configmaps` would list one named "pinniped-config"
- It should be possible for an operator to make the word "pinniped"
mostly disappear if they choose, by specifying the app_name in
values.yaml, to the extent that is practical (but not from APIService
names because those are hardcoded in golang)
- Each role/clusterrole and its corresponding binding have the same name
- Pinniped resource names that must be known by the server golang code
are passed to the code at run time via ConfigMap, rather than
hardcoded in the golang code. This also allows them to be prepended
with the app_name from values.yaml while creating the ConfigMap.
- Since the CLI `get-kubeconfig` command cannot guess the name of the
CredentialIssuerConfig resource in advance anymore, it lists all
CredentialIssuerConfig in the app's namespace and returns an error
if there is not exactly one found, and then uses that one regardless
of its name
2020-09-18 22:56:50 +00:00
name : #@ data.values.app_name
2020-07-17 21:42:02 +00:00
namespace : #@ data.values.namespace
---
apiVersion : v1
2020-07-09 16:42:31 +00:00
kind : ConfigMap
metadata :
name : #@ data.values.app_name + "-config"
namespace : #@ data.values.namespace
labels :
app : #@ data.values.app_name
data :
Rename many of resources that are created in Kubernetes by Pinniped
New resource naming conventions:
- Do not repeat the Kind in the name,
e.g. do not call it foo-cluster-role-binding, just call it foo
- Names will generally start with a prefix to identify our component,
so when a user lists all objects of that kind, they can tell to which
component it is related,
e.g. `kubectl get configmaps` would list one named "pinniped-config"
- It should be possible for an operator to make the word "pinniped"
mostly disappear if they choose, by specifying the app_name in
values.yaml, to the extent that is practical (but not from APIService
names because those are hardcoded in golang)
- Each role/clusterrole and its corresponding binding have the same name
- Pinniped resource names that must be known by the server golang code
are passed to the code at run time via ConfigMap, rather than
hardcoded in the golang code. This also allows them to be prepended
with the app_name from values.yaml while creating the ConfigMap.
- Since the CLI `get-kubeconfig` command cannot guess the name of the
CredentialIssuerConfig resource in advance anymore, it lists all
CredentialIssuerConfig in the app's namespace and returns an error
if there is not exactly one found, and then uses that one regardless
of its name
2020-09-18 22:56:50 +00:00
#! If names.apiService is changed in this ConfigMap, must also change name of the ClusterIP Service resource below.
2020-07-09 16:58:28 +00:00
#@yaml/text-templated-strings
2020-08-20 17:54:15 +00:00
pinniped.yaml : |
2020-08-03 14:17:11 +00:00
discovery :
2020-08-03 18:36:08 +00:00
url : (@= data.values.discovery_url or "null" @)
2020-08-20 21:13:02 +00:00
api :
servingCertificate :
durationSeconds : (@= str(data.values.api_serving_certificate_duration_seconds) @)
renewBeforeSeconds : (@= str(data.values.api_serving_certificate_renew_before_seconds) @)
Rename many of resources that are created in Kubernetes by Pinniped
New resource naming conventions:
- Do not repeat the Kind in the name,
e.g. do not call it foo-cluster-role-binding, just call it foo
- Names will generally start with a prefix to identify our component,
so when a user lists all objects of that kind, they can tell to which
component it is related,
e.g. `kubectl get configmaps` would list one named "pinniped-config"
- It should be possible for an operator to make the word "pinniped"
mostly disappear if they choose, by specifying the app_name in
values.yaml, to the extent that is practical (but not from APIService
names because those are hardcoded in golang)
- Each role/clusterrole and its corresponding binding have the same name
- Pinniped resource names that must be known by the server golang code
are passed to the code at run time via ConfigMap, rather than
hardcoded in the golang code. This also allows them to be prepended
with the app_name from values.yaml while creating the ConfigMap.
- Since the CLI `get-kubeconfig` command cannot guess the name of the
CredentialIssuerConfig resource in advance anymore, it lists all
CredentialIssuerConfig in the app's namespace and returns an error
if there is not exactly one found, and then uses that one regardless
of its name
2020-09-18 22:56:50 +00:00
names :
servingCertificateSecret : (@= data.values.app_name + "-api-tls-serving-certificate" @)
credentialIssuerConfig : (@= data.values.app_name + "-config" @)
apiService : (@= data.values.app_name + "-api" @)
2020-07-07 20:17:34 +00:00
---
2020-08-13 00:02:43 +00:00
#@ if data.values.image_pull_dockerconfigjson and data.values.image_pull_dockerconfigjson != "":
apiVersion : v1
kind : Secret
metadata :
name : image-pull-secret
namespace : #@ data.values.namespace
labels :
app : #@ data.values.app_name
2020-08-13 20:34:23 +00:00
type : kubernetes.io/dockerconfigjson
2020-08-13 00:02:43 +00:00
data :
.dockerconfigjson : #@ data.values.image_pull_dockerconfigjson
#@ end
---
2020-07-07 20:17:34 +00:00
apiVersion : apps/v1
2020-08-19 18:21:07 +00:00
kind : Deployment
2020-07-07 20:17:34 +00:00
metadata :
2020-08-12 00:55:34 +00:00
name : #@ data.values.app_name
2020-07-07 20:17:34 +00:00
namespace : #@ data.values.namespace
labels :
app : #@ data.values.app_name
spec :
2020-09-04 03:52:01 +00:00
replicas : #@ data.values.replicas
2020-07-07 20:17:34 +00:00
selector :
matchLabels :
app : #@ data.values.app_name
template :
metadata :
labels :
app : #@ data.values.app_name
2020-08-04 21:34:10 +00:00
annotations :
scheduler.alpha.kubernetes.io/critical-pod : ""
2020-07-07 20:17:34 +00:00
spec :
Rename many of resources that are created in Kubernetes by Pinniped
New resource naming conventions:
- Do not repeat the Kind in the name,
e.g. do not call it foo-cluster-role-binding, just call it foo
- Names will generally start with a prefix to identify our component,
so when a user lists all objects of that kind, they can tell to which
component it is related,
e.g. `kubectl get configmaps` would list one named "pinniped-config"
- It should be possible for an operator to make the word "pinniped"
mostly disappear if they choose, by specifying the app_name in
values.yaml, to the extent that is practical (but not from APIService
names because those are hardcoded in golang)
- Each role/clusterrole and its corresponding binding have the same name
- Pinniped resource names that must be known by the server golang code
are passed to the code at run time via ConfigMap, rather than
hardcoded in the golang code. This also allows them to be prepended
with the app_name from values.yaml while creating the ConfigMap.
- Since the CLI `get-kubeconfig` command cannot guess the name of the
CredentialIssuerConfig resource in advance anymore, it lists all
CredentialIssuerConfig in the app's namespace and returns an error
if there is not exactly one found, and then uses that one regardless
of its name
2020-09-18 22:56:50 +00:00
serviceAccountName : #@ data.values.app_name
2020-08-13 00:02:43 +00:00
#@ if data.values.image_pull_dockerconfigjson and data.values.image_pull_dockerconfigjson != "":
imagePullSecrets :
- name : image-pull-secret
#@ end
2020-07-07 20:17:34 +00:00
containers :
2020-08-20 17:54:15 +00:00
- name : pinniped
2020-07-09 17:16:46 +00:00
#@ if data.values.image_digest:
2020-07-07 20:17:34 +00:00
image : #@ data.values.image_repo + "@" + data.values.image_digest
2020-07-09 17:16:46 +00:00
#@ else:
image : #@ data.values.image_repo + ":" + data.values.image_tag
#@ end
2020-07-09 04:39:56 +00:00
imagePullPolicy : IfNotPresent
2020-08-28 19:18:48 +00:00
resources :
requests :
memory : "128Mi"
2020-07-17 21:42:02 +00:00
args :
2020-08-20 17:54:15 +00:00
- --config=/etc/config/pinniped.yaml
2020-07-17 21:42:02 +00:00
- --downward-api-path=/etc/podinfo
2020-07-09 16:42:31 +00:00
volumeMounts :
2020-07-17 21:42:02 +00:00
- name : config-volume
mountPath : /etc/config
- name : podinfo
mountPath : /etc/podinfo
2020-08-17 23:44:42 +00:00
livenessProbe :
httpGet :
path : /healthz
port : 443
scheme : HTTPS
2020-08-18 16:18:51 +00:00
initialDelaySeconds : 2
2020-08-17 23:44:42 +00:00
timeoutSeconds : 15
periodSeconds : 10
failureThreshold : 5
readinessProbe :
httpGet :
path : /healthz
port : 443
scheme : HTTPS
2020-08-18 16:18:51 +00:00
initialDelaySeconds : 2
2020-08-17 23:44:42 +00:00
timeoutSeconds : 3
periodSeconds : 10
failureThreshold : 3
2020-07-09 16:42:31 +00:00
volumes :
2020-07-17 21:42:02 +00:00
- name : config-volume
configMap :
name : #@ data.values.app_name + "-config"
2020-07-16 19:24:30 +00:00
- name : podinfo
2020-07-17 21:42:02 +00:00
downwardAPI :
items :
- path : "labels"
fieldRef :
fieldPath : metadata.labels
- path : "namespace"
fieldRef :
fieldPath : metadata.namespace
2020-07-24 20:41:51 +00:00
tolerations :
2020-08-12 00:55:34 +00:00
- key : CriticalAddonsOnly
operator : Exists
2020-08-19 18:21:07 +00:00
- key : node-role.kubernetes.io/master #! Allow running on master nodes too
2020-08-12 00:55:34 +00:00
effect : NoSchedule
#! "system-cluster-critical" cannot be used outside the kube-system namespace until Kubernetes >= 1.17,
#! so we skip setting this for now (see https://github.com/kubernetes/kubernetes/issues/60596).
#!priorityClassName: system-cluster-critical
2020-08-21 15:14:45 +00:00
#! This will help make sure our multiple pods run on different nodes, making
#! our deployment "more" "HA".
affinity :
podAntiAffinity :
preferredDuringSchedulingIgnoredDuringExecution :
- weight : 50
podAffinityTerm :
labelSelector :
matchLabels :
app : #@ data.values.app_name
topologyKey : kubernetes.io/hostname
2020-08-04 23:46:27 +00:00
---
apiVersion : v1
kind : Service
metadata :
Rename many of resources that are created in Kubernetes by Pinniped
New resource naming conventions:
- Do not repeat the Kind in the name,
e.g. do not call it foo-cluster-role-binding, just call it foo
- Names will generally start with a prefix to identify our component,
so when a user lists all objects of that kind, they can tell to which
component it is related,
e.g. `kubectl get configmaps` would list one named "pinniped-config"
- It should be possible for an operator to make the word "pinniped"
mostly disappear if they choose, by specifying the app_name in
values.yaml, to the extent that is practical (but not from APIService
names because those are hardcoded in golang)
- Each role/clusterrole and its corresponding binding have the same name
- Pinniped resource names that must be known by the server golang code
are passed to the code at run time via ConfigMap, rather than
hardcoded in the golang code. This also allows them to be prepended
with the app_name from values.yaml while creating the ConfigMap.
- Since the CLI `get-kubeconfig` command cannot guess the name of the
CredentialIssuerConfig resource in advance anymore, it lists all
CredentialIssuerConfig in the app's namespace and returns an error
if there is not exactly one found, and then uses that one regardless
of its name
2020-09-18 22:56:50 +00:00
#! If name is changed, must also change names.apiService in the ConfigMap above
name : #@ data.values.app_name + "-api"
2020-08-04 23:46:27 +00:00
namespace : #@ data.values.namespace
labels :
app : #@ data.values.app_name
spec :
type : ClusterIP
selector :
app : #@ data.values.app_name
ports :
- protocol : TCP
port : 443
targetPort : 443
---
apiVersion : apiregistration.k8s.io/v1
kind : APIService
metadata :
2020-08-20 17:54:15 +00:00
name : v1alpha1.pinniped.dev
2020-08-04 23:46:27 +00:00
labels :
app : #@ data.values.app_name
spec :
version : v1alpha1
2020-08-20 17:54:15 +00:00
group : pinniped.dev
2020-08-04 23:46:27 +00:00
groupPriorityMinimum : 2500 #! TODO what is the right value? https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#apiservicespec-v1beta1-apiregistration-k8s-io
versionPriority : 10 #! TODO what is the right value? https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#apiservicespec-v1beta1-apiregistration-k8s-io
#! caBundle: Do not include this key here. Starts out null, will be updated/owned by the golang code.
service :
2020-08-20 17:54:15 +00:00
name : pinniped-api
2020-08-04 23:46:27 +00:00
namespace : #@ data.values.namespace
port : 443
2020-09-16 20:00:03 +00:00
---
apiVersion : apiregistration.k8s.io/v1
kind : APIService
metadata :
name : v1alpha1.login.pinniped.dev
labels :
app : #@ data.values.app_name
spec :
version : v1alpha1
group : login.pinniped.dev
groupPriorityMinimum : 2500
versionPriority : 10
#! caBundle: Do not include this key here. Starts out null, will be updated/owned by the golang code.
service :
name : pinniped-api
namespace : #@ data.values.namespace
port : 443