From 009cf87ef1964e942e81d2cc1957f51e45db19e6 Mon Sep 17 00:00:00 2001 From: Amol Deodhar Date: Tue, 30 Apr 2024 18:03:00 -0400 Subject: [PATCH] adeodhar: add try catch block --- .../default-CAPL-cluster/chainsaw-test.yaml | 224 +++++++------- .../k3s-capl-cluster/chainsaw-test.yaml | 221 +++++++------- .../rke2-capl-cluster/chainsaw-test.yaml | 221 +++++++------- .../minimal-linodecluster/chainsaw-test.yaml | 160 +++++----- .../minimal-linodemachine/chainsaw-test.yaml | 159 +++++----- .../vpc-integration/chainsaw-test.yaml | 277 ++++++++++-------- .../chainsaw-test.yaml | 163 ++++++----- .../minimal-linodevpc/chainsaw-test.yaml | 120 ++++---- 8 files changed, 812 insertions(+), 733 deletions(-) diff --git a/e2e/capl-cluster-flavors/default-CAPL-cluster/chainsaw-test.yaml b/e2e/capl-cluster-flavors/default-CAPL-cluster/chainsaw-test.yaml index c2cbf0d2e..687ee2c1d 100755 --- a/e2e/capl-cluster-flavors/default-CAPL-cluster/chainsaw-test.yaml +++ b/e2e/capl-cluster-flavors/default-CAPL-cluster/chainsaw-test.yaml @@ -12,112 +12,122 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'default-cluster', env('GIT_REF')])) - - name: cluster - # Format the cluster name - value: (trim((truncate(($run), `32`)), '-')) + - name: run + value: (join('-', ['e2e', 'default-cluster', env('GIT_REF')])) + - name: cluster + # Format the cluster name + value: (trim((truncate(($run), `32`)), '-')) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Generate cluster using clusterctl - try: - - script: - env: - - name: CLUSTER - value: ($cluster) - - name: NAMESPACE - value: ($namespace) - - name: CLUSTERCTL_CONFIG - value: (env('CLUSTERCTL_CONFIG')) - content: | - set -e - clusterctl generate cluster $CLUSTER -n $NAMESPACE \ - --kubernetes-version v1.29.1 \ - --infrastructure local-linode:v0.0.0 \ - --control-plane-machine-count 1 --worker-machine-count 1 \ - --config $CLUSTERCTL_CONFIG > default-cluster.yaml - check: - ($error == null): true - - name: Apply generated cluster yaml - try: - - apply: - file: default-cluster.yaml - - assert: - file: assert-child-cluster-resources.yaml - catch: - - events: - namespace: ($namespace) - - get: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: MachineDeployment - - name: Check if the linodes are created - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 2 - - name: Delete child cluster - try: - - delete: - ref: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: Cluster - name: ($cluster) - - delete: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 - kind: LinodeVPC - name: ($cluster) - - error: - file: check-child-cluster-and-vpc-deleted.yaml - - name: Check if the linodes are deleted - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 - - name: Delete generated child cluster manifest yaml - try: - - script: - content: | - rm -f default-cluster.yaml - check: - ($error == null): true + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Generate cluster using clusterctl + try: + - script: + env: + - name: CLUSTER + value: ($cluster) + - name: NAMESPACE + value: ($namespace) + - name: CLUSTERCTL_CONFIG + value: (env('CLUSTERCTL_CONFIG')) + content: | + set -e + clusterctl generate cluster $CLUSTER -n $NAMESPACE \ + --kubernetes-version v1.29.1 \ + --infrastructure local-linode:v0.0.0 \ + --control-plane-machine-count 1 --worker-machine-count 1 \ + --config $CLUSTERCTL_CONFIG > default-cluster.yaml + check: + ($error == null): true + - name: Apply generated cluster yaml + try: + - apply: + file: default-cluster.yaml + - assert: + file: assert-child-cluster-resources.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeMachine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Machine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: MachineDeployment + - describe: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlane + - describe: + apiVersion: addons.cluster.x-k8s.io/v1alpha1 + kind: HelmReleaseProxy + - name: Check if the linodes are created + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 2 + - name: Delete child cluster + try: + - delete: + ref: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + name: ($cluster) + - delete: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + name: ($cluster) + - error: + file: check-child-cluster-and-vpc-deleted.yaml + - name: Check if the linodes are deleted + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 + - name: Delete generated child cluster manifest yaml + try: + - script: + content: | + rm -f default-cluster.yaml + check: + ($error == null): true diff --git a/e2e/capl-cluster-flavors/k3s-capl-cluster/chainsaw-test.yaml b/e2e/capl-cluster-flavors/k3s-capl-cluster/chainsaw-test.yaml index e4028f7be..1b5e6ebda 100755 --- a/e2e/capl-cluster-flavors/k3s-capl-cluster/chainsaw-test.yaml +++ b/e2e/capl-cluster-flavors/k3s-capl-cluster/chainsaw-test.yaml @@ -12,112 +12,119 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'k3s-cluster', env('GIT_REF')])) - - name: cluster - # Format the cluster name - value: (trim((truncate(($run), `32`)), '-')) + - name: run + value: (join('-', ['e2e', 'k3s-cluster', env('GIT_REF')])) + - name: cluster + # Format the cluster name + value: (trim((truncate(($run), `32`)), '-')) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Generate cluster using clusterctl - try: - - script: - env: - - name: CLUSTER - value: ($cluster) - - name: NAMESPACE - value: ($namespace) - - name: CLUSTERCTL_CONFIG - value: (env('CLUSTERCTL_CONFIG')) - content: | - set -e - clusterctl generate cluster $CLUSTER -n $NAMESPACE \ - --flavor k3s --kubernetes-version v1.29.1+k3s2 \ - --infrastructure local-linode:v0.0.0 \ - --control-plane-machine-count 1 --worker-machine-count 1 \ - --config $CLUSTERCTL_CONFIG > k3s-cluster.yaml - check: - ($error == null): true - - name: Apply generated cluster yaml - try: - - apply: - file: k3s-cluster.yaml - - assert: - file: assert-child-cluster-resources.yaml - catch: - - events: - namespace: ($namespace) - - get: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: MachineDeployment - - name: Check if the linodes are created - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 2 - - name: Delete child cluster - try: - - delete: - ref: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: Cluster - name: ($cluster) - - delete: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 - kind: LinodeVPC - name: ($cluster) - - error: - file: check-child-cluster-and-vpc-deleted.yaml - - name: Check if the linodes are deleted - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 - - name: Delete generated child cluster manifest yaml - try: - - script: - content: | - rm -f k3s-cluster.yaml - check: - ($error == null): true + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Generate cluster using clusterctl + try: + - script: + env: + - name: CLUSTER + value: ($cluster) + - name: NAMESPACE + value: ($namespace) + - name: CLUSTERCTL_CONFIG + value: (env('CLUSTERCTL_CONFIG')) + content: | + set -e + clusterctl generate cluster $CLUSTER -n $NAMESPACE \ + --flavor k3s --kubernetes-version v1.29.1+k3s2 \ + --infrastructure local-linode:v0.0.0 \ + --control-plane-machine-count 1 --worker-machine-count 1 \ + --config $CLUSTERCTL_CONFIG > k3s-cluster.yaml + check: + ($error == null): true + - name: Apply generated cluster yaml + try: + - apply: + file: k3s-cluster.yaml + - assert: + file: assert-child-cluster-resources.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeMachine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Machine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: MachineDeployment + - describe: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KThreesControlPlane + - name: Check if the linodes are created + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 2 + - name: Delete child cluster + try: + - delete: + ref: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + name: ($cluster) + - delete: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + name: ($cluster) + - error: + file: check-child-cluster-and-vpc-deleted.yaml + - name: Check if the linodes are deleted + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 + - name: Delete generated child cluster manifest yaml + try: + - script: + content: | + rm -f k3s-cluster.yaml + check: + ($error == null): true diff --git a/e2e/capl-cluster-flavors/rke2-capl-cluster/chainsaw-test.yaml b/e2e/capl-cluster-flavors/rke2-capl-cluster/chainsaw-test.yaml index 0491aa61e..65262dfa9 100755 --- a/e2e/capl-cluster-flavors/rke2-capl-cluster/chainsaw-test.yaml +++ b/e2e/capl-cluster-flavors/rke2-capl-cluster/chainsaw-test.yaml @@ -12,112 +12,119 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'rke2-cluster', env('GIT_REF')])) - - name: cluster - # Format the cluster name - value: (trim((truncate(($run), `32`)), '-')) + - name: run + value: (join('-', ['e2e', 'rke2-cluster', env('GIT_REF')])) + - name: cluster + # Format the cluster name + value: (trim((truncate(($run), `32`)), '-')) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Generate cluster using clusterctl - try: - - script: - env: - - name: CLUSTER - value: ($cluster) - - name: NAMESPACE - value: ($namespace) - - name: CLUSTERCTL_CONFIG - value: (env('CLUSTERCTL_CONFIG')) - content: | - set -e - clusterctl generate cluster $CLUSTER -n $NAMESPACE \ - --flavor rke2 --kubernetes-version v1.29.1+rke2r1 \ - --infrastructure local-linode:v0.0.0 \ - --control-plane-machine-count 1 --worker-machine-count 1 \ - --config $CLUSTERCTL_CONFIG> rke2-cluster.yaml - check: - ($error == null): true - - name: Apply generated cluster yaml - try: - - apply: - file: rke2-cluster.yaml - - assert: - file: assert-child-cluster-resources.yaml - catch: - - events: - namespace: ($namespace) - - get: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: MachineDeployment - - name: Check if the linodes are created - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 2 - - name: Delete child cluster - try: - - delete: - ref: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: Cluster - name: ($cluster) - - delete: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 - kind: LinodeVPC - name: ($cluster) - - error: - file: check-child-cluster-and-vpc-deleted.yaml - - name: Check if the linodes are deleted - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 - - name: Delete generated child cluster manifest yaml - try: - - script: - content: | - rm -f rke2-cluster.yaml - check: - ($error == null): true + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Generate cluster using clusterctl + try: + - script: + env: + - name: CLUSTER + value: ($cluster) + - name: NAMESPACE + value: ($namespace) + - name: CLUSTERCTL_CONFIG + value: (env('CLUSTERCTL_CONFIG')) + content: | + set -e + clusterctl generate cluster $CLUSTER -n $NAMESPACE \ + --flavor rke2 --kubernetes-version v1.29.1+rke2r1 \ + --infrastructure local-linode:v0.0.0 \ + --control-plane-machine-count 1 --worker-machine-count 1 \ + --config $CLUSTERCTL_CONFIG> rke2-cluster.yaml + check: + ($error == null): true + - name: Apply generated cluster yaml + try: + - apply: + file: rke2-cluster.yaml + - assert: + file: assert-child-cluster-resources.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeMachine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Machine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: MachineDeployment + - describe: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: RKE2ControlPlane + - name: Check if the linodes are created + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 2 + - name: Delete child cluster + try: + - delete: + ref: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + name: ($cluster) + - delete: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + name: ($cluster) + - error: + file: check-child-cluster-and-vpc-deleted.yaml + - name: Check if the linodes are deleted + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 + - name: Delete generated child cluster manifest yaml + try: + - script: + content: | + rm -f rke2-cluster.yaml + check: + ($error == null): true diff --git a/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml b/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml index 6b35b873b..1ab13799e 100755 --- a/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml +++ b/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml @@ -12,81 +12,89 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'min-cluster', env('GIT_REF')])) - - name: cluster - # Format the cluster name - value: (trim((truncate(($run), `32`)), '-')) - - name: nodebalancer - value: ($cluster) + - name: run + value: (join('-', ['e2e', 'min-cluster', env('GIT_REF')])) + - name: cluster + # Format the cluster name + value: (trim((truncate(($run), `32`)), '-')) + - name: nodebalancer + value: ($cluster) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Create Cluster resource - try: - - apply: - file: create-cluster.yaml - - name: Create LinodeCluster resource - try: - - apply: - file: create-linodecluster.yaml - - assert: - file: assert-linodecluster.yaml - - name: Check if the nodebalancer exists - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: nodebalancers - - name: FILTER - value: (to_string({"label":($nodebalancer)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 1 - - name: Delete Cluster resource - try: - - delete: - ref: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: Cluster - name: ($cluster) - - error: - file: check-linodecluster-deleted.yaml - - name: Check if the nodebalancer is deleted - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: nodebalancers - - name: FILTER - value: (to_string({"label":($nodebalancer)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Create Cluster resource + try: + - apply: + file: create-cluster.yaml + catch: + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + - name: Create LinodeCluster resource + try: + - apply: + file: create-linodecluster.yaml + - assert: + file: assert-linodecluster.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeCluster + - name: Check if the nodebalancer exists + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: nodebalancers + - name: FILTER + value: (to_string({"label":($nodebalancer)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 1 + - name: Delete Cluster resource + try: + - delete: + ref: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + name: ($cluster) + - error: + file: check-linodecluster-deleted.yaml + - name: Check if the nodebalancer is deleted + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: nodebalancers + - name: FILTER + value: (to_string({"label":($nodebalancer)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 diff --git a/e2e/linodemachine-controller/minimal-linodemachine/chainsaw-test.yaml b/e2e/linodemachine-controller/minimal-linodemachine/chainsaw-test.yaml index 7b8152f29..b44d66244 100755 --- a/e2e/linodemachine-controller/minimal-linodemachine/chainsaw-test.yaml +++ b/e2e/linodemachine-controller/minimal-linodemachine/chainsaw-test.yaml @@ -12,79 +12,90 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'min-lm', env('GIT_REF')])) - - name: cluster - # Format the cluster name - value: (trim((truncate(($run), `32`)), '-')) + - name: run + value: (join('-', ['e2e', 'min-lm', env('GIT_REF')])) + - name: cluster + # Format the cluster name + value: (trim((truncate(($run), `32`)), '-')) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Create Cluster resource - try: - - apply: - file: create-cluster.yaml - - name: Create LinodeMachine resource - try: - - apply: - file: create-linodemachine.yaml - - assert: - file: assert-linodemachine.yaml - - name: Check if the Linodes were created - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 1 - - name: Delete Cluster resource - try: - - delete: - ref: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: Cluster - name: ($cluster) - - error: - file: check-linodemachine-deletion.yaml - - name: Check if the Linodes were deleted - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Create Cluster resource + try: + - apply: + file: create-cluster.yaml + catch: + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + - name: Create LinodeMachine resource + try: + - apply: + file: create-linodemachine.yaml + - assert: + file: assert-linodemachine.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeMachineTemplate + - describe: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlane + - name: Check if the Linodes were created + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 1 + - name: Delete Cluster resource + try: + - delete: + ref: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + name: ($cluster) + - error: + file: check-linodemachine-deletion.yaml + - name: Check if the Linodes were deleted + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 diff --git a/e2e/linodemachine-controller/vpc-integration/chainsaw-test.yaml b/e2e/linodemachine-controller/vpc-integration/chainsaw-test.yaml index 30ada818f..4911cdc9c 100755 --- a/e2e/linodemachine-controller/vpc-integration/chainsaw-test.yaml +++ b/e2e/linodemachine-controller/vpc-integration/chainsaw-test.yaml @@ -13,135 +13,152 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'lm-vpc', env('GIT_REF')])) - - name: cluster - # Format the cluster name - value: (trim((truncate(($run), `32`)), '-')) - - name: vpc - # Format the VPC name into a valid Kubernetes object name - value: (trim((truncate(($run), `63`)), '-')) + - name: run + value: (join('-', ['e2e', 'lm-vpc', env('GIT_REF')])) + - name: cluster + # Format the cluster name + value: (trim((truncate(($run), `32`)), '-')) + - name: vpc + # Format the VPC name into a valid Kubernetes object name + value: (trim((truncate(($run), `63`)), '-')) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Create Cluster and LinodeVPC resources - try: - - apply: - file: create-cluster-vpc.yaml - - assert: - file: assert-vpc.yaml - - name: Create LinodeMachine resource - try: - - apply: - file: create-linodemachine.yaml - - assert: - file: assert-linodemachine.yaml - - name: Check if the Linodes & VPC were created - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 1 - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: vpcs - - name: FILTER - value: (to_string({"label":($vpc)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - data: - - subnets: - - linodes: - - interfaces: - - active: true - - name: Delete the Cluster & LinodeVPC resource - try: - - delete: - ref: - apiVersion: cluster.x-k8s.io/v1beta1 - kind: Cluster - name: ($cluster) - - delete: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 - kind: LinodeVPC - name: ($vpc) - - error: - file: check-vpc-lm-deletion.yaml - - name: Check if the Linodes & VPC were deleted - try: - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: linode/instances - - name: FILTER - value: (to_string({"tags":($cluster)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 - - script: - env: - - name: TARGET_API - value: api.linode.com - - name: TARGET_API_VERSION - value: v4beta - - name: URI - value: vpcs - - name: FILTER - value: (to_string({"label":($vpc)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://$TARGET_API/$TARGET_API_VERSION/$URI" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Create Cluster and LinodeVPC resources + try: + - apply: + file: create-cluster-vpc.yaml + - assert: + file: assert-vpc.yaml + catch: + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeCluster + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + - name: Create LinodeMachine resource + try: + - apply: + file: create-linodemachine.yaml + - assert: + file: assert-linodemachine.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeMachine + - describe: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Machine + - name: Check if the Linodes & VPC were created + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 1 + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: vpcs + - name: FILTER + value: (to_string({"label":($vpc)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + data: + - subnets: + - linodes: + - interfaces: + - active: true + - name: Delete the Cluster & LinodeVPC resource + try: + - delete: + ref: + apiVersion: cluster.x-k8s.io/v1beta1 + kind: Cluster + name: ($cluster) + - delete: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + name: ($vpc) + - error: + file: check-vpc-lm-deletion.yaml + - name: Check if the Linodes & VPC were deleted + try: + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: linode/instances + - name: FILTER + value: (to_string({"tags":($cluster)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 + - script: + env: + - name: TARGET_API + value: api.linode.com + - name: TARGET_API_VERSION + value: v4beta + - name: URI + value: vpcs + - name: FILTER + value: (to_string({"label":($vpc)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://$TARGET_API/$TARGET_API_VERSION/$URI" + check: + ($error): ~ + (json_parse($stdout)): + results: 0 diff --git a/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/chainsaw-test.yaml b/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/chainsaw-test.yaml index 325bf8eea..165cd2025 100755 --- a/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/chainsaw-test.yaml +++ b/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/chainsaw-test.yaml @@ -11,79 +11,94 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'min-obj', env('GIT_REF')])) - - name: bucket - # Format the bucket name into a valid Kubernetes object name - # TODO: This is over-truncated to account for the Kubernetes access key Secret - value: (trim((truncate(($run), `52`)), '-')) - - name: access_keys_secret - value: (join('-', [($bucket), 'bucket-details'])) + - name: run + value: (join('-', ['e2e', 'min-obj', env('GIT_REF')])) + - name: bucket + # Format the bucket name into a valid Kubernetes object name + # TODO: This is over-truncated to account for the Kubernetes access key Secret + value: (trim((truncate(($run), `52`)), '-')) + - name: access_keys_secret + value: (join('-', [($bucket), 'bucket-details'])) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Create LinodeObjectStorageBucket - try: - - apply: - file: create-linodeobjectstoragebucket.yaml - - assert: - file: assert-obj-and-secret.yaml - - name: Check if the bucket was created - try: - - script: - env: - - name: BUCKET - value: ($bucket) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "Content-Type: application/json" \ - "https://api.linode.com/v4/object-storage/buckets/us-sea-1/$BUCKET" - check: - ($error): ~ - (json_parse($stdout)): - label: ($bucket) - - name: Test Key Generation - try: - - apply: - file: patch-obj.yaml - - assert: - file: assert-keygen.yaml - - name: Delete LinodeObjectStorageBucket details Secret - try: - - delete: - ref: - apiVersion: v1 - kind: Secret - name: (join('-', [($namespace), 'backups-bucket-details'])) - - name: Assert LinodeObjectStorageBucket key secret exists - try: - - assert: - file: assert-key-secret.yaml - - name: Delete LinodeObjectStorageBucket - try: - - delete: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 - kind: LinodeObjectStorageBucket - name: ($bucket) - - script: - env: - - name: BUCKET - value: ($bucket) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -X DELETE \ - "https://api.linode.com/v4/object-storage/buckets/us-sea-1/$BUCKET" - check: - ($error): ~ - - name: Check if the LinodeObjectStorageBucket was deleted - try: - - error: - file: check-obj-and-key-deletion.yaml + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Create LinodeObjectStorageBucket + try: + - apply: + file: create-linodeobjectstoragebucket.yaml + - assert: + file: assert-obj-and-secret.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeObjectStorageBucket + - describe: + apiVersion: v1 + kind: Secret + - name: Check if the bucket was created + try: + - script: + env: + - name: BUCKET + value: ($bucket) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "Content-Type: application/json" \ + "https://api.linode.com/v4/object-storage/buckets/us-sea-1/$BUCKET" + check: + ($error): ~ + (json_parse($stdout)): + label: ($bucket) + - name: Test Key Generation + try: + - apply: + file: patch-obj.yaml + - assert: + file: assert-keygen.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeObjectStorageBucket + - name: Delete LinodeObjectStorageBucket details Secret + try: + - delete: + ref: + apiVersion: v1 + kind: Secret + name: (join('-', [($namespace), 'backups-bucket-details'])) + - name: Assert LinodeObjectStorageBucket key secret exists + try: + - assert: + file: assert-key-secret.yaml + catch: + - describe: + apiVersion: v1 + kind: Secret + - name: Delete LinodeObjectStorageBucket + try: + - delete: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeObjectStorageBucket + name: ($bucket) + - script: + env: + - name: BUCKET + value: ($bucket) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -X DELETE \ + "https://api.linode.com/v4/object-storage/buckets/us-sea-1/$BUCKET" + check: + ($error): ~ + - name: Check if the LinodeObjectStorageBucket was deleted + try: + - error: + file: check-obj-and-key-deletion.yaml diff --git a/e2e/linodevpc-controller/minimal-linodevpc/chainsaw-test.yaml b/e2e/linodevpc-controller/minimal-linodevpc/chainsaw-test.yaml index f4660bf53..8fd770845 100644 --- a/e2e/linodevpc-controller/minimal-linodevpc/chainsaw-test.yaml +++ b/e2e/linodevpc-controller/minimal-linodevpc/chainsaw-test.yaml @@ -11,63 +11,67 @@ metadata: spec: bindings: # A short identifier for the E2E test run - - name: run - value: (join('-', ['e2e', 'min-vpc', env('GIT_REF')])) - - name: vpc - # Format the VPC name into a valid Kubernetes object name - value: (trim((truncate(($run), `63`)), '-')) + - name: run + value: (join('-', ['e2e', 'min-vpc', env('GIT_REF')])) + - name: vpc + # Format the VPC name into a valid Kubernetes object name + value: (trim((truncate(($run), `63`)), '-')) template: true steps: - - name: Check if CAPI provider resources exist - try: - - assert: - file: assert-capi-resources.yaml - - name: Create LinodeVPC - try: - - apply: - file: create-vpc.yaml - - assert: - file: assert-vpc.yaml - - name: Check if the VPC was created - try: - - script: - env: - - name: FILTER - value: (to_string({"label":($vpc)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://api.linode.com/v4/vpcs" - check: - ($error): ~ - (json_parse($stdout)): - results: 1 - - name: Delete VPC - try: - - delete: - ref: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 - kind: LinodeVPC - name: ($vpc) - - error: - file: check-vpc-deletion.yaml - - name: Check if the VPC was deleted - try: - - script: - env: - - name: FILTER - value: (to_string({"label":($vpc)})) - content: | - set -e - curl -s \ - -H "Authorization: Bearer $LINODE_TOKEN" \ - -H "X-Filter: $FILTER" \ - -H "Content-Type: application/json" \ - "https://api.linode.com/v4/nodebalancers" - check: - ($error): ~ - (json_parse($stdout)): - results: 0 + - name: Check if CAPI provider resources exist + try: + - assert: + file: assert-capi-resources.yaml + - name: Create LinodeVPC + try: + - apply: + file: create-vpc.yaml + - assert: + file: assert-vpc.yaml + catch: + - describe: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + - name: Check if the VPC was created + try: + - script: + env: + - name: FILTER + value: (to_string({"label":($vpc)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://api.linode.com/v4/vpcs" + check: + ($error): ~ + (json_parse($stdout)): + results: 1 + - name: Delete VPC + try: + - delete: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 + kind: LinodeVPC + name: ($vpc) + - error: + file: check-vpc-deletion.yaml + - name: Check if the VPC was deleted + try: + - script: + env: + - name: FILTER + value: (to_string({"label":($vpc)})) + content: | + set -e + curl -s \ + -H "Authorization: Bearer $LINODE_TOKEN" \ + -H "X-Filter: $FILTER" \ + -H "Content-Type: application/json" \ + "https://api.linode.com/v4/nodebalancers" + check: + ($error): ~ + (json_parse($stdout)): + results: 0