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

k8s-tester: initial commit, run test against existing cluster #210

Merged
merged 2 commits into from
Apr 20, 2021

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Apr 19, 2021

// Tester defines Kubernetes tester interface.
type Tester interface {
  // Name returns the name of the tester.
  Name() string
  // Apply installs the test case and also "validates".
  Apply() error
  // Delete removes all resources for the installed test case.
  Delete() error
 }

ref. #123

@gyuho
Copy link
Contributor Author

gyuho commented Apr 19, 2021

Tested with

k8s-tester-nlb-hello-world apply \
--namespace hello2 \
--kubectl-path=/tmp/kubectl-test-v1.18.9 \
--kubeconfig-path=/tmp/eks-2021041706-goodnakevd9c.kubeconfig.yaml

<head>
        <title>Hello world!</title>
        <link href='//fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
        <style>
        body {
                background-color: white;
                text-align: center;
                padding: 50px;
                font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
        }

        #logo {
                margin-bottom: 40px;
        }
        </style>
</head>
<body>
        <img id="logo" src="logo.png" />
        <h1>Hello world!</h1>
        <h3>My hostname is hello-world-deployment-cf7c8f77d-jrf54</h3>                  <h3>Links found</h3>
                                        <b>KUBERNETES</b> listening in 443 available at tcp://172.20.0.1:443<br />
                                </body>
</html>

2021-04-19T21:42:04.370Z        INFO    nlb-hello-world/tester.go:384   read hello-world Service; exiting       {"host-name": "...-....elb.us-west-2.amazonaws.com"}

NLB hello-world ARN: arn:aws:elasticloadbalancing:region:account-id:loadbalancer/net/ABC/DEF
NLB hello-world Name: ABC
NLB hello-world URL: http://...-....elb.us-west-2.amazonaws.com
k8s-tester-nlb-hello-world delete \
--namespace hello2 \
--kubectl-path=/tmp/kubectl-test-v1.18.9 \
--kubeconfig-path=/tmp/eks-2021041706-goodnakevd9c.kubeconfig.yaml

Signed-off-by: Gyuho Lee <[email protected]>
@gyuho
Copy link
Contributor Author

gyuho commented Apr 19, 2021

Gaps compared to existing add-on:

  • support color output in terminal
  • configure logger
  • automatic rollback on apply failure

@jonahjon
Copy link
Contributor

LGTM! Can confirm it worked, will work on making a sample case and test it as well! This feature is awesome

go run k8s-tester/nlb-hello-world/cmd/k8s-tester-nlb-hello-world/main.go apply \
        --namespace hello2 \
        --kubectl-path=/usr/local/bin/kubectl \
        --kubeconfig-path="/Users/jonahjo/.kube/config"
2021-04-20T15:29:51.844-0500	INFO	nlb-hello-world/tester.go:384	read hello-world Service; exiting	{"host-name": "a2c679b55aae540faaf74cfe9e06c3b3-84350b53f4a0edd2.elb.us-west-2.amazonaws.com"}

NLB hello-world ARN: arn:aws:elasticloadbalancing:region:account-id:loadbalancer/net/a2c679b55aae540faaf74cfe9e06c3b3/84350b53f4a0edd2
NLB hello-world Name: a2c679b55aae540faaf74cfe9e06c3b3
NLB hello-world URL: http://a2c679b55aae540faaf74cfe9e06c3b3-84350b53f4a0edd2.elb.us-west-2.amazonaws.com


*********************************
'k8s-tester-nlb-hello-world apply' success`

@gyuho gyuho merged commit a6aae61 into aws:master Apr 20, 2021
@gyuho gyuho deleted the tester branch April 20, 2021 21:02
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.

2 participants