Skip to content

Commit

Permalink
Update CRD to apiextensions v1 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas authored Apr 7, 2021
1 parent 6ebd45d commit ef73a32
Show file tree
Hide file tree
Showing 8 changed files with 5,422 additions and 5,123 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ ENV GOROOT=/usr/local/go
ENV PATH=${PATH}:${GOROOT}/bin

# Install Kubebuilder
RUN curl -sL https://go.kubebuilder.io/dl/2.0.1/linux/amd64 | tar -xz -C /usr/local/ \
&& mv /usr/local/kubebuilder_2.0.1_linux_amd64 /usr/local/kubebuilder
RUN curl -sL https://go.kubebuilder.io/dl/2.3.2/linux/amd64 | tar -xz -C /usr/local/ \
&& mv /usr/local/kubebuilder_2.3.2_linux_amd64 /usr/local/kubebuilder
ENV PATH=${PATH}:/usr/local/kubebuilder/bin

WORKDIR /workspace/
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ run: generate fmt vet
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./api/v1beta1/..." output:crd:artifacts:config=config/crd/bases
kubectl kustomize config/crd > config/crd/bases/patched_crd.yaml
mv config/crd/bases/patched_crd.yaml config/crd/bases/flinkoperator.k8s.io_flinkclusters.yaml
go mod tidy

# Run go fmt against code
Expand All @@ -62,7 +64,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.4 ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(shell go env GOPATH)/bin/controller-gen
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/flinkcluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This marker is responsible for generating a mutating webhook manifest.
The meaning of each marker can be found [here](/reference/markers/webhook.md).
*/

// +kubebuilder:webhook:path=/mutate-flinkoperator-k8s-io-v1beta1-flinkcluster,mutating=true,failurePolicy=fail,groups=flinkoperator.k8s.io,resources=flinkclusters,verbs=create;update,versions=v1beta1,name=mflinkcluster.flinkoperator.k8s.io
// +kubebuilder:webhook:webhookVersions=v1beta1,path=/mutate-flinkoperator-k8s-io-v1beta1-flinkcluster,mutating=true,failurePolicy=fail,groups=flinkoperator.k8s.io,resources=flinkclusters,verbs=create;update,versions=v1beta1,name=mflinkcluster.flinkoperator.k8s.io

/*
We use the `webhook.Defaulter` interface to set defaults to our CRD.
Expand All @@ -63,7 +63,7 @@ func (cluster *FlinkCluster) Default() {
This marker is responsible for generating a validating webhook manifest.
*/

// +kubebuilder:webhook:path=/validate-flinkoperator-k8s-io-v1beta1-flinkcluster,mutating=false,failurePolicy=fail,groups=flinkoperator.k8s.io,resources=flinkclusters,verbs=create;update,versions=v1beta1,name=vflinkcluster.flinkoperator.k8s.io
// +kubebuilder:webhook:webhookVersions=v1beta1,path=/validate-flinkoperator-k8s-io-v1beta1-flinkcluster,mutating=false,failurePolicy=fail,groups=flinkoperator.k8s.io,resources=flinkclusters,verbs=create;update,versions=v1beta1,name=vflinkcluster.flinkoperator.k8s.io

var _ webhook.Validator = &FlinkCluster{}
var validator = Validator{}
Expand Down
Loading

0 comments on commit ef73a32

Please sign in to comment.