-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test-helm-chart target to Makefile to lint/test Helm chart upgrades
Signed-off-by: Eddie Torres <[email protected]>
- Loading branch information
Showing
8 changed files
with
438 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: helm-sa | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: test-role | ||
rules: | ||
- apiGroups: [ "" ] | ||
resources: | ||
- events | ||
- nodes | ||
- pods | ||
- replicationcontrollers | ||
- serviceaccounts | ||
- configmaps | ||
- persistentvolumes | ||
- persistentvolumeclaims | ||
verbs: [ "list" ] | ||
- apiGroups: [ "" ] | ||
resources: | ||
- services | ||
- nodes | ||
- nodes/proxy | ||
- persistentvolumes | ||
- persistentvolumeclaims | ||
- pods | ||
- pods/log | ||
verbs: [ "get" ] | ||
- apiGroups: [ "" ] | ||
resources: | ||
- namespaces | ||
- persistentvolumes | ||
- persistentvolumeclaims | ||
- pods | ||
- pods/exec | ||
verbs: [ "create" ] | ||
- apiGroups: [ "" ] | ||
resources: | ||
- namespaces | ||
- persistentvolumes | ||
- persistentvolumeclaims | ||
- pods | ||
verbs: [ "delete" ] | ||
- apiGroups: [ "" ] | ||
resources: | ||
- persistentvolumeclaims | ||
verbs: [ "update" ] | ||
- apiGroups: [ "" ] | ||
resources: | ||
- pods/ephemeralcontainers | ||
verbs: [ "patch" ] | ||
- apiGroups: [ "" ] | ||
resources: | ||
- serviceaccounts | ||
- configmaps | ||
verbs: [ "watch" ] | ||
- apiGroups: [ "apps" ] | ||
resources: | ||
- replicasets | ||
- daemonsets | ||
verbs: [ "list" ] | ||
- apiGroups: [ "storage.k8s.io" ] | ||
resources: | ||
- storageclasses | ||
verbs: [ "create" ] | ||
- apiGroups: [ "storage.k8s.io" ] | ||
resources: | ||
- storageclasses | ||
- csinodes | ||
verbs: [ "get" ] | ||
- apiGroups: [ "storage.k8s.io" ] | ||
resources: | ||
- storageclasses | ||
verbs: [ "delete" ] | ||
- apiGroups: [ "snapshot.storage.k8s.io" ] | ||
resources: | ||
- volumesnapshots | ||
- volumesnapshotclasses | ||
- volumesnapshotcontents | ||
verbs: [ "create" ] | ||
- apiGroups: [ "snapshot.storage.k8s.io" ] | ||
resources: | ||
- volumesnapshots | ||
- volumesnapshotclasses | ||
- volumesnapshotcontents | ||
verbs: [ "get" ] | ||
- apiGroups: [ "snapshot.storage.k8s.io" ] | ||
resources: | ||
- volumesnapshotcontents | ||
verbs: [ "update" ] | ||
- apiGroups: [ "snapshot.storage.k8s.io" ] | ||
resources: | ||
- volumesnapshots | ||
- volumesnapshotclasses | ||
- volumesnapshotcontents | ||
verbs: [ "delete" ] | ||
- apiGroups: [ "authorization.k8s.io" ] | ||
resources: | ||
- clusterroles | ||
verbs: [ "list" ] | ||
- apiGroups: [ "authorization.k8s.io" ] | ||
resources: | ||
- subjectaccessreviews | ||
verbs: [ "create" ] | ||
- apiGroups: [ "rbac.authorization.k8s.io" ] | ||
resources: | ||
- clusterroles | ||
verbs: [ "list" ] | ||
- apiGroups: [ "rbac.authorization.k8s.io" ] | ||
resources: | ||
- clusterrolebindings | ||
verbs: [ "create" ] | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: test-role-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: helm-sa | ||
namespace: kube-system | ||
roleRef: | ||
kind: ClusterRole | ||
name: test-role | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
data: | ||
manifests.yaml: | | ||
ShortName: ebs | ||
StorageClass: | ||
FromFile: storageclass.yaml | ||
SnapshotClass: | ||
FromName: true | ||
DriverInfo: | ||
Name: ebs.csi.aws.com | ||
SupportedSizeRange: | ||
Min: 1Gi | ||
Max: 16Ti | ||
SupportedFsType: | ||
xfs: {} | ||
ext4: {} | ||
SupportedMountOption: | ||
dirsync: {} | ||
TopologyKeys: ["topology.ebs.csi.aws.com/zone"] | ||
Capabilities: | ||
persistence: true | ||
fsGroup: true | ||
block: true | ||
exec: true | ||
snapshotDataSource: true | ||
pvcDataSource: false | ||
multipods: true | ||
controllerExpansion: true | ||
nodeExpansion: true | ||
volumeLimits: true | ||
topology: true | ||
storageclass.yaml: | | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1 | ||
metadata: | ||
name: ebs.csi.aws.com | ||
provisioner: ebs.csi.aws.com | ||
volumeBindingMode: WaitForFirstConsumer | ||
metadata: | ||
name: manifest-config | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: helm-test | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: helm-test | ||
image: gcr.io/k8s-staging-test-infra/kubekins-e2e:v20220624-1a63fdd9f2-master | ||
command: [ "/bin/sh", "-c" ] | ||
args: | ||
- | | ||
cp /etc/config/storageclass.yaml /workspace/storageclass.yaml | ||
go install sigs.k8s.io/kubetest2/...@latest | ||
kubectl config set-cluster cluster --server=https://kubernetes.default --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt | ||
kubectl config set-context kubetest2 --cluster=cluster | ||
kubectl config set-credentials sa --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) | ||
kubectl config set-context kubetest2 --user=sa | ||
kubectl config use-context kubetest2 | ||
kubetest2 noop --run-id='e2e-kubernetes' --test=ginkgo -- --test-package-version=$(curl https://storage.googleapis.com/kubernetes-release/release/stable-1.25.txt) --skip-regex='\[Disruptive\]|\[Serial\]' --focus-regex='External.Storage' --parallel=25 --test-args='-storage.testdriver=/etc/config/manifests.yaml' | ||
volumeMounts: | ||
- name: config-vol | ||
mountPath: /etc/config | ||
serviceAccountName: helm-sa | ||
volumes: | ||
- name: config-vol | ||
configMap: | ||
name: manifest-config | ||
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: str() | ||
home: str(required=False) | ||
version: str() | ||
apiVersion: str() | ||
appVersion: any(str(), num(), required=False) | ||
description: str(required=False) | ||
keywords: list(str(), required=False) | ||
sources: list(str(), required=False) | ||
maintainers: list(include('maintainer'), required=False) | ||
dependencies: list(include('dependency'), required=False) | ||
icon: str(required=False) | ||
engine: str(required=False) | ||
condition: str(required=False) | ||
tags: str(required=False) | ||
deprecated: bool(required=False) | ||
kubeVersion: str(required=False) | ||
annotations: map(str(), str(), required=False) | ||
type: str(required=False) | ||
--- | ||
maintainer: | ||
name: str() | ||
email: str(required=False) | ||
url: str(required=False) | ||
--- | ||
dependency: | ||
name: str() | ||
version: str() | ||
repository: str(required=False) | ||
condition: str(required=False) | ||
tags: list(str(), required=False) | ||
enabled: bool(required=False) | ||
import-values: any(list(str()), list(include('import-value')), required=False) | ||
alias: str(required=False) | ||
--- | ||
import-value: | ||
child: str() | ||
parent: str() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
remote: origin | ||
since: HEAD~1 | ||
github-instance: https://github.com | ||
lint-conf: charts/lintconf.yaml | ||
chart-yaml-schema: charts/chart_schema.yaml | ||
validate-chart-schema: true | ||
validate-yaml: true | ||
check-version-increment: false | ||
charts: | ||
- charts/aws-ebs-csi-driver | ||
helm-extra-args: "--timeout 1000s" | ||
upgrade: true | ||
skip-missing-values: true | ||
namespace: kube-system | ||
release-label: release | ||
kubectl-timeout: 1000s | ||
skip-clean-up: false | ||
print-logs: true | ||
debug: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
rules: | ||
braces: | ||
min-spaces-inside: 0 | ||
max-spaces-inside: 0 | ||
min-spaces-inside-empty: -1 | ||
max-spaces-inside-empty: -1 | ||
brackets: | ||
min-spaces-inside: 0 | ||
max-spaces-inside: 0 | ||
min-spaces-inside-empty: -1 | ||
max-spaces-inside-empty: -1 | ||
colons: | ||
max-spaces-before: 0 | ||
max-spaces-after: 1 | ||
commas: | ||
max-spaces-before: 0 | ||
min-spaces-after: 1 | ||
max-spaces-after: 1 | ||
comments: | ||
require-starting-space: true | ||
min-spaces-from-content: 2 | ||
document-end: disable | ||
document-start: disable # No --- to start a file | ||
empty-lines: | ||
max: 2 | ||
max-start: 0 | ||
max-end: 0 | ||
hyphens: | ||
max-spaces-after: 1 | ||
indentation: | ||
spaces: consistent | ||
indent-sequences: whatever # - list indentation will handle both indentation and without | ||
check-multi-line-strings: false | ||
key-duplicates: enable | ||
line-length: disable # Lines can be any length | ||
new-line-at-end-of-file: enable | ||
new-lines: | ||
type: unix | ||
trailing-spaces: enable | ||
truthy: | ||
level: warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -uo pipefail | ||
|
||
function ct_install() { | ||
INSTALL_PATH=${1} | ||
CHART_TESTING_VERSION=${2} | ||
if [[ ! -e ${INSTALL_PATH}/chart-testing ]]; then | ||
CHART_TESTING_DOWNLOAD_URL="https://github.com/helm/chart-testing/releases/download/v${CHART_TESTING_VERSION}/chart-testing_${CHART_TESTING_VERSION}_linux_amd64.tar.gz" | ||
curl --silent --location "${CHART_TESTING_DOWNLOAD_URL}" | tar xz -C "${INSTALL_PATH}" | ||
chmod +x "${INSTALL_PATH}"/ct | ||
fi | ||
|
||
export PATH=/root/.local/bin:$PATH | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install --user yamllint yamale | ||
} |
Oops, something went wrong.