Add teleport
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
## Unit tests for Helm charts
|
||||
|
||||
Helm chart unit tests run here using the [helm-unittest](https://github.com/quintush/helm-unittest/) Helm plugin.
|
||||
|
||||
*Note: there are multiple forks for the helm-unittest plugin.
|
||||
They are not compatible and don't provide the same featureset (e.g. including templates from sub-directories).
|
||||
Our tests rely on features and bugfixes that are only available on the quintush fork
|
||||
(which seems to be the most maintained at the time of writing)*
|
||||
|
||||
If you get a snapshot error during your testing, you should verify that your changes intended to alter the output, then run
|
||||
this command from the root of your Teleport checkout to update the snapshots:
|
||||
|
||||
```bash
|
||||
make -C build.assets test-helm-update-snapshots
|
||||
```
|
||||
|
||||
After this, re-run the tests to make sure everything is fine:
|
||||
|
||||
```bash
|
||||
make -C build.assets test-helm
|
||||
```
|
||||
|
||||
Commit the updated snapshots along with your changes.
|
||||
@@ -0,0 +1,28 @@
|
||||
generate a admin cluster role binding when adminClusterRoleBinding.create is true:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: admin-k8s-cluster-group
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: Group
|
||||
name: cluster-admin
|
||||
generate a admin cluster role binding when adminClusterRoleBinding.create is true and adminClusterRoleBinding.name is set:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: admin-k8s-cluster-group
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: Group
|
||||
name: my-cluster-admin
|
||||
@@ -0,0 +1,57 @@
|
||||
creates a ClusterRole:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: RELEASE-NAME
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- users
|
||||
- groups
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- impersonate
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- authorization.k8s.io
|
||||
resources:
|
||||
- selfsubjectaccessreviews
|
||||
verbs:
|
||||
- create
|
||||
sets ClusterRole labels when specified:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: clusterrole
|
||||
name: RELEASE-NAME
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- users
|
||||
- groups
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- impersonate
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- authorization.k8s.io
|
||||
resources:
|
||||
- selfsubjectaccessreviews
|
||||
verbs:
|
||||
- create
|
||||
@@ -0,0 +1,31 @@
|
||||
creates a ClusterRoleBinding:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: RELEASE-NAME
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: RELEASE-NAME
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
sets ClusterRoleBinding labels when specified:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: clusterrolebinding
|
||||
name: RELEASE-NAME
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: RELEASE-NAME
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,205 @@
|
||||
should create ServiceAccount for post-delete hook by default:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
annotations:
|
||||
helm.sh/hook: post-delete
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
helm.sh/hook-weight: "-4"
|
||||
name: RELEASE-NAME-delete-hook
|
||||
namespace: NAMESPACE
|
||||
? should inherit ServiceAccount name from values and not create serviceAccount if
|
||||
serviceAccount.create is false and serviceAccount.name is set
|
||||
: 1: |
|
||||
containers:
|
||||
- args:
|
||||
- kube-state
|
||||
- delete
|
||||
command:
|
||||
- teleport
|
||||
env:
|
||||
- name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: RELEASE_NAME
|
||||
value: RELEASE-NAME
|
||||
image: public.ecr.aws/gravitational/teleport-distroless:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: post-delete-job
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
restartPolicy: OnFailure
|
||||
serviceAccountName: lint-serviceaccount
|
||||
should not create ServiceAccount for post-delete hook if serviceAccount.create is false:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
annotations:
|
||||
helm.sh/hook: post-delete
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
helm.sh/hook-weight: "-3"
|
||||
name: RELEASE-NAME-delete-hook
|
||||
namespace: NAMESPACE
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- delete
|
||||
- list
|
||||
2: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
annotations:
|
||||
helm.sh/hook: post-delete
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
helm.sh/hook-weight: "-2"
|
||||
name: RELEASE-NAME-delete-hook
|
||||
namespace: NAMESPACE
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: RELEASE-NAME-delete-hook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME-delete-hook
|
||||
namespace: NAMESPACE
|
||||
3: |
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
annotations:
|
||||
helm.sh/hook: post-delete
|
||||
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||
helm.sh/hook-weight: "-1"
|
||||
name: RELEASE-NAME-delete-hook
|
||||
namespace: NAMESPACE
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: RELEASE-NAME-delete-hook
|
||||
spec:
|
||||
containers:
|
||||
- args:
|
||||
- kube-state
|
||||
- delete
|
||||
command:
|
||||
- teleport
|
||||
env:
|
||||
- name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: RELEASE_NAME
|
||||
value: RELEASE-NAME
|
||||
image: public.ecr.aws/gravitational/teleport-distroless:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: post-delete-job
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
restartPolicy: OnFailure
|
||||
serviceAccountName: lint-serviceaccount
|
||||
should not create ServiceAccount, Role or RoleBinding for post-delete hook if serviceAccount.create and rbac.create are false:
|
||||
1: |
|
||||
containers:
|
||||
- args:
|
||||
- kube-state
|
||||
- delete
|
||||
command:
|
||||
- teleport
|
||||
env:
|
||||
- name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: RELEASE_NAME
|
||||
value: RELEASE-NAME
|
||||
image: public.ecr.aws/gravitational/teleport-distroless:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: post-delete-job
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
restartPolicy: OnFailure
|
||||
serviceAccountName: lint-serviceaccount
|
||||
should set nodeSelector in post-delete hook:
|
||||
1: |
|
||||
containers:
|
||||
- args:
|
||||
- kube-state
|
||||
- delete
|
||||
command:
|
||||
- teleport
|
||||
env:
|
||||
- name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: RELEASE_NAME
|
||||
value: RELEASE-NAME
|
||||
image: public.ecr.aws/gravitational/teleport-distroless:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: post-delete-job
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
nodeSelector:
|
||||
gravitational.io/k8s-role: node
|
||||
restartPolicy: OnFailure
|
||||
serviceAccountName: RELEASE-NAME-delete-hook
|
||||
should set securityContext in post-delete hook:
|
||||
1: |
|
||||
containers:
|
||||
- args:
|
||||
- kube-state
|
||||
- delete
|
||||
command:
|
||||
- teleport
|
||||
env:
|
||||
- name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: RELEASE_NAME
|
||||
value: RELEASE-NAME
|
||||
image: public.ecr.aws/gravitational/teleport-distroless:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: post-delete-job
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
restartPolicy: OnFailure
|
||||
serviceAccountName: RELEASE-NAME-delete-hook
|
||||
@@ -0,0 +1,30 @@
|
||||
sets PodDisruptionBudget labels when specified:
|
||||
1: |
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
labels:
|
||||
app: RELEASE-NAME
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: poddisruptionbudget
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
spec:
|
||||
minAvailable: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: RELEASE-NAME
|
||||
should create a PDB when enabled in values (pdb.yaml):
|
||||
1: |
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
labels:
|
||||
app: RELEASE-NAME
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
spec:
|
||||
minAvailable: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: RELEASE-NAME
|
||||
@@ -0,0 +1,123 @@
|
||||
creates a PodSecurityPolicy when enabled in values and supported:
|
||||
1: |
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
annotations:
|
||||
seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default,runtime/default
|
||||
seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default
|
||||
name: RELEASE-NAME
|
||||
spec:
|
||||
allowPrivilegeEscalation: false
|
||||
fsGroup:
|
||||
ranges:
|
||||
- max: 65535
|
||||
min: 1
|
||||
rule: MustRunAs
|
||||
hostIPC: false
|
||||
hostNetwork: false
|
||||
hostPID: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
requiredDropCapabilities:
|
||||
- ALL
|
||||
runAsUser:
|
||||
rule: MustRunAsNonRoot
|
||||
seLinux:
|
||||
rule: RunAsAny
|
||||
supplementalGroups:
|
||||
ranges:
|
||||
- max: 65535
|
||||
min: 1
|
||||
rule: MustRunAs
|
||||
volumes:
|
||||
- '*'
|
||||
2: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: RELEASE-NAME-psp
|
||||
rules:
|
||||
- apiGroups:
|
||||
- policy
|
||||
resourceNames:
|
||||
- RELEASE-NAME
|
||||
resources:
|
||||
- podsecuritypolicies
|
||||
verbs:
|
||||
- use
|
||||
3: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: RELEASE-NAME-psp
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: RELEASE-NAME-psp
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME
|
||||
sets PodSecurityPolicy labels when specified:
|
||||
1: |
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
annotations:
|
||||
seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default,runtime/default
|
||||
seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: podsecuritypolicy
|
||||
name: RELEASE-NAME
|
||||
spec:
|
||||
allowPrivilegeEscalation: false
|
||||
fsGroup:
|
||||
ranges:
|
||||
- max: 65535
|
||||
min: 1
|
||||
rule: MustRunAs
|
||||
hostIPC: false
|
||||
hostNetwork: false
|
||||
hostPID: false
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
requiredDropCapabilities:
|
||||
- ALL
|
||||
runAsUser:
|
||||
rule: MustRunAsNonRoot
|
||||
seLinux:
|
||||
rule: RunAsAny
|
||||
supplementalGroups:
|
||||
ranges:
|
||||
- max: 65535
|
||||
min: 1
|
||||
rule: MustRunAs
|
||||
volumes:
|
||||
- '*'
|
||||
2: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: RELEASE-NAME-psp
|
||||
rules:
|
||||
- apiGroups:
|
||||
- policy
|
||||
resourceNames:
|
||||
- RELEASE-NAME
|
||||
resources:
|
||||
- podsecuritypolicies
|
||||
verbs:
|
||||
- use
|
||||
3: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: RELEASE-NAME-psp
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: RELEASE-NAME-psp
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME
|
||||
@@ -0,0 +1,37 @@
|
||||
creates a Role:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- patch
|
||||
sets Role labels when specified:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: role
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- update
|
||||
- patch
|
||||
@@ -0,0 +1,33 @@
|
||||
creates a RoleBinding:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: RELEASE-NAME
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
sets RoleBinding labels when specified:
|
||||
1: |
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: rolebinding
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: RELEASE-NAME
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
@@ -0,0 +1,82 @@
|
||||
generate a secret when neither authToken nor joinParams.tokenName are provided:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: teleport-kube-agent-join-token
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: ""
|
||||
type: Opaque
|
||||
generates a secret when authToken is provided:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: teleport-kube-agent-join-token
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: |
|
||||
sample-auth-token-dont-use-this
|
||||
type: Opaque
|
||||
generates a secret when joinParams.tokenName is provided:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: teleport-kube-agent-join-token
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: |
|
||||
sample-auth-token-dont-use-this
|
||||
type: Opaque
|
||||
generates a secret with a custom name when authToken and joinTokenSecret.name are provided:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: some-other-secret-name
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: |
|
||||
sample-auth-token-dont-use-this
|
||||
type: Opaque
|
||||
generates a secret with a custom name when authToken and secretName are provided:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: some-other-secret-name
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: |
|
||||
sample-auth-token-dont-use-this
|
||||
type: Opaque
|
||||
sets Secret annotations when specified:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/secret: test-annotation
|
||||
kubernetes.io/secret-different: 6
|
||||
name: teleport-kube-agent-join-token
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: |
|
||||
auth-token
|
||||
type: Opaque
|
||||
sets Secret labels when specified:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: secret
|
||||
name: teleport-kube-agent-join-token
|
||||
namespace: NAMESPACE
|
||||
stringData:
|
||||
auth-token: |
|
||||
auth-token
|
||||
type: Opaque
|
||||
@@ -0,0 +1,20 @@
|
||||
sets ServiceAccount annotations when specified:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/serviceaccount: test-annotation
|
||||
kubernetes.io/serviceaccount-different: 5
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
sets ServiceAccount labels when specified:
|
||||
1: |
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: teleport-kube-agent
|
||||
resource: serviceaccount
|
||||
name: RELEASE-NAME
|
||||
namespace: NAMESPACE
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
sets the affinity:
|
||||
1: |
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: gravitational.io/dedicated
|
||||
operator: In
|
||||
values:
|
||||
- teleport
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- teleport
|
||||
topologyKey: kubernetes.io/hostname
|
||||
weight: 1
|
||||
containers:
|
||||
- args:
|
||||
- --agent-name=RELEASE-NAME
|
||||
- --agent-namespace=NAMESPACE
|
||||
- --base-image=public.ecr.aws/gravitational/teleport-distroless
|
||||
- --version-server=https://my-custom-version-server/v1
|
||||
- --version-channel=custom/preview
|
||||
image: public.ecr.aws/gravitational/teleport-kube-agent-updater:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
failureThreshold: 6
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: healthz
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
name: kube-agent-updater
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: metrics
|
||||
protocol: TCP
|
||||
- containerPort: 8081
|
||||
name: healthz
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
failureThreshold: 6
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: healthz
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
serviceAccountName: RELEASE-NAME-updater
|
||||
sets the tolerations:
|
||||
1: |
|
||||
containers:
|
||||
- args:
|
||||
- --agent-name=RELEASE-NAME
|
||||
- --agent-namespace=NAMESPACE
|
||||
- --base-image=public.ecr.aws/gravitational/teleport-distroless
|
||||
- --version-server=https://my-custom-version-server/v1
|
||||
- --version-channel=custom/preview
|
||||
image: public.ecr.aws/gravitational/teleport-kube-agent-updater:13.3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
failureThreshold: 6
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: healthz
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
name: kube-agent-updater
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: metrics
|
||||
protocol: TCP
|
||||
- containerPort: 8081
|
||||
name: healthz
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
failureThreshold: 6
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: healthz
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 9807
|
||||
serviceAccountName: RELEASE-NAME-updater
|
||||
tolerations:
|
||||
- effect: NoExecute
|
||||
key: dedicated
|
||||
operator: Equal
|
||||
value: teleport
|
||||
- effect: NoSchedule
|
||||
key: dedicated
|
||||
operator: Equal
|
||||
value: teleport
|
||||
@@ -0,0 +1,76 @@
|
||||
sets the correct role rules:
|
||||
1: |
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- list
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/status
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- list
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- watch
|
||||
- list
|
||||
- apiGroups:
|
||||
- ""
|
||||
resourceNames:
|
||||
- RELEASE-NAME-shared-state
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
- statefulsets
|
||||
- deployments/status
|
||||
- statefulsets/status
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resourceNames:
|
||||
- RELEASE-NAME
|
||||
resources:
|
||||
- deployments
|
||||
- statefulsets
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resourceNames:
|
||||
- RELEASE-NAME
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
@@ -0,0 +1,35 @@
|
||||
suite: AdminClusterRoleBinding
|
||||
templates:
|
||||
- admin_clusterrolebinding.yaml
|
||||
tests:
|
||||
- it: don't generate a admin cluster role binding when adminClusterRoleBinding.create is false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: generate a admin cluster role binding when adminClusterRoleBinding.create is true
|
||||
set:
|
||||
adminClusterRoleBinding:
|
||||
create: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: subjects[0].name
|
||||
value: cluster-admin
|
||||
- matchSnapshot: {}
|
||||
- it: generate a admin cluster role binding when adminClusterRoleBinding.create is true and adminClusterRoleBinding.name is set
|
||||
set:
|
||||
adminClusterRoleBinding:
|
||||
create: true
|
||||
name: my-cluster-admin
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: subjects[0].name
|
||||
value: my-cluster-admin
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,23 @@
|
||||
suite: ClusterRole
|
||||
templates:
|
||||
- clusterrole.yaml
|
||||
tests:
|
||||
- it: creates a ClusterRole
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets ClusterRole labels when specified
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: clusterrole
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,23 @@
|
||||
suite: ClusterRoleBinding
|
||||
templates:
|
||||
- clusterrolebinding.yaml
|
||||
tests:
|
||||
- it: creates a ClusterRoleBinding
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets ClusterRoleBinding labels when specified
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: clusterrolebinding
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,291 @@
|
||||
suite: ConfigMap
|
||||
templates:
|
||||
- config.yaml
|
||||
tests:
|
||||
- it: matches snapshot for affinity.yaml
|
||||
values:
|
||||
- ../.lint/affinity.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for all-v6.yaml
|
||||
values:
|
||||
- ../.lint/all-v6.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot and tests for extra-labels.yaml
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: config
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot and tests for annotations.yaml
|
||||
values:
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/config
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/config-different
|
||||
value: 2
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for aws-databases.yaml
|
||||
values:
|
||||
- ../.lint/aws-databases.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for azure-databases.yaml
|
||||
values:
|
||||
- ../.lint/azure-databases.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for backwards-compatibility.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for ca-pin.yaml
|
||||
values:
|
||||
- ../.lint/ca-pin.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: does not generate a config for clusterrole.yaml
|
||||
values:
|
||||
- ../.lint/clusterrole.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for db.yaml
|
||||
values:
|
||||
- ../.lint/db.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for dynamic-app.yaml
|
||||
values:
|
||||
- ../.lint/dynamic-app.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for dynamic-db.yaml
|
||||
values:
|
||||
- ../.lint/dynamic-db.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for imagepullsecrets.yaml
|
||||
values:
|
||||
- ../.lint/imagepullsecrets.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for initcontainers.yaml
|
||||
values:
|
||||
- ../.lint/initcontainers.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for join-params-iam.yaml
|
||||
values:
|
||||
- ../.lint/join-params-iam.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for join-params-token.yaml
|
||||
values:
|
||||
- ../.lint/join-params-token.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for log-basic.yaml
|
||||
values:
|
||||
- ../.lint/log-basic.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for log-extra.yaml
|
||||
values:
|
||||
- ../.lint/log-extra.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for log-legacy.yaml
|
||||
values:
|
||||
- ../.lint/log-legacy.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for node-selector.yaml
|
||||
values:
|
||||
- ../.lint/node-selector.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for pdb.yaml
|
||||
values:
|
||||
- ../.lint/log-extra.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: does not generate a config for pdb.yaml
|
||||
values:
|
||||
- ../.lint/pdb.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for resources.yaml
|
||||
values:
|
||||
- ../.lint/resources.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for stateful.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for tolerations.yaml
|
||||
values:
|
||||
- ../.lint/tolerations.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for volumes.yaml
|
||||
values:
|
||||
- ../.lint/volumes.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for v10.yaml
|
||||
values:
|
||||
- ../.lint/v10.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: matches snapshot for v11.yaml
|
||||
values:
|
||||
- ../.lint/v11.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: ConfigMap
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,687 @@
|
||||
suite: Deployment
|
||||
templates:
|
||||
- deployment.yaml
|
||||
- config.yaml
|
||||
release:
|
||||
upgrade: true
|
||||
tests:
|
||||
- it: creates a Deployment if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/all-v6.yaml
|
||||
asserts:
|
||||
- isKind:
|
||||
of: Deployment
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
|
||||
- it: sets Deployment labels when specified if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: deployment
|
||||
- matchSnapshot:
|
||||
path: spec
|
||||
|
||||
- it: sets Pod labels when specified if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.resource
|
||||
value: pod
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: sets Deployment annotations when specified if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/deployment
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/deployment-different
|
||||
value: 3
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets Pod annotations when specified if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.annotations.kubernetes\.io/pod
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: spec.template.metadata.annotations.kubernetes\.io/pod-different
|
||||
value: 4
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should have one replica when replicaCount is not set if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should have multiple replicas when replicaCount is set (using .replicaCount, deprecated) if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
replicaCount: 3
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 3
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should have multiple replicas when replicaCount is set (using highAvailability.replicaCount) if action is Upgrade
|
||||
template: deployment.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
highAvailability:
|
||||
replicaCount: 3
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 3
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set affinity when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/affinity.yaml
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set required affinity when highAvailability.requireAntiAffinity is set if action is Upgrade
|
||||
template: deployment.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
highAvailability:
|
||||
replicaCount: 2
|
||||
requireAntiAffinity: true
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
|
||||
- isNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set preferred affinity when more than one replica is used if action is Upgrade
|
||||
template: deployment.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
highAvailability:
|
||||
replicaCount: 3
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution
|
||||
- isNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set tolerations when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/tolerations.yaml
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set resources when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/resources.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.limits.cpu
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.limits.memory
|
||||
value: 4Gi
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.requests.cpu
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.requests.memory
|
||||
value: 2Gi
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set SecurityContext if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.capabilities
|
||||
value:
|
||||
drop:
|
||||
- all
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
|
||||
value: true
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.runAsNonRoot
|
||||
value: true
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.runAsUser
|
||||
value: 9807
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set image and tag correctly if action is Upgrade
|
||||
template: deployment.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
teleportVersionOverride: 12.2.1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: public.ecr.aws/gravitational/teleport-distroless:12.2.1
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount extraVolumes and extraVolumeMounts if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/volumes.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /path/to/mount
|
||||
name: my-mount
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: my-mount
|
||||
secret:
|
||||
secretName: mySecret
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set imagePullPolicy when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
imagePullPolicy: Always
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].imagePullPolicy
|
||||
value: Always
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set environment when extraEnv set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
proxyAddr: helm-lint.example.com
|
||||
authToken: sample-auth-token-dont-use-this
|
||||
kubeClusterName: helm-lint.example.com
|
||||
extraEnv:
|
||||
- name: HTTPS_PROXY
|
||||
value: "http://username:password@my.proxy.host:3128"
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: HTTPS_PROXY
|
||||
value: "http://username:password@my.proxy.host:3128"
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should provision initContainer correctly when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/initcontainers.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.initContainers[0].args
|
||||
content: "echo test"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].name
|
||||
value: "teleport-init"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].image
|
||||
value: "alpine"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.limits.cpu
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.limits.memory
|
||||
value: 4Gi
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.requests.cpu
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.requests.memory
|
||||
value: 2Gi
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should add insecureSkipProxyTLSVerify to args when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
insecureSkipProxyTLSVerify: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--insecure"
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should expose diag port if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
content:
|
||||
name: diag
|
||||
containerPort: 3000
|
||||
protocol: TCP
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set nodeSelector if set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/node-selector.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.nodeSelector
|
||||
value:
|
||||
gravitational.io/k8s-role: node
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should add emptyDir for data when existingDataVolume is not set if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: data
|
||||
emptyDir: {}
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /var/lib/teleport
|
||||
name: data
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should correctly configure existingDataVolume when set if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/existing-data-volume.yaml
|
||||
asserts:
|
||||
- notContains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: data
|
||||
emptyDir: {}
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /var/lib/teleport
|
||||
name: teleport-kube-agent-data
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount tls.existingCASecretName and set environment when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/existing-tls-secret-with-ca.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: teleport-tls-ca
|
||||
secret:
|
||||
secretName: helm-lint-existing-tls-secret-ca
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /etc/teleport-tls-ca
|
||||
name: teleport-tls-ca
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: SSL_CERT_FILE
|
||||
value: /etc/teleport-tls-ca/ca.pem
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount tls.existingCASecretName and set extra environment when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/existing-tls-secret-with-ca.yaml
|
||||
- ../.lint/extra-env.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: teleport-tls-ca
|
||||
secret:
|
||||
secretName: helm-lint-existing-tls-secret-ca
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /etc/teleport-tls-ca
|
||||
name: teleport-tls-ca
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: SSL_CERT_FILE
|
||||
value: /etc/teleport-tls-ca/ca.pem
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: HTTPS_PROXY
|
||||
value: http://username:password@my.proxy.host:3128
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set priorityClassName when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/priority-class-name.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.priorityClassName
|
||||
value: teleport-kube-agent
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set not set priorityClassName when not set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- isNull:
|
||||
path: spec.template.spec.priorityClassName
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set serviceAccountName when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/service-account-name.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: teleport-kube-agent-sa
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set default serviceAccountName when not set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: RELEASE-NAME
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set probeTimeoutSeconds when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/probe-timeout-seconds.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe.timeoutSeconds
|
||||
value: 5
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe.timeoutSeconds
|
||||
value: 5
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set dnsConfig when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/dnsconfig.yaml
|
||||
asserts:
|
||||
- notEqual:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value: null
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec.dnsConfig
|
||||
|
||||
- it: should set dnsPolicy when set in values if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/dnsconfig.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirstWithHostNet
|
||||
|
||||
- it: should not render Deployment if action is fresh install without storage
|
||||
template: deployment.yaml
|
||||
release:
|
||||
upgrade: false
|
||||
values:
|
||||
- ../.lint/all-v6.yaml
|
||||
set:
|
||||
storage:
|
||||
enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
- it: sets by default a container security context if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/initcontainers.yaml
|
||||
asserts:
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec.initContainers[0].securityContext
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
|
||||
- it: sets no container security context when manually unset and if action is Upgrade
|
||||
template: deployment.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/initcontainers.yaml
|
||||
- ../.lint/security-context-empty.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].securityContext
|
||||
value: null
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value: null
|
||||
@@ -0,0 +1,208 @@
|
||||
suite: Job
|
||||
templates:
|
||||
- delete_hook.yaml
|
||||
|
||||
release:
|
||||
upgrade: true
|
||||
tests:
|
||||
- it: should create ServiceAccount, Role, RoleBinding and Job for post-delete hook by default
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
assets:
|
||||
- containsDocument:
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
- containsDocument:
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
- containsDocument:
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
- containsDocument:
|
||||
kind: Job
|
||||
apiVersion: batch/v1
|
||||
|
||||
- it: should set securityContext in post-delete hook
|
||||
template: delete_hook.yaml
|
||||
# documentIndex: 0=ServiceAccount 1=Role 2=RoleBinding 3=Job
|
||||
documentIndex: 3
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.capabilities
|
||||
value:
|
||||
drop:
|
||||
- all
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
|
||||
value: true
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.runAsNonRoot
|
||||
value: true
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.runAsUser
|
||||
value: 9807
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set nodeSelector in post-delete hook
|
||||
template: delete_hook.yaml
|
||||
# documentIndex: 0=ServiceAccount 1=Role 2=RoleBinding 3=Job
|
||||
documentIndex: 3
|
||||
values:
|
||||
- ../.lint/node-selector.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.nodeSelector
|
||||
value:
|
||||
gravitational.io/k8s-role: node
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should create ServiceAccount for post-delete hook by default
|
||||
template: delete_hook.yaml
|
||||
# documentIndex: 0=ServiceAccount 1=Role 2=RoleBinding 3=Job
|
||||
documentIndex: 0
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-delete-hook
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should create ServiceAccount for post-delete hook with a custom name if serviceAccount.name is set and serviceAccount.create is true
|
||||
template: delete_hook.yaml
|
||||
# documentIndex: 0=ServiceAccount 1=Role 2=RoleBinding 3=Job
|
||||
documentIndex: 0
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
serviceAccount:
|
||||
create: true
|
||||
name: lint-serviceaccount
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: lint-serviceaccount
|
||||
|
||||
- it: should create Role for post-delete hook by default
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
|
||||
- it: should create RoleBinding for post-delete hook by default
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
|
||||
- it: should not create ServiceAccount for post-delete hook if serviceAccount.create is false
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: lint-serviceaccount
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should inherit ServiceAccount name from values and not create serviceAccount if serviceAccount.create is false and serviceAccount.name is set
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: lint-serviceaccount
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
# ServiceAccount is not created in this mode
|
||||
# documentIndex: 0=Role 1=RoleBinding 2=Job
|
||||
- documentIndex: 2
|
||||
equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: lint-serviceaccount
|
||||
- documentIndex: 2
|
||||
matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should not create Role for post-delete hook if rbac.create is false
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
rbac:
|
||||
create: false
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
|
||||
- it: should not create RoleBinding for post-delete hook if rbac.create is false
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
rbac:
|
||||
create: false
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
|
||||
- it: should not create ServiceAccount, Role or RoleBinding for post-delete hook if serviceAccount.create and rbac.create are false
|
||||
template: delete_hook.yaml
|
||||
values:
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
set:
|
||||
rbac:
|
||||
create: false
|
||||
serviceAccount:
|
||||
create: false
|
||||
name: lint-serviceaccount
|
||||
asserts:
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
- not: true
|
||||
containsDocument:
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
@@ -0,0 +1,26 @@
|
||||
suite: PodDisruptionBudget
|
||||
templates:
|
||||
- pdb.yaml
|
||||
tests:
|
||||
- it: should create a PDB when enabled in values (pdb.yaml)
|
||||
values:
|
||||
- ../.lint/pdb.yaml
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: PodDisruptionBudget
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets PodDisruptionBudget labels when specified
|
||||
values:
|
||||
- ../.lint/pdb.yaml
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: poddisruptionbudget
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,43 @@
|
||||
suite: PodMonitor
|
||||
templates:
|
||||
- podmonitor.yaml
|
||||
tests:
|
||||
- it: does not create a PodMonitor by default
|
||||
set:
|
||||
proxyAddr: proxy.example.com:3080
|
||||
kubeClusterName: test-kube-cluster-name
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
- it: creates a PodMonitor when enabled
|
||||
set:
|
||||
proxyAddr: proxy.example.com:3080
|
||||
kubeClusterName: test-kube-cluster-name
|
||||
podMonitor:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: PodMonitor
|
||||
|
||||
- it: configures scrape interval if provided
|
||||
set:
|
||||
proxyAddr: proxy.example.com:3080
|
||||
kubeClusterName: test-kube-cluster-name
|
||||
podMonitor:
|
||||
enabled: true
|
||||
interval: 2m
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.podMetricsEndpoints[0].interval
|
||||
value: 2m
|
||||
|
||||
- it: wears additional labels if provided
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.prometheus
|
||||
value: default
|
||||
values:
|
||||
- ../.lint/podmonitor.yaml
|
||||
@@ -0,0 +1,55 @@
|
||||
suite: PodSecurityPolicy
|
||||
templates:
|
||||
- psp.yaml
|
||||
tests:
|
||||
- it: creates a PodSecurityPolicy when enabled in values and supported
|
||||
capabilities:
|
||||
majorVersion: 1
|
||||
minorVersion: 22
|
||||
set:
|
||||
podSecurityPolicy:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: PodSecurityPolicy
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Role
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: RoleBinding
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets PodSecurityPolicy labels when specified
|
||||
capabilities:
|
||||
majorVersion: 1
|
||||
minorVersion: 22
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
set:
|
||||
podSecurityPolicy:
|
||||
enabled: true
|
||||
asserts:
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- documentIndex: 0
|
||||
equal:
|
||||
path: metadata.labels.resource
|
||||
value: podsecuritypolicy
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: does not create a PodSecurityPolicy when enabled in values but not supported
|
||||
capabilities:
|
||||
majorVersion: 1
|
||||
minorVersion: 25
|
||||
set:
|
||||
podSecurityPolicy:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
@@ -0,0 +1,34 @@
|
||||
suite: Role
|
||||
templates:
|
||||
- role.yaml
|
||||
tests:
|
||||
- it: Create a Role when upgrading
|
||||
release:
|
||||
isupgrade: true
|
||||
set:
|
||||
unitTestUpgrade: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Role
|
||||
|
||||
- it: creates a Role
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Role
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets Role labels when specified
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: role
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,34 @@
|
||||
suite: RoleBinding
|
||||
templates:
|
||||
- rolebinding.yaml
|
||||
tests:
|
||||
- it: Create a RoleBinding when upgrading
|
||||
release:
|
||||
isupgrade: true
|
||||
set:
|
||||
unitTestUpgrade: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
|
||||
- it: creates a RoleBinding
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: RoleBinding
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets RoleBinding labels when specified
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: rolebinding
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,101 @@
|
||||
suite: Secret
|
||||
templates:
|
||||
- secret.yaml
|
||||
tests:
|
||||
- it: generate a secret when neither authToken nor joinParams.tokenName are provided
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Secret
|
||||
- matchSnapshot: {}
|
||||
- it: generates a secret when authToken is provided
|
||||
set:
|
||||
authToken: sample-auth-token-dont-use-this
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: teleport-kube-agent-join-token
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: generates a secret when joinParams.tokenName is provided
|
||||
set:
|
||||
joinParams:
|
||||
tokenName: sample-auth-token-dont-use-this
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: teleport-kube-agent-join-token
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: generates a secret with a custom name when authToken and secretName are provided
|
||||
set:
|
||||
authToken: sample-auth-token-dont-use-this
|
||||
secretName: some-other-secret-name
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: some-other-secret-name
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: generates a secret with a custom name when authToken and joinTokenSecret.name are provided
|
||||
set:
|
||||
authToken: sample-auth-token-dont-use-this
|
||||
joinTokenSecret:
|
||||
name: some-other-secret-name
|
||||
create: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: Secret
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: some-other-secret-name
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: does not create a secret when joinTokenSecret.create is false
|
||||
set:
|
||||
authToken: sample-auth-token-dont-use-this
|
||||
joinTokenSecret:
|
||||
name: some-other-secret-name
|
||||
create: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
- it: sets Secret labels when specified
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: secret
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets Secret annotations when specified
|
||||
values:
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/secret
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/secret-different
|
||||
value: 6
|
||||
- matchSnapshot: {}
|
||||
@@ -0,0 +1,33 @@
|
||||
suite: ServiceAccount
|
||||
templates:
|
||||
- serviceaccount.yaml
|
||||
tests:
|
||||
- it: sets ServiceAccount labels when specified
|
||||
values:
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: serviceaccount
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets ServiceAccount annotations when specified
|
||||
values:
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/serviceaccount
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/serviceaccount-different
|
||||
value: 5
|
||||
- matchSnapshot: {}
|
||||
- it: skips ServiceAccount creation
|
||||
set:
|
||||
serviceAccount.create: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
@@ -0,0 +1,721 @@
|
||||
suite: StatefulSet
|
||||
templates:
|
||||
- statefulset.yaml
|
||||
- config.yaml
|
||||
tests:
|
||||
- it: creates a StatefulSet
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
elease:
|
||||
isupgrade: true
|
||||
asserts:
|
||||
- isKind:
|
||||
of: StatefulSet
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
|
||||
- it: sets StatefulSet labels when specified
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: metadata.labels.resource
|
||||
value: deployment
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: sets Pod labels when specified
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/extra-labels.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.app\.kubernetes\.io/name
|
||||
value: teleport-kube-agent
|
||||
- equal:
|
||||
path: spec.template.metadata.labels.resource
|
||||
value: pod
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: sets Pod annotations when specified
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/annotations.yaml
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.annotations.kubernetes\.io/pod
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: spec.template.metadata.annotations.kubernetes\.io/pod-different
|
||||
value: 4
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should have one replica when replicaCount is not set
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should have multiple replicas when replicaCount is set (using .replicaCount, deprecated)
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
replicaCount: 3
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 3
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should have multiple replicas when replicaCount is set (using highAvailability.replicaCount)
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
highAvailability:
|
||||
replicaCount: 3
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 3
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set affinity when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/affinity.yaml
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set required affinity when highAvailability.requireAntiAffinity is set
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
highAvailability:
|
||||
replicaCount: 2
|
||||
requireAntiAffinity: true
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
|
||||
- isNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set preferred affinity when more than one replica is used
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
highAvailability:
|
||||
replicaCount: 3
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution
|
||||
- isNull:
|
||||
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set tolerations when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/tolerations.yaml
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set resources when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/resources.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.limits.cpu
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.limits.memory
|
||||
value: 4Gi
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.requests.cpu
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.requests.memory
|
||||
value: 2Gi
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set SecurityContext
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
|
||||
value: false
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.capabilities
|
||||
value:
|
||||
drop:
|
||||
- all
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
|
||||
value: true
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.runAsNonRoot
|
||||
value: true
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext.runAsUser
|
||||
value: 9807
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set image and tag correctly
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
teleportVersionOverride: 12.2.1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: public.ecr.aws/gravitational/teleport-distroless:12.2.1
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount extraVolumes and extraVolumeMounts
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/volumes.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /path/to/mount
|
||||
name: my-mount
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: my-mount
|
||||
secret:
|
||||
secretName: mySecret
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount auth token if token is provided
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/join-params-token.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /etc/teleport-secrets
|
||||
name: auth-token
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: auth-token
|
||||
secret:
|
||||
secretName: teleport-kube-agent-join-token
|
||||
|
||||
- it: should set imagePullPolicy when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
imagePullPolicy: Always
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].imagePullPolicy
|
||||
value: Always
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set environment when extraEnv set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
extraEnv:
|
||||
- name: HTTPS_PROXY
|
||||
value: "http://username:password@my.proxy.host:3128"
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: TELEPORT_REPLICA_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: HTTPS_PROXY
|
||||
value: "http://username:password@my.proxy.host:3128"
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should provision initContainer correctly when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/initcontainers.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.initContainers[0].args
|
||||
content: "echo test"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].name
|
||||
value: "teleport-init"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].image
|
||||
value: "alpine"
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.limits.cpu
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.limits.memory
|
||||
value: 4Gi
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.requests.cpu
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.requests.memory
|
||||
value: 2Gi
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should add insecureSkipProxyTLSVerify to args when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
insecureSkipProxyTLSVerify: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--insecure"
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should expose diag port
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].ports
|
||||
content:
|
||||
name: diag
|
||||
containerPort: 3000
|
||||
protocol: TCP
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set nodeSelector if set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/node-selector.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.nodeSelector
|
||||
value:
|
||||
gravitational.io/k8s-role: node
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should not add emptyDir for data when using StatefulSet
|
||||
template: statefulset.yaml
|
||||
release:
|
||||
isupgrade: true
|
||||
set:
|
||||
unitTestUpgrade: true
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- notContains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: data
|
||||
emptyDir: {}
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should add volumeMount for data volume when using StatefulSet
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- notContains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: data
|
||||
mountPath: RELEASE-NAME-teleport-data
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should add volumeClaimTemplate for data volume when using StatefulSet and action is an Upgrade
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
release:
|
||||
isupgrade: true
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.volumeClaimTemplates[0].spec
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should add volumeClaimTemplate for data volume when using StatefulSet and is Fresh Install
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
release:
|
||||
isupgrade: false
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.volumeClaimTemplates
|
||||
- matchSnapshot: {}
|
||||
|
||||
- it: should set storage.storageClassName when set in values and action is an Upgrade
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
release:
|
||||
isupgrade: true
|
||||
set:
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
|
||||
storage:
|
||||
storageClassName: helm-lint-storage-class
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[0].spec.storageClassName
|
||||
value: helm-lint-storage-class
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set storage.requests when set in values and action is an Upgrade
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
release:
|
||||
isupgrade: true
|
||||
set:
|
||||
storage:
|
||||
requests: 256Mi
|
||||
# unit test does not support lookup functions, so to test the behavior we use this undoc value
|
||||
# https://github.com/helm/helm/issues/8137
|
||||
unitTestUpgrade: true
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
|
||||
value: 256Mi
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount tls.existingCASecretName and set environment when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/existing-tls-secret-with-ca.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: teleport-tls-ca
|
||||
secret:
|
||||
secretName: helm-lint-existing-tls-secret-ca
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /etc/teleport-tls-ca
|
||||
name: teleport-tls-ca
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: SSL_CERT_FILE
|
||||
value: /etc/teleport-tls-ca/ca.pem
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should mount tls.existingCASecretName and set extra environment when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/existing-tls-secret-with-ca.yaml
|
||||
- ../.lint/extra-env.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: teleport-tls-ca
|
||||
secret:
|
||||
secretName: helm-lint-existing-tls-secret-ca
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /etc/teleport-tls-ca
|
||||
name: teleport-tls-ca
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: SSL_CERT_FILE
|
||||
value: /etc/teleport-tls-ca/ca.pem
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: HTTPS_PROXY
|
||||
value: http://username:password@my.proxy.host:3128
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
|
||||
- it: should set serviceAccountName when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/service-account-name.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: teleport-kube-agent-sa
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set default serviceAccountName when not set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/backwards-compatibility.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: RELEASE-NAME
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set probeTimeoutSeconds when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/probe-timeout-seconds.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].livenessProbe.timeoutSeconds
|
||||
value: 5
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].readinessProbe.timeoutSeconds
|
||||
value: 5
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should set dnsConfig when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/dnsconfig.yaml
|
||||
asserts:
|
||||
- notEqual:
|
||||
path: spec.template.spec.dnsConfig
|
||||
value: null
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec.dnsConfig
|
||||
|
||||
- it: should set dnsPolicy when set in values
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/dnsconfig.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.dnsPolicy
|
||||
value: ClusterFirstWithHostNet
|
||||
|
||||
- it: should install Statefulset when storage is disabled and mode is a Fresh Install
|
||||
template: statefulset.yaml
|
||||
release:
|
||||
isupgrade: false
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
storage:
|
||||
enabled: false
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: TELEPORT_REPLICA_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- notContains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: data
|
||||
mountPath: RELEASE-NAME-teleport-data
|
||||
- isNull:
|
||||
path: spec.volumeClaimTemplates
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: should generate Statefulset when storage is disabled and mode is a Upgrade
|
||||
template: statefulset.yaml
|
||||
release:
|
||||
isupgrade: true
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
set:
|
||||
unitTestUpgrade: false
|
||||
storage:
|
||||
enabled: false
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: TELEPORT_REPLICA_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: KUBE_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- notContains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
name: data
|
||||
mountPath: RELEASE-NAME-teleport-data
|
||||
- isNull:
|
||||
path: spec.volumeClaimTemplates
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
|
||||
- it: sets by default a container security context
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/initcontainers.yaml
|
||||
asserts:
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec.initContainers[0].securityContext
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
|
||||
- it: sets no container security context when manually unset
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/initcontainers.yaml
|
||||
- ../.lint/security-context-empty.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].securityContext
|
||||
value: null
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].securityContext
|
||||
value: null
|
||||
|
||||
- it: should enable maintenance schedule export when updater is enabled
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/existing-tls-secret-with-ca.yaml
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: TELEPORT_EXT_UPGRADER
|
||||
value: kube
|
||||
|
||||
- it: should set the installation method environment variable
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: TELEPORT_INSTALL_METHOD_HELM_KUBE_AGENT
|
||||
value: "true"
|
||||
|
||||
- it: should set the hostAliases when specified
|
||||
template: statefulset.yaml
|
||||
values:
|
||||
- ../.lint/stateful.yaml
|
||||
- ../.lint/host-aliases.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.hostAliases
|
||||
value:
|
||||
- ip: "127.0.0.1"
|
||||
hostnames:
|
||||
- "foo.local"
|
||||
- "bar.local"
|
||||
- ip: "10.1.2.3"
|
||||
hostnames:
|
||||
- "foo.remote"
|
||||
- "bar.remote"
|
||||
@@ -0,0 +1,227 @@
|
||||
suite: Updater Deployment
|
||||
templates:
|
||||
- updater/deployment.yaml
|
||||
tests:
|
||||
#
|
||||
# Basic tests
|
||||
#
|
||||
- it: does not create a Deployment when updater.enabled is false (default)
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: creates a Deployment when updater.enabled is true
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
name: RELEASE-NAME-updater
|
||||
namespace: NAMESPACE
|
||||
#
|
||||
# Testing the agent configuration
|
||||
#
|
||||
- it: sets the updater base image
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
set:
|
||||
image: repo.example.com/gravitational/teleport-distroless
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--base-image=repo.example.com/gravitational/teleport-distroless"
|
||||
- it: sets the updater base entreprise image
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
set:
|
||||
enterprise: true
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--base-image=public.ecr.aws/gravitational/teleport-ent-distroless"
|
||||
- it: sets the updater agent name
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
release:
|
||||
name: my-release
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--agent-name=my-release"
|
||||
- it: sets the updater agent namespace
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
release:
|
||||
namespace: my-namespace
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--agent-namespace=my-namespace"
|
||||
- it: sets the updater version server
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--version-server=https://my-custom-version-server/v1"
|
||||
- it: sets the updater release channel
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--version-channel=custom/preview"
|
||||
#
|
||||
# Kubernetes-related tests
|
||||
#
|
||||
- it: sets the deployment annotations
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/deployment
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: metadata.annotations.kubernetes\.io/deployment-different
|
||||
value: 3
|
||||
- it: sets the pod annotations
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/annotations.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.metadata.annotations.kubernetes\.io/pod
|
||||
value: test-annotation
|
||||
- equal:
|
||||
path: spec.template.metadata.annotations.kubernetes\.io/pod-different
|
||||
value: 4
|
||||
- it: sets the affinity
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/affinity.yaml
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.affinity
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
- it: sets the tolerations
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/tolerations.yaml
|
||||
asserts:
|
||||
- isNotNull:
|
||||
path: spec.template.spec.tolerations
|
||||
- matchSnapshot:
|
||||
path: spec.template.spec
|
||||
- it: sets the imagePullSecrets
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/imagepullsecrets.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.imagePullSecrets[0].name
|
||||
value: myRegistryKeySecretName
|
||||
- it: sets the nodeSelector
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/node-selector.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.nodeSelector
|
||||
value:
|
||||
gravitational.io/k8s-role: node
|
||||
- it: sets the updater container image and version
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
set:
|
||||
teleportVersionOverride: 12.2.1
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].image
|
||||
value: public.ecr.aws/gravitational/teleport-kube-agent-updater:12.2.1
|
||||
- it: sets the updater container imagePullPolicy
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/image-pull-policy.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].imagePullPolicy
|
||||
value: Always
|
||||
- it: mounts the tls CA if provided and set the env var
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/existing-tls-secret-with-ca.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.volumes
|
||||
content:
|
||||
name: teleport-tls-ca
|
||||
secret:
|
||||
secretName: helm-lint-existing-tls-secret-ca
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].volumeMounts
|
||||
content:
|
||||
mountPath: /etc/teleport-tls-ca
|
||||
name: teleport-tls-ca
|
||||
readOnly: true
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: SSL_CERT_FILE
|
||||
value: /etc/teleport-tls-ca/ca.pem
|
||||
- it: sets the updater container extraEnv
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/extra-env.yaml
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: HTTPS_PROXY
|
||||
value: http://username:password@my.proxy.host:3128
|
||||
- it: sets the pod resources
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/resources.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.limits.cpu
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.limits.memory
|
||||
value: 4Gi
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.requests.cpu
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].resources.requests.memory
|
||||
value: 2Gi
|
||||
- it: sets the pod priorityClass
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/priority-class-name.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.priorityClassName
|
||||
value: teleport-kube-agent
|
||||
- it: sets the pod service-account
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/service-account-name.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: teleport-kube-agent-sa-updater
|
||||
- it: sets the pod service-account (override)
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
- ../.lint/service-account-name.yaml
|
||||
set:
|
||||
updater:
|
||||
serviceAccount:
|
||||
name: distinct-updater-sa
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.serviceAccountName
|
||||
value: distinct-updater-sa
|
||||
@@ -0,0 +1,39 @@
|
||||
suite: Updater Role
|
||||
templates:
|
||||
- updater/role.yaml
|
||||
tests:
|
||||
#
|
||||
# Basic tests
|
||||
#
|
||||
- it: does not create a Role when updater.enabled is false (default)
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: creates a Role when updater.enabled is true
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
name: RELEASE-NAME-updater
|
||||
namespace: NAMESPACE
|
||||
- it: does not create a Role when updater.enabled is true but rbac creation is disabled
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
set:
|
||||
rbac:
|
||||
create: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
#
|
||||
# Catch-all content test
|
||||
#
|
||||
- it: sets the correct role rules
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- matchSnapshot:
|
||||
path: rules
|
||||
@@ -0,0 +1,49 @@
|
||||
suite: Updater Role
|
||||
templates:
|
||||
- updater/rolebinding.yaml
|
||||
tests:
|
||||
#
|
||||
# Basic tests
|
||||
#
|
||||
- it: does not create a RoleBinding when updater.enabled is false (default)
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
- it: creates a RoleBinding when updater.enabled is true
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- containsDocument:
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
name: RELEASE-NAME-updater
|
||||
namespace: NAMESPACE
|
||||
- it: does not create a RoleBinding when updater.enabled is true but rbac creation is disabled
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
set:
|
||||
rbac:
|
||||
create: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
#
|
||||
# Catch-all content test
|
||||
#
|
||||
- it: sets the correct rolebinding content
|
||||
values:
|
||||
- ../.lint/updater.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: roleRef
|
||||
value:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: RELEASE-NAME-updater
|
||||
- equal:
|
||||
path: subjects
|
||||
value:
|
||||
- kind: ServiceAccount
|
||||
name: RELEASE-NAME-updater
|
||||
namespace: NAMESPACE
|
||||
Reference in New Issue
Block a user