Skip to content

Refactor CRD to support K8s 1.15 specific requirements#6075

Merged
morgo merged 1 commit intovitessio:masterfrom
carsonoid:carsonoid-helm-crd
Apr 16, 2020
Merged

Refactor CRD to support K8s 1.15 specific requirements#6075
morgo merged 1 commit intovitessio:masterfrom
carsonoid:carsonoid-helm-crd

Conversation

@carsonoid
Copy link
Copy Markdown
Contributor

K8s 1.15 added extra validation to CRD structure when using
the v1beta1 api. The CRD has been restructured to conform
to the new rules.

I also moved the test to the v1beta1 api client.

Signed-off-by: Carson Anderson ca@carsonoid.net


I have manually validated that the crd below works for K8s 1.13, 1.14, 1.15 and 1.16:

This was the validation script:

k3d create --name=113 --port=6113 --version=v0.3.0
k3d create --name=114 --port=6114 --version=v0.8.1
k3d create --name=115 --port=6115 --version=v0.9.0-rc1
k3d create --name=116 --port=6116

for v in 113 114 115 116; do
    echo
    echo testing $v
    export KUBECONFIG="$(k3d get-kubeconfig --name=$v)"
    kubectl version
    kubectl apply -f helm/vitess/crds/VitessTopoNodes-crd.yaml
done

k3d delete --name=113
k3d delete --name=114
k3d delete --name=115
k3d delete --name=116

Results:

testing 113
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.5-k3s.1", GitCommit:"256ea73aeb2627eb9b510f6c22881af8f967dd0c", GitTreeState:"clean", BuildDate:"2019-03-27T18:49+00:00Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
customresourcedefinition.apiextensions.k8s.io/vitesstoponodes.topo.vitess.io created

testing 114
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6-k3s.1", GitCommit:"4cd85f14854d942e9016cc15f399785c103242e9", GitTreeState:"clean", BuildDate:"2019-08-19T16:12+00:00Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
customresourcedefinition.apiextensions.k8s.io/vitesstoponodes.topo.vitess.io created

testing 115
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3-k3s.1", GitCommit:"2258cf7b7c767ecca887c5fc17784b3f8472b271", GitTreeState:"clean", BuildDate:"2019-08-29T05:27+00:00Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
customresourcedefinition.apiextensions.k8s.io/vitesstoponodes.topo.vitess.io created

testing 116
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2-k3s.1", GitCommit:"b8b17ba55f20e590df507fce333dfee13ab438c6", GitTreeState:"clean", BuildDate:"2019-10-16T05:17Z", GoVersion:"go1.13.3", Compiler:"gc", Platform:"linux/amd64"}
customresourcedefinition.apiextensions.k8s.io/vitesstoponodes.topo.vitess.io created

K8s 1.15 added extra validation to CRD structure when using
the v1beta1 api. The CRD has been restructured to conform
to the new rules.

Signed-off-by: Carson Anderson <ca@carsonoid.net>
@morgo morgo self-requested a review April 16, 2020 18:01
Copy link
Copy Markdown
Contributor

@morgo morgo left a comment

Choose a reason for hiding this comment

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

Manually tested on 1.15, LGTM

@morgo
Copy link
Copy Markdown
Contributor

morgo commented Apr 16, 2020

The failing test will be fixed in #6076

I'm going to merge this.

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