rancher-sandbox / elemental-e2e

e2e test for the CAPI Elemental provider
0 stars 1 forks source link

Improve check in the CI #14

Closed juadk closed 4 months ago

juadk commented 5 months ago

Add more checks in the CI like elementalmachine and elementalhost status before going forward in the test. https://github.com/rancher-sandbox/elemental-e2e/blob/main/tests/e2e/bootstrap_capi_test.go#L148-L162

juadk commented 5 months ago

check these status:

gh-runner@elemental-e2e-ci-a26257abaef94f1c92ba698e741f7c2d:~> kubectl get elementalhosts -A
NAMESPACE   NAME       CLUSTER             MACHINE                                 ELEMENTALMACHINE                        PHASE     READY   AGE
default     node-001   elemental-cluster   elemental-cluster-control-plane-nzcr9   elemental-cluster-control-plane-jcnzm   Running   True    15m
default     node-003   elemental-cluster   elemental-cluster-md-0-v9bth-5phxr      elemental-cluster-md-0-v9bth-5phxr      Running   True    15m
default     node-002   elemental-cluster   elemental-cluster-md-0-v9bth-g4d57      elemental-cluster-md-0-v9bth-g4d57      Running   True    15m
gh-runner@elemental-e2e-ci-a26257abaef94f1c92ba698e741f7c2d:~> kubectl get elementalmachine -A
NAMESPACE   NAME                                    CLUSTER             MACHINE                                 PROVIDERID                     READY   AGE
default     elemental-cluster-control-plane-jcnzm   elemental-cluster   elemental-cluster-control-plane-nzcr9   elemental://default/node-001   True    21m
default     elemental-cluster-md-0-v9bth-5phxr      elemental-cluster   elemental-cluster-md-0-v9bth-5phxr      elemental://default/node-003   True    21m
default     elemental-cluster-md-0-v9bth-g4d57      elemental-cluster   elemental-cluster-md-0-v9bth-g4d57      elemental://default/node-002   True    21m
gh-runner@elemental-e2e-ci-a26257abaef94f1c92ba698e741f7c2d:~> kubectl get elementalhosts node-001 -o yaml|yq
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalHost
metadata:
  creationTimestamp: "2024-06-14T12:34:26Z"
  finalizers:
    - elementalmachine.infrastructure.cluster.x-k8s.io
  generation: 2
  labels:
    cluster.x-k8s.io/cluster-name: elemental-cluster
    elementalhost.infrastructure.cluster.x-k8s.io/bootstrapped: "true"
    elementalhost.infrastructure.cluster.x-k8s.io/installed: "true"
    elementalhost.infrastructure.cluster.x-k8s.io/machine-name: elemental-cluster-control-plane-nzcr9
  name: node-001
  namespace: default
  ownerReferences:
    - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
      controller: true
      kind: ElementalRegistration
      name: machine-registration-master-elemental-cluster
      uid: 8d463dff-35eb-4140-8957-6878e0f9b145
  resourceVersion: "2992"
  uid: b8fc7401-84ae-4f06-b928-75708195292f
spec:
  bootstrapSecret:
    kind: Secret
    name: elemental-cluster-control-plane-gqs9q
    namespace: default
  machineRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: ElementalMachine
    name: elemental-cluster-control-plane-jcnzm
    namespace: default
    uid: cc8a5f3a-c937-42d2-ae52-8b0c61d3f6a1
  pubKey: |
    -----BEGIN PUBLIC KEY-----
    MCowBQYDK2VwAyEAK85TDvVwtF1NiWMhPJ977O/LMbAhR8MyRBmySAvVX38=
    -----END PUBLIC KEY-----
status:
  conditions:
    - lastTransitionTime: "2024-06-14T12:38:52Z"
      status: "True"
      type: Ready
    - lastTransitionTime: "2024-06-14T12:38:52Z"
      severity: Info
      status: "True"
      type: BootstrapReady
    - lastTransitionTime: "2024-06-14T12:36:57Z"
      severity: Info
      status: "True"
      type: InstallationReady
    - lastTransitionTime: "2024-06-14T12:34:26Z"
      severity: Info
      status: "True"
      type: RegistrationReady
  phase: Running
juadk commented 5 months ago

and for elementalmachines:

gh-runner@elemental-e2e-ci-a26257abaef94f1c92ba698e741f7c2d:~> kubectl get elementalmachine  elemental-cluster-md-0-v9bth-5phxr -o yaml|yq
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalMachine
metadata:
  annotations:
    cluster.x-k8s.io/cloned-from-groupkind: ElementalMachineTemplate.infrastructure.cluster.x-k8s.io
    cluster.x-k8s.io/cloned-from-name: elemental-cluster-md-0
  creationTimestamp: "2024-06-14T12:28:28Z"
  finalizers:
    - elementalmachine.infrastructure.cluster.x-k8s.io
  generation: 3
  labels:
    cluster.x-k8s.io/cluster-name: elemental-cluster
    cluster.x-k8s.io/deployment-name: elemental-cluster-md-0
    cluster.x-k8s.io/set-name: elemental-cluster-md-0-v9bth
    machine-template-hash: 406246232-v9bth
    nodepool: pool1
  name: elemental-cluster-md-0-v9bth-5phxr
  namespace: default
  ownerReferences:
    - apiVersion: cluster.x-k8s.io/v1beta1
      blockOwnerDeletion: true
      controller: true
      kind: Machine
      name: elemental-cluster-md-0-v9bth-5phxr
      uid: b48382a5-008c-4dfd-b9b3-0e176386e67f
  resourceVersion: "4337"
  uid: 4c70ab9d-879c-4fb9-a819-fd6335d7aacb
spec:
  hostRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: ElementalHost
    name: node-003
    namespace: default
    uid: e7c645e5-6fb1-4265-9e9b-dccfc5cb7c48
  providerID: elemental://default/node-003
status:
  conditions:
    - lastTransitionTime: "2024-06-14T12:47:43Z"
      status: "True"
      type: Ready
    - lastTransitionTime: "2024-06-14T12:46:53Z"
      severity: Info
      status: "True"
      type: AssociationReady
    - lastTransitionTime: "2024-06-14T12:47:43Z"
      severity: Info
      status: "True"
      type: HostReady
    - lastTransitionTime: "2024-06-14T12:47:43Z"
      severity: Info
      status: "True"
      type: ProviderIDReady
  ready: true
juadk commented 5 months ago
kubectl get elementalhosts node-001 -o jsonpath={.status.conditions[?(@.type==\"Ready\")].type}
Ready

kubectl get elementalhosts node-001 -o jsonpath={.status.conditions[?(@.type==\"InstallationReady\")].status}
True