eks-anywhere icon indicating copy to clipboard operation
eks-anywhere copied to clipboard

Preflight validate cmd POC

Open raymond-zhang00 opened this issue 3 years ago β€’ 5 comments

Issue #, if available: Add validate cmd

Description of changes: Add validate cmd to run create cluster validations

Testing (if applicable): To be added

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

raymond-zhang00 avatar Aug 03 '22 16:08 raymond-zhang00

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign pokearu after the PR has been reviewed. You can assign the PR to them by writing /assign @pokearu in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

eks-distro-bot avatar Aug 03 '22 16:08 eks-distro-bot

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

eks-distro-bot avatar Aug 03 '22 16:08 eks-distro-bot

Codecov Report

Merging #2858 (59f0ac7) into main (d0a42e7) will increase coverage by 0.90%. The diff coverage is 5.55%.

@@            Coverage Diff             @@
##             main    #2858      +/-   ##
==========================================
+ Coverage   60.49%   61.40%   +0.90%     
==========================================
  Files         319      324       +5     
  Lines       26308    26434     +126     
==========================================
+ Hits        15916    16232     +316     
+ Misses       9081     8927     -154     
+ Partials     1311     1275      -36     
Impacted Files Coverage Ξ”
pkg/cluster/docker.go 75.00% <0.00%> (-11.37%) :arrow_down:
pkg/cluster/snow.go 68.08% <0.00%> (-2.57%) :arrow_down:
pkg/cluster/vsphere.go 74.57% <0.00%> (-4.38%) :arrow_down:
pkg/workflows/validate.go 0.00% <0.00%> (ΓΈ)
pkg/cluster/cloudstack.go 57.89% <100.00%> (ΓΈ)
pkg/validations/runner.go 100.00% <100.00%> (ΓΈ)
...g/api/v1alpha1/cloudstackdatacenterconfig_types.go 55.81% <0.00%> (-9.26%) :arrow_down:
pkg/curatedpackages/packagecontrollerclient.go 96.10% <0.00%> (-3.90%) :arrow_down:
controllers/vsphere_datacenter_controller.go 11.86% <0.00%> (-2.89%) :arrow_down:
pkg/api/v1alpha1/cluster.go 58.87% <0.00%> (-1.74%) :arrow_down:
... and 43 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 03 '22 16:08 codecov[bot]

Usage - ./eksctl-anywhere exp validate -f <yaml config file>

Output - valid config example:

βœ… Validate docker executable
βœ… Validate cluster
βœ… Validate kubeconfig path
βœ… Validate supported provider
βœ… Validate certificate for registry mirror
βœ… Create preflight validations pass
βœ… Connected to server
βœ… Authenticated to vSphere
βœ… Datacenter validated
βœ… Network validated
βœ… Datastore validated
βœ… Folder validated
βœ… Resource pool validated
βœ… Control plane and Workload templates validated
Provided control plane sshAuthorizedKey is not set or is empty, auto-generating new key pair...
Private key saved to tmpValidate1230314345/eks-a-id_rsa. Use 'ssh -i tmpValidate1230314345/eks-a-id_rsa <username>@<Node-IP-Address>' to login to your cluster node
βœ… Vsphere Provider setup is valid

Output - invalid config example:

βœ… Validate docker executable
❌ Validation failed	{"validation": "validate cluster", "error": "failed to validate cluster config name:  is not a valid cluster name, cluster names must start with lowercase/uppercase letters and can include numbers and dashes. For instance 'testCluster-123' is a valid name but '123testCluster' is not. ", "remediation": ""}
Error: validations failed

raymond-zhang00 avatar Aug 04 '22 20:08 raymond-zhang00

I haven't reviewed this in full but great work!

Do we think its necessary to output so much information? I suspect consumers don't really care that a specific portion of validation succeeded - that feels more like a debug level of logging. I care whether or not the invocation I made makes sense and I can get that from a single line (ideally) saying "Configuration valid".

chrisdoherty4 avatar Aug 05 '22 12:08 chrisdoherty4

Closing this POC PR

raymond-zhang00 avatar Aug 24 '22 15:08 raymond-zhang00