Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate: add support for kubernetes deployment validation with src validate kube subcommand #926

Merged
merged 12 commits into from
Jan 23, 2023

Conversation

jdpleiness
Copy link
Contributor

@jdpleiness jdpleiness commented Jan 20, 2023

This PR adds the src validate kube subcommand for validating Sourcegraph deployments on Kubernetes.

Features include:

  • pod validation
  • service validation
  • PVC validation
  • network connection validation between Sourcegraph services

Validations can also include warnings for non-failure states that should be addressed.

Kubernetes cluster configuration is handled via standard kubeconfig file in users home directory or can be specified with --kubeconfig flag. Users can also specify a specific namespace via --namespace flag.

Screenshot 2023-01-20 at 11 23 56 AM

Screenshot 2023-01-20 at 11 25 44 AM

Screenshot 2023-01-20 at 11 51 04 AM

TODO:

  • Add --quiet flag to silence command line output in CI/CD pipelines
  • Update CHANGELOG.md

Test plan

  • Locally tested changes using latest Sourcegraph Helm install.
  • Added unit tests in internal/validate/kube/kube_test.go.
  • ran go test ./... - all tests passing
  • ran staticcheck ./... - no issues found in new code

@jdpleiness jdpleiness self-assigned this Jan 20, 2023
@jdpleiness jdpleiness marked this pull request as ready for review January 20, 2023 16:59
Copy link

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

cmd/src/validate_install.go Show resolved Hide resolved
cmd/src/validate_install.go Show resolved Hide resolved

var results []validate.Result

//TODO make concurrent
Copy link
Member

@beyang beyang Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove TODO in master branch

Suggested change
//TODO make concurrent


var results []validate.Result

//TODO make concurrent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//TODO make concurrent


var results []validate.Result

//TODO make concurrent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//TODO make concurrent

@jdpleiness jdpleiness merged commit dd50ea0 into main Jan 23, 2023
@jdpleiness jdpleiness deleted the jdp/src-validate-kube branch January 23, 2023 19:08
scjohns pushed a commit that referenced this pull request Apr 24, 2023
…validate kube` subcommand (#926)

* Refactor out shared vars
* Add basic kube validation
* Add pod validation
* Add skeleton for service and connection validation
* Add connection validations
* Add go modules files
* Fix --kubeconfig flag
* Fix line output
* Add usage output to cli
* Fix path in example
* Add quiet flag to suppress output and return exit status only
* Fix exit status to be consistent if there are failures
* Remove TODOs
* Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants