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

Extracting validation error from apply server dry run output #333

Merged
merged 2 commits into from
Apr 28, 2021

Conversation

superbrothers
Copy link
Contributor

In addition to client dry-run, I also improve the server dry-run case to reduce verbose output and only print errors.

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.4", GitCommit:"e87da0bd6e03ec3fea7933c4b5263d151aafd07c", GitTreeState:"clean", BuildDate:"2021-02-18T16:12:00Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:20:00Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl create deploy nginx --image nginx --dry-run=client -o yaml | kubectl apply -f- --dry-run=server
deployment.apps/nginx created (server dry run)

ref/ #277

Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
numLines := len(strings.Split(filtered, "\n"))
if numLines != 1 {
t.Errorf("Should filter out all but one line from the error output, but got %d lines", numLines)
}
Copy link
Member

Choose a reason for hiding this comment

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

I would also check for a (partial) string match here to confirm the right string is returned.

Copy link
Contributor Author

@superbrothers superbrothers Apr 27, 2021

Choose a reason for hiding this comment

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

I've updated. e91129c

@superbrothers superbrothers force-pushed the server-dry-run branch 3 times, most recently from ddd2278 to 4a45df2 Compare April 27, 2021 10:27
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @superbrothers

@stefanprodan stefanprodan merged commit 774da2d into fluxcd:main Apr 28, 2021
@superbrothers superbrothers deleted the server-dry-run branch April 28, 2021 05:43
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.

3 participants